From 69ba864c0146eac4116da0fbfe26f5129a6aecaf Mon Sep 17 00:00:00 2001 From: NktAts Date: Fri, 4 Oct 2019 21:16:34 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=E3=82=B3=E3=83=94=E3=83=BC=E6=99=82?= =?UTF-8?q?=E3=81=AB=E7=95=AA=E5=8F=B7=E3=82=92=E4=BB=98=E4=B8=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/class/game-character.ts | 4 +++- .../game-character/game-character.component.ts | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/app/class/game-character.ts b/src/app/class/game-character.ts index 854d4b049..0188358ad 100644 --- a/src/app/class/game-character.ts +++ b/src/app/class/game-character.ts @@ -57,7 +57,9 @@ export class GameCharacter extends TabletopObject { } return null; } - + + set name(value:string) { this.setCommonValue('name', value); } + TestExec() { console.log('TestExec'); diff --git a/src/app/component/game-character/game-character.component.ts b/src/app/component/game-character/game-character.component.ts index de50da6a1..8ea9713e5 100644 --- a/src/app/component/game-character/game-character.component.ts +++ b/src/app/component/game-character/game-character.component.ts @@ -23,6 +23,7 @@ import { ContextMenuSeparator, ContextMenuService } from 'service/context-menu.s import { PanelOption, PanelService } from 'service/panel.service'; import { PointerDeviceService } from 'service/pointer-device.service'; import { RemoteControllerComponent } from 'component/remote-controller/remote-controller.component'; +import { debug } from 'util'; @Component({ selector: 'game-character', @@ -143,6 +144,9 @@ export class GameCharacterComponent implements OnInit, OnDestroy, AfterViewInit { name: 'コピーを作る', action: () => { let cloneObject = this.gameCharacter.clone(); + + cloneObject.name = this.appendCloneNumber(cloneObject.name); + cloneObject.location.x += this.gridSize; cloneObject.location.y += this.gridSize; cloneObject.update(); @@ -187,4 +191,16 @@ export class GameCharacterComponent implements OnInit, OnDestroy, AfterViewInit component.character = gameObject; } + private appendCloneNumber(objectname: string): string { + let reg = new RegExp('(.*)_([0-9]*)'); + let res = objectname.match(reg); + console.log(res); + + if(res != null && res.length == 3) { + let cloneNumber:number = parseInt(res[2]) + 1; + return res[1] + "_" + cloneNumber; + } else { + return objectname + "_2"; + } + } } From 2febefaaed40e7d50a78e0ceb212dd1c3430ade1 Mon Sep 17 00:00:00 2001 From: NktAts Date: Fri, 4 Oct 2019 21:24:29 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=82=92=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/component/game-character/game-character.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/app/component/game-character/game-character.component.ts b/src/app/component/game-character/game-character.component.ts index 8ea9713e5..e84650561 100644 --- a/src/app/component/game-character/game-character.component.ts +++ b/src/app/component/game-character/game-character.component.ts @@ -23,7 +23,6 @@ import { ContextMenuSeparator, ContextMenuService } from 'service/context-menu.s import { PanelOption, PanelService } from 'service/panel.service'; import { PointerDeviceService } from 'service/pointer-device.service'; import { RemoteControllerComponent } from 'component/remote-controller/remote-controller.component'; -import { debug } from 'util'; @Component({ selector: 'game-character', @@ -194,7 +193,6 @@ export class GameCharacterComponent implements OnInit, OnDestroy, AfterViewInit private appendCloneNumber(objectname: string): string { let reg = new RegExp('(.*)_([0-9]*)'); let res = objectname.match(reg); - console.log(res); if(res != null && res.length == 3) { let cloneNumber:number = parseInt(res[2]) + 1; From 9686252a4f0bdf90e0e0476ecff5e237c7bff12d Mon Sep 17 00:00:00 2001 From: NktAts Date: Sat, 15 Feb 2020 14:45:08 +0900 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E3=82=A4=E3=83=B3=E3=83=99=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=83=AA=E3=81=A7=E3=82=B3=E3=83=94=E3=83=BC=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=8D=E7=95=AA=E5=8F=B7=E3=81=8C=E4=BB=98?= =?UTF-8?q?=E4=B8=8E=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/class/game-character.ts | 21 +++++++++++++++++++ .../game-character.component.ts | 15 ------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/app/class/game-character.ts b/src/app/class/game-character.ts index 0188358ad..c9d9e38ea 100644 --- a/src/app/class/game-character.ts +++ b/src/app/class/game-character.ts @@ -109,6 +109,27 @@ export class GameCharacter extends TabletopObject { } } + clone() :this { + let cloneObject = super.clone(); + + let objectname:string; + let reg = new RegExp('(.*)_([0-9]*)'); + let res = cloneObject.name.match(reg); + + if(res != null && res.length == 3) { + let cloneNumber:number = parseInt(res[2]) + 1; + objectname = res[1] + "_" + cloneNumber; + } else { + objectname = cloneObject.name + "_2"; + } + + cloneObject.name = objectname; + cloneObject.update(); + + return cloneObject; + + } + createTestGameDataElement(name: string, size: number, imageIdentifier: string) { this.createDataElements(); diff --git a/src/app/component/game-character/game-character.component.ts b/src/app/component/game-character/game-character.component.ts index e84650561..ec8d402be 100644 --- a/src/app/component/game-character/game-character.component.ts +++ b/src/app/component/game-character/game-character.component.ts @@ -143,9 +143,6 @@ export class GameCharacterComponent implements OnInit, OnDestroy, AfterViewInit { name: 'コピーを作る', action: () => { let cloneObject = this.gameCharacter.clone(); - - cloneObject.name = this.appendCloneNumber(cloneObject.name); - cloneObject.location.x += this.gridSize; cloneObject.location.y += this.gridSize; cloneObject.update(); @@ -189,16 +186,4 @@ export class GameCharacterComponent implements OnInit, OnDestroy, AfterViewInit let component = this.panelService.open(RemoteControllerComponent, option); component.character = gameObject; } - - private appendCloneNumber(objectname: string): string { - let reg = new RegExp('(.*)_([0-9]*)'); - let res = objectname.match(reg); - - if(res != null && res.length == 3) { - let cloneNumber:number = parseInt(res[2]) + 1; - return res[1] + "_" + cloneNumber; - } else { - return objectname + "_2"; - } - } } From 18c0d4f1659d20b8d2e9012235ed0ab367dbe860 Mon Sep 17 00:00:00 2001 From: Hideyo Mikisato Date: Wed, 24 Feb 2021 21:15:45 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E6=AD=A3=E8=A6=8F=E8=A1=A8=E7=8F=BE?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/class/game-character.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/class/game-character.ts b/src/app/class/game-character.ts index c9d9e38ea..c8789af62 100644 --- a/src/app/class/game-character.ts +++ b/src/app/class/game-character.ts @@ -113,7 +113,7 @@ export class GameCharacter extends TabletopObject { let cloneObject = super.clone(); let objectname:string; - let reg = new RegExp('(.*)_([0-9]*)'); + let reg = new RegExp('^(.*)_([0-9]+)$'); let res = cloneObject.name.match(reg); if(res != null && res.length == 3) {