133 lines
3.5 KiB
C#
133 lines
3.5 KiB
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using System.Collections.Generic;
|
|
using GCGame.Table;
|
|
|
|
public class HundredTimesWelfarePanelCtr : MonoBehaviour{
|
|
|
|
public OperationActivityEnterfaceId _ActEnterFaceId;
|
|
private int _ActId = 70; //入口ID2 活动ID70
|
|
private int _TagId = -1;
|
|
|
|
public GameObject _EnableBtn;
|
|
public GameObject _EnabledBtn;
|
|
public void OnEnable()
|
|
{
|
|
ReqInfo();
|
|
}
|
|
|
|
public void ReqInfo()
|
|
{
|
|
MarketingActAwardPageReq packet = new MarketingActAwardPageReq();
|
|
packet.actID = _ActId;
|
|
packet.updateOrInit = 1;
|
|
packet.SendMsg();
|
|
}
|
|
|
|
public Image _ActIcon;
|
|
public List<Text> _Descs;
|
|
public UIContainerBase _AwardItemContainer;
|
|
public UICameraTexture _ModelCamera;
|
|
|
|
public virtual void MarketingActAwardPageRet(MarketingActAwardPageRet packet)
|
|
{
|
|
_TagId = packet.awardTags[0].tagID;
|
|
SetDescs(packet.descList);
|
|
|
|
if(_ActIcon != null && packet.awardTags[0].iconPath.Count > 0 && !string.IsNullOrEmpty(packet.awardTags[0].iconPath[0]))
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(_ActIcon, packet.awardTags[0].iconPath[0]);
|
|
}
|
|
|
|
if (packet.awardTags[0].awardItems.Count > 0)
|
|
{
|
|
_AwardItemContainer.InitContentItem(packet.awardTags[0].awardItems);
|
|
}
|
|
|
|
if (_ModelCamera != null && gameObject.activeInHierarchy)
|
|
StartCoroutine(ShowModel(packet.awardTags[0].modleID));
|
|
|
|
RefreshBtnState(packet.awardTags[0].state);
|
|
}
|
|
|
|
public void RefreshBtnState(int btnState)
|
|
{
|
|
if(btnState == 2) //已领取
|
|
{
|
|
if(_EnabledBtn != null)
|
|
{
|
|
_EnabledBtn.SetActive(true);
|
|
}
|
|
|
|
if(_EnableBtn != null)
|
|
{
|
|
_EnableBtn.SetActive(false);
|
|
}
|
|
}else
|
|
{
|
|
if (_EnabledBtn != null)
|
|
{
|
|
_EnabledBtn.SetActive(false);
|
|
}
|
|
|
|
if (_EnableBtn != null)
|
|
{
|
|
_EnableBtn.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
IEnumerator ShowModel(int modelId)
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
Tab_CharModel charModel = TableManager.GetCharModelByID(modelId, 0);
|
|
if(charModel != null)
|
|
{
|
|
_ModelCamera.gameObject.SetActive(true);
|
|
_ModelCamera.InitModelPath(charModel.ResPath, charModel);
|
|
}else
|
|
{
|
|
_ModelCamera.gameObject.SetActive(false);
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
public void SetDescs(List<string> _DescLists)
|
|
{
|
|
for(int index = 0; index < _Descs.Count; index++)
|
|
{
|
|
_Descs[index].gameObject.SetActive(index < _DescLists.Count);
|
|
}
|
|
|
|
for(int index = 0; index < _DescLists.Count && index < _Descs.Count; index++)
|
|
{
|
|
if(!string.IsNullOrEmpty(_DescLists[index]))
|
|
{
|
|
_Descs[index].text = StrDictionary.GetServerDictionaryFormatString(_DescLists[index]);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnCloseBtnClick()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
|
|
public virtual void OnDisable()
|
|
{
|
|
if (MarketingActsRoot.Instance())
|
|
{
|
|
MarketingActsRoot.Instance().ClearShowingWin((int)_ActEnterFaceId);
|
|
}
|
|
}
|
|
|
|
public void OnGetBtnClick()
|
|
{
|
|
MarketingActAwardPageGetAward req = new MarketingActAwardPageGetAward();
|
|
req.actID = _ActId;
|
|
req.tagID = _TagId;
|
|
req.SendMsg();
|
|
}
|
|
}
|