62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
using UnityEngine.UI;
|
|||
|
using System.Collections.Generic;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class WelfareSevenDayMenuItem : MonoBehaviour {
|
|||
|
private const string _HasGetedStringColor = "<color=#D2EAFA>{0}</color>";
|
|||
|
|
|||
|
public GameObject _SelectedObj;
|
|||
|
public Image _DayDescBG;
|
|||
|
public Text _DayDesc;
|
|||
|
public GameObject _MarkIcon;
|
|||
|
|
|||
|
//0.未领取的时候 1.领取的时候
|
|||
|
public List<Sprite> _StateSpriteList;
|
|||
|
|
|||
|
private int _SiubNodeId = -1;
|
|||
|
private int _CurSelectedIndex = -1;
|
|||
|
public void InitMenuItem(int _SubNodeId, int _Index, int _State)
|
|||
|
{
|
|||
|
_CurSelectedIndex = _Index;
|
|||
|
this._SiubNodeId = _SubNodeId;
|
|||
|
string _StrDicId = "#{" + (39800 + _Index) + "}";
|
|||
|
_DayDesc.text = StrDictionary.GetClientDictionaryString(_StrDicId);
|
|||
|
|
|||
|
//状态只有领取跟未领取
|
|||
|
if(_State == (int)WelfareRootCtr.WlfareRewardState.CanGet)
|
|||
|
{
|
|||
|
_DayDescBG.overrideSprite = _StateSpriteList[0];
|
|||
|
_DayDescBG.SetNativeSize();
|
|||
|
_DayDescBG.rectTransform.sizeDelta = new Vector2(_DayDescBG.rectTransform.sizeDelta.x * 1.3f, _DayDescBG.rectTransform.sizeDelta.y * 1.3f);
|
|||
|
_MarkIcon.SetActive(false);
|
|||
|
OnMenuItemClick();
|
|||
|
}
|
|||
|
else if(_State == (int)WelfareRootCtr.WlfareRewardState.HasGeted)
|
|||
|
{
|
|||
|
_DayDescBG.overrideSprite = _StateSpriteList[1];
|
|||
|
_DayDescBG.SetNativeSize();
|
|||
|
_MarkIcon.SetActive(true);
|
|||
|
|
|||
|
_DayDesc.text = string.Format(_HasGetedStringColor, _DayDesc.text);
|
|||
|
}else
|
|||
|
{
|
|||
|
_MarkIcon.SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnMenuItemClick()
|
|||
|
{
|
|||
|
if(WelfareSevenDayCtr.Instance)
|
|||
|
{
|
|||
|
WelfareSevenDayCtr.Instance.OnSubNodeMenuItemClick(_CurSelectedIndex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void ShowSelectedObj(bool isShow)
|
|||
|
{
|
|||
|
_SelectedObj.SetActive(isShow);
|
|||
|
}
|
|||
|
}
|