118 lines
2.9 KiB
C#
118 lines
2.9 KiB
C#
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Games.GlobeDefine;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
using System;
|
|
|
|
public class MarketingCommonPageRoot : MarketingUIBaseCS
|
|
{
|
|
#region
|
|
public void OnEnable()
|
|
{
|
|
InitWin();
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
#endregion
|
|
|
|
public Image _ActIcon;
|
|
public List<Text> _Descs;
|
|
public UIContainerBase _TagContainer;
|
|
public Button _PerchaseBtn;
|
|
|
|
private Dictionary<int, GameObject> _LuaPages = new Dictionary<int, GameObject>();
|
|
private int _LastShowAct = -1;
|
|
|
|
public virtual void InitWin()
|
|
{
|
|
ReqActList();
|
|
|
|
var actTab = TableManager.GetActInfoClientByID(_ActID, 0);
|
|
if (actTab != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(actTab.Icon) && _ActIcon != null)
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(_ActIcon, actTab.Icon);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetActListMenu(List<MarketingActAwardTag> actStages)
|
|
{
|
|
_TagContainer.InitContentItem(actStages);
|
|
}
|
|
|
|
public void SetDescs(List<string> descs)
|
|
{
|
|
for (int i = 0; i < descs.Count && i < _Descs.Count; ++i)
|
|
{
|
|
if (_Descs[i] != null && !string.IsNullOrEmpty(descs[i]))
|
|
{
|
|
_Descs[i].text = StrDictionary.GetServerDictionaryFormatString( descs[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnBtnCharge()
|
|
{
|
|
YuanBaoShopLogic.OpenChargePage();
|
|
}
|
|
|
|
#region
|
|
|
|
public virtual void ReqActList()
|
|
{
|
|
MarketingActAwardPageReq packet = new MarketingActAwardPageReq();
|
|
packet.actID = _ActID;
|
|
packet.updateOrInit = 1;
|
|
packet.SendMsg();
|
|
}
|
|
|
|
public void SetPerchaseBtnState(bool isPerchased)
|
|
{
|
|
if(_PerchaseBtn != null)
|
|
_PerchaseBtn.interactable = !isPerchased;
|
|
}
|
|
|
|
protected override void MarketingActPageAwardRetDelInner(object _Packet)
|
|
{
|
|
MarketingActAwardPageRet packet = (MarketingActAwardPageRet)_Packet;
|
|
SetActListMenu(packet.awardTags);
|
|
SetDescs(packet.descList);
|
|
SetPerchaseBtnState(packet.pagrState == 1);
|
|
}
|
|
|
|
protected override void MarketingActPageGetAwardRetInner(object _Packet)
|
|
{
|
|
MarketingActAwardPageGetAwardRet packet = (MarketingActAwardPageGetAwardRet)_Packet;
|
|
if (packet.btnState == 1)
|
|
{
|
|
_TagContainer.ForeachActiveItem<MarketingCommonTag>((awardTag) =>
|
|
{
|
|
if (awardTag.TagInfo.tagID == packet.tagID)
|
|
{
|
|
awardTag.RefreshTagState(packet.btnState);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (MarketingActsRoot.Instance() != null)
|
|
{
|
|
MarketingActsRoot.Instance().ClearShowingWin(_ActID);
|
|
}
|
|
this.gameObject.SetActive(false);
|
|
}
|
|
#endregion
|
|
}
|