From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/RollDlg.cs | 96 ++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/RollDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/RollDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/RollDlg.cs b/Client/Assets/Scripts/XMainClient/RollDlg.cs new file mode 100644 index 00000000..d90c1317 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/RollDlg.cs @@ -0,0 +1,96 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class RollDlg : DlgBase + { + public override string fileName + { + get + { + return "Battle/RollDlg"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private XRollDocument _doc; + + protected override void Init() + { + base.Init(); + this._doc = (XSingleton.singleton.Doc.GetXComponent(XRollDocument.uuID) as XRollDocument); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_YesButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnYesButtonClicked)); + base.uiBehaviour.m_CancelButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCancelButtonClicked)); + } + + public void ShowRollInfo() + { + this.SetVisibleWithAnimation(true, null); + this.SetupRollItemInfo(); + } + + private bool OnYesButtonClicked(IXUIButton button) + { + this._doc.SendRollReq(1); + this.SetVisible(false, true); + return true; + } + + private bool OnCancelButtonClicked(IXUIButton button) + { + this._doc.SendRollReq(2); + this.SetVisible(false, true); + return true; + } + + private void SetupRollItemInfo() + { + XSingleton.singleton.normalItemDrawer.DrawItem(base.uiBehaviour.m_ItemTpl, (int)this._doc.RollItemID, (int)this._doc.RollItemCount, false); + ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this._doc.RollItemID); + bool flag = itemConf == null; + if (!flag) + { + base.uiBehaviour.m_Level.SetText(itemConf.ReqLevel.ToString()); + base.uiBehaviour.m_Prof.SetText(XSingleton.singleton.GetProfName((int)itemConf.Profession)); + } + } + + public override void OnUpdate() + { + base.OnUpdate(); + bool flag = Time.time - this._doc.LastRollTime > (float)this._doc.ClientRollTime; + if (flag) + { + this.SetVisible(false, true); + } + else + { + base.uiBehaviour.m_TimeBar.Value = ((float)this._doc.ClientRollTime - Time.time + this._doc.LastRollTime) / (float)this._doc.ClientRollTime; + } + } + } +} -- cgit v1.1-26-g67d0