// *********************************************************************** // Assembly : Game // Author : Kimch // Created : 2021-05-14 // Description : // Last Modified By : // Last Modified On : // *********************************************************************** // // // *********************************************************************** namespace G.UI { using UnityEngine; using UnityEngine.UI; using Text = TMPro.TextMeshProUGUI; /// /// /// partial class GainwayBox { class WayWidget : KUIWidget { [KUIFlag] Image _imgIcon; [KUIFlag] Button _btnGoto; [KUIFlag] Text _tmpWay; public override void Refresh() { if (this.data is string wayType) { _tmpWay.text = wayType; if ("游历" == wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_bg_08_open", "sa_system"); } else if ("江湖宝箱" == wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_bg_03_open", "sa_system"); } else if ("挑战关卡" == wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_bg_05_open", "sa_system"); } else if ("每日兑换" == wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_bg_03_open", "sa_system"); } else if ("侠客令" ==wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_xkl", "sa_system"); } else if ("礼包" == wayType) { IconProxy.Instance.SetSprite(_imgIcon, "icon_shop", "sa_system"); } } } public void SetListener(UnityEngine.Events.UnityAction call) { _btnGoto.onClick.RemoveAllListeners(); _btnGoto.onClick.AddListener(call); } private void OnGotoAction() { } private void Awake() { SetViewData(); } } #region Field #pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null [KUIFlag] Button _btnClose; [KUIFlag] Text _tmpDescription; [KUIFlag] KUIList __listGainway; [KUIFlag] GameObject __goProp; #pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null PropWidget _propWidget; #endregion #region Method /// /// /// public void InitView() { SetViewData(); _btnClose.onClick.AddListener(this.OnCloseBtnClick); __listGainway.AddTemplate(true); _propWidget = __goProp.AddComponent(); } /// /// /// public void RefreshView() { if (this.data is ItemProp propItem) { _tmpDescription.text = propItem.text; _propWidget.SetItem(propItem.id); __listGainway.Clear(); var widget = __listGainway.GetItem(); if (propItem.isBeautyProp) { widget.SetData("江湖宝箱"); //widget.SetData(propItem); widget.SetListener(this.OnJump); } else if (propItem.isGem) { widget.SetData("游历"); //widget.SetData(propItem); widget.SetListener(this.OnJump); widget = __listGainway.GetItem(); widget.SetData("江湖宝箱"); widget.SetListener(this.OnJump3); } else if(propItem.id == 26)//新增神兽羽获取路径显示 { widget.SetData("礼包"); widget.SetListener(this.OnJump7); widget = __listGainway.GetItem(); widget.SetData("游历"); widget.SetListener(this.OnJump); widget = __listGainway.GetItem(); widget.SetData("江湖宝箱"); widget.SetListener(this.OnJump4); } else if (propItem.id == 25)//服饰碎片 { widget.SetData("每日兑换"); widget.SetListener(this.OnJump5); widget = __listGainway.GetItem(); widget.SetData("江湖宝箱"); widget.SetListener(this.OnJump5); } else if (propItem.id == 37)//武器碎片 { widget.SetData("侠客令"); widget.SetListener(this.OnJump6); } } else if (this.data is ItemBook bookItem) { _tmpDescription.text = bookItem.description; _propWidget.SetItem(141); __listGainway.Clear(); var widget = __listGainway.GetItem(); widget.SetData("游历"); widget.SetListener(this.OnJump2); widget = __listGainway.GetItem(); widget.SetData("挑战关卡"); widget.SetListener(this.OnJump); } } private void OnJump() { if (this.data is ItemProp propItem) { CloseWindow(this); if (propItem.isBeautyProp) { CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4"); } else if (propItem.isGem) { CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "0"); } else if (propItem.id ==26)//添加神兽羽游历获取 { CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "0"); } } else if (this.data is ItemBook bookItem) { CloseWindow(this); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "2"); var level = ItemProxy.Instance.GetStaticItem(bookItem.bookGroup.dropLevelId); OpenWindow(level); } } private void OnJump2() { CloseWindow(this); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "0"); } private void OnJump3()//添加宝石宝箱获取 { CloseWindow(this); CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4"); } private void OnJump4()//添加神兽羽宝箱获取 { CloseWindow(this); CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4"); } private void OnJump5()//添加服饰碎片宝箱获取 { if (FunctionProxy.Instance.GetFunctionUnlock(FunctionProxy.FunctionId.Shop)) { CloseWindow(this); CloseWindow(); PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4"); } else { ToastBox.ShowText(LanguageProxy.Instance.GetLocalString(88)); } } private void OnJump6()//添加武器碎片宝箱获取 { if (FunctionProxy.Instance.GetFunctionUnlock(FunctionProxy.FunctionId.解锁侠客令功能)) { CloseWindow(this); CloseWindow(); OpenWindow(); } else { ToastBox.ShowText(LanguageProxy.Instance.GetLocalString(89)); } } private void OnJump7()//添加神兽羽礼包获取 { CloseWindow(this); CloseWindow(); OpenWindow("petGet"); } private void OnCloseBtnClick() { CloseWindow(this); } #endregion } }