Files
JJBB/Assets/Project/Script/GUI/Activity/FactionRewItem.cs
2024-08-23 15:49:34 +08:00

58 lines
1.8 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GCGame.Table;
public class FactionRewItem : UIItemBase {
public Text _ConditionDesc;
public UIContainerBase _RewItemContainer;
public GameObject _CanRecBtn;
public GameObject _CantRecBtn;
public GameObject _HasGeted;
public int _CurRewId = -1;
public override void Show(Hashtable hash)
{
base.Show(hash);
_CurRewId = (int)hash["InitObj"];
var rewTab = TableManager.GetChallengeOnceRewardByID(_CurRewId, 0);
if(rewTab == null)
{
Debug.LogError("tabId is null : " + _CurRewId);
this.gameObject.SetActive(false);
return;
}
List<InteractionRewItem.InteractionRewItemData> rewItemDataList = new List<InteractionRewItem.InteractionRewItemData>();
for(int index = 0; index < rewTab.getItemIdCount(); index++)
{
if (rewTab.GetItemIdbyIndex(index) != -1)
{
InteractionRewItem.InteractionRewItemData rew = new InteractionRewItem.InteractionRewItemData(rewTab.GetItemIdbyIndex(index), rewTab.GetItemNumbyIndex(index));
rewItemDataList.Add(rew);
}
}
_ConditionDesc.text = rewTab.ConditionDesc;
_RewItemContainer.InitContentItem(rewItemDataList);
}
private int _State = 0; //0.不可领取 1.可领取 2.已领取
public void RefreshState(int state)
{
_State = state;
_CanRecBtn.SetActive(state == 1);
_CantRecBtn.SetActive(state == 0);
_HasGeted.SetActive(state == 2);
}
public void OnGetBtn()
{
ReqGetChallengeRewardList req = new ReqGetChallengeRewardList();
req.nodeId = _CurRewId;
req.SendMsg();
}
}