import { find } from "cc"; import { ChatContentsLayout } from "./ChatContentsLayout"; import { DemoData } from "./DemoData"; 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; EnterChat(id: number) { find("Canvas/ChatPanel").active = true; find("Canvas/GirlDetailPanel").active = false; } EnterDetail(id: number) { find("Canvas/GirlListPanel").active = false; find("Canvas/GirlDetailPanel").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(); } }