diff --git a/src/app/service/tabletop.service.ts b/src/app/service/tabletop.service.ts index fc501896a..947d07e34 100644 --- a/src/app/service/tabletop.service.ts +++ b/src/app/service/tabletop.service.ts @@ -312,6 +312,24 @@ export class TabletopService { return cardStack; } + createCard(position: PointerCoordinate):Card { + let front_url: string = './assets/images/trump/x01.gif'; + if (!ImageStorage.instance.get(front_url)) { + ImageStorage.instance.add(front_url); + } + + let back_url: string = './assets/images/trump/z02.gif'; + if (!ImageStorage.instance.get(back_url)) { + ImageStorage.instance.add(back_url); + } + + let card:Card = Card.create('新しいカード',front_url,back_url); + + card.location.x = position.x; + card.location.y = position.y; + return card; + } + makeDefaultTable() { let tableSelecter = new TableSelecter('tableSelecter'); tableSelecter.initialize(); @@ -399,6 +417,7 @@ export class TabletopService { this.getCreateTerrainMenu(position), this.getCreateTextNoteMenu(position), this.getCreateTrumpMenu(position), + this.getCreateCardMenu(position), this.getCreateDiceSymbolMenu(position), ]; } @@ -449,6 +468,15 @@ export class TabletopService { } } + private getCreateCardMenu(position: PointerCoordinate): ContextMenuAction { + return { + name: 'カードを作成', action: () => { + this.createCard(position); + SoundEffect.play(PresetSound.cardPut); + } + } + } + private getCreateDiceSymbolMenu(position: PointerCoordinate): ContextMenuAction { let dices: { menuName: string, diceName: string, type: DiceType, imagePathPrefix: string }[] = [ { menuName: 'D4', diceName: 'D4', type: DiceType.D4, imagePathPrefix: '4_dice' },