/// #pkgName FGUI包名
/// #prefabName ui预制名字
/// #viewName uiview名字
/// #UIName ui的名字，prefabName首字母转大写
/// ui逻辑处理类
/// created by chenwb 2024

import { ChannelType } from "../../../../common/Xys";
import GameDataCenter from "../../../../data/GameDataCenter";
import FguiMgr from "../../../../frameWork/fgui/FguiMgr";
import { FguiViewCtrl } from "../../../../frameWork/fgui/mvc/FguiViewCtrl";
import { ChatType } from "../../../../shared/chat/PtlChatSend";
import { ChatVM } from "./ChatVM";
import { ChatView } from "./ChatView";

export class ChatCtrl extends FguiViewCtrl<ChatVM> {
    OnInited(): void {
    }
    OnShow(intent?: any): void {
        this.AddListeners();
    }
    OnHide(): void {
        this.RemoveListeners();
    }
    //#region UI事件
    private AddListeners() : void {
        this.RegisterClick(this.VM.BtnSend, this.OnClickBtnSend);

    }
    private RemoveListeners() : void {
// <#UIEventsRemoveArea>
    }
    private OnClickBtnSend(): void {
        GameDataCenter.chat.sendChat(ChatType.hefu, this.VM.TxtInput.text);
    }

    private Close(): void{
        FguiMgr.Instance.closeUI(ChatView);
    }
    //#endregion
}