diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs b/Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs new file mode 100644 index 00000000..ff20ef92 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XGuildPortraitView.cs @@ -0,0 +1,143 @@ +using System;
+using UILib;
+using XMainClient.UI.UICommon;
+
+namespace XMainClient.UI
+{
+ internal class XGuildPortraitView : DlgBase<XGuildPortraitView, XGuildPortraitBehaviour>
+ {
+ public int PortraitIndex
+ {
+ get
+ {
+ return this.m_SelectedIndex;
+ }
+ }
+
+ public override string fileName
+ {
+ get
+ {
+ return "Guild/GuildPortraitDlg";
+ }
+ }
+
+ public override int layer
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ public override int group
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ public override bool autoload
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public override bool pushstack
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ public static readonly int PORTRAIT_COUNT = 10;
+
+ public static readonly int COL_COUNT = 5;
+
+ private ButtonClickEventHandler _OKButtonHandler = null;
+
+ private int m_SelectedIndex = 0;
+
+ private IXUICheckBox[] m_Portraits = new IXUICheckBox[XGuildPortraitView.PORTRAIT_COUNT];
+
+ protected override void Init()
+ {
+ for (int i = 0; i < XGuildPortraitView.PORTRAIT_COUNT; i++)
+ {
+ IXUISprite ixuisprite = base.uiBehaviour.m_PortraitList[i].GetComponent("XUISprite") as IXUISprite;
+ ixuisprite.SetSprite(XGuildDocument.GetPortraitName(i));
+ this.m_Portraits[i] = (base.uiBehaviour.m_PortraitList[i].GetComponent("XUICheckBox") as IXUICheckBox);
+ this.m_Portraits[i].ID = (ulong)((long)i);
+ }
+ }
+
+ protected override void OnUnload()
+ {
+ }
+
+ public override void RegisterEvent()
+ {
+ base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick));
+ base.uiBehaviour.m_BtnOK.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnOKBtnClick));
+ for (int i = 0; i < XGuildPortraitView.PORTRAIT_COUNT; i++)
+ {
+ this.m_Portraits[i].RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._OnPortraitClick));
+ }
+ }
+
+ protected override void OnShow()
+ {
+ bool flag = this.m_SelectedIndex >= 0 && this.m_SelectedIndex < XGuildPortraitView.PORTRAIT_COUNT;
+ if (flag)
+ {
+ this.m_Portraits[this.m_SelectedIndex].bChecked = true;
+ }
+ }
+
+ protected override void OnHide()
+ {
+ base.OnHide();
+ this._OKButtonHandler = null;
+ }
+
+ public void Open(int index, ButtonClickEventHandler OKButtonHandler)
+ {
+ this.m_SelectedIndex = index;
+ this._OKButtonHandler = OKButtonHandler;
+ this.SetVisibleWithAnimation(true, null);
+ }
+
+ private bool _OnPortraitClick(IXUICheckBox iXUICheckBox)
+ {
+ int num = (int)iXUICheckBox.ID;
+ base.uiBehaviour.m_SelectorList[num].SetActive(iXUICheckBox.bChecked);
+ bool bChecked = iXUICheckBox.bChecked;
+ if (bChecked)
+ {
+ this.m_SelectedIndex = num;
+ }
+ return true;
+ }
+
+ private bool _OnCloseBtnClick(IXUIButton go)
+ {
+ this.SetVisibleWithAnimation(false, null);
+ return true;
+ }
+
+ private bool _OnOKBtnClick(IXUIButton btn)
+ {
+ bool flag = this._OKButtonHandler != null;
+ if (flag)
+ {
+ this._OKButtonHandler(btn);
+ }
+ this.SetVisibleWithAnimation(false, null);
+ return true;
+ }
+ }
+}
|