diff --git a/src/app/class/chat-message.ts b/src/app/class/chat-message.ts index 91273bf09..df9453133 100644 --- a/src/app/class/chat-message.ts +++ b/src/app/class/chat-message.ts @@ -16,6 +16,7 @@ export interface ChatMessageContext { tag?: string; dicebot?: string; imageIdentifier?: string; + color?: string; } @SyncObject('chat') @@ -27,6 +28,7 @@ export class ChatMessage extends ObjectNode implements ChatMessageContext { @SyncVar() tag: string; @SyncVar() dicebot: string; @SyncVar() imageIdentifier: string; + @SyncVar() color: string; get tabIdentifier(): string { return this.parent.identifier; } get text(): string { return this.value } diff --git a/src/app/class/chat-palette.ts b/src/app/class/chat-palette.ts index 155219429..0bf03364a 100644 --- a/src/app/class/chat-palette.ts +++ b/src/app/class/chat-palette.ts @@ -16,6 +16,7 @@ export interface PaletteVariable { @SyncObject('chat-palette') export class ChatPalette extends ObjectNode { @SyncVar() dicebot: string = ''; + @SyncVar() color: string = '#000000'; //TODO: キャラシ項目のコピー get paletteLines(): PaletteLine[] { diff --git a/src/app/component/chat-message/chat-message.component.html b/src/app/component/chat-message/chat-message.component.html index 28723bb1e..b8d106bb1 100644 --- a/src/app/component/chat-message/chat-message.component.html +++ b/src/app/component/chat-message/chat-message.component.html @@ -6,6 +6,7 @@
+ {{chatMessage.name}}  {{chatMessage.from}}  {{chatMessage.timestamp | date:'y/M/d H:mm'}} diff --git a/src/app/component/chat-palette/chat-palette.component.css b/src/app/component/chat-palette/chat-palette.component.css index e0a5c9433..2c1706eb0 100644 --- a/src/app/component/chat-palette/chat-palette.component.css +++ b/src/app/component/chat-palette/chat-palette.component.css @@ -107,4 +107,23 @@ position: absolute; top: -4px; right: 0; +} + +.color-picker-container { + position: relative; + overflow: hidden; + width:16px; + height:16px; + border-radius: 16px; + float:left; + margin: 5px; +} + +.color-picker-container > .color-picker { + position: absolute; + right: -8px; + top: -8px; + width: 32px; + height: 32px; + border: none; } \ No newline at end of file diff --git a/src/app/component/chat-palette/chat-palette.component.html b/src/app/component/chat-palette/chat-palette.component.html index 03b805f88..d28f8ee92 100644 --- a/src/app/component/chat-palette/chat-palette.component.html +++ b/src/app/component/chat-palette/chat-palette.component.html @@ -15,6 +15,9 @@
+
+ +
> diff --git a/src/app/component/chat-palette/chat-palette.component.ts b/src/app/component/chat-palette/chat-palette.component.ts index 063cd139a..82c3102be 100644 --- a/src/app/component/chat-palette/chat-palette.component.ts +++ b/src/app/component/chat-palette/chat-palette.component.ts @@ -71,6 +71,7 @@ export class ChatPaletteComponent implements OnInit, OnDestroy { this.panelService.title = this.character.name + ' のチャットパレット'; this.chatTabidentifier = this.chatMessageService.chatTabs ? this.chatMessageService.chatTabs[0].identifier : ''; this.gameType = this.character.chatPalette ? this.character.chatPalette.dicebot : ''; + this.color = this.character.chatPalette ? this.character.chatPalette.color : '#000000'; EventSystem.register(this) .on('UPDATE_GAME_OBJECT', -1000, event => { if (event.data.aliasName !== GameCharacter.aliasName) return; @@ -123,6 +124,17 @@ export class ChatPaletteComponent implements OnInit, OnDestroy { }); } + private _color: string = "#000000"; + get color(): string { return this._color }; + set color(color: string) { + this._color = color; + if (this.character.chatPalette) this.character.chatPalette.color = color; + }; + onChangeColor(new_color: string) { + this._color = new_color; + if (this.character.chatPalette) this.character.chatPalette.color = new_color; + } + showDicebotHelp() { DiceBot.getHelpMessage(this.gameType).then(help => { let gameName: string = 'ダイスボット'; @@ -169,7 +181,7 @@ export class ChatPaletteComponent implements OnInit, OnDestroy { if (this.chatTab) { let text = this.palette.evaluate(this.text, this.character.rootDataElement); - this.chatMessageService.sendMessage(this.chatTab, text, this.gameType, this.character.identifier, this.sendTo); + this.chatMessageService.sendMessage(this.chatTab, text, this.gameType, this.character.identifier, this.sendTo, this._color); } this.text = ''; this.previousWritingLength = this.text.length; diff --git a/src/app/component/chat-tab-setting/chat-tab-setting.component.html b/src/app/component/chat-tab-setting/chat-tab-setting.component.html index 9e17301f9..36e4059f4 100644 --- a/src/app/component/chat-tab-setting/chat-tab-setting.component.html +++ b/src/app/component/chat-tab-setting/chat-tab-setting.component.html @@ -15,6 +15,7 @@
+ diff --git a/src/app/component/chat-tab-setting/chat-tab-setting.component.ts b/src/app/component/chat-tab-setting/chat-tab-setting.component.ts index d0c3060f4..bd3b8e7b3 100644 --- a/src/app/component/chat-tab-setting/chat-tab-setting.component.ts +++ b/src/app/component/chat-tab-setting/chat-tab-setting.component.ts @@ -68,6 +68,47 @@ export class ChatTabSettingComponent implements OnInit, OnDestroy { this.saveDataService.saveGameObject(this.selectedTab, fileName); } + save_log() { + if (!this.selectedTab) return; + + let msg_arr = this.selectedTab.children; + if(msg_arr.length<=0) return; + + function twobit(n: number){ + return (n<=9? "0"+n: n); + } + + let date = new Date(); + let y = date.getFullYear(); + let m = twobit(date.getMonth()+1); + let d = twobit(date.getDate()); + let h = twobit(date.getHours()); + let min = twobit(date.getMinutes()); + let sec = twobit(date.getSeconds()); + let fileName: string = 'chatlog_' + y+m+d + "_" + h+min+sec + "_" + this.selectedTab.name + ".html"; + + let html_doc = ""; + for(let i=0; i ": ( msg["name"]+": "); + html_doc += ""+name+""+msg.value+"
\n"; + } + this.downloadHtml(fileName, html_doc); + } + + downloadHtml(filename, html) { + var evt = new MouseEvent('click', { + 'view': window, + 'bubbles': true, + 'cancelable': true + }); + var aLink = document.createElement('a'); + aLink.download = filename; + aLink.href = "data:text/html;charset=UTF-8," + encodeURIComponent(html); + aLink.dispatchEvent(evt); + } + delete() { if (!this.isEmpty && this.selectedTab) { this.selectedTabXml = this.selectedTab.toXml(); diff --git a/src/app/component/chat-window/chat-window.component.css b/src/app/component/chat-window/chat-window.component.css index 7874b4c91..fef579633 100644 --- a/src/app/component/chat-window/chat-window.component.css +++ b/src/app/component/chat-window/chat-window.component.css @@ -146,3 +146,22 @@ vertical-align: middle; font-size: 1.0rem; } + +.color-picker-container { + position: relative; + overflow: hidden; + width:16px; + height:16px; + border-radius: 16px; + float:left; + margin: 5px; +} + +.color-picker-container > .color-picker { + position: absolute; + right: -8px; + top: -8px; + width: 32px; + height: 32px; + border: none; +} diff --git a/src/app/component/chat-window/chat-window.component.html b/src/app/component/chat-window/chat-window.component.html index c478d3a0a..5243abcf6 100644 --- a/src/app/component/chat-window/chat-window.component.html +++ b/src/app/component/chat-window/chat-window.component.html @@ -23,6 +23,9 @@
+
+ +