From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/NextLevelSealView.cs | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/NextLevelSealView.cs (limited to 'Client/Assets/Scripts/XMainClient/NextLevelSealView.cs') diff --git a/Client/Assets/Scripts/XMainClient/NextLevelSealView.cs b/Client/Assets/Scripts/XMainClient/NextLevelSealView.cs new file mode 100644 index 00000000..9ddc074b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/NextLevelSealView.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class NextLevelSealView : DlgBase + { + public override string fileName + { + get + { + return "OperatingActivity/NextSeal"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override int group + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + private XLevelSealDocument doc = null; + + protected override void Init() + { + this.doc = XDocuments.GetSpecificDocument(XLevelSealDocument.uuID); + } + + public override void RegisterEvent() + { + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked)); + } + + public bool OnCloseClicked(IXUIButton btn) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshPage(); + } + + protected override void OnHide() + { + base.uiBehaviour.m_NextSealTexL.SetTexturePath(""); + base.uiBehaviour.m_NextSealTexR.SetTexturePath(""); + base.uiBehaviour.m_NextSealTexM.SetTexturePath(""); + base.OnHide(); + } + + protected override void OnUnload() + { + base.OnUnload(); + } + + public void RefreshPage() + { + uint removeSealType = this.doc.GetRemoveSealType(XSingleton.singleton.XPlayerData.Level); + Queue levelSealNewFunction = this.doc.GetLevelSealNewFunction(removeSealType); + base.uiBehaviour.m_NewFunctionPool.ReturnAll(false); + int count = levelSealNewFunction.Count; + for (int i = 0; i < count; i++) + { + GameObject gameObject = base.uiBehaviour.m_NewFunctionPool.FetchGameObject(false); + LevelSealNewFunctionTable.RowData rowData = levelSealNewFunction.Dequeue(); + (gameObject.transform.Find("Function/Level").GetComponent("XUILabel") as IXUILabel).SetText(rowData.OpenLevel.ToString() + XStringDefineProxy.GetString("SEAL_OPEN_FUNCTION")); + (gameObject.transform.Find("Function/Name").GetComponent("XUILabel") as IXUILabel).SetText(rowData.Tag); + (gameObject.transform.Find("Function/P").GetComponent("XUISprite") as IXUISprite).SetSprite(rowData.IconName); + gameObject.transform.localPosition = new Vector3((float)(base.uiBehaviour.m_NewFunctionPool.TplWidth * i), 0f, 0f); + } + bool flag = count == 0; + if (flag) + { + base.uiBehaviour.m_NewFunction.gameObject.SetActive(false); + } + else + { + base.uiBehaviour.m_NewFunction.gameObject.SetActive(true); + base.uiBehaviour.m_NewFunctionBg.spriteWidth = base.uiBehaviour.m_NewFunctionBgWidth + (count - 1) * base.uiBehaviour.m_NewFunctionPool.TplWidth; + } + LevelSealTypeTable.RowData levelSealType = XLevelSealDocument.GetLevelSealType(removeSealType); + bool flag2 = !string.IsNullOrEmpty(levelSealType.NextSealImageL); + if (flag2) + { + base.uiBehaviour.m_NextSealTexL.SetTexturePath(levelSealType.NextSealImageL); + } + bool flag3 = !string.IsNullOrEmpty(levelSealType.NextSealImageR); + if (flag3) + { + base.uiBehaviour.m_NextSealTexR.SetTexturePath(levelSealType.NextSealImageR); + } + bool flag4 = levelSealType.NextSealImageBig != null && levelSealType.NextSealImageBig != ""; + if (flag4) + { + base.uiBehaviour.m_NextSealTexM.SetAlpha(1f); + base.uiBehaviour.m_NextSealTexM.SetTexturePath(levelSealType.NextSealImageBig); + } + else + { + base.uiBehaviour.m_NextSealTexM.SetAlpha(0f); + } + } + + public void SetNextSealLabel(string str) + { + base.uiBehaviour.m_NextSealLabel.SetText(str); + } + + public void SetPosition(Vector3 pos) + { + base.uiBehaviour.transform.position = pos; + } + } +} -- cgit v1.1-26-g67d0