summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XChatInputView.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XChatInputView.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XChatInputView.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XChatInputView.cs111
1 files changed, 111 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/XChatInputView.cs b/Client/Assets/Scripts/XMainClient/XChatInputView.cs
new file mode 100644
index 00000000..840b8357
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/XChatInputView.cs
@@ -0,0 +1,111 @@
+using System;
+using UILib;
+using UnityEngine;
+using XMainClient.UI.UICommon;
+
+namespace XMainClient
+{
+ internal class XChatInputView : DlgBase<XChatInputView, XChatInputBehaviour>
+ {
+ public override string fileName
+ {
+ get
+ {
+ return "Common/ChatInput";
+ }
+ }
+
+ public override bool autoload
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ private string _tips;
+
+ private ChatInputStringBack _func = null;
+
+ public ChatInputType inputType = ChatInputType.TEXT;
+
+ public void ShowChatInput(ChatInputStringBack func)
+ {
+ this._func = func;
+ this.SetVisible(true, true);
+ }
+
+ protected override void Init()
+ {
+ base.Init();
+ this._tips = XStringDefineProxy.GetString("ChatInput_DefaultTips");
+ }
+
+ public override void RegisterEvent()
+ {
+ base.RegisterEvent();
+ base.uiBehaviour.m_BlackBg.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCanCelBlackClick));
+ base.uiBehaviour.m_SendBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSendBtnClick));
+ base.uiBehaviour.m_btnChatpic.RegisterClickEventHandler(new ButtonClickEventHandler(this.OpenEmotion));
+ }
+
+ protected override void OnShow()
+ {
+ this.TextInit();
+ }
+
+ protected override void OnHide()
+ {
+ this.inputType = ChatInputType.TEXT;
+ this.SetInputType(this.inputType);
+ base.OnHide();
+ }
+
+ public void SetInputType(ChatInputType type)
+ {
+ this.inputType = type;
+ base.uiBehaviour.m_btnChatpic.SetVisible(type == ChatInputType.EMOTION);
+ }
+
+ public void SetCharacterLimit(int num)
+ {
+ base.uiBehaviour.m_TextInput.SetCharacterLimit(num);
+ }
+
+ private void OnCanCelBlackClick(IXUISprite iSp)
+ {
+ this.TextInit();
+ this.SetVisible(false, true);
+ }
+
+ private bool OnSendBtnClick(IXUIButton btn)
+ {
+ bool flag = this._func != null;
+ if (flag)
+ {
+ this._func(base.uiBehaviour.m_TextInput.GetText());
+ }
+ this.SetVisible(false, true);
+ return true;
+ }
+
+ private void TextInit()
+ {
+ base.uiBehaviour.m_TextInput.SetText("");
+ base.uiBehaviour.m_ShowLabel.SetText(this._tips);
+ }
+
+ private bool OpenEmotion(IXUIButton btn)
+ {
+ DlgBase<ChatEmotionView, ChatEmotionBehaviour>.singleton.ShowChatEmotion(new ChatSelectStringBack(this.OnSelectEmotion), new Vector3(16f, 143f, 0f), 0);
+ return true;
+ }
+
+ public void OnSelectEmotion(string motionstr)
+ {
+ string text = base.uiBehaviour.m_TextInput.GetText();
+ text += motionstr;
+ base.uiBehaviour.m_TextInput.SetText(text);
+ }
+ }
+}