113 lines
3.7 KiB
C#
113 lines
3.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using GCGame.Table;
|
|
|
|
// 七日投资Item控制
|
|
public class AweekInverstmentSmallItemCS : UIItemBase {
|
|
|
|
public Image bg; // 背景
|
|
public Sprite closeSprite; // 未打开背景图
|
|
public Sprite openSprite; // 打开背景图
|
|
public Sprite canTakeSprite; // 可领取按钮背景
|
|
public Sprite cantTakeSprire; // 不可领取按钮背景
|
|
public Image whetherCanTakeImg; // 是否可领取图片
|
|
public Text desc; // 描述
|
|
public Button getBtn; // 获得按钮
|
|
|
|
private int state = -1; // 按钮状态(按钮为背景)
|
|
private int actID; // 活动id
|
|
private int tagID; // tagId
|
|
|
|
public override void Init()
|
|
{
|
|
if(getBtn != null)
|
|
{
|
|
getBtn.onClick.AddListener(OnGetBtnClick);
|
|
}
|
|
}
|
|
|
|
public override void Show(Hashtable hash)
|
|
{
|
|
MarketingActAwardTag info = hash["InitObj"] as MarketingActAwardTag;
|
|
if(info != null)
|
|
{
|
|
// 背景根据状态更新
|
|
if(info.state == 0 || info.state == 1)
|
|
{
|
|
if(closeSprite != null)
|
|
{
|
|
bg.sprite = closeSprite;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(openSprite != null)
|
|
{
|
|
bg.sprite = openSprite;
|
|
}
|
|
}
|
|
|
|
if(info.state == 0 || info.state == 1)
|
|
{
|
|
whetherCanTakeImg.gameObject.SetActive(true);
|
|
whetherCanTakeImg.sprite = info.state == 0 ? cantTakeSprire : canTakeSprite;
|
|
}
|
|
else
|
|
{
|
|
whetherCanTakeImg.gameObject.SetActive(false);
|
|
}
|
|
|
|
// 奖励文字
|
|
if (info.descs.Count != 0 && !string.IsNullOrEmpty(info.descs[0]))
|
|
{
|
|
desc.text = StrDictionary.GetServerDictionaryFormatString(info.descs[0]);
|
|
}
|
|
|
|
string moneyType = "";
|
|
if (info.awardItems != null && info.awardItems.Count > 0)
|
|
{
|
|
switch ((MONEYTYPE)info.awardItems[0].awardSubType)
|
|
{
|
|
case MONEYTYPE.MONEYTYPE_COIN:
|
|
moneyType = StrDictionary.GetClientDictionaryString("#{6003}");
|
|
break;//银两
|
|
case MONEYTYPE.MONEYTYPE_YUANBAO:
|
|
moneyType = StrDictionary.GetClientDictionaryString("#{6001}");
|
|
break;//灵玉
|
|
case MONEYTYPE.MONEYTYPE_YUANBAO_BIND:
|
|
moneyType = StrDictionary.GetClientDictionaryString("#{6002}");
|
|
break;//元宝
|
|
case MONEYTYPE.MONEYTYPE_COIN_BIND:
|
|
moneyType = StrDictionary.GetClientDictionaryString("#{6004}");
|
|
break;//银票
|
|
}
|
|
|
|
desc.text = info.awardItems[0].awardNum.ToString() + moneyType;
|
|
}
|
|
|
|
// 0.不可领取 1.可领取 2.已领取
|
|
this.state = info.state;
|
|
actID = info.actID;
|
|
tagID = info.tagID;
|
|
}
|
|
else
|
|
{
|
|
state = -1;
|
|
}
|
|
}
|
|
|
|
private void OnGetBtnClick()
|
|
{
|
|
if(this.state == 1)
|
|
{
|
|
MarketingActAwardPageGetAward req = new MarketingActAwardPageGetAward();
|
|
req.actID = actID;
|
|
req.tagID = tagID;
|
|
|
|
req.SendMsg();
|
|
}
|
|
}
|
|
}
|