272 lines
6.9 KiB
C#
272 lines
6.9 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2021-05-14
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "GainwayBox.View" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
namespace G.UI
|
|
{
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using Text = TMPro.TextMeshProUGUI;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
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
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void InitView()
|
|
{
|
|
SetViewData();
|
|
_btnClose.onClick.AddListener(this.OnCloseBtnClick);
|
|
__listGainway.AddTemplate<WayWidget>(true);
|
|
_propWidget = __goProp.AddComponent<PropWidget>();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public void RefreshView()
|
|
{
|
|
if (this.data is ItemProp propItem)
|
|
{
|
|
_tmpDescription.text = propItem.text;
|
|
_propWidget.SetItem(propItem.id);
|
|
|
|
__listGainway.Clear();
|
|
var widget = __listGainway.GetItem<WayWidget>();
|
|
|
|
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<WayWidget>();
|
|
widget.SetData("江湖宝箱");
|
|
widget.SetListener(this.OnJump3);
|
|
}
|
|
else if(propItem.id == 26)//新增神兽羽获取路径显示
|
|
{
|
|
widget.SetData("礼包");
|
|
widget.SetListener(this.OnJump7);
|
|
|
|
widget = __listGainway.GetItem<WayWidget>();
|
|
widget.SetData("游历");
|
|
widget.SetListener(this.OnJump);
|
|
|
|
widget = __listGainway.GetItem<WayWidget>();
|
|
widget.SetData("江湖宝箱");
|
|
widget.SetListener(this.OnJump4);
|
|
}
|
|
else if (propItem.id == 25)//服饰碎片
|
|
{
|
|
widget.SetData("每日兑换");
|
|
widget.SetListener(this.OnJump5);
|
|
|
|
widget = __listGainway.GetItem<WayWidget>();
|
|
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<WayWidget>();
|
|
widget.SetData("游历");
|
|
widget.SetListener(this.OnJump2);
|
|
|
|
widget = __listGainway.GetItem<WayWidget>();
|
|
widget.SetData("挑战关卡");
|
|
widget.SetListener(this.OnJump);
|
|
}
|
|
}
|
|
|
|
private void OnJump()
|
|
{
|
|
if (this.data is ItemProp propItem)
|
|
{
|
|
CloseWindow(this);
|
|
if (propItem.isBeautyProp)
|
|
{
|
|
CloseWindow<BeautyWindow>();
|
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4");
|
|
}
|
|
else if (propItem.isGem)
|
|
{
|
|
CloseWindow<EquipmentDetailBox>();
|
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "0");
|
|
}
|
|
else if (propItem.id ==26)//添加神兽羽游历获取
|
|
{
|
|
CloseWindow<PetWindow>();
|
|
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<ItemLevel>(bookItem.bookGroup.dropLevelId);
|
|
OpenWindow<LevelDetailBox>(level);
|
|
}
|
|
}
|
|
|
|
private void OnJump2()
|
|
{
|
|
CloseWindow(this);
|
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "0");
|
|
}
|
|
private void OnJump3()//添加宝石宝箱获取
|
|
{
|
|
CloseWindow(this);
|
|
CloseWindow<EquipmentDetailBox>();
|
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4");
|
|
}
|
|
private void OnJump4()//添加神兽羽宝箱获取
|
|
{
|
|
CloseWindow(this);
|
|
CloseWindow<PetWindow>();
|
|
PostNotification(GlobalDefine.EVENT_MAIN_WINDOW_PAGE, null, "4");
|
|
}
|
|
private void OnJump5()//添加服饰碎片宝箱获取
|
|
{
|
|
if (FunctionProxy.Instance.GetFunctionUnlock(FunctionProxy.FunctionId.Shop))
|
|
{
|
|
CloseWindow(this);
|
|
CloseWindow<SkinWindow>();
|
|
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<SkinWindow>();
|
|
OpenWindow<BattlePassWindow>();
|
|
}
|
|
else
|
|
{
|
|
ToastBox.ShowText(LanguageProxy.Instance.GetLocalString(89));
|
|
}
|
|
}
|
|
private void OnJump7()//添加神兽羽礼包获取
|
|
{
|
|
CloseWindow(this);
|
|
CloseWindow<PetWindow>();
|
|
OpenWindow<RmbShopWindow>("petGet");
|
|
}
|
|
private void OnCloseBtnClick()
|
|
{
|
|
CloseWindow(this);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|