From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/UI/XShowGetItemView.cs | 223 +++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/XShowGetItemView.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/XShowGetItemView.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/XShowGetItemView.cs b/Client/Assets/Scripts/XMainClient/UI/XShowGetItemView.cs new file mode 100644 index 00000000..3ebf2a58 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XShowGetItemView.cs @@ -0,0 +1,223 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class XShowGetItemView : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/ShowGetItemTip"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool needOnTop + { + get + { + return true; + } + } + + public override bool isHideChat + { + get + { + return false; + } + } + + private XShowGetItemDocument _doc = null; + + private GameObject _preShowItem = null; + + private int _showCount; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XShowGetItemDocument.uuID); + } + + protected override void OnShow() + { + this._showCount = 0; + base.uiBehaviour.m_ShowItemPool.ReturnAll(false); + } + + public void ShowItem(XItem item) + { + bool flag = this._doc.IsForbidGetItemUI || this._doc.IsForbidByLua; + if (flag) + { + this._doc.ItemQueue.Clear(); + this.SetVisible(false, true); + } + else + { + bool flag2 = !base.IsVisible(); + if (flag2) + { + this.SetVisible(true, true); + } + this._showCount++; + GameObject gameObject = base.uiBehaviour.m_ShowItemPool.FetchGameObject(false); + gameObject.transform.localPosition = base.uiBehaviour.m_ShowItemPool.TplPos; + bool flag3 = this._preShowItem != null; + if (flag3) + { + bool activeSelf = this._preShowItem.activeSelf; + if (activeSelf) + { + this._preShowItem.transform.parent = gameObject.transform; + } + } + this._preShowItem = gameObject; + IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel; + string text = string.Format("[{0}]{1}", XSingleton.singleton.GetItemQualityRGB((int)XBagDocument.GetItemConf(item.itemID).ItemQuality).ToString(), XSingleton.singleton.ChooseProfString(XBagDocument.GetItemConf(item.itemID).ItemName, 0u)); + ixuilabel.SetText(string.Format("{0}[ffffff]x{1}", XStringDefineProxy.GetString("GET_ITEM", new object[] + { + text + }), item.itemCount.ToString())); + IXUITweenTool ixuitweenTool = gameObject.transform.GetComponent("XUIPlayTween") as IXUITweenTool; + ixuitweenTool.SetTargetGameObject(gameObject); + ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish)); + ixuitweenTool.PlayTween(true, -1f); + } + } + + public void ShowTip(string tip) + { + bool flag = !base.IsVisible(); + if (flag) + { + this.SetVisible(true, true); + } + this._showCount++; + GameObject gameObject = base.uiBehaviour.m_ShowItemPool.FetchGameObject(false); + gameObject.transform.localPosition = base.uiBehaviour.m_ShowItemPool.TplPos; + bool flag2 = this._preShowItem != null; + if (flag2) + { + bool activeSelf = this._preShowItem.activeSelf; + if (activeSelf) + { + this._preShowItem.transform.parent = gameObject.transform; + } + } + this._preShowItem = gameObject; + IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(tip); + IXUITweenTool ixuitweenTool = gameObject.transform.GetComponent("XUIPlayTween") as IXUITweenTool; + ixuitweenTool.SetTargetGameObject(gameObject); + ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish)); + ixuitweenTool.PlayTween(true, -1f); + } + + public void ShowFullTip(int Count) + { + bool flag = !base.IsVisible(); + if (flag) + { + this.SetVisible(true, true); + } + this._showCount++; + GameObject gameObject = base.uiBehaviour.m_ShowItemPool.FetchGameObject(false); + gameObject.transform.localPosition = base.uiBehaviour.m_ShowItemPool.TplPos; + bool flag2 = this._preShowItem != null; + if (flag2) + { + bool activeSelf = this._preShowItem.activeSelf; + if (activeSelf) + { + this._preShowItem.transform.parent = gameObject.transform; + } + } + this._preShowItem = gameObject; + IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(XStringDefineProxy.GetString("EXCEED_ITEM", new object[] + { + Count + })); + IXUITweenTool ixuitweenTool = gameObject.transform.GetComponent("XUIPlayTween") as IXUITweenTool; + ixuitweenTool.SetTargetGameObject(gameObject); + ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish)); + ixuitweenTool.PlayTween(true, -1f); + } + + public void ShowString(string str, uint id) + { + bool flag = !base.IsVisible(); + if (flag) + { + this.SetVisible(true, true); + } + this._showCount++; + GameObject gameObject = base.uiBehaviour.m_ShowItemPool.FetchGameObject(false); + gameObject.transform.localPosition = base.uiBehaviour.m_ShowItemPool.TplPos; + bool flag2 = this._preShowItem != null; + if (flag2) + { + bool activeSelf = this._preShowItem.activeSelf; + if (activeSelf) + { + this._preShowItem.transform.parent = gameObject.transform; + } + } + this._preShowItem = gameObject; + IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(str); + ixuilabel.ID = (ulong)id; + IXUITweenTool ixuitweenTool = gameObject.transform.GetComponent("XUIPlayTween") as IXUITweenTool; + ixuitweenTool.SetTargetGameObject(gameObject); + ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnPlayTweenFinish)); + ixuitweenTool.PlayTween(true, -1f); + } + + public void EditString(string str, uint id) + { + List list = ListPool.Get(); + base.uiBehaviour.m_ShowItemPool.GetActiveList(list); + for (int i = 0; i < list.Count; i++) + { + IXUILabel ixuilabel = list[i].transform.Find("Text").GetComponent("XUILabel") as IXUILabel; + bool flag = ixuilabel.ID != (ulong)id; + if (!flag) + { + ixuilabel.SetText(str); + break; + } + } + ListPool.Release(list); + } + + public void OnPlayTweenFinish(IXUITweenTool iPlayTween) + { + bool flag = !base.IsVisible(); + if (!flag) + { + base.uiBehaviour.m_ShowItemPool.ReturnInstance(iPlayTween.gameObject, true); + this._showCount--; + bool flag2 = this._showCount == 0; + if (flag2) + { + this.SetVisible(false, true); + } + } + } + } +} -- cgit v1.1-26-g67d0