From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../CustomBattleBountyModeDetailHandler.cs | 255 +++++++++++ .../CustomBattleBountyModeDetailHandler.cs.meta | 12 + .../CustomBattleBountyModeListHandler.cs | 297 +++++++++++++ .../CustomBattleBountyModeListHandler.cs.meta | 12 + .../UI/CustomBattle/CustomBattleBriefHandler.cs | 172 ++++++++ .../CustomBattle/CustomBattleBriefHandler.cs.meta | 12 + .../UI/CustomBattle/CustomBattleChestHandler.cs | 213 +++++++++ .../CustomBattle/CustomBattleChestHandler.cs.meta | 12 + .../CustomBattleCustomModeCreateHandler.cs | 491 +++++++++++++++++++++ .../CustomBattleCustomModeCreateHandler.cs.meta | 12 + .../CustomBattleCustomModeDetailHandler.cs | 386 ++++++++++++++++ .../CustomBattleCustomModeDetailHandler.cs.meta | 12 + .../CustomBattleCustomModeListHandler.cs | 334 ++++++++++++++ .../CustomBattleCustomModeListHandler.cs.meta | 12 + .../UI/CustomBattle/CustomBattleMatchingHandler.cs | 40 ++ .../CustomBattleMatchingHandler.cs.meta | 12 + .../CustomBattlePasswordSettingHandler.cs | 130 ++++++ .../CustomBattlePasswordSettingHandler.cs.meta | 12 + 18 files changed, 2426 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs.meta create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs create mode 100644 Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs.meta (limited to 'Client/Assets/Scripts/XMainClient/UI/CustomBattle') diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs new file mode 100644 index 00000000..600b3432 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs @@ -0,0 +1,255 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleBountyModeDetailHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/BountyModeDetailFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUISprite _close; + + private IXUILabel _title; + + private IXUILabel _win_count; + + private IXUISprite[] _fail_flag = new IXUISprite[3]; + + private IXUISlider _slider; + + private IXUILabel _slider_count; + + private Transform _reward_frame; + + private IXUILabelSymbol _current_reward1; + + private IXUILabelSymbol _current_reward2; + + private IXUILabelSymbol _next_reward1; + + private IXUILabelSymbol _next_reward2; + + private IXUIButton _giveup; + + private IXUIButton _start; + + private IXUISprite _box; + + private IXUILabel _box_time; + + private IXUISprite _game_icon; + + private XLeftTimeCounter _boxCD; + + private IXUILabel _canfetch; + + private Transform _fx_point; + + private XFx _fx = null; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._close = (base.transform.Find("Bg/Close").GetComponent("XUISprite") as IXUISprite); + this._title = (base.transform.Find("Bg/Title").GetComponent("XUILabel") as IXUILabel); + this._win_count = (base.transform.Find("Bg/Left/Win/Count").GetComponent("XUILabel") as IXUILabel); + for (int i = 0; i < 3; i++) + { + this._fail_flag[i] = (base.transform.Find(string.Format("Bg/Left/Fail/Fail{0}/Flag", i)).GetComponent("XUISprite") as IXUISprite); + } + this._slider = (base.transform.Find("Bg/Left/Slider").GetComponent("XUISlider") as IXUISlider); + this._slider_count = (base.transform.Find("Bg/Left/Slider/Count").GetComponent("XUILabel") as IXUILabel); + this._reward_frame = base.transform.Find("Bg/Left/RewardTip"); + this._current_reward1 = (base.transform.Find("Bg/Left/RewardTip/Current/Reward1").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._current_reward2 = (base.transform.Find("Bg/Left/RewardTip/Current/Reward2").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._next_reward1 = (base.transform.Find("Bg/Left/RewardTip/Next/Reward1").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._next_reward2 = (base.transform.Find("Bg/Left/RewardTip/Next/Reward2").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._giveup = (base.transform.Find("Bg/Right/BtnGiveup").GetComponent("XUIButton") as IXUIButton); + this._start = (base.transform.Find("Bg/Right/BtnStart").GetComponent("XUIButton") as IXUIButton); + this._box = (base.transform.Find("Bg/Right/Box").GetComponent("XUISprite") as IXUISprite); + this._box_time = (base.transform.Find("Bg/Right/Box/Time").GetComponent("XUILabel") as IXUILabel); + this._canfetch = (base.transform.Find("Bg/Right/Box/CanFetch").GetComponent("XUILabel") as IXUILabel); + this._fx_point = base.transform.Find("Bg/Right/Box/Fx"); + this._game_icon = (base.transform.Find("Bg/Right/GameIcon").GetComponent("XUISprite") as IXUISprite); + this._boxCD = new XLeftTimeCounter(this._box_time, true); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + protected override void OnHide() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnHide(); + } + + public override void OnUnload() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnUnload(); + } + + public override void RefreshData() + { + base.RefreshData(); + this._title.SetText(this._doc.CurrentBountyData.gameName); + this._win_count.SetText(this._doc.CurrentBountyData.winCount.ToString()); + for (int i = 0; i < 3; i++) + { + this._fail_flag[i].SetAlpha((float)(((long)i < (long)((ulong)this._doc.CurrentBountyData.loseCount)) ? 1 : 0)); + } + this._slider.Value = this._doc.CurrentBountyData.winPrecent; + this._slider_count.SetText(this._doc.CurrentBountyData.winText); + SeqListRef systemBattleReward = this._doc.GetSystemBattleReward((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount); + this._current_reward1.InputText = ""; + this._current_reward2.InputText = ""; + bool flag = systemBattleReward.Count > 0; + if (flag) + { + this._current_reward1.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward[0, 0]) + " " + systemBattleReward[0, 1].ToString(); + } + bool flag2 = systemBattleReward.Count > 1; + if (flag2) + { + this._current_reward2.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward[1, 0]) + " " + systemBattleReward[1, 1].ToString(); + } + SeqListRef systemBattleReward2 = this._doc.GetSystemBattleReward((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount + 1u); + this._next_reward1.InputText = ""; + this._next_reward2.InputText = ""; + bool flag3 = systemBattleReward2.Count > 0; + if (flag3) + { + this._next_reward1.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward2[0, 0]) + " " + systemBattleReward2[0, 1].ToString(); + } + else + { + this._next_reward1.InputText = XSingleton.singleton.GetString("MaxRewardTip"); + } + bool flag4 = systemBattleReward2.Count > 1; + if (flag4) + { + this._next_reward2.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward2[1, 0]) + " " + systemBattleReward2[1, 1].ToString(); + } + this._doc.DestoryFx(this._fx); + this._fx = null; + switch (this._doc.CurrentBountyData.status) + { + case CustomBattleRoleState.CustomBattle_RoleState_Join: + this._giveup.SetVisible(true); + this._start.SetVisible(true); + this._box.SetVisible(false); + this._reward_frame.gameObject.SetActive(true); + this._giveup.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGiveUpButtonClicked)); + this._start.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnStartButtonClicked)); + break; + case CustomBattleRoleState.CustomBattle_RoleState_Reward: + { + this._giveup.SetVisible(false); + this._start.SetVisible(false); + this._box.SetVisible(true); + this._boxCD.SetLeftTime(this._doc.CurrentBountyData.boxLeftTime, -1); + this._reward_frame.gameObject.SetActive(false); + this._canfetch.gameObject.SetActive(this._doc.CurrentBountyData.boxLeftTime <= 0u); + bool flag5 = this._doc.CurrentBountyData.boxLeftTime <= 0u; + if (flag5) + { + this._fx = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false); + } + this._box.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnBoxClicked)); + break; + } + case CustomBattleRoleState.Custombattle_RoleState_Taken: + this._giveup.SetVisible(false); + this._start.SetVisible(false); + this._box.SetVisible(false); + this._reward_frame.gameObject.SetActive(false); + break; + default: + this._giveup.SetVisible(false); + this._start.SetVisible(false); + this._box.SetVisible(false); + this._reward_frame.gameObject.SetActive(false); + break; + } + CustomBattleSystemTable.RowData systemBattleData = this._doc.GetSystemBattleData((uint)this._doc.CurrentBountyData.gameID); + bool flag6 = systemBattleData != null; + if (flag6) + { + this._game_icon.SetSprite(systemBattleData.IconSpritePath); + } + } + + private void OnCloseClicked(IXUISprite sp) + { + base.SetVisible(false); + } + + private bool OnGiveUpButtonClicked(IXUIButton button) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("UnJoinBountyModeTip"), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.OnUnJoinOkClicked)); + return true; + } + + private bool OnUnJoinOkClicked(IXUIButton button) + { + DlgBase.singleton.SetVisible(false, true); + this._doc.SendCustomBattleDrop(this._doc.CurrentBountyData.gameID); + return true; + } + + private bool OnStartButtonClicked(IXUIButton button) + { + bool flag = this._doc.CurrentBountyData.expID == 0; + if (flag) + { + bool flag2 = XTeamDocument.GoSingleBattleBeforeNeed(new ButtonClickEventHandler(this.OnStartButtonClicked), button); + if (flag2) + { + return true; + } + this._doc.SendCustomBattleMatch(this._doc.CurrentBountyData.gameID); + } + else + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument.SetAndMatch(this._doc.CurrentBountyData.expID); + } + return true; + } + + private void OnBoxClicked(IXUISprite sp) + { + DlgBase.singleton.ShowChestHandler(); + } + + public override void OnUpdate() + { + base.OnUpdate(); + this._boxCD.Update(); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs.meta new file mode 100644 index 00000000..b306da17 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeDetailHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 12230a71528ce9343b0236446ac84acc +timeCreated: 1611403241 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs new file mode 100644 index 00000000..08e5a53c --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleBountyModeListHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/BountyModeListFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUILabel _tip; + + private IXUIScrollView _scroll_view; + + private IXUIWrapContent _wrap_content; + + private Dictionary timers = new Dictionary(); + + private ulong _cache_gameid = 0UL; + + private Dictionary _fx_list = new Dictionary(); + + private Vector3 _fx_scale = new Vector3(0.7f, 0.7f); + + protected override void Init() + { + base.Init(); + this.timers.Clear(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._tip = (base.transform.Find("Bg/Tip").GetComponent("XUILabel") as IXUILabel); + this._tip.SetText(XSingleton.singleton.GetString("BountyModeGameTip")); + this._scroll_view = (base.transform.Find("Bg/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this._wrap_content = (base.transform.Find("Bg/Panel/List").GetComponent("XUIWrapContent") as IXUIWrapContent); + this._wrap_content.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentUpdated)); + } + + protected override void OnShow() + { + base.OnShow(); + this._doc.SendCustomBattleQueryBountyMode(); + } + + protected override void OnHide() + { + this.DestoryAllFx(); + base.OnHide(); + } + + public override void OnUnload() + { + this.DestoryAllFx(); + base.OnUnload(); + } + + private void DestoryAllFx() + { + foreach (KeyValuePair keyValuePair in this._fx_list) + { + this._doc.DestoryFx(keyValuePair.Value); + } + this._fx_list.Clear(); + } + + public override void RefreshData() + { + base.RefreshData(); + this._wrap_content.SetContentCount(this._doc.BountyList.Count, false); + this._scroll_view.ResetPosition(); + } + + private void WrapContentUpdated(Transform t, int index) + { + bool flag = index < 0 || index >= this._doc.BountyList.Count; + if (flag) + { + t.gameObject.SetActive(false); + } + else + { + this.SetupBounty(t, index); + } + } + + private void SetupBounty(Transform t, int index) + { + Transform transform = t.Find("Box"); + Transform transform2 = t.Find("BtnEnter"); + Transform transform3 = t.Find("Course"); + IXUILabel ixuilabel = t.Find("Course/win/Count").GetComponent("XUILabel") as IXUILabel; + IXUISprite[] array = new IXUISprite[3]; + for (int i = 0; i < 3; i++) + { + array[i] = (t.Find(string.Format("Course/fail/Flag{0}/Flag", i)).GetComponent("XUISprite") as IXUISprite); + } + Transform transform4 = t.Find("Lock"); + IXUILabel ixuilabel2 = t.Find("Lock/Label").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite = t.GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel3 = t.Find("Game/name").GetComponent("XUILabel") as IXUILabel; + IXUILabelSymbol ixuilabelSymbol = t.Find("Reward1").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUILabelSymbol ixuilabelSymbol2 = t.Find("Reward2").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUIButton ixuibutton = t.Find("BtnEnter").GetComponent("XUIButton") as IXUIButton; + IXUILabelSymbol ixuilabelSymbol3 = t.Find("BtnEnter/Label").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUISprite ixuisprite2 = t.Find("Game/Helpicon").GetComponent("XUISprite") as IXUISprite; + Transform parent = t.Find("Box/Fx"); + IXUISprite ixuisprite3 = t.Find("Icon").GetComponent("XUISprite") as IXUISprite; + IXUISprite ixuisprite4 = t.Find("Game/NameIcon").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)index; + ixuibutton.ID = (ulong)index; + ixuisprite2.ID = (ulong)this._doc.BountyList[index].gameType; + ixuisprite2.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnHelpClicked)); + ixuilabel3.SetText(this._doc.BountyList[index].gameName); + SeqListRef systemBattleReward = this._doc.GetSystemBattleReward((uint)this._doc.BountyList[index].gameID, this._doc.BountyList[index].winMax); + ixuilabelSymbol.InputText = ""; + ixuilabelSymbol2.InputText = ""; + bool flag = systemBattleReward.Count > 0; + if (flag) + { + ixuilabelSymbol.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward[0, 0]) + " " + systemBattleReward[0, 1].ToString(); + } + bool flag2 = systemBattleReward.Count > 1; + if (flag2) + { + ixuilabelSymbol2.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleReward[1, 0]) + " " + systemBattleReward[1, 1].ToString(); + } + IXUILabel ixuilabel4 = t.Find("Box/CanFetch").GetComponent("XUILabel") as IXUILabel; + bool flag3 = !this.timers.ContainsKey(t); + if (flag3) + { + IXUILabel label = t.Find("Box/Time").GetComponent("XUILabel") as IXUILabel; + this.timers.Add(t, new XLeftTimeCounter(label, true)); + } + bool flag4 = this._fx_list.ContainsKey(t); + if (flag4) + { + this._doc.DestoryFx(this._fx_list[t]); + this._fx_list[t] = null; + } + XLeftTimeCounter xleftTimeCounter = this.timers[t]; + bool flag5 = this._doc.BountyList[index].boxLeftTime > 0u; + if (flag5) + { + xleftTimeCounter.SetLeftTime(this._doc.BountyList[index].boxLeftTime, -1); + ixuilabel4.gameObject.SetActive(false); + } + else + { + xleftTimeCounter.SetLeftTime(0f, -1); + ixuilabel4.gameObject.SetActive(true); + this._fx_list[t] = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", parent, this._fx_scale, false); + } + switch (this._doc.BountyList[index].status) + { + case CustomBattleRoleState.CustomBattle_RoleState_Ready: + transform.gameObject.SetActive(false); + transform2.gameObject.SetActive(true); + transform3.gameObject.SetActive(false); + transform4.gameObject.SetActive(false); + ixuisprite.RegisterSpriteClickEventHandler(null); + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnJoinClicked)); + ixuilabelSymbol3.InputText = XLabelSymbolHelper.FormatSmallIcon((int)this._doc.BountyList[index].ticket.itemID) + " " + this._doc.BountyList[index].ticket.itemCount.ToString(); + break; + case CustomBattleRoleState.CustomBattle_RoleState_Join: + transform.gameObject.SetActive(false); + transform2.gameObject.SetActive(false); + transform3.gameObject.SetActive(true); + transform4.gameObject.SetActive(false); + ixuilabel.SetText(this._doc.BountyList[index].winCount.ToString()); + for (int j = 0; j < 3; j++) + { + array[j].SetAlpha((float)(((long)j < (long)((ulong)this._doc.BountyList[index].loseCount)) ? 1 : 0)); + } + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnEnterDetailClicked)); + ixuibutton.RegisterClickEventHandler(null); + break; + case CustomBattleRoleState.CustomBattle_RoleState_Reward: + transform.gameObject.SetActive(true); + transform2.gameObject.SetActive(false); + transform3.gameObject.SetActive(false); + transform4.gameObject.SetActive(false); + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnEnterDetailClicked)); + ixuibutton.RegisterClickEventHandler(null); + break; + case CustomBattleRoleState.Custombattle_RoleState_Taken: + transform.gameObject.SetActive(true); + transform2.gameObject.SetActive(false); + transform3.gameObject.SetActive(false); + transform4.gameObject.SetActive(false); + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnEnterDetailClicked)); + ixuibutton.RegisterClickEventHandler(null); + break; + default: + transform.gameObject.SetActive(false); + transform2.gameObject.SetActive(false); + transform3.gameObject.SetActive(false); + transform4.gameObject.SetActive(false); + break; + } + CustomBattleSystemTable.RowData systemBattleData = this._doc.GetSystemBattleData((uint)this._doc.BountyList[index].gameID); + bool flag6 = systemBattleData != null; + if (flag6) + { + bool flag7 = systemBattleData.levellimit > XSingleton.singleton.XPlayerData.Level; + if (flag7) + { + transform.gameObject.SetActive(false); + transform2.gameObject.SetActive(false); + transform3.gameObject.SetActive(false); + transform4.gameObject.SetActive(true); + ixuilabel2.SetText(XStringDefineProxy.GetString("LEVEL_REQUIRE_LEVEL", new object[] + { + systemBattleData.levellimit + })); + ixuisprite.RegisterSpriteClickEventHandler(null); + ixuibutton.RegisterClickEventHandler(null); + } + ixuisprite3.SetSprite(systemBattleData.IconSpritePath); + ixuisprite4.SetSprite(systemBattleData.TitleSpriteName); + } + } + + private void OnEnterDetailClicked(IXUISprite sp) + { + this.ShowDetailByIndex((int)sp.ID); + } + + public void ShowDetailByIndex(int index) + { + bool flag = index >= this._doc.BountyList.Count; + if (!flag) + { + this._doc.CurrentBountyData = this._doc.BountyList[index]; + DlgBase.singleton.ShowBountyModeDetailHandler(); + } + } + + private void OnHelpClicked(IXUISprite sp) + { + CustomBattleTypeTable.RowData customBattleTypeData = this._doc.GetCustomBattleTypeData((int)sp.ID); + string title = (customBattleTypeData != null) ? customBattleTypeData.name : ""; + string @string = XSingleton.singleton.GetString(string.Format("CustomTypeTip_{0}", sp.ID)); + DlgBase.singleton.ShowHelp(title, @string); + } + + private bool OnJoinClicked(IXUIButton button) + { + bool flag = (int)button.ID >= this._doc.BountyList.Count; + bool result; + if (flag) + { + result = false; + } + else + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("JoinBountyCost", new object[] + { + XLabelSymbolHelper.FormatSmallIcon((int)this._doc.BountyList[(int)button.ID].ticket.itemID) + " " + this._doc.BountyList[(int)button.ID].ticket.itemCount.ToString() + }), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.OnJoinOkClicked)); + this._cache_gameid = this._doc.BountyList[(int)button.ID].gameID; + result = true; + } + return result; + } + + private bool OnJoinOkClicked(IXUIButton button) + { + this._doc.SendCustomBattleJoin(this._cache_gameid, false, ""); + this._cache_gameid = 0UL; + DlgBase.singleton.SetVisible(false, true); + return true; + } + + public override void OnUpdate() + { + base.OnUpdate(); + foreach (KeyValuePair keyValuePair in this.timers) + { + bool activeInHierarchy = keyValuePair.Key.gameObject.activeInHierarchy; + if (activeInHierarchy) + { + keyValuePair.Value.Update(); + } + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs.meta new file mode 100644 index 00000000..67219963 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBountyModeListHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: df292cafa66e9df45827f16016456515 +timeCreated: 1611404691 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs new file mode 100644 index 00000000..d4995594 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs @@ -0,0 +1,172 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleBriefHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/CustomModeBriefFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUISprite _close; + + private IXUILabel _name; + + private IXUILabel _type; + + private IXUILabel _creater; + + private Transform _slider; + + private IXUILabel _left_time; + + private IXUILabel _left_time_tip; + + private IXUILabel _size; + + private IXUILabel _length; + + private IXUILabel _limit; + + private IXUILabel _id; + + private IXUIButton _start; + + private IXUIButton _edit; + + private XLeftTimeCounter _lefttime_counter; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._close = (base.transform.Find("Bg/Close").GetComponent("XUISprite") as IXUISprite); + this._name = (base.transform.Find("Bg/Name").GetComponent("XUILabel") as IXUILabel); + this._type = (base.transform.Find("Bg/Type").GetComponent("XUILabel") as IXUILabel); + this._creater = (base.transform.Find("Bg/Creater").GetComponent("XUILabel") as IXUILabel); + this._slider = base.transform.Find("Bg/Slider"); + this._left_time = (base.transform.Find("Bg/Slider/Time").GetComponent("XUILabel") as IXUILabel); + this._left_time_tip = (base.transform.Find("Bg/Slider/Time/Tip").GetComponent("XUILabel") as IXUILabel); + this._lefttime_counter = new XLeftTimeCounter(this._left_time, false); + this._size = (base.transform.Find("Bg/Size").GetComponent("XUILabel") as IXUILabel); + this._length = (base.transform.Find("Bg/Length").GetComponent("XUILabel") as IXUILabel); + this._limit = (base.transform.Find("Bg/Limit").GetComponent("XUILabel") as IXUILabel); + this._id = (base.transform.Find("Bg/ID").GetComponent("XUILabel") as IXUILabel); + this._start = (base.transform.Find("Bg/Start").GetComponent("XUIButton") as IXUIButton); + this._edit = (base.transform.Find("Bg/Edit").GetComponent("XUIButton") as IXUIButton); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked)); + this._start.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnStartButtonClicked)); + this._edit.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnEditButtonClicked)); + } + + private void OnCloseClicked(IXUISprite sp) + { + base.SetVisible(false); + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = this._doc.CurrentCustomData == null; + if (flag) + { + base.SetVisible(false); + } + else + { + CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(this._doc.CurrentCustomData.configID); + this._type.SetText(customBattleData.desc); + this._name.SetText(this._doc.CurrentCustomData.gameName); + this._id.SetText(this._doc.CurrentCustomData.token); + this._creater.SetText(this._doc.CurrentCustomData.gameCreator); + this._size.SetText(this._doc.CurrentCustomData.joinText); + this._length.SetText(XSingleton.singleton.TimeAccFormatString((int)this._doc.CurrentCustomData.gameLength, 4, 0)); + uint num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Friend); + bool flag2 = (this._doc.CurrentCustomData.gameMask & num) == num; + num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Guild); + bool flag3 = (this._doc.CurrentCustomData.gameMask & num) == num; + string text = ""; + bool flag4 = flag2; + if (flag4) + { + text += XSingleton.singleton.GetString("FriendOnlyJoin"); + } + bool flag5 = flag3; + if (flag5) + { + text = text + ((text == "") ? "" : ",") + XSingleton.singleton.GetString("GuildOnlyJoin"); + } + bool flag6 = text == ""; + if (flag6) + { + text = XSingleton.singleton.GetString("AllJoin"); + } + this._limit.SetText(text); + this._start.SetEnable(this._doc.CurrentCustomData.creatorID == XSingleton.singleton.XPlayerData.RoleID, false); + this._edit.SetEnable(this._doc.CurrentCustomData.creatorID == XSingleton.singleton.XPlayerData.RoleID, false); + switch (this._doc.CurrentCustomData.gameStatus) + { + case CustomBattleState.CustomBattle_Ready: + this._left_time_tip.SetText(XSingleton.singleton.GetString("WaitForStart")); + this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameStartLeftTime, -1); + break; + case CustomBattleState.CustomBattle_Going: + this._left_time_tip.SetText(XSingleton.singleton.GetString("WaitForEnd")); + this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1); + this._start.SetEnable(false, false); + break; + case CustomBattleState.CustomBattle_End: + this._left_time_tip.SetText(XSingleton.singleton.GetString("WaitForEnd")); + this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1); + this._start.SetEnable(false, false); + break; + case CustomBattleState.CustomBattle_Destory: + this._left_time_tip.SetText(XSingleton.singleton.GetString("WaitForEnd")); + this._lefttime_counter.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1); + this._start.SetEnable(false, false); + break; + } + } + } + + private bool OnStartButtonClicked(IXUIButton button) + { + this._doc.SendCustomBattleStartNow(this._doc.CurrentCustomData.gameID); + return true; + } + + private bool OnEditButtonClicked(IXUIButton button) + { + DlgBase.singleton.ShowPasswordSettingHandler(); + return true; + } + + public override void OnUpdate() + { + base.OnUpdate(); + this._lefttime_counter.Update(); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs.meta new file mode 100644 index 00000000..e4ef50a4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleBriefHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e36a3045d0e5e2b4c885f6bb1a2d957c +timeCreated: 1611404732 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs new file mode 100644 index 00000000..22b9569b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs @@ -0,0 +1,213 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleChestHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/ChestFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUISprite _close; + + private XUIPool _item_pool = new XUIPool(XSingleton.singleton.m_uiTool); + + private IXUIButton _fetch_btn; + + private Transform _wait_open_frame; + + private IXUIButton _open_now; + + private IXUILabel _left_time; + + private IXUILabelSymbol _cost; + + private XLeftTimeCounter _boxCD; + + private Transform _fx_point; + + private XFx _fx = null; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._close = (base.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + Transform transform = base.transform.Find("List/Item"); + this._item_pool.SetupPool(transform.parent.gameObject, transform.gameObject, 4u, false); + this._fetch_btn = (base.transform.Find("FetchBtn").GetComponent("XUIButton") as IXUIButton); + this._wait_open_frame = base.transform.Find("WaitFrame"); + this._open_now = (base.transform.Find("WaitFrame/OpenBtn").GetComponent("XUIButton") as IXUIButton); + this._left_time = (base.transform.Find("WaitFrame/Time").GetComponent("XUILabel") as IXUILabel); + this._boxCD = new XLeftTimeCounter(this._left_time, false); + this._cost = (base.transform.Find("WaitFrame/OpenBtn/Cost").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._fx_point = base.transform.Find("Title/Box/Fx"); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked)); + this._fetch_btn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnFetchButtonClicked)); + this._open_now.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnOpenNowButtonClicked)); + } + + protected override void OnHide() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnHide(); + } + + public override void OnUnload() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnUnload(); + } + + private void OnCloseClicked(IXUISprite sp) + { + base.SetVisible(false); + } + + private bool OnFetchButtonClicked(IXUIButton button) + { + bool flag = DlgBase.singleton._BountyModeDetailHandler != null && DlgBase.singleton._BountyModeDetailHandler.IsVisible(); + if (flag) + { + this._doc.SendCustomBattleGetReward(this._doc.CurrentBountyData.gameID); + } + bool flag2 = DlgBase.singleton._CustomModeDetailHandler != null && DlgBase.singleton._CustomModeDetailHandler.IsVisible(); + if (flag2) + { + this._doc.SendCustomBattleGetReward(this._doc.CurrentCustomData.gameID); + } + return true; + } + + private bool OnOpenNowButtonClicked(IXUIButton button) + { + bool flag = DlgBase.singleton._BountyModeDetailHandler != null && DlgBase.singleton._BountyModeDetailHandler.IsVisible(); + if (flag) + { + this._doc.SendCustomBattleClearCD(this._doc.CurrentBountyData.gameID); + } + bool flag2 = DlgBase.singleton._CustomModeDetailHandler != null && DlgBase.singleton._CustomModeDetailHandler.IsVisible(); + if (flag2) + { + this._doc.SendCustomBattleClearCD(this._doc.CurrentCustomData.gameID); + } + return true; + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = DlgBase.singleton._BountyModeDetailHandler != null && DlgBase.singleton._BountyModeDetailHandler.IsVisible(); + if (flag) + { + this.RefreshBountyData(); + } + bool flag2 = DlgBase.singleton._CustomModeDetailHandler != null && DlgBase.singleton._CustomModeDetailHandler.IsVisible(); + if (flag2) + { + this.RefreshCustomData(); + } + } + + private void RefreshBountyData() + { + bool flag = this._doc.CurrentBountyData == null; + if (!flag) + { + this._item_pool.ReturnAll(false); + SeqListRef systemBattleReward = this._doc.GetSystemBattleReward((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount); + for (int i = 0; i < systemBattleReward.Count; i++) + { + GameObject gameObject = this._item_pool.FetchGameObject(false); + gameObject.transform.localPosition = this._item_pool.TplPos + new Vector3(((float)i - (float)(systemBattleReward.Count - 1) / 2f) * (float)this._item_pool.TplWidth, 0f); + XSingleton.singleton.normalItemDrawer.DrawItem(gameObject, (int)systemBattleReward[i, 0], (int)systemBattleReward[i, 1], false); + } + this._doc.DestoryFx(this._fx); + this._fx = null; + bool flag2 = this._doc.CurrentBountyData.boxLeftTime == 0u; + if (flag2) + { + this._fetch_btn.SetVisible(true); + this._wait_open_frame.gameObject.SetActive(false); + this._boxCD.SetLeftTime(0f, -1); + this._fx = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false); + } + else + { + this._fetch_btn.SetVisible(false); + this._wait_open_frame.gameObject.SetActive(true); + this._boxCD.SetLeftTime(this._doc.CurrentBountyData.boxLeftTime, -1); + SeqRef systemBattleQuickOpenCost = this._doc.GetSystemBattleQuickOpenCost((uint)this._doc.CurrentBountyData.gameID, this._doc.CurrentBountyData.winCount); + this._cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)systemBattleQuickOpenCost[0]) + " " + systemBattleQuickOpenCost[1].ToString(); + } + } + } + + private void RefreshCustomData() + { + bool flag = this._doc.CurrentCustomData == null; + if (!flag) + { + this._item_pool.ReturnAll(false); + SeqListRef customBattleRewardByRank = this._doc.GetCustomBattleRewardByRank(this._doc.CurrentCustomData.configID, this._doc.CurrentCustomData.selfRank); + for (int i = 0; i < customBattleRewardByRank.Count; i++) + { + GameObject gameObject = this._item_pool.FetchGameObject(false); + gameObject.transform.localPosition = this._item_pool.TplPos + new Vector3(((float)i - (float)(customBattleRewardByRank.Count - 1) / 2f) * (float)this._item_pool.TplWidth, 0f); + XSingleton.singleton.normalItemDrawer.DrawItem(gameObject, (int)customBattleRewardByRank[i, 0], (int)customBattleRewardByRank[i, 1], false); + } + this._doc.DestoryFx(this._fx); + this._fx = null; + bool flag2 = this._doc.CurrentCustomData.boxLeftTime == 0u; + if (flag2) + { + this._fetch_btn.SetVisible(true); + this._wait_open_frame.gameObject.SetActive(false); + this._boxCD.SetLeftTime(0f, -1); + this._fx = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false); + } + else + { + this._fetch_btn.SetVisible(false); + this._wait_open_frame.gameObject.SetActive(true); + this._boxCD.SetLeftTime(this._doc.CurrentCustomData.boxLeftTime, -1); + SeqRef customBattleQuickOpenCost = this._doc.GetCustomBattleQuickOpenCost(this._doc.CurrentCustomData.configID, this._doc.CurrentCustomData.selfRank); + this._cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleQuickOpenCost[0]) + " " + customBattleQuickOpenCost[1].ToString(); + } + } + } + + public override void OnUpdate() + { + base.OnUpdate(); + bool activeInHierarchy = this._wait_open_frame.gameObject.activeInHierarchy; + if (activeInHierarchy) + { + this._boxCD.Update(); + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs.meta new file mode 100644 index 00000000..b56b0df7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleChestHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 645424fe5db17b9408c4656e13df2952 +timeCreated: 1611403847 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs new file mode 100644 index 00000000..fa6d3f3f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs @@ -0,0 +1,491 @@ +using System; +using System.Collections.Generic; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleCustomModeCreateHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/CustomModeCreateFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUIButton _close; + + private IXUILabelSymbol _reward1; + + private IXUILabelSymbol _reward2; + + private IXUISprite _add_reward; + + private IXUISprite _sub_reward; + + private IXUISprite _reward_box; + + private IXUISprite _reward_info; + + private IXUILabel _reward_tip; + + private IXUILabel _game_size; + + private IXUILabel _game_wait_time; + + private IXUILabel _game_time; + + private IXUISprite _game_time_add; + + private IXUISprite _game_time_sub; + + private IXUIInput _game_name; + + private IXUISprite _game_name_edit; + + private IXUISprite _friendsonly_switch; + + private IXUISprite _guildonly_switch; + + private IXUISprite _fairmode_switch; + + private IXUISprite _password_switch; + + private IXUITexture _game_type_change; + + private IXUILabel _game_type_name; + + private IXUIButton _game_create; + + private IXUILabelSymbol _game_create_cost; + + private Transform _check_frame; + + private IXUILabel _check_game_name; + + private IXUILabelSymbol _check_game_reward1; + + private IXUILabelSymbol _check_game_reward2; + + private IXUIButton _check_cancel; + + private IXUIButton _check_create; + + private IXUILabelSymbol _check_create_cost; + + private Transform _change_frame; + + private IXUIScrollView _game_type_scrollview; + + private XUIPool _game_type_pool = new XUIPool(XSingleton.singleton.m_uiTool); + + private IXUISprite _change_frame_close; + + private Transform _fx_point; + + private XFx _fx = null; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._close = (base.transform.Find("Close").GetComponent("XUIButton") as IXUIButton); + this._reward1 = (base.transform.Find("Box/Reward1").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._reward2 = (base.transform.Find("Box/Reward2").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._add_reward = (base.transform.Find("Box/Right").GetComponent("XUISprite") as IXUISprite); + this._sub_reward = (base.transform.Find("Box/Left").GetComponent("XUISprite") as IXUISprite); + this._reward_box = (base.transform.Find("Box/Box").GetComponent("XUISprite") as IXUISprite); + this._reward_info = (base.transform.Find("Box/Box/Info").GetComponent("XUISprite") as IXUISprite); + this._reward_tip = (base.transform.Find("Box/Box/Tips").GetComponent("XUILabel") as IXUILabel); + this._reward_tip.SetText(XSingleton.singleton.ReplaceReturn(XSingleton.singleton.GetString("CustomBattleCreateBoxTip"))); + this._game_size = (base.transform.Find("Box/Size").GetComponent("XUILabel") as IXUILabel); + this._game_wait_time = (base.transform.Find("Box/WaitTime").GetComponent("XUILabel") as IXUILabel); + this._game_time = (base.transform.Find("Box/Time").GetComponent("XUILabel") as IXUILabel); + this._game_time_add = (base.transform.Find("Box/Time/Add").GetComponent("XUISprite") as IXUISprite); + this._game_time_sub = (base.transform.Find("Box/Time/Sub").GetComponent("XUISprite") as IXUISprite); + this._game_name = (base.transform.Find("Settings/Name/Input").GetComponent("XUIInput") as IXUIInput); + this._game_name_edit = (base.transform.Find("Settings/Name/Edit").GetComponent("XUISprite") as IXUISprite); + this._friendsonly_switch = (base.transform.Find("Settings/FriendsOnly").GetComponent("XUISprite") as IXUISprite); + this._guildonly_switch = (base.transform.Find("Settings/GuildOnly").GetComponent("XUISprite") as IXUISprite); + this._fairmode_switch = (base.transform.Find("Settings/FairMode").GetComponent("XUISprite") as IXUISprite); + this._password_switch = (base.transform.Find("Settings/Password").GetComponent("XUISprite") as IXUISprite); + this._game_type_change = (base.transform.Find("Settings/GameChange").GetComponent("XUITexture") as IXUITexture); + this._game_type_name = (base.transform.Find("Settings/GameChange/Name").GetComponent("XUILabel") as IXUILabel); + this._game_create = (base.transform.Find("BtnCreate").GetComponent("XUIButton") as IXUIButton); + this._game_create_cost = (base.transform.Find("BtnCreate/Cost").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._check_frame = base.transform.Find("CheckFrame"); + this._check_game_name = (base.transform.Find("CheckFrame/Name").GetComponent("XUILabel") as IXUILabel); + this._check_game_reward1 = (base.transform.Find("CheckFrame/Reward/Reward1").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._check_game_reward2 = (base.transform.Find("CheckFrame/Reward/Reward2").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._check_cancel = (base.transform.Find("CheckFrame/Cancel").GetComponent("XUIButton") as IXUIButton); + this._check_create = (base.transform.Find("CheckFrame/BtnCreate").GetComponent("XUIButton") as IXUIButton); + this._check_create_cost = (base.transform.Find("CheckFrame/BtnCreate/Cost").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._change_frame = base.transform.Find("ChangeFrame"); + this._game_type_scrollview = (base.transform.Find("ChangeFrame/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this._change_frame_close = (base.transform.Find("ChangeFrame/Close").GetComponent("XUISprite") as IXUISprite); + Transform transform = base.transform.Find("ChangeFrame/Panel/Tpl"); + this._game_type_pool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false); + this._fx_point = base.transform.Find("Box/Box/Fx"); + } + + protected override void OnHide() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnHide(); + } + + public override void OnUnload() + { + List list = ListPool.Get(); + this._game_type_pool.GetActiveList(list); + for (int i = 0; i < list.Count; i++) + { + IXUITexture ixuitexture = list[i].transform.Find("Background").GetComponent("XUITexture") as IXUITexture; + ixuitexture.SetTexturePath(""); + } + ListPool.Release(list); + this._game_type_change.SetTexturePath(""); + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnUnload(); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseButtonClicked)); + this._add_reward.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAddRewardClicked)); + this._sub_reward.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSubRewardClicked)); + this._reward_box.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnRewardBoxClicked)); + this._reward_info.RegisterSpritePressEventHandler(new SpritePressEventHandler(this.OnRewardInfoPressed)); + this._game_time_add.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGameTimeAddClicked)); + this._game_time_sub.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGameTimeSubClicked)); + this._game_name_edit.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGameNameEditClicked)); + this._friendsonly_switch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnFriendOnlySwitchClicked)); + this._guildonly_switch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGuildOnlySwitchClicked)); + this._fairmode_switch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnFairModeSwitchClicked)); + this._password_switch.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnPasswordSwitchClicked)); + this._game_type_change.RegisterLabelClickEventHandler(new TextureClickEventHandler(this.OnGameTypeChangeClicked)); + this._game_create.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGameCreateButtonClicked)); + this._check_cancel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCheckCancelButtonClicked)); + this._check_create.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCheckCreateButtonClicked)); + this._change_frame_close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnChangeFrameCloseClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this._reward_tip.Alpha = 0f; + this._doc.DestoryFx(this._fx); + this._fx = null; + this._fx = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false); + this._doc.ResetCustomModeCreateData(); + this.RefreshData(); + this.RefreshTypeList(); + } + + private void RefreshTypeList() + { + this._game_type_pool.ReturnAll(false); + CustomBattleTypeTable.RowData[] customBattleTypelist = this._doc.GetCustomBattleTypelist(); + for (int i = 0; i < customBattleTypelist.Length; i++) + { + bool flag = customBattleTypelist[i].gmcreate && !this._doc.IsCreateGM; + if (!flag) + { + GameObject gameObject = this._game_type_pool.FetchGameObject(false); + gameObject.transform.localPosition = this._game_type_pool.TplPos + new Vector3(0f, (float)(-(float)i * this._game_type_pool.TplHeight)); + IXUITexture ixuitexture = gameObject.transform.Find("Background").GetComponent("XUITexture") as IXUITexture; + ixuitexture.SetTexturePath("atlas/UI/" + customBattleTypelist[i].show); + IXUILabel ixuilabel = gameObject.transform.Find("Name").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(customBattleTypelist[i].name); + IXUISprite ixuisprite = gameObject.GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)((long)customBattleTypelist[i].type); + GameObject gameObject2 = gameObject.transform.Find("Lock").gameObject; + IXUILabel ixuilabel2 = gameObject2.GetComponent("XUILabel") as IXUILabel; + bool notopen = customBattleTypelist[i].notopen; + if (notopen) + { + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnTypeSelect)); + ixuitexture.SetEnabled(true); + gameObject2.SetActive(true); + } + else + { + ixuisprite.RegisterSpriteClickEventHandler(null); + ixuitexture.SetEnabled(false); + gameObject2.SetActive(false); + } + uint customBattleLevelLimitByType = this._doc.GetCustomBattleLevelLimitByType((uint)customBattleTypelist[i].type); + bool flag2 = customBattleLevelLimitByType > XSingleton.singleton.XPlayerData.Level; + if (flag2) + { + gameObject2.SetActive(true); + ixuilabel2.SetText(XStringDefineProxy.GetString("LEVEL_REQUIRE_LEVEL", new object[] + { + customBattleLevelLimitByType + })); + ixuisprite.RegisterSpriteClickEventHandler(null); + } + else + { + gameObject2.SetActive(false); + } + } + } + } + + public override void RefreshData() + { + base.RefreshData(); + this._change_frame.gameObject.SetActive(false); + this._check_frame.gameObject.SetActive(false); + this._game_name.SetText(this._doc.CustomCreateData.gameName); + uint num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Friend); + bool flag = (this._doc.CustomCreateData.scaleMask & num) == num; + num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Guild); + bool flag2 = (this._doc.CustomCreateData.scaleMask & num) == num; + this.SetSwitchSprite(this._friendsonly_switch, flag); + this.SetSwitchSprite(this._guildonly_switch, flag2); + this.SetSwitchSprite(this._fairmode_switch, this._doc.CustomCreateData.isFair); + this.SetSwitchSprite(this._password_switch, this._doc.CustomCreateData.hasPassword); + this.ShowGameType(1u); + } + + public void SetPasswordSwitchSprite(bool flag) + { + this.SetSwitchSprite(this._password_switch, flag); + XSingleton.singleton.ShowSystemTip(flag ? XSingleton.singleton.GetString("SetPasswordSucc") : XSingleton.singleton.GetString("CancelPassword"), "fece00"); + } + + internal void SetSwitchSprite(IXUISprite sp, bool flag) + { + sp.SetSprite(flag ? "UI_Sw_on" : "UI_Sw_off"); + } + + private bool OnCloseButtonClicked(IXUIButton button) + { + base.SetVisible(false); + return true; + } + + private void OnAddRewardClicked(IXUISprite sp) + { + uint customBattleNextID = this._doc.GetCustomBattleNextID(this._doc.CustomCreateData.gameType, this._doc.CustomCreateData.configID); + this.ShowConfig(customBattleNextID); + } + + private void OnSubRewardClicked(IXUISprite sp) + { + uint customBattlePreID = this._doc.GetCustomBattlePreID(this._doc.CustomCreateData.gameType, this._doc.CustomCreateData.configID); + this.ShowConfig(customBattlePreID); + } + + private void OnRewardBoxClicked(IXUISprite sp) + { + } + + private bool OnRewardInfoPressed(IXUISprite sp, bool isPressed) + { + this._reward_tip.Alpha = (float)(isPressed ? 1 : 0); + return true; + } + + private void OnGameTimeAddClicked(IXUISprite sp) + { + CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(this._doc.CustomCreateData.configID); + int num = customBattleData.timespan.Length; + bool flag = (ulong)this._doc.CustomCreateData.battleTimeIndex < (ulong)((long)(num - 1)); + if (flag) + { + XCustomBattleDocument doc = this._doc; + doc.CustomCreateData.battleTimeIndex = doc.CustomCreateData.battleTimeIndex + 1u; + } + this._game_time.SetText(XSingleton.singleton.TimeAccFormatString((int)customBattleData.timespan[(int)this._doc.CustomCreateData.battleTimeIndex], 4, 0)); + } + + private void OnGameTimeSubClicked(IXUISprite sp) + { + CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(this._doc.CustomCreateData.configID); + bool flag = this._doc.CustomCreateData.battleTimeIndex > 0u; + if (flag) + { + XCustomBattleDocument doc = this._doc; + doc.CustomCreateData.battleTimeIndex = doc.CustomCreateData.battleTimeIndex - 1u; + } + this._game_time.SetText(XSingleton.singleton.TimeAccFormatString((int)customBattleData.timespan[(int)this._doc.CustomCreateData.battleTimeIndex], 4, 0)); + } + + private void OnGameNameEditClicked(IXUISprite sp) + { + this._game_name.selected(true); + } + + private void OnFriendOnlySwitchClicked(IXUISprite sp) + { + uint num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Friend); + XCustomBattleDocument doc = this._doc; + doc.CustomCreateData.scaleMask = (doc.CustomCreateData.scaleMask ^ num); + bool flag = (this._doc.CustomCreateData.scaleMask & num) == num; + this.SetSwitchSprite(this._friendsonly_switch, flag); + } + + private void OnGuildOnlySwitchClicked(IXUISprite sp) + { + uint num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleScale.CustomBattle_Scale_Guild); + XCustomBattleDocument doc = this._doc; + doc.CustomCreateData.scaleMask = (doc.CustomCreateData.scaleMask ^ num); + bool flag = (this._doc.CustomCreateData.scaleMask & num) == num; + this.SetSwitchSprite(this._guildonly_switch, flag); + } + + private void OnFairModeSwitchClicked(IXUISprite sp) + { + this._doc.CustomCreateData.isFair = !this._doc.CustomCreateData.isFair; + this.SetSwitchSprite(this._fairmode_switch, this._doc.CustomCreateData.isFair); + } + + private void OnPasswordSwitchClicked(IXUISprite sp) + { + bool flag = !this._doc.CustomCreateData.hasPassword; + if (flag) + { + this.SetSwitchSprite(this._password_switch, true); + DlgBase.singleton.ShowPasswordSettingHandler(); + } + else + { + this._doc.CustomCreateData.hasPassword = false; + this.SetPasswordSwitchSprite(false); + } + } + + private void OnGameTypeChangeClicked(IXUITexture sp) + { + this._change_frame.gameObject.SetActive(true); + } + + private bool OnGameCreateButtonClicked(IXUIButton button) + { + this._check_game_name.SetText(this._game_name.GetText()); + this._doc.CustomCreateData.gameName = this._game_name.GetText(); + SeqListRef customBattleBestReward = this._doc.GetCustomBattleBestReward(this._doc.CustomCreateData.configID); + this._check_game_reward1.InputText = ""; + this._check_game_reward2.InputText = ""; + bool flag = customBattleBestReward.Count > 0; + if (flag) + { + this._check_game_reward1.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleBestReward[0, 0]) + " " + customBattleBestReward[0, 1].ToString(); + } + bool flag2 = customBattleBestReward.Count > 1; + if (flag2) + { + this._check_game_reward2.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleBestReward[1, 0]) + " " + customBattleBestReward[1, 1].ToString(); + } + this._check_create_cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)this._doc.CustomCreateData.cost.itemID) + " " + this._doc.CustomCreateData.cost.itemCount.ToString(); + this._check_frame.gameObject.SetActive(true); + return true; + } + + private bool OnCheckCancelButtonClicked(IXUIButton button) + { + this._check_frame.gameObject.SetActive(false); + return true; + } + + private bool OnCheckCreateButtonClicked(IXUIButton button) + { + this._doc.SendCustomBattleCreate(); + return true; + } + + private void OnChangeFrameCloseClicked(IXUISprite sp) + { + this._change_frame.gameObject.SetActive(false); + } + + private void OnTypeSelect(IXUISprite sp) + { + uint num = (uint)sp.ID; + this._change_frame.gameObject.SetActive(false); + bool flag = num != this._doc.CustomCreateData.gameType; + if (flag) + { + this._doc.CustomCreateData.gameType = num; + this.ShowGameType(num); + } + } + + private void ShowGameType(uint typeid) + { + uint customBattleFirstID = this._doc.GetCustomBattleFirstID(typeid); + CustomBattleTypeTable.RowData customBattleTypeData = this._doc.GetCustomBattleTypeData((int)typeid); + this._game_type_change.SetTexturePath("atlas/UI/" + customBattleTypeData.show); + this._game_type_name.SetText(customBattleTypeData.name); + this.ShowConfig(customBattleFirstID); + } + + private void ShowConfig(uint configID) + { + CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(configID); + bool flag = customBattleData == null; + if (!flag) + { + this._doc.CustomCreateData.configID = configID; + this._doc.CustomCreateData.canJoinCount = customBattleData.joincount; + this._doc.CustomCreateData.readyTime = customBattleData.readytimepan; + this._game_size.SetText(this._doc.CustomCreateData.canJoinCount.ToString()); + this._game_wait_time.SetText(XSingleton.singleton.TimeAccFormatString((int)this._doc.CustomCreateData.readyTime, 4, 0)); + bool flag2 = (ulong)this._doc.CustomCreateData.battleTimeIndex >= (ulong)((long)customBattleData.timespan.Length); + if (flag2) + { + this._doc.CustomCreateData.battleTimeIndex = (uint)(customBattleData.timespan.Length - 1); + } + this._game_time.SetText(XSingleton.singleton.TimeAccFormatString((int)customBattleData.timespan[(int)this._doc.CustomCreateData.battleTimeIndex], 4, 0)); + SeqListRef customBattleBestReward = this._doc.GetCustomBattleBestReward(configID); + this._reward1.InputText = ""; + this._reward2.InputText = ""; + bool flag3 = customBattleBestReward.Count > 0; + if (flag3) + { + this._reward1.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleBestReward[0, 0]) + " " + customBattleBestReward[0, 1].ToString(); + } + bool flag4 = customBattleBestReward.Count > 1; + if (flag4) + { + this._reward2.InputText = XLabelSymbolHelper.FormatSmallIcon((int)customBattleBestReward[1, 0]) + " " + customBattleBestReward[1, 1].ToString(); + } + this._doc.CustomCreateData.cost.itemID = customBattleData.create[0, 0]; + this._doc.CustomCreateData.cost.itemCount = customBattleData.create[0, 1]; + this._game_create_cost.InputText = XLabelSymbolHelper.FormatSmallIcon((int)this._doc.CustomCreateData.cost.itemID) + " " + this._doc.CustomCreateData.cost.itemCount.ToString(); + bool flag5 = uint.MaxValue == this._doc.GetCustomBattleNextID(this._doc.CustomCreateData.gameType, configID); + if (flag5) + { + this._add_reward.SetAlpha(0f); + } + else + { + this._add_reward.SetAlpha(1f); + } + bool flag6 = this._doc.GetCustomBattlePreID(this._doc.CustomCreateData.gameType, configID) == 0u; + if (flag6) + { + this._sub_reward.SetAlpha(0f); + } + else + { + this._sub_reward.SetAlpha(1f); + } + this._reward_box.SetSprite(customBattleData.BoxSpriteName); + } + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs.meta new file mode 100644 index 00000000..025a1fec --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeCreateHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b42979cfc366e224da0f14e9de385864 +timeCreated: 1611404392 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs new file mode 100644 index 00000000..b02aff14 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs @@ -0,0 +1,386 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleCustomModeDetailHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/CustomModeDetailFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUIScrollView _scroll_view; + + private IXUIWrapContent _wrap_content; + + private IXUISprite _selfinfo_rankimage; + + private IXUILabel _selfinfo_rank; + + private IXUILabel _selfinfo_name; + + private IXUILabel _selfinfo_point; + + private IXUILabelSymbol _selfinfo_reward; + + private IXUISprite _game_info_button; + + private IXUILabel _game_type; + + private IXUILabel _game_name; + + private IXUILabel _game_id; + + private IXUILabel _game_creater; + + private IXUILabel _game_size; + + private IXUILabel _game_time; + + private IXUILabel _game_time_tip; + + private Transform _game_time_slider; + + private IXUIButton _game_match; + + private IXUIButton _game_join; + + private IXUIButton _game_exit; + + private IXUISprite _game_box; + + private IXUILabel _game_notice; + + private IXUILabel _game_box_time; + + private IXUILabel _can_fetch; + + private Transform _fx_point; + + private XLeftTimeCounter _left_time; + + private XLeftTimeCounter _box_left_time; + + private IXUIButton _back; + + private XFx _fx; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._scroll_view = (base.transform.Find("Bg/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this._wrap_content = (base.transform.Find("Bg/Panel/List").GetComponent("XUIWrapContent") as IXUIWrapContent); + this._wrap_content.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentUpdated)); + this._selfinfo_rankimage = (base.transform.Find("Bg/MyInfo/RankImage").GetComponent("XUISprite") as IXUISprite); + this._selfinfo_rank = (base.transform.Find("Bg/MyInfo/Rank").GetComponent("XUILabel") as IXUILabel); + this._selfinfo_name = (base.transform.Find("Bg/MyInfo/Name").GetComponent("XUILabel") as IXUILabel); + this._selfinfo_point = (base.transform.Find("Bg/MyInfo/Point").GetComponent("XUILabel") as IXUILabel); + this._selfinfo_reward = (base.transform.Find("Bg/MyInfo/Reward").GetComponent("XUILabelSymbol") as IXUILabelSymbol); + this._game_info_button = (base.transform.Find("Bg/GameInfo/Info").GetComponent("XUISprite") as IXUISprite); + this._game_type = (base.transform.Find("Bg/GameInfo/Type").GetComponent("XUILabel") as IXUILabel); + this._game_name = (base.transform.Find("Bg/GameInfo/Name").GetComponent("XUILabel") as IXUILabel); + this._game_id = (base.transform.Find("Bg/GameInfo/ID").GetComponent("XUILabel") as IXUILabel); + this._game_creater = (base.transform.Find("Bg/GameInfo/Creater").GetComponent("XUILabel") as IXUILabel); + this._game_size = (base.transform.Find("Bg/GameInfo/Size").GetComponent("XUILabel") as IXUILabel); + this._game_time = (base.transform.Find("Bg/GameInfo/Slider/Time").GetComponent("XUILabel") as IXUILabel); + this._game_time_tip = (base.transform.Find("Bg/GameInfo/Slider/Time/T").GetComponent("XUILabel") as IXUILabel); + this._game_time_slider = base.transform.Find("Bg/GameInfo/Slider"); + this._left_time = new XLeftTimeCounter(this._game_time, false); + this._game_match = (base.transform.Find("Bg/GameInfo/BtnStart").GetComponent("XUIButton") as IXUIButton); + this._game_join = (base.transform.Find("Bg/GameInfo/BtnJoin").GetComponent("XUIButton") as IXUIButton); + this._game_exit = (base.transform.Find("Bg/GameInfo/BtnExit").GetComponent("XUIButton") as IXUIButton); + this._game_box = (base.transform.Find("Bg/GameInfo/Box").GetComponent("XUISprite") as IXUISprite); + this._game_box_time = (base.transform.Find("Bg/GameInfo/Box/Time").GetComponent("XUILabel") as IXUILabel); + this._game_notice = (base.transform.Find("Bg/GameInfo/Notice").GetComponent("XUILabel") as IXUILabel); + this._can_fetch = (base.transform.Find("Bg/GameInfo/Box/CanFetch").GetComponent("XUILabel") as IXUILabel); + this._box_left_time = new XLeftTimeCounter(this._game_box_time, true); + this._fx_point = base.transform.Find("Bg/GameInfo/Box/Fx"); + this._back = (base.transform.Find("Bg/Back").GetComponent("XUIButton") as IXUIButton); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._game_info_button.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGameInfoButtonClicked)); + this._game_match.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGameMatchButtonClicked)); + this._game_join.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGameJoinButtonClicked)); + this._game_exit.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGameExitButtonClicked)); + this._game_box.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGameBoxClicked)); + this._back.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnBackButtonClicked)); + } + + protected override void OnHide() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnHide(); + } + + public override void OnUnload() + { + this._doc.DestoryFx(this._fx); + this._fx = null; + base.OnUnload(); + } + + protected override void OnShow() + { + base.OnShow(); + this._doc.SendCustomBattleSearchCustomModeList(this._doc.CurrentCustomData.gameID); + this._doc.SendCustomBattleQueryCustomModeSelfInfo(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + CustomBattleTable.RowData customBattleData = this._doc.GetCustomBattleData(this._doc.CurrentCustomData.configID); + bool flag = customBattleData == null || this._doc.CurrentCustomData == null; + if (!flag) + { + this._game_type.SetText(customBattleData.desc); + this._game_name.SetText(this._doc.CurrentCustomData.gameName); + this._game_id.SetText(this._doc.CurrentCustomData.token); + this._game_creater.SetText(this._doc.CurrentCustomData.gameCreator); + this._game_size.SetText(this._doc.CurrentCustomData.joinText); + this._doc.DestoryFx(this._fx); + this._fx = null; + bool flag2 = this._doc.SelfCustomData != null && this._doc.CurrentCustomData.gameID == this._doc.SelfCustomData.gameID; + switch (this._doc.CurrentCustomData.gameStatus) + { + case CustomBattleState.CustomBattle_Ready: + this._game_box.SetVisible(false); + this._game_match.SetVisible(false); + this._game_time_slider.gameObject.SetActive(true); + this._game_time_tip.SetText(XSingleton.singleton.GetString("WaitForStart")); + this._left_time.SetLeftTime(this._doc.CurrentCustomData.gameStartLeftTime, -1); + this._game_exit.SetVisible(flag2); + this._game_join.SetVisible(!flag2); + this._game_notice.SetText(flag2 ? XSingleton.singleton.GetString("WaitForShowMatch") : ""); + break; + case CustomBattleState.CustomBattle_Going: + this._game_box.SetVisible(false); + this._game_time_slider.gameObject.SetActive(true); + this._game_time_tip.SetText(XSingleton.singleton.GetString("WaitForEnd")); + this._left_time.SetLeftTime(this._doc.CurrentCustomData.gameEndLeftTime, -1); + this._game_match.SetVisible(flag2); + this._game_exit.SetVisible(flag2); + this._game_join.SetVisible(!flag2); + this._game_notice.SetText(""); + break; + case CustomBattleState.CustomBattle_End: + { + CustomBattleRoleState selfStatus = this._doc.CurrentCustomData.selfStatus; + if (selfStatus != CustomBattleRoleState.CustomBattle_RoleState_Reward) + { + if (selfStatus != CustomBattleRoleState.Custombattle_RoleState_Taken) + { + this._game_box.SetVisible(false); + this._game_match.SetVisible(false); + this._game_join.SetVisible(false); + this._game_exit.SetVisible(false); + this._game_time_slider.gameObject.SetActive(false); + this._game_notice.SetText(XSingleton.singleton.GetString("GameEnd")); + } + else + { + this._game_box.SetVisible(false); + this._game_match.SetVisible(false); + this._game_join.SetVisible(false); + this._game_exit.SetVisible(flag2); + this._game_time_slider.gameObject.SetActive(false); + this._game_notice.SetText(XSingleton.singleton.GetString("GameEnd")); + } + } + else + { + this._game_box.SetVisible(flag2); + this._game_match.SetVisible(false); + this._game_join.SetVisible(false); + this._game_exit.SetVisible(flag2); + this._game_time_slider.gameObject.SetActive(false); + this._can_fetch.SetVisible(this._doc.CurrentCustomData.boxLeftTime <= 0u); + this._box_left_time.SetLeftTime(this._doc.CurrentCustomData.boxLeftTime, -1); + bool flag3 = this._doc.CurrentCustomData.boxLeftTime <= 0u; + if (flag3) + { + this._fx = XSingleton.singleton.CreateUIFx("Effects/FX_Particle/UIfx/UI_BountyModeListFrame_Clip01", this._fx_point, false); + } + this._game_notice.SetText(flag2 ? "" : XSingleton.singleton.GetString("GameEnd")); + } + break; + } + case CustomBattleState.CustomBattle_Destory: + this._game_box.SetVisible(false); + this._game_match.SetVisible(false); + this._game_join.SetVisible(false); + this._game_exit.SetVisible(false); + this._game_time_slider.gameObject.SetActive(false); + this._game_notice.SetText(XSingleton.singleton.GetString("GameEnd")); + break; + } + bool flag4 = this._doc.SelfCustomData != null && this._doc.CurrentCustomData.gameID == this._doc.SelfCustomData.gameID; + if (flag4) + { + } + this._wrap_content.SetContentCount(this._doc.CurrentCustomData.rankList.Count, false); + this._scroll_view.ResetPosition(); + this.SetupSelf(); + } + } + + private void WrapContentUpdated(Transform t, int index) + { + bool flag = index < 0 || index >= this._doc.CurrentCustomData.rankList.Count; + if (flag) + { + t.gameObject.SetActive(false); + } + else + { + this.SetupRank(t, index); + } + } + + private void SetupRank(Transform t, int index) + { + IXUISprite ixuisprite = t.Find("RankImage").GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel = t.Find("Rank").GetComponent("XUILabel") as IXUILabel; + IXUISprite ixuisprite2 = t.Find("ViewBattle").GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel2 = t.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = t.Find("Point").GetComponent("XUILabel") as IXUILabel; + IXUILabelSymbol ixuilabelSymbol = t.Find("Reward").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + CustomBattleRank customBattleRank = this._doc.CurrentCustomData.rankList[index]; + ixuisprite.SetVisible(index < 3); + ixuilabel.SetVisible(index >= 3); + ixuisprite2.SetVisible(false); + ixuisprite.SetSprite(string.Format("N{0}", index + 1)); + ixuilabel.SetText((index + 1).ToString()); + ixuilabel2.SetText(customBattleRank.name); + ixuilabel3.SetText(customBattleRank.point.ToString()); + SeqListRef customBattleRewardByRank = this._doc.GetCustomBattleRewardByRank(this._doc.CurrentCustomData.configID, (uint)(index + 1)); + string text = ""; + for (int i = 0; i < customBattleRewardByRank.Count; i++) + { + text = string.Concat(new string[] + { + text, + (i == 0) ? "" : " ", + XLabelSymbolHelper.FormatSmallIcon((int)customBattleRewardByRank[i, 0]), + " ", + customBattleRewardByRank[i, 1].ToString() + }); + } + ixuilabelSymbol.InputText = text; + } + + private void SetupSelf() + { + bool flag = this._doc.CurrentCustomData.selfRank == 0u; + if (flag) + { + this._selfinfo_rankimage.SetSprite(""); + this._selfinfo_rank.SetText(""); + this._selfinfo_name.SetText(""); + this._selfinfo_point.SetText(""); + this._selfinfo_reward.InputText = ""; + } + else + { + this._selfinfo_rankimage.SetVisible(this._doc.CurrentCustomData.selfRank <= 3u); + this._selfinfo_rank.SetVisible(this._doc.CurrentCustomData.selfRank > 3u); + this._selfinfo_rankimage.SetSprite(string.Format("N{0}", this._doc.CurrentCustomData.selfRank)); + this._selfinfo_rank.SetText(this._doc.CurrentCustomData.selfRank.ToString()); + this._selfinfo_name.SetText(XSingleton.singleton.XPlayerData.Name); + this._selfinfo_point.SetText(this._doc.CurrentCustomData.selfPoint.ToString()); + SeqListRef customBattleRewardByRank = this._doc.GetCustomBattleRewardByRank(this._doc.CurrentCustomData.configID, this._doc.CurrentCustomData.selfRank); + string text = ""; + for (int i = 0; i < customBattleRewardByRank.Count; i++) + { + text = string.Concat(new string[] + { + text, + (i == 0) ? "" : " ", + XLabelSymbolHelper.FormatSmallIcon((int)customBattleRewardByRank[i, 0]), + " ", + customBattleRewardByRank[i, 1].ToString() + }); + } + this._selfinfo_reward.InputText = text; + } + } + + private void OnGameInfoButtonClicked(IXUISprite sp) + { + DlgBase.singleton.ShowCustomModeBriefHandler(); + } + + private bool OnGameMatchButtonClicked(IXUIButton button) + { + bool flag = this._doc.CurrentCustomData.expID == 0; + if (flag) + { + bool flag2 = XTeamDocument.GoSingleBattleBeforeNeed(new ButtonClickEventHandler(this.OnGameMatchButtonClicked), button); + if (flag2) + { + return true; + } + this._doc.SendCustomBattleMatch(this._doc.CurrentCustomData.gameID); + } + else + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument.SetAndMatch(this._doc.CurrentCustomData.expID); + } + return true; + } + + private bool OnGameJoinButtonClicked(IXUIButton button) + { + this._doc.SendCustomBattleJoin(this._doc.CurrentCustomData.gameID, this._doc.CurrentCustomData.hasPassword, ""); + return true; + } + + private bool OnGameExitButtonClicked(IXUIButton button) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("UnJoinCustomModeTip"), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.OnUnJoinOkClicked)); + return true; + } + + private bool OnUnJoinOkClicked(IXUIButton button) + { + DlgBase.singleton.SetVisible(false, true); + this._doc.SendCustomBattleExit(this._doc.CurrentCustomData.gameID); + return true; + } + + private void OnGameBoxClicked(IXUISprite sp) + { + DlgBase.singleton.ShowChestHandler(); + } + + private bool OnBackButtonClicked(IXUIButton button) + { + DlgBase.singleton.ShowCustomModeListHandler(); + return true; + } + + public override void OnUpdate() + { + base.OnUpdate(); + this._left_time.Update(); + this._box_left_time.Update(); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs.meta new file mode 100644 index 00000000..e604b9b2 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeDetailHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 14c6b16e189ff28439a7d7232b922618 +timeCreated: 1611403259 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs new file mode 100644 index 00000000..4660c87b --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs @@ -0,0 +1,334 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleCustomModeListHandler : DlgHandlerBase + { + private int wrapCount + { + get + { + bool flag = this._doc == null; + int result; + if (flag) + { + result = 0; + } + else + { + result = ((this._doc.SelfCustomData == null) ? this._doc.CustomList.Count : (this._doc.CustomList.Count + 1)); + } + return result; + } + } + + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/CustomModeListFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUIInput _input; + + private IXUISprite _search; + + private IXUIButton _create_game; + + private IXUIButton _my_game; + + private Transform _red_point; + + private IXUIButton _refresh; + + private IXUISprite _show_other; + + private Transform _show_flag; + + private Transform _empty_game; + + private IXUIScrollView _scroll_view; + + private IXUIWrapContent _wrap_content; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._input = (base.transform.Find("Bg/Input").GetComponent("XUIInput") as IXUIInput); + this._search = (base.transform.Find("Bg/Input/Search").GetComponent("XUISprite") as IXUISprite); + this._create_game = (base.transform.Find("Bg/BtnCreateGame").GetComponent("XUIButton") as IXUIButton); + this._my_game = (base.transform.Find("Bg/BtnMyGame").GetComponent("XUIButton") as IXUIButton); + this._red_point = base.transform.Find("Bg/BtnMyGame/RedPoint"); + this._refresh = (base.transform.Find("Bg/BtnRefresh").GetComponent("XUIButton") as IXUIButton); + this._show_other = (base.transform.Find("Bg/BtnOther").GetComponent("XUISprite") as IXUISprite); + this._show_flag = base.transform.Find("Bg/BtnOther/Flag"); + this._empty_game = base.transform.Find("Bg/EmptyGame"); + this._scroll_view = (base.transform.Find("Bg/Panel").GetComponent("XUIScrollView") as IXUIScrollView); + this._wrap_content = (base.transform.Find("Bg/Panel/List").GetComponent("XUIWrapContent") as IXUIWrapContent); + this._wrap_content.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentUpdated)); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._search.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSearchClicked)); + this._create_game.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCreateGameButtonClicked)); + this._my_game.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnMyGameButtonClicked)); + this._refresh.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnRefreshButtonClicked)); + this._show_other.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnShowOtherClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this._input.SetText(""); + this._show_flag.gameObject.SetActive(this._doc.QueryCross); + this._doc.SendCustomBattleQueryCustomModeList(this._doc.QueryCross); + this._doc.SendCustomBattleQueryCustomModeSelfInfo(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = this._doc.SelfCustomData != null; + if (flag) + { + this._create_game.SetVisible(false); + this._my_game.SetVisible(true); + this._red_point.gameObject.SetActive(this._doc.SelfCustomData.selfStatus == CustomBattleRoleState.CustomBattle_RoleState_Reward && this._doc.SelfCustomData.boxLeftTime == 0u); + } + else + { + this._create_game.SetVisible(true); + this._my_game.SetVisible(false); + } + this._wrap_content.SetContentCount(this.wrapCount, false); + this._empty_game.gameObject.SetActive(this.wrapCount == 0); + this._scroll_view.ResetPosition(); + } + + private void WrapContentUpdated(Transform t, int index) + { + bool flag = index < 0 || index >= this.wrapCount; + if (flag) + { + t.gameObject.SetActive(false); + } + else + { + this.SetupCustom(t, index); + } + } + + private void SetupCustom(Transform t, int index) + { + Transform transform = t.Find("FairMode"); + IXUILabelSymbol ixuilabelSymbol = t.Find("Name").GetComponent("XUILabelSymbol") as IXUILabelSymbol; + IXUILabel ixuilabel = t.Find("Type").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = t.Find("Creator").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = t.Find("JoinCount").GetComponent("XUILabel") as IXUILabel; + IXUIButton ixuibutton = t.Find("JoinBtn").GetComponent("XUIButton") as IXUIButton; + IXUIButton ixuibutton2 = t.Find("DetailBtn").GetComponent("XUIButton") as IXUIButton; + bool flag = this._doc.SelfCustomData == null; + XCustomBattleDocument.CustomModeData customModeData; + if (flag) + { + customModeData = this._doc.CustomList[index]; + } + else + { + bool flag2 = index == 0; + if (flag2) + { + customModeData = this._doc.SelfCustomData; + } + else + { + customModeData = this._doc.CustomList[index - 1]; + } + } + transform.gameObject.SetActive(customModeData.fairMode); + string text = " "; + uint num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleTag.CustomBattle_Tag_Friend); + bool flag3 = (customModeData.tagMask & num) == num; + num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleTag.CustomBattle_Tag_Guild); + bool flag4 = (customModeData.tagMask & num) == num; + num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleTag.CustomBattle_Tag_Cross); + bool flag5 = (customModeData.tagMask & num) == num; + num = 1u << XFastEnumIntEqualityComparer.ToInt(CustomBattleTag.CustomBattle_Tag_GM); + bool flag6 = (customModeData.tagMask & num) == num; + bool flag7 = flag3; + if (flag7) + { + text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_8"); + } + bool flag8 = flag4; + if (flag8) + { + text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_2"); + } + bool flag9 = flag5; + if (flag9) + { + text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_11"); + } + bool flag10 = flag6; + if (flag10) + { + text += XLabelSymbolHelper.FormatImage("common/Universal", "chat_tag_12"); + } + ixuilabelSymbol.InputText = customModeData.gameName + text; + CustomBattleTypeTable.RowData customBattleTypeData = this._doc.GetCustomBattleTypeData((int)customModeData.gameType); + ixuilabel.SetText((customBattleTypeData != null) ? customBattleTypeData.name : ""); + ixuilabel2.SetText(customModeData.gameCreator); + ixuilabel3.SetText(customModeData.joinText); + ixuibutton.ID = (ulong)((long)index); + ixuibutton2.ID = (ulong)((long)index); + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnJoinButtonClicked)); + ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnDetailButtonClicked)); + bool flag11 = this._doc.SelfCustomData != null && this._doc.SelfCustomData.gameID == customModeData.gameID; + if (flag11) + { + ixuibutton.SetEnable(false, false); + } + else + { + ixuibutton.SetEnable(true, false); + } + } + + private void OnSearchClicked(IXUISprite sp) + { + this._doc.SendCustomBattleSearch(this._input.GetText()); + this._input.SetText(""); + } + + private bool OnCreateGameButtonClicked(IXUIButton button) + { + DlgBase.singleton.ShowCustomModeCreateHandler(); + return true; + } + + private bool OnMyGameButtonClicked(IXUIButton button) + { + bool flag = this._doc.SelfCustomData == null; + bool result; + if (flag) + { + result = false; + } + else + { + this._doc.CurrentCustomData = this._doc.SelfCustomData; + DlgBase.singleton.ShowCustomModeDetailHandler(); + result = true; + } + return result; + } + + private bool OnRefreshButtonClicked(IXUIButton button) + { + this._doc.SendCustomBattleQueryCustomModeList(this._doc.QueryCross); + this._doc.SendCustomBattleQueryCustomModeSelfInfo(); + this._input.SetText(""); + return true; + } + + private void OnShowOtherClicked(IXUISprite sp) + { + this._doc.QueryCross = !this._doc.QueryCross; + this._show_flag.gameObject.SetActive(this._doc.QueryCross); + this.OnRefreshButtonClicked(null); + } + + private bool OnJoinButtonClicked(IXUIButton button) + { + bool flag = (int)button.ID >= this.wrapCount; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = this._doc.SelfCustomData != null; + if (flag2) + { + bool flag3 = button.ID == 0UL; + if (flag3) + { + this._doc.CurrentCustomData = this._doc.SelfCustomData; + this._doc.SendCustomBattleJoin(this._doc.SelfCustomData.gameID, this._doc.SelfCustomData.hasPassword, ""); + } + else + { + this._doc.CurrentCustomData = this._doc.CustomList[(int)button.ID - 1]; + this._doc.SendCustomBattleJoin(this._doc.CustomList[(int)button.ID - 1].gameID, this._doc.CustomList[(int)button.ID - 1].hasPassword, ""); + } + } + else + { + this._doc.CurrentCustomData = this._doc.CustomList[(int)button.ID]; + this._doc.SendCustomBattleJoin(this._doc.CustomList[(int)button.ID].gameID, this._doc.CustomList[(int)button.ID].hasPassword, ""); + } + result = true; + } + return result; + } + + private bool OnDetailButtonClicked(IXUIButton button) + { + this.ShowDetailByIndex((int)button.ID); + return true; + } + + public bool ShowDetailByIndex(int index) + { + bool flag = index >= this.wrapCount; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = this._doc.SelfCustomData != null; + if (flag2) + { + bool flag3 = index == 0; + if (flag3) + { + this._doc.CurrentCustomData = this._doc.SelfCustomData; + } + else + { + this._doc.CurrentCustomData = this._doc.CustomList[index - 1]; + } + } + else + { + this._doc.CurrentCustomData = this._doc.CustomList[index]; + } + DlgBase.singleton.ShowCustomModeDetailHandler(); + result = true; + } + return result; + } + + public void ShowSelfDetail() + { + this._doc.CurrentCustomData = this._doc.SelfCustomData; + DlgBase.singleton.ShowCustomModeDetailHandler(); + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs.meta new file mode 100644 index 00000000..4afdd4b9 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleCustomModeListHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ea74f24d0b7939b40aba295ab2204107 +timeCreated: 1611404779 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs new file mode 100644 index 00000000..14fb4780 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs @@ -0,0 +1,40 @@ +using System; +using UILib; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattleMatchingHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/MatchingFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUIButton _cancel; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._cancel = (base.transform.Find("Cancel").GetComponent("XUIButton") as IXUIButton); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._cancel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCancelButtonClicked)); + } + + private bool OnCancelButtonClicked(IXUIButton button) + { + this._doc.SendCustomBattleUnMatch(); + base.SetVisible(false); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs.meta new file mode 100644 index 00000000..1a772b19 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattleMatchingHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9a9a41dfb20578340ad1e457c2fec5f5 +timeCreated: 1611404201 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs new file mode 100644 index 00000000..e45ce9a7 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs @@ -0,0 +1,130 @@ +using System; +using UILib; +using XMainClient.UI.UICommon; + +namespace XMainClient.UI.CustomBattle +{ + internal class CustomBattlePasswordSettingHandler : DlgHandlerBase + { + protected override string FileName + { + get + { + return "GameSystem/CustomBattle/PasswordSettingFrame"; + } + } + + private XCustomBattleDocument _doc = null; + + private IXUIButton _ok; + + private IXUIButton _cancel; + + private IXUIInput _password; + + private bool passwordForJoin = false; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XCustomBattleDocument.uuID); + this._ok = (base.transform.Find("OK").GetComponent("XUIButton") as IXUIButton); + this._cancel = (base.transform.Find("Cancel").GetComponent("XUIButton") as IXUIButton); + this._password = (base.transform.Find("Password").GetComponent("XUIInput") as IXUIInput); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this._ok.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnOKButtonClicked)); + this._cancel.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCancelButtonClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this.passwordForJoin = this._doc.passwordForJoin; + this._doc.passwordForJoin = false; + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = DlgBase.singleton._CustomModeCreateHandler != null && DlgBase.singleton._CustomModeCreateHandler.IsVisible(); + if (flag) + { + bool flag2 = this._doc.CustomCreateData.hasPassword && !string.IsNullOrEmpty(this._doc.CustomCreateData.password); + if (flag2) + { + this._password.SetText(this._doc.CustomCreateData.password); + } + } + } + + private bool OnOKButtonClicked(IXUIButton button) + { + bool flag = this.passwordForJoin; + bool result; + if (flag) + { + bool flag2 = this._password.GetText() == this._password.GetDefault(); + if (flag2) + { + this._doc.SendCustomBattleJoin(this._doc.CurrentCustomData.gameID, false, ""); + } + else + { + this._doc.SendCustomBattleJoin(this._doc.CurrentCustomData.gameID, false, this._password.GetText()); + } + base.SetVisible(false); + result = true; + } + else + { + bool flag3 = this._password.GetText() == "" || this._password.GetText() == this._password.GetDefault(); + if (flag3) + { + bool flag4 = DlgBase.singleton._CustomModeCreateHandler != null && DlgBase.singleton._CustomModeCreateHandler.IsVisible(); + if (flag4) + { + this._doc.CustomCreateData.hasPassword = false; + this._doc.CustomCreateData.password = ""; + DlgBase.singleton._CustomModeCreateHandler.SetPasswordSwitchSprite(false); + } + } + else + { + bool flag5 = DlgBase.singleton._CustomModeCreateHandler != null && DlgBase.singleton._CustomModeCreateHandler.IsVisible(); + if (flag5) + { + this._doc.CustomCreateData.hasPassword = true; + this._doc.CustomCreateData.password = this._password.GetText(); + DlgBase.singleton._CustomModeCreateHandler.SetPasswordSwitchSprite(true); + } + } + bool flag6 = DlgBase.singleton._CustomModeBriefHandler != null && DlgBase.singleton._CustomModeBriefHandler.IsVisible(); + if (flag6) + { + this._doc.SendCustomBattleModifyPassword(this._doc.CurrentCustomData.gameID, this._password.GetText()); + } + base.SetVisible(false); + result = true; + } + return result; + } + + private bool OnCancelButtonClicked(IXUIButton button) + { + bool flag = DlgBase.singleton._CustomModeCreateHandler != null && DlgBase.singleton._CustomModeCreateHandler.IsVisible(); + if (flag) + { + this._doc.CustomCreateData.hasPassword = false; + this._doc.CustomCreateData.password = ""; + DlgBase.singleton._CustomModeCreateHandler.SetPasswordSwitchSprite(false); + } + base.SetVisible(false); + return true; + } + } +} diff --git a/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs.meta b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs.meta new file mode 100644 index 00000000..ea6be6e6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/CustomBattle/CustomBattlePasswordSettingHandler.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: efb5e705336a38b4691c4457bfa2ee5c +timeCreated: 1611404805 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: -- cgit v1.1-26-g67d0