wip
This commit is contained in:
parent
be3b2558d1
commit
38e3d248fb
|
@ -376,7 +376,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House, tile: Mahjong.Tile, riichi = false) {
|
private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House, tile: Mahjong.TileId, riichi = false) {
|
||||||
const res = engine.commit_dahai(house, tile, riichi);
|
const res = engine.commit_dahai(house, tile, riichi);
|
||||||
room.gameState = engine.state;
|
room.gameState = engine.state;
|
||||||
await this.saveRoom(room);
|
await this.saveRoom(room);
|
||||||
|
@ -384,8 +384,6 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
const aiHouses = [[1, room.user1Ai], [2, room.user2Ai], [3, room.user3Ai], [4, room.user4Ai]].filter(([id, ai]) => ai).map(([id, ai]) => engine.getHouse(id));
|
const aiHouses = [[1, room.user1Ai], [2, room.user2Ai], [3, room.user3Ai], [4, room.user4Ai]].filter(([id, ai]) => ai).map(([id, ai]) => engine.getHouse(id));
|
||||||
|
|
||||||
if (res.asking) {
|
if (res.asking) {
|
||||||
console.log('asking', res);
|
|
||||||
|
|
||||||
const answers: CallingAnswers = {
|
const answers: CallingAnswers = {
|
||||||
pon: null,
|
pon: null,
|
||||||
cii: null,
|
cii: null,
|
||||||
|
@ -478,11 +476,10 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async commit_dahai(roomId: MiMahjongGame['id'], user: MiUser, tile: string, riichi = false) {
|
public async commit_dahai(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId, riichi = false) {
|
||||||
const room = await this.getRoom(roomId);
|
const room = await this.getRoom(roomId);
|
||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
if (room.gameState == null) return;
|
if (room.gameState == null) return;
|
||||||
if (!Mahjong.isTile(tile)) return;
|
|
||||||
|
|
||||||
const engine = new Mahjong.MasterGameEngine(room.gameState);
|
const engine = new Mahjong.MasterGameEngine(room.gameState);
|
||||||
const myHouse = getHouseOfUserId(room, engine, user.id);
|
const myHouse = getHouseOfUserId(room, engine, user.id);
|
||||||
|
@ -493,7 +490,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async commit_ankan(roomId: MiMahjongGame['id'], user: MiUser, tile: string) {
|
public async commit_ankan(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId) {
|
||||||
const room = await this.getRoom(roomId);
|
const room = await this.getRoom(roomId);
|
||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
if (room.gameState == null) return;
|
if (room.gameState == null) return;
|
||||||
|
@ -511,7 +508,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async commit_kakan(roomId: MiMahjongGame['id'], user: MiUser, tile: string) {
|
public async commit_kakan(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId) {
|
||||||
const room = await this.getRoom(roomId);
|
const room = await this.getRoom(roomId);
|
||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
if (room.gameState == null) return;
|
if (room.gameState == null) return;
|
||||||
|
@ -643,11 +640,10 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
|
|
||||||
if (engine.state.riichis[house]) {
|
if (engine.state.riichis[house]) {
|
||||||
// リーチ時はアガリ牌でない限りツモ切り
|
// リーチ時はアガリ牌でない限りツモ切り
|
||||||
const handTiles = engine.state.handTiles[house];
|
const horaSets = Mahjong.getHoraSets(engine.handTileTypes[house]);
|
||||||
const horaSets = Mahjong.getHoraSets(handTiles);
|
|
||||||
if (horaSets.length === 0) {
|
if (horaSets.length === 0) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.dahai(room, engine, house, handTiles.at(-1));
|
this.dahai(room, engine, house, engine.state.handTiles[house].at(-1));
|
||||||
}, 500);
|
}, 500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ class MahjongRoomChannel extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async dahai(tile: string, riichi = false) {
|
private async dahai(tile: number, riichi = false) {
|
||||||
if (this.user == null) return;
|
if (this.user == null) return;
|
||||||
|
|
||||||
this.mahjongService.commit_dahai(this.roomId!, this.user, tile, riichi);
|
this.mahjongService.commit_dahai(this.roomId!, this.user, tile, riichi);
|
||||||
|
@ -136,14 +136,14 @@ class MahjongRoomChannel extends Channel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async ankan(tile: string) {
|
private async ankan(tile: number) {
|
||||||
if (this.user == null) return;
|
if (this.user == null) return;
|
||||||
|
|
||||||
this.mahjongService.commit_ankan(this.roomId!, this.user, tile);
|
this.mahjongService.commit_ankan(this.roomId!, this.user, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async kakan(tile: string) {
|
private async kakan(tile: number) {
|
||||||
if (this.user == null) return;
|
if (this.user == null) return;
|
||||||
|
|
||||||
this.mahjongService.commit_kakan(this.roomId!, this.user, tile);
|
this.mahjongService.commit_kakan(this.roomId!, this.user, tile);
|
||||||
|
|
BIN
packages/frontend/assets/mahjong/tiles/m5r.png
Normal file
BIN
packages/frontend/assets/mahjong/tiles/m5r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
BIN
packages/frontend/assets/mahjong/tiles/p5r.png
Normal file
BIN
packages/frontend/assets/mahjong/tiles/p5r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
packages/frontend/assets/mahjong/tiles/s5r.png
Normal file
BIN
packages/frontend/assets/mahjong/tiles/s5r.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
|
@ -5,26 +5,26 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="huro.type === 'ankan'" :class="[$style.root]">
|
<div v-if="huro.type === 'ankan'" :class="[$style.root]">
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[0])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[1])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[2])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[3])" :variation="variation" :doras="doras"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="huro.type === 'minkan'" :class="[$style.root]">
|
<div v-else-if="huro.type === 'minkan'" :class="[$style.root]">
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[0])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[1])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[2])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[3])" :variation="variation" :doras="doras"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="huro.type === 'cii'" :class="[$style.root]">
|
<div v-else-if="huro.type === 'cii'" :class="[$style.root]">
|
||||||
<XTile :tile="huro.tiles[0]" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[0])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tiles[1]" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[1])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tiles[2]" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[2])" :variation="variation" :doras="doras"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else :class="[$style.root]">
|
<div v-else :class="[$style.root]">
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[0])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[1])" :variation="variation" :doras="doras"/>
|
||||||
<XTile :tile="huro.tile" :variation="variation" :doras="doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(huro.tiles[2])" :variation="variation" :doras="doras"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import XTile from './tile.vue';
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
huro: Mahjong.Huro;
|
huro: Mahjong.Huro;
|
||||||
variation: string;
|
variation: string;
|
||||||
doras: Mahjong.Tile[];
|
doras: Mahjong.TileType[];
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -76,28 +76,28 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div :class="$style.hoTilesContainerOfToimen">
|
<div :class="$style.hoTilesContainerOfToimen">
|
||||||
<div :class="$style.hoTilesOfToimen">
|
<div :class="$style.hoTilesOfToimen">
|
||||||
<div v-for="(tile, i) in engine.state.hoTiles[Mahjong.prevHouse(Mahjong.prevHouse(engine.myHouse))]" :class="$style.hoTile" :style="{ zIndex: engine.state.hoTiles[Mahjong.prevHouse(Mahjong.prevHouse(engine.myHouse))].length - i }">
|
<div v-for="(tile, i) in engine.state.hoTiles[Mahjong.prevHouse(Mahjong.prevHouse(engine.myHouse))]" :class="$style.hoTile" :style="{ zIndex: engine.state.hoTiles[Mahjong.prevHouse(Mahjong.prevHouse(engine.myHouse))].length - i }">
|
||||||
<XTile :tile="tile" variation="2" :doras="engine.doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(tile)" variation="2" :doras="engine.doras"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.hoTilesContainerOfKamitya">
|
<div :class="$style.hoTilesContainerOfKamitya">
|
||||||
<div :class="$style.hoTilesOfKamitya">
|
<div :class="$style.hoTilesOfKamitya">
|
||||||
<div v-for="tile in engine.state.hoTiles[Mahjong.prevHouse(engine.myHouse)]" :class="$style.hoTile">
|
<div v-for="tile in engine.state.hoTiles[Mahjong.prevHouse(engine.myHouse)]" :class="$style.hoTile">
|
||||||
<XTile :tile="tile" variation="4" :doras="engine.doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(tile)" variation="4" :doras="engine.doras"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.hoTilesContainerOfSimotya">
|
<div :class="$style.hoTilesContainerOfSimotya">
|
||||||
<div :class="$style.hoTilesOfSimotya">
|
<div :class="$style.hoTilesOfSimotya">
|
||||||
<div v-for="(tile, i) in engine.state.hoTiles[Mahjong.nextHouse(engine.myHouse)]" :class="$style.hoTile" :style="{ zIndex: engine.state.hoTiles[Mahjong.nextHouse(engine.myHouse)].length - i }">
|
<div v-for="(tile, i) in engine.state.hoTiles[Mahjong.nextHouse(engine.myHouse)]" :class="$style.hoTile" :style="{ zIndex: engine.state.hoTiles[Mahjong.nextHouse(engine.myHouse)].length - i }">
|
||||||
<XTile :tile="tile" variation="5" :doras="engine.doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(tile)" variation="5" :doras="engine.doras"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.hoTilesContainerOfMe">
|
<div :class="$style.hoTilesContainerOfMe">
|
||||||
<div :class="$style.hoTilesOfMe">
|
<div :class="$style.hoTilesOfMe">
|
||||||
<div v-for="tile in engine.state.hoTiles[engine.myHouse]" :class="$style.hoTile">
|
<div v-for="tile in engine.state.hoTiles[engine.myHouse]" :class="$style.hoTile">
|
||||||
<XTile :tile="tile" variation="1" :doras="engine.doras"/>
|
<XTile :tile="Mahjong.findTileByIdOrFail(tile)" variation="1" :doras="engine.doras"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -106,20 +106,20 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div :class="$style.handTilesOfMe">
|
<div :class="$style.handTilesOfMe">
|
||||||
<div
|
<div
|
||||||
v-for="tile in Mahjong.sortTiles((isMyTurn && iTsumoed) ? engine.myHandTiles.slice(0, engine.myHandTiles.length - 1) : engine.myHandTiles)"
|
v-for="tile in Mahjong.sortTiles((isMyTurn && iTsumoed) ? engine.myHandTiles.slice(0, engine.myHandTiles.length - 1) : engine.myHandTiles)"
|
||||||
:class="[$style.myTile, { [$style.myTileNonSelectable]: selectableTiles != null && !selectableTiles.includes(tile), [$style.myTileDora]: engine.doras.includes(tile) }]"
|
:class="[$style.myTile, { [$style.myTileNonSelectable]: selectableTiles != null && !selectableTiles.includes(Mahjong.findTileByIdOrFail(tile).t), [$style.myTileDora]: engine.doras.includes(Mahjong.findTileByIdOrFail(tile).t) }]"
|
||||||
@click="chooseTile(tile, $event)"
|
@click="chooseTile(tile, $event)"
|
||||||
>
|
>
|
||||||
<img :src="`/client-assets/mahjong/tile-front.png`" :class="$style.myTileBg"/>
|
<img :src="`/client-assets/mahjong/tile-front.png`" :class="$style.myTileBg"/>
|
||||||
<img :src="`/client-assets/mahjong/tiles/${tile}.png`" :class="$style.myTileFg"/>
|
<img :src="`/client-assets/mahjong/tiles/${Mahjong.findTileByIdOrFail(tile).red ? Mahjong.findTileByIdOrFail(tile).t + 'r' : Mahjong.findTileByIdOrFail(tile).t}.png`" :class="$style.myTileFg"/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="isMyTurn && iTsumoed"
|
v-if="isMyTurn && iTsumoed"
|
||||||
style="display: inline-block; margin-left: 5px;"
|
style="display: inline-block; margin-left: 5px;"
|
||||||
:class="[$style.myTile, { [$style.myTileNonSelectable]: selectableTiles != null && !selectableTiles.includes(engine.myHandTiles.at(-1)), [$style.myTileDora]: engine.doras.includes(engine.myHandTiles.at(-1)) }]"
|
:class="[$style.myTile, { [$style.myTileNonSelectable]: selectableTiles != null && !selectableTiles.includes(Mahjong.findTileByIdOrFail(engine.myHandTiles.at(-1)).t), [$style.myTileDora]: engine.doras.includes(Mahjong.findTileByIdOrFail(engine.myHandTiles.at(-1)).t) }]"
|
||||||
@click="chooseTile(engine.myHandTiles.at(-1), $event)"
|
@click="chooseTile(engine.myHandTiles.at(-1), $event)"
|
||||||
>
|
>
|
||||||
<img :src="`/client-assets/mahjong/tile-front.png`" :class="$style.myTileBg"/>
|
<img :src="`/client-assets/mahjong/tile-front.png`" :class="$style.myTileBg"/>
|
||||||
<img :src="`/client-assets/mahjong/tiles/${engine.myHandTiles.at(-1)}.png`" :class="$style.myTileFg"/>
|
<img :src="`/client-assets/mahjong/tiles/${Mahjong.findTileByIdOrFail(engine.myHandTiles.at(-1)).red ? Mahjong.findTileByIdOrFail(engine.myHandTiles.at(-1)).t + 'r' : Mahjong.findTileByIdOrFail(engine.myHandTiles.at(-1)).t}.png`" :class="$style.myTileFg"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ const canHora = computed(() => {
|
||||||
return Mahjong.getHoraSets(engine.value.myHandTiles).length > 0;
|
return Mahjong.getHoraSets(engine.value.myHandTiles).length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
const selectableTiles = ref<Mahjong.Tile[] | null>(null);
|
const selectableTiles = ref<Mahjong.TileType[] | null>(null);
|
||||||
const ronSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
const ronSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
||||||
const ciiSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
const ciiSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
||||||
const ponSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
const ponSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
||||||
|
@ -267,43 +267,6 @@ const kanSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: f
|
||||||
const tsumoSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
const tsumoSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
||||||
const riichiSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
const riichiSerifHouses = reactive<Record<Mahjong.House, boolean>>({ e: false, s: false, w: false, n: false });
|
||||||
|
|
||||||
/*
|
|
||||||
console.log(Mahjong.getTilesForRiichi([
|
|
||||||
'm1',
|
|
||||||
'm2',
|
|
||||||
'm2',
|
|
||||||
'm3',
|
|
||||||
'm3',
|
|
||||||
'm5',
|
|
||||||
'm6',
|
|
||||||
'p4',
|
|
||||||
'p5',
|
|
||||||
'p6',
|
|
||||||
's6',
|
|
||||||
's7',
|
|
||||||
's8',
|
|
||||||
'm7',
|
|
||||||
]));
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
console.log(Mahjong.getHoraSets([
|
|
||||||
'm3',
|
|
||||||
'm3',
|
|
||||||
'm4',
|
|
||||||
'm4',
|
|
||||||
'm5',
|
|
||||||
'm5',
|
|
||||||
'p4',
|
|
||||||
'p4',
|
|
||||||
'p7',
|
|
||||||
'p8',
|
|
||||||
'p9',
|
|
||||||
's4',
|
|
||||||
's5',
|
|
||||||
's6',
|
|
||||||
]));
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (room.value.isStarted && !room.value.isEnded) {
|
if (room.value.isStarted && !room.value.isEnded) {
|
||||||
useInterval(() => {
|
useInterval(() => {
|
||||||
|
@ -354,7 +317,7 @@ let ankanSelect = false;
|
||||||
let kakanSelect = false;
|
let kakanSelect = false;
|
||||||
let ciiSelect = false;
|
let ciiSelect = false;
|
||||||
|
|
||||||
function chooseTile(tile: Mahjong.Tile, ev: MouseEvent) {
|
function chooseTile(tile: Mahjong.TileId, ev: MouseEvent) {
|
||||||
if (!isMyTurn.value) return;
|
if (!isMyTurn.value) return;
|
||||||
|
|
||||||
iTsumoed.value = false;
|
iTsumoed.value = false;
|
||||||
|
@ -390,22 +353,22 @@ function riichi() {
|
||||||
if (!isMyTurn.value) return;
|
if (!isMyTurn.value) return;
|
||||||
|
|
||||||
riichiSelect = true;
|
riichiSelect = true;
|
||||||
selectableTiles.value = Mahjong.getTilesForRiichi(engine.value.myHandTiles);
|
selectableTiles.value = Mahjong.getTilesForRiichi(engine.value.myHandTileTypes);
|
||||||
console.log(Mahjong.getTilesForRiichi(engine.value.myHandTiles));
|
console.log(Mahjong.getTilesForRiichi(engine.value.myHandTileTypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
function ankan() {
|
function ankan() {
|
||||||
if (!isMyTurn.value) return;
|
if (!isMyTurn.value) return;
|
||||||
|
|
||||||
ankanSelect = true;
|
ankanSelect = true;
|
||||||
selectableTiles.value = engine.value.getAnkanableTiles();
|
selectableTiles.value = engine.value.getAnkanableTiles().map(id => Mahjong.findTileByIdOrFail(id).t);
|
||||||
}
|
}
|
||||||
|
|
||||||
function kakan() {
|
function kakan() {
|
||||||
if (!isMyTurn.value) return;
|
if (!isMyTurn.value) return;
|
||||||
|
|
||||||
kakanSelect = true;
|
kakanSelect = true;
|
||||||
selectableTiles.value = engine.value.getKakanableTiles();
|
selectableTiles.value = engine.value.getKakanableTiles().map(id => Mahjong.findTileByIdOrFail(id).t);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tsumoHora() {
|
function tsumoHora() {
|
||||||
|
@ -957,7 +920,6 @@ onUnmounted(() => {
|
||||||
aspect-ratio: 0.7;
|
aspect-ratio: 0.7;
|
||||||
transition: translate 0.1s ease;
|
transition: translate 0.1s ease;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
overflow: clip;
|
|
||||||
}
|
}
|
||||||
.myTile:hover {
|
.myTile:hover {
|
||||||
translate: 0 -10px;
|
translate: 0 -10px;
|
||||||
|
@ -967,6 +929,7 @@ onUnmounted(() => {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
.myTileDora {
|
.myTileDora {
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -982,6 +945,7 @@ onUnmounted(() => {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
.myTileBg {
|
.myTileBg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<template>
|
<template>
|
||||||
<div :class="[$style.root, { [$style.h]: ['3', '4', '5'].includes(variation), [$style.v]: ['1', '2'].includes(variation), [$style.isDora]: isDora }]">
|
<div :class="[$style.root, { [$style.h]: ['3', '4', '5'].includes(variation), [$style.v]: ['1', '2'].includes(variation), [$style.isDora]: isDora }]">
|
||||||
<img :src="`/client-assets/mahjong/putted-tile-${variation}.png`" :class="$style.bg"/>
|
<img :src="`/client-assets/mahjong/putted-tile-${variation}.png`" :class="$style.bg"/>
|
||||||
<img :src="`/client-assets/mahjong/tiles/${tile}.png`" :class="$style.fg"/>
|
<img :src="`/client-assets/mahjong/tiles/${tile.red ? tile.t + 'r' : tile.t}.png`" :class="$style.fg"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@ import { computed } from 'vue';
|
||||||
import * as Mahjong from 'misskey-mahjong';
|
import * as Mahjong from 'misskey-mahjong';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
tile: Mahjong.Tile;
|
tile: Mahjong.TileInstance;
|
||||||
variation: string;
|
variation: string;
|
||||||
doras: Mahjong.Tile[];
|
doras: Mahjong.TileType[];
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isDora = computed(() => props.doras.includes(props.tile));
|
const isDora = computed(() => props.doras.includes(props.tile.t));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
@ -59,7 +59,7 @@ const isDora = computed(() => props.doras.includes(props.tile));
|
||||||
height: 53%;
|
height: 53%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
.isDora {
|
.isDora {
|
||||||
&:after {
|
&:after {
|
||||||
content: "";
|
content: "";
|
||||||
|
@ -74,5 +74,5 @@ const isDora = computed(() => props.doras.includes(props.tile));
|
||||||
animation: shine 2s infinite;
|
animation: shine 2s infinite;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -14,7 +14,7 @@ function $(tileId: TileId): Common.TileInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
function $type(tileId: TileId): TileType {
|
function $type(tileId: TileId): TileType {
|
||||||
return Common.findTileByIdOrFail(tileId).t;
|
return $(tileId).t;
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ export class MasterGameEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static createInitialState(): MasterState {
|
public static createInitialState(): MasterState {
|
||||||
const ikasama: TileId[] = [125, 129, 9, 54, 57, 61, 77, 81, 85, 133, 134, 135, 121, 122];
|
const ikasama: TileId[] = [125, 129, 9, 56, 57, 61, 77, 81, 85, 133, 134, 135, 121, 122];
|
||||||
|
|
||||||
const tiles = [...Common.TILE_ID_MAP.keys()];
|
const tiles = [...Common.TILE_ID_MAP.keys()];
|
||||||
tiles.sort(() => Math.random() - 0.5);
|
tiles.sort(() => Math.random() - 0.5);
|
||||||
|
|
|
@ -13,7 +13,7 @@ function $(tileId: TileId): Common.TileInstance {
|
||||||
}
|
}
|
||||||
|
|
||||||
function $type(tileId: TileId): TileType {
|
function $type(tileId: TileId): TileType {
|
||||||
return Common.findTileByIdOrFail(tileId).t;
|
return $(tileId).t;
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue