144 lines
3.8 KiB
C#
144 lines
3.8 KiB
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.UI;
|
||
using GCGame.Table;
|
||
using XLua;
|
||
|
||
//equired int32 actID = 1; //
|
||
// required int32 tagID = 2; //
|
||
// repeated string descs = 3; //
|
||
//repeated MarketingActAwardItem awardItems = 4; //
|
||
// required int32 state = 5; // 类型: 0.不可领取 1.可领取 2.已领取
|
||
// repeated string iconPath = 6; //背景路径,没有为空
|
||
//required int32 modleID = 7; //需要显示的模型CharModelId 不需要:0
|
||
// required int32 SequenceID = 8; //需要显示的序列帧Id 不需要:0
|
||
// required int32 NeedNotice = 9; //是否需要提示 0.不需要 1.需要
|
||
// required int32 isSpecialRew = 10; //是否珍品
|
||
// required int32 Quality = 11; //什么品质需要特效 -1不需要,0表示所有,之后按对应品质播放
|
||
// repeated string otherDescs = 12; //补充描述
|
||
|
||
//[LuaCallCSharp]
|
||
public class tempTestStruct
|
||
{
|
||
public int actID;
|
||
public int tagID;
|
||
public List<string> descs;
|
||
public int state;
|
||
}
|
||
|
||
// 0元购活动
|
||
public class FreeBuyRootCS : MarketingUIBaseCS
|
||
{
|
||
public Image banner;
|
||
public Button closeBtn;
|
||
public UIBackRayBehind behindMask;
|
||
public UIContainerBase awardContainer;
|
||
public Text remainTime;
|
||
|
||
public int beforeActId; // root和页面结合在一个页面显示
|
||
|
||
private void Awake()
|
||
{
|
||
if (behindMask != null)
|
||
{
|
||
behindMask._BackClick.AddListener(Close);
|
||
}
|
||
|
||
if (closeBtn != null)
|
||
{
|
||
closeBtn.onClick.AddListener(Close);
|
||
}
|
||
}
|
||
|
||
public void Close()
|
||
{
|
||
this.gameObject.SetActive(false);
|
||
}
|
||
|
||
private void OnEnable()
|
||
{
|
||
AskForMenuID();
|
||
}
|
||
|
||
private void OnDisable()
|
||
{
|
||
if (MarketingActsRoot.Instance() != null)
|
||
{
|
||
MarketingActsRoot.Instance().ClearShowingWin(_ActID);
|
||
MarketingActsRoot.Instance().ClearShowingWin(beforeActId);
|
||
}
|
||
}
|
||
|
||
// 初始化相关文字信息
|
||
public void InitDesc(List<string> descs)
|
||
{
|
||
// 本活动应该只有一条页面描述,就是剩余时间
|
||
if(descs != null && descs.Count > 0)
|
||
{
|
||
remainTime.text = StrDictionary.GetServerDictionaryFormatString(descs[0]);
|
||
}
|
||
}
|
||
|
||
// 显示奖品
|
||
protected virtual void InitAwardItem(List<MarketingActAwardTag> datas)
|
||
{
|
||
awardContainer.InitContentItem(datas);
|
||
}
|
||
|
||
|
||
#region 请求与接收处理
|
||
|
||
// 菜单请求
|
||
private void AskForMenuID()
|
||
{
|
||
MarketingActsReq req = new MarketingActsReq();
|
||
req.actType = this._ActID;
|
||
|
||
req.SendMsg();
|
||
}
|
||
|
||
// root菜单接收
|
||
protected override void MarketingActRetInner(MarketingActsRet marketActsRet)
|
||
{
|
||
if (marketActsRet != null && marketActsRet.actIDState.Count > 0)
|
||
{
|
||
beforeActId = this._ActID;
|
||
MarketingActState tempActState = new MarketingActState();
|
||
tempActState.actID = marketActsRet.actIDState[0].actID;
|
||
Hashtable param = new Hashtable();
|
||
param.Add("ActState", tempActState);
|
||
|
||
if (MarketingActsRoot.Instance() != null)
|
||
{
|
||
MarketingActsRoot.Instance().LoadUICallBack(true, param, gameObject);
|
||
}
|
||
|
||
AskForInfo();
|
||
}
|
||
}
|
||
|
||
// 页面信息请求
|
||
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)
|
||
{
|
||
InitAwardItem(info.awardTags);
|
||
InitDesc(info.descList);
|
||
}
|
||
}
|
||
|
||
|
||
#endregion
|
||
}
|