69 lines
1.7 KiB
C#
69 lines
1.7 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using GCGame.Table;
|
||
|
||
// 七日投资
|
||
public class AWeekInvestmentCS : MarketingUIBaseCS
|
||
{
|
||
public List<AweekInverstmentSmallItemCS> smallAwards; // 7天礼包数组
|
||
public Button investmentBtn;
|
||
public Image hasBuyTips;
|
||
public Image banner;
|
||
|
||
private void Awake()
|
||
{
|
||
investmentBtn.onClick.AddListener(OnInvestmentBtn);
|
||
}
|
||
|
||
private void OnEnable()
|
||
{
|
||
AskForInfo();
|
||
}
|
||
|
||
public void ShowInfo(MarketingActAwardPageRet info)
|
||
{
|
||
for(int i = 0; i < smallAwards.Count; ++i)
|
||
{
|
||
Hashtable h = new Hashtable();
|
||
h.Add("InitObj", info.awardTags[i]);
|
||
smallAwards[i].Show(h);
|
||
}
|
||
|
||
// 更新按钮状态, 0 未购买,1 已购买
|
||
investmentBtn.gameObject.SetActive(info.pagrState == 0);
|
||
hasBuyTips.gameObject.SetActive(info.pagrState == 1);
|
||
}
|
||
|
||
#region 协议发送与接收
|
||
|
||
private void AskForInfo()
|
||
{
|
||
MarketingActAwardPageReq req = new MarketingActAwardPageReq();
|
||
req.actID = this._ActID;
|
||
req.updateOrInit = 1;
|
||
|
||
req.SendMsg();
|
||
}
|
||
|
||
protected override void MarketingActPageAwardRetDelInner(object packet)
|
||
{
|
||
MarketingActAwardPageRet info = packet as MarketingActAwardPageRet;
|
||
if(info != null)
|
||
{
|
||
ShowInfo(info);
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
|
||
private void OnInvestmentBtn()
|
||
{
|
||
MarketinfActPerchasePeq req = new MarketinfActPerchasePeq();
|
||
req.actId = this._ActID;
|
||
req.tagId = 0; // 其实该活动无tagid
|
||
|
||
req.SendMsg();
|
||
}
|
||
} |