Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

インベントリにて標準のダイスボットを設定できるよう機能追加 (Issue #42) #129

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/class/data-summary-setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class DataSummarySetting extends GameObject implements InnerXml {
@SyncVar() sortTag: string = 'name';
@SyncVar() sortOrder: SortOrder = SortOrder.ASC;
@SyncVar() dataTag: string = 'HP MP 敏捷度 生命力 精神力';
@SyncVar() gameType: string = "";

private _dataTag: string;
private _dataTags: string[];
Expand Down
12 changes: 10 additions & 2 deletions src/app/component/chat-palette/chat-palette.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { PeerCursor } from '@udonarium/peer-cursor';
import { ChatInputComponent } from 'component/chat-input/chat-input.component';
import { ChatMessageService } from 'service/chat-message.service';
import { PanelService } from 'service/panel.service';
import { GameObjectInventoryService} from 'service/game-object-inventory.service';

@Component({
selector: 'chat-palette',
Expand Down Expand Up @@ -51,13 +52,20 @@ export class ChatPaletteComponent implements OnInit, OnDestroy {

constructor(
public chatMessageService: ChatMessageService,
private panelService: PanelService
private panelService: PanelService,
private inventoryService: GameObjectInventoryService
) { }

ngOnInit() {
Promise.resolve().then(() => this.updatePanelTitle());
this.chatTabidentifier = this.chatMessageService.chatTabs ? this.chatMessageService.chatTabs[0].identifier : '';
this.gameType = this.character.chatPalette ? this.character.chatPalette.dicebot : '';

if(this.character.chatPalette != null && this.character.chatPalette.dicebot != '') {
this.gameType = this.character.chatPalette.dicebot;
} else {
this.gameType = this.inventoryService.gameType;
}

EventSystem.register(this)
.on('DELETE_GAME_OBJECT', -1000, event => {
if (this.character && this.character.identifier === event.data.identifier) {
Expand Down
5 changes: 4 additions & 1 deletion src/app/component/chat-window/chat-window.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ChatTabSettingComponent } from 'component/chat-tab-setting/chat-tab-set
import { ChatMessageService } from 'service/chat-message.service';
import { PanelOption, PanelService } from 'service/panel.service';
import { PointerDeviceService } from 'service/pointer-device.service';
import { GameObjectInventoryService} from 'service/game-object-inventory.service';

@Component({
selector: 'chat-window',
Expand Down Expand Up @@ -38,12 +39,14 @@ export class ChatWindowComponent implements OnInit, OnDestroy, AfterViewInit {
constructor(
public chatMessageService: ChatMessageService,
private panelService: PanelService,
private pointerDeviceService: PointerDeviceService
private pointerDeviceService: PointerDeviceService,
private inventoryService: GameObjectInventoryService
) { }

ngOnInit() {
this.sendFrom = PeerCursor.myCursor.identifier;
this._chatTabidentifier = 0 < this.chatMessageService.chatTabs.length ? this.chatMessageService.chatTabs[0].identifier : '';
this.gameType = this.inventoryService.gameType;

EventSystem.register(this)
.on('MESSAGE_ADDED', event => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
</div>
<div style="font-size: 12px; padding-top: 6px;">表示項目</div>
<input style="width: 100%; box-sizing: border-box;" [(ngModel)]="dataTag" placeholder="スペース区切りでタグ名 スラッシュで改行 ex.「HP MP / メモ」" />
<div style="font-size: 12px; padding-top: 6px;">標準ダイスボット</div>
<select style="width: 12em;" (change)="onChangeGameType($event.target.value)" [(ngModel)]="gameType" [ngModelOptions]="{standalone: true}">
<option value="">ダイスボット指定なし</option>
<option *ngFor="let diceBotInfo of diceBotInfos" value="{{diceBotInfo.script}}">{{diceBotInfo.game}}</option>
</select>
<div style="padding-top: 6px;">
<button class="tab-setting small-font" (click)="toggleEdit()"><i class="material-icons small-font">settings</i>完了</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ContextMenuAction, ContextMenuService, ContextMenuSeparator } from 'ser
import { GameObjectInventoryService } from 'service/game-object-inventory.service';
import { PanelOption, PanelService } from 'service/panel.service';
import { PointerDeviceService } from 'service/pointer-device.service';
import { DiceBot } from '@udonarium/dice-bot';

@Component({
selector: 'game-object-inventory',
Expand Down Expand Up @@ -42,6 +43,10 @@ export class GameObjectInventoryComponent implements OnInit, AfterViewInit, OnDe

get newLineString(): string { return this.inventoryService.newLineString; }

get diceBotInfos() { return DiceBot.diceBotInfos }
get gameType(): string { return this.inventoryService.gameType; }
set gameType(gameType: string) { this.inventoryService.gameType = gameType; }

constructor(
private changeDetector: ChangeDetectorRef,
private panelService: PanelService,
Expand Down Expand Up @@ -216,4 +221,11 @@ export class GameObjectInventoryComponent implements OnInit, AfterViewInit, OnDe
trackByGameObject(index: number, gameObject: GameObject) {
return gameObject ? gameObject.identifier : index;
}

onChangeGameType(gameType: string) {
console.log('onChangeGameType ready');
DiceBot.getHelpMessage(this.gameType).then(help => {
console.log('onChangeGameType done\n' + help + gameType);
});
}
}
3 changes: 3 additions & 0 deletions src/app/service/game-object-inventory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export class GameObjectInventoryService {
set dataTag(dataTag: string) { this.summarySetting.dataTag = dataTag; }
get dataTags(): string[] { return this.summarySetting.dataTags; }

get gameType(): string { return this.summarySetting.gameType; }
set gameType(gameType: string) {this.summarySetting.gameType = gameType; }

tableInventory: ObjectInventory = new ObjectInventory(object => { return object.location.name === 'table'; });
commonInventory: ObjectInventory = new ObjectInventory(object => { return !this.isAnyLocation(object.location.name); });
privateInventory: ObjectInventory = new ObjectInventory(object => { return object.location.name === Network.peerId; });
Expand Down