127 lines
4.3 KiB
C#
127 lines
4.3 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
using Module.Log;
|
|
|
|
public class WelfareEveryDaySinginItem : UIItemBase {
|
|
|
|
public Image _ItemIcon;
|
|
public Image _itemQuality;
|
|
public Text _ItemCount;
|
|
public Image _ItemStateIcon;
|
|
public GameObject _HasGetIcon;
|
|
public Image _CanDoubleIcon;
|
|
public List<Sprite> _StateIconList;
|
|
public GameObject _MarkIcon;
|
|
public GameObject effectCtr;
|
|
public GameObject effect; // 特效控制,挂载点即本脚物体
|
|
|
|
public int _ItemState;
|
|
private int _ItemId;
|
|
|
|
public int _NodeId;
|
|
public int _SubNodeId;
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
base.Show(hash);
|
|
|
|
WelfareEveryDaySingInItemInfo info = (WelfareEveryDaySingInItemInfo)hash["InitObj"];
|
|
|
|
Tab_CommonItem commonItem = TableManager.GetCommonItemByID(info._ItemId, 0);
|
|
if(commonItem == null)
|
|
{
|
|
LogModule.ErrorLog("CommonItem is null, Item id is : " + info._ItemId);
|
|
return;
|
|
}
|
|
_ItemId = info._ItemId;
|
|
_ItemState = info._ItemState;
|
|
|
|
_NodeId = info._NodeId;
|
|
_SubNodeId = info._SubNodeId;
|
|
|
|
LoadAssetBundle.Instance.SetImageSprite(_ItemIcon, commonItem.Icon);
|
|
LoadAssetBundle.Instance.SetImageSprite(_itemQuality, GCGame.Utils.GetItemQualityFrame(commonItem.Quality));
|
|
if (commonItem.QualityEffect > 0)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, commonItem.QualityEffect, _ItemIcon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, commonItem.QualityEffect, _ItemIcon.transform);
|
|
}
|
|
|
|
_ItemCount.text = info._ItemCount.ToString();
|
|
|
|
_CanDoubleIcon.gameObject.SetActive(!info._vipDoubleIconPath.Equals(""));
|
|
LoadAssetBundle.Instance.SetImageSprite(_CanDoubleIcon, info._vipDoubleIconPath);
|
|
|
|
if (info._isSpecial)
|
|
{
|
|
effect.gameObject.SetActive(true);
|
|
effect.transform.localPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
effect.gameObject.SetActive(false);
|
|
}
|
|
|
|
InitRewState();
|
|
}
|
|
|
|
public void InitRewState()
|
|
{
|
|
switch(_ItemState)
|
|
{
|
|
case (int)WelfareRootCtr.WlfareRewardState.CanGet:
|
|
_MarkIcon.SetActive(true);
|
|
_ItemStateIcon.gameObject.SetActive(true);
|
|
_HasGetIcon.SetActive(false);
|
|
_ItemStateIcon.overrideSprite = _StateIconList[(int)WelfareRootCtr.WlfareRewardState.CanGet - 1];
|
|
effectCtr.gameObject.SetActive(true);
|
|
break;
|
|
case (int)WelfareRootCtr.WlfareRewardState.HasGeted:
|
|
_MarkIcon.SetActive(true);
|
|
_ItemStateIcon.gameObject.SetActive(false);
|
|
_HasGetIcon.SetActive(true);
|
|
effectCtr.gameObject.SetActive(false);
|
|
break;
|
|
case (int)WelfareRootCtr.WlfareRewardState.CanReCheck:
|
|
_MarkIcon.SetActive(true);
|
|
_HasGetIcon.SetActive(false);
|
|
_ItemStateIcon.gameObject.SetActive(true);
|
|
effectCtr.gameObject.SetActive(false);
|
|
_ItemStateIcon.overrideSprite = _StateIconList[(int)WelfareRootCtr.WlfareRewardState.CanReCheck - 1];
|
|
break;
|
|
case (int)WelfareRootCtr.WlfareRewardState.None:
|
|
_MarkIcon.SetActive(false);
|
|
_HasGetIcon.SetActive(false);
|
|
_ItemStateIcon.gameObject.SetActive(false);
|
|
effectCtr.gameObject.SetActive(true);
|
|
break;
|
|
}
|
|
}
|
|
|
|
public override void OnItemClick()
|
|
{
|
|
switch(_ItemState)
|
|
{
|
|
case (int)WelfareRootCtr.WlfareRewardState.CanGet:
|
|
case (int)WelfareRootCtr.WlfareRewardState.CanReCheck:
|
|
{
|
|
ReqGetWelfareRew req = new ReqGetWelfareRew();
|
|
req._NodeId = _NodeId;
|
|
req._SubNodeId = _SubNodeId;
|
|
req.SendMsg();
|
|
}
|
|
break;
|
|
default:
|
|
{
|
|
ItemTooltipsLogic.ShowItemTooltip(_ItemId, ItemTooltipsLogic.ShowType.Info, _ItemIcon.transform.position);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|