92 lines
2.4 KiB
C#
92 lines
2.4 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections.Generic;
|
|||
|
using GCGame.Table;
|
|||
|
using Module.Log;
|
|||
|
|
|||
|
public class WelfareLevelSubNodeItem : UIItemBase {
|
|||
|
|
|||
|
public GameObject _CanGetBtn;
|
|||
|
public GameObject _CantGetBtn;
|
|||
|
public GameObject _GetedBtn;
|
|||
|
|
|||
|
public Text _Desc;
|
|||
|
public UIContainerBase _RewContainer;
|
|||
|
public Text _BtnDesc;
|
|||
|
|
|||
|
private int _NodeId;
|
|||
|
private int _SubNodeId;
|
|||
|
private int _SubNodeState;
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show(hash);
|
|||
|
|
|||
|
WelfareLevelSubNodeInfo info = (WelfareLevelSubNodeInfo)hash["InitObj"];
|
|||
|
if(info == null)
|
|||
|
{
|
|||
|
LogModule.ErrorLog("info is null");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
_NodeId = info._NodeId;
|
|||
|
_SubNodeId = info._SubNodeId;
|
|||
|
_SubNodeState = info._SubNodeState;
|
|||
|
InitDesc(info._DescList);
|
|||
|
_RewContainer.InitContentItem(info._RewList);
|
|||
|
InitBtnDesc();
|
|||
|
}
|
|||
|
|
|||
|
public override void Refresh(Hashtable hash)
|
|||
|
{
|
|||
|
if(hash.ContainsKey(_SubNodeId))
|
|||
|
{
|
|||
|
_SubNodeState = (int)hash[_SubNodeId];
|
|||
|
}
|
|||
|
|
|||
|
InitBtnDesc();
|
|||
|
}
|
|||
|
|
|||
|
public void InitBtnDesc()
|
|||
|
{
|
|||
|
switch(_SubNodeState)
|
|||
|
{
|
|||
|
case (int)WelfareRootCtr.WlfareRewardState.CanGet:
|
|||
|
_CanGetBtn.SetActive(true);
|
|||
|
_CantGetBtn.SetActive(false);
|
|||
|
_GetedBtn.SetActive(false);
|
|||
|
break;
|
|||
|
case (int)WelfareRootCtr.WlfareRewardState.HasGeted:
|
|||
|
_GetedBtn.SetActive(true);
|
|||
|
_CanGetBtn.SetActive(false);
|
|||
|
_CantGetBtn.SetActive(false);
|
|||
|
break;
|
|||
|
case (int)WelfareRootCtr.WlfareRewardState.None:
|
|||
|
_CantGetBtn.SetActive(true);
|
|||
|
_CanGetBtn.SetActive(false);
|
|||
|
_GetedBtn.SetActive(false);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnRecBtnClick()
|
|||
|
{
|
|||
|
if(_SubNodeState == (int)WelfareRootCtr.WlfareRewardState.CanGet)
|
|||
|
{
|
|||
|
ReqGetWelfareRew req = new ReqGetWelfareRew();
|
|||
|
req._NodeId = _NodeId;
|
|||
|
req._SubNodeId = _SubNodeId;
|
|||
|
req.SendMsg();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void InitDesc(List<string> DescList)
|
|||
|
{
|
|||
|
if(DescList.Count == 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
_Desc.text = StrDictionary.GetServerDictionaryFormatString(DescList[0]);
|
|||
|
}
|
|||
|
}
|