87 lines
2.5 KiB
C#
87 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
public class CaptainWelfareRewPreviewCtr : MonoBehaviour {
|
|
|
|
public static CaptainWelfareRewPreviewCtr Instance;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
Instance = null;
|
|
}
|
|
|
|
public UIContainerBase rewContainer;
|
|
public GameObject _CantBtn;
|
|
public GameObject _GetBtn;
|
|
public GameObject _GetedBtn;
|
|
|
|
private int _CurRewNeedVal = -1;
|
|
public int _CurIndex = -1;
|
|
public void InitWelfareRewPreview(int teamId, int state)
|
|
{
|
|
_CurIndex = teamId;
|
|
var teamLeaderAwardWeek = TableManager.GetTeamLeaderAwardWeekByID(teamId, 0);
|
|
if (teamLeaderAwardWeek == null)
|
|
return;
|
|
|
|
_CurRewNeedVal = teamLeaderAwardWeek.WeekNeedExp;
|
|
List<CommonItemContainerItem.ItemInfo> rewItemInfoList = new List<CommonItemContainerItem.ItemInfo>();
|
|
for (int index = 0; index < teamLeaderAwardWeek.getAwardIdCount(); index++)
|
|
{
|
|
if (teamLeaderAwardWeek.GetAwardIdbyIndex(index) == 3 && teamLeaderAwardWeek.GetAwardSubIdbyIndex(index) != -1)
|
|
{
|
|
CommonItemContainerItem.ItemInfo info = new CommonItemContainerItem.ItemInfo();
|
|
info.itemID = teamLeaderAwardWeek.GetAwardSubIdbyIndex(index);
|
|
info.itemNum = teamLeaderAwardWeek.GetAwardCountbyIndex(index);
|
|
|
|
rewItemInfoList.Add(info);
|
|
}
|
|
}
|
|
|
|
rewContainer.InitContentItem(rewItemInfoList);
|
|
InitItemState(state);
|
|
}
|
|
|
|
private int _curState = -1;
|
|
public void InitItemState(int state)
|
|
{
|
|
_curState = state;
|
|
_CantBtn.SetActive(state == 0);
|
|
_GetBtn.SetActive(state == 1);
|
|
_GetedBtn.SetActive(state == 2);
|
|
}
|
|
|
|
public void OnCantBtnClick()
|
|
{
|
|
if (CaptainWelfareRoot.Instance)
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{68004}", _CurRewNeedVal - CaptainWelfareRoot.Instance._packet.exp_week));
|
|
}
|
|
|
|
public void OnGetBtnClick()
|
|
{
|
|
ReqCetTeamLeaderAwardWeek req = new ReqCetTeamLeaderAwardWeek();
|
|
req.index = _CurIndex;
|
|
req.SendMsg();
|
|
|
|
OnBackClick();
|
|
}
|
|
|
|
public void OnGetedBtnClick()
|
|
{
|
|
GUIData.AddNotifyData(StrDictionary.GetClientDictionaryString("#{2939}"));
|
|
return;
|
|
}
|
|
|
|
public void OnBackClick()
|
|
{
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
}
|