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/EndlessAbyssDlg.cs | 211 +++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/EndlessAbyssDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/EndlessAbyssDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/EndlessAbyssDlg.cs b/Client/Assets/Scripts/XMainClient/UI/EndlessAbyssDlg.cs new file mode 100644 index 00000000..df205601 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/EndlessAbyssDlg.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class EndlessAbyssDlg : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/EndlessAbyssDlg"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool hideMainMenu + { + get + { + return true; + } + } + + public override bool pushstack + { + get + { + return true; + } + } + + public override bool fullscreenui + { + get + { + return true; + } + } + + private XExpeditionDocument _doc; + + protected override void Init() + { + this._doc = XDocuments.GetSpecificDocument(XExpeditionDocument.uuID); + this.RefreshTimes(); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_closedBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseDlg)); + base.uiBehaviour.m_goBattleBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEnterTeamClick)); + base.uiBehaviour.m_shopBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGoToShop)); + base.uiBehaviour.m_Help.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHelpClicked)); + } + + public bool OnHelpClicked(IXUIButton button) + { + DlgBase.singleton.ShowHelp(XSysDefine.XSys_EndlessAbyss); + return true; + } + + protected override void OnShow() + { + this.RequstLeftCount(); + this.FillItem(); + } + + protected override void OnHide() + { + } + + private bool OnGoToShop(IXUIButton button) + { + DlgBase.singleton.ShowShopSystem(EndlessAbyssDlg.GetShopSystem(), 0UL); + return true; + } + + public static XSysDefine GetShopSystem() + { + SeqList sequenceList = XSingleton.singleton.GetSequenceList("EndlessabyssLevelInterval", true); + List intList = XSingleton.singleton.GetIntList("EndlessabyssShopType"); + int level = (int)XSingleton.singleton.XPlayerData.Level; + for (int i = 0; i < (int)sequenceList.Count; i++) + { + bool flag = level >= sequenceList[i, 0] && level <= sequenceList[i, 1]; + if (flag) + { + return (XSysDefine)(XFastEnumIntEqualityComparer.ToInt(XSysDefine.XSys_Mall_MystShop) + intList[i]); + } + } + XSingleton.singleton.AddErrorLog("Can't find player level state from golbalconfig EndlessabyssLevelInterval. level = ", level.ToString(), null, null, null, null); + return XSysDefine.XSys_Mall_32A; + } + + private void FillItem() + { + string text = ""; + List stringList = XSingleton.singleton.GetStringList("EndlessabyssDropShow"); + SeqList sequenceList = XSingleton.singleton.GetSequenceList("EndlessabyssLevelInterval", true); + bool flag = (int)sequenceList.Count != stringList.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("EndlessAbyss reward config error! level interval's count is not the same as reward interval's cout.", null, null, null, null, null); + } + uint level = XSingleton.singleton.XPlayerData.Level; + for (int i = 0; i < (int)sequenceList.Count; i++) + { + bool flag2 = (ulong)level >= (ulong)((long)sequenceList[i, 0]) && (ulong)level <= (ulong)((long)sequenceList[i, 1]); + if (flag2) + { + text = stringList[i]; + } + } + bool flag3 = text == ""; + if (flag3) + { + XSingleton.singleton.AddErrorLog("Can't find the reward of EndlessAbyss from globalconfig, level = ", level.ToString(), null, null, null, null); + } + string[] array = text.Split(XGlobalConfig.SequenceSeparator); + base.uiBehaviour.m_ItemPool.ReturnAll(false); + Vector3 tplPos = base.uiBehaviour.m_ItemPool.TplPos; + float num = tplPos.x - ((float)array.Length - 1f) / 2f * (float)base.uiBehaviour.m_ItemPool.TplWidth; + for (int j = 0; j < array.Length; j++) + { + int num2 = int.Parse(array[j]); + GameObject gameObject = base.uiBehaviour.m_ItemPool.FetchGameObject(false); + gameObject.transform.localPosition = new Vector3(num + (float)(j * base.uiBehaviour.m_ItemPool.TplWidth), tplPos.y); + XSingleton.singleton.normalItemDrawer.DrawItem(gameObject, num2, 0, false); + IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)((long)num2); + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.ShowTip)); + } + } + + public void RefreshTimes() + { + bool flag = this._doc == null || !base.IsVisible(); + if (!flag) + { + int dayCount = this._doc.GetDayCount(TeamLevelType.TeamLevelEndlessAbyss, null); + int dayMaxCount = this._doc.GetDayMaxCount(TeamLevelType.TeamLevelEndlessAbyss, null); + base.uiBehaviour.m_canJoinTimeslab.SetText(string.Format("{0}/{1}", dayCount, dayMaxCount)); + bool flag2 = dayCount > 0; + base.uiBehaviour.m_goBattleBtn.SetVisible(flag2); + base.uiBehaviour.m_noTimesGo.SetActive(!flag2); + } + } + + private void RequstLeftCount() + { + List expeditionList = this._doc.GetExpeditionList(TeamLevelType.TeamLevelEndlessAbyss); + bool flag = expeditionList != null && expeditionList.Count > 0; + if (flag) + { + XLevelSealDocument specificDocument = XDocuments.GetSpecificDocument(XLevelSealDocument.uuID); + for (int i = 0; i < expeditionList.Count; i++) + { + bool flag2 = specificDocument.SealType == expeditionList[i].LevelSealType; + if (flag2) + { + this._doc.ExpeditionId = expeditionList[i].DNExpeditionID; + XTeamDocument specificDocument2 = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument2.ReqTeamOp(TeamOperate.TEAM_QUERYCOUNT, 0UL, null, TeamMemberType.TMT_NORMAL, null); + return; + } + } + } + XSingleton.singleton.AddLog("Df data is error,not find target DATA!", null, null, null, null, null, XDebugColor.XDebug_None); + } + + private bool OnCloseDlg(IXUIButton btn) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool OnEnterTeamClick(IXUIButton button) + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument.SetAndMatch(this._doc.ExpeditionId); + return true; + } + + private void ShowTip(IXUISprite sp) + { + XSingleton.singleton.OnItemClick(sp); + } + } +} -- cgit v1.1-26-g67d0