61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
import { find } from "cc";
|
|
import { ChatContentsLayout } from "./ChatContentsLayout";
|
|
import { DemoData } from "./DemoData";
|
|
import {GirlDetailPanel} from "db://assets/Scripts/test/GirlDetailPanel";
|
|
import {ChatPanel} from "db://assets/Scripts/test/ChatPanel";
|
|
import {GirlListPanel} from "db://assets/Scripts/test/girlListPanel/GirlListPanel";
|
|
|
|
export class DemoManager {
|
|
private static _instance: DemoManager;
|
|
public static getInstance() {
|
|
if (!this._instance) {
|
|
this._instance = new DemoManager();
|
|
}
|
|
return this._instance;
|
|
}
|
|
|
|
private constructor() {
|
|
this.demoData = new DemoData();
|
|
}
|
|
|
|
demoData: DemoData;
|
|
|
|
public layoutout: ChatContentsLayout;
|
|
public detailPanel:GirlDetailPanel;
|
|
public chatPanel:ChatPanel;
|
|
public girlListPanel:GirlListPanel;
|
|
|
|
EnterChat(id: number) {
|
|
if(this.chatPanel==null)
|
|
{
|
|
this.chatPanel = find("Canvas/ChatPanel").getComponent(ChatPanel);
|
|
}
|
|
this.chatPanel.node.active = true;
|
|
this.detailPanel.node.active = false;
|
|
}
|
|
|
|
EnterDetail(id: number) {
|
|
if(this.girlListPanel==null)
|
|
{
|
|
this.girlListPanel =find("Canvas/GirlListPanel").getComponent(GirlListPanel);
|
|
}
|
|
this.girlListPanel.node.active = false;
|
|
if(this.detailPanel==null)
|
|
{
|
|
this.detailPanel = find("Canvas/GirlDetailPanel").getComponent(GirlDetailPanel);
|
|
}
|
|
this.detailPanel.refresh(id);
|
|
this.detailPanel.node.active = true;
|
|
}
|
|
|
|
public updateDialog(isPlayer: boolean, str: string) {
|
|
this.demoData.pushDialog(isPlayer, str);
|
|
console.log("update dialog");
|
|
this.layoutout.UpdateDialog(this.getDialogs());
|
|
}
|
|
|
|
public getDialogs() {
|
|
return this.demoData.GetDialogs();
|
|
}
|
|
}
|