From df346daf71a366f6efb58c19ca67191bdf63ca98 Mon Sep 17 00:00:00 2001 From: NktAts Date: Sat, 13 Jul 2019 02:14:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E3=80=8C=E3=82=AB=E3=83=BC=E3=83=89=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E3=82=8B=E3=80=8D=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/service/tabletop.service.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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' },