74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
|
|||
|
public class PartInBanQuetItem : UIItemBase {
|
|||
|
|
|||
|
public List<Image> _HeadIconList;
|
|||
|
public List<Text> _RoleNameList;
|
|||
|
public List<GameObject> _IsFriendObjList;
|
|||
|
public Text _RemainTime;
|
|||
|
|
|||
|
public UIContainerBase _RewItemContainer;
|
|||
|
public Image _TypeIcon;
|
|||
|
public List<Sprite> _TypeIconList;
|
|||
|
private int _CurWeedingBanQuetId = -1;
|
|||
|
public override void Show(Hashtable hash)
|
|||
|
{
|
|||
|
base.Show(hash);
|
|||
|
WeddingFeastInfo info = (WeddingFeastInfo)hash["InitObj"];
|
|||
|
_TypeIcon.overrideSprite = _TypeIconList[0];
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(_HeadIconList[0], GCGame.Utils.GetProfessionSpriteName(info.groom.profession));
|
|||
|
LoadAssetBundle.Instance.SetImageSprite(_HeadIconList[1], GCGame.Utils.GetProfessionSpriteName(info.bride.profession));
|
|||
|
|
|||
|
_RoleNameList[0].text = info.groom.name;
|
|||
|
_RoleNameList[1].text = info.bride.name;
|
|||
|
|
|||
|
_IsFriendObjList[0].SetActive(info.groom.isfriend == 1);
|
|||
|
_IsFriendObjList[1].SetActive(info.bride.isfriend == 1);
|
|||
|
|
|||
|
_CurWeedingBanQuetId = info.nWeddingId;
|
|||
|
var banQuetTab = TableManager.GetWeedingBanQuetByID(info.nType, 0);
|
|||
|
if (banQuetTab == null)
|
|||
|
return;
|
|||
|
|
|||
|
List<int> rewList = new List<int>();
|
|||
|
for(int index = 0; index < banQuetTab.getRewardCount(); index++)
|
|||
|
{
|
|||
|
if (banQuetTab.GetRewardbyIndex(index) != -1)
|
|||
|
rewList.Add(banQuetTab.GetRewardbyIndex(index));
|
|||
|
}
|
|||
|
|
|||
|
_RewItemContainer.InitContentItem(rewList);
|
|||
|
|
|||
|
if (info.nRemainTime > 0)
|
|||
|
StartCoroutine(CountRemainTime(info.nRemainTime));
|
|||
|
else
|
|||
|
_RemainTime.text = "00:00";
|
|||
|
}
|
|||
|
|
|||
|
IEnumerator CountRemainTime(int endTime)
|
|||
|
{
|
|||
|
while(true)
|
|||
|
{
|
|||
|
yield return new WaitForSeconds(1.0f);
|
|||
|
var remainTime = endTime - GlobalData.ServerAnsiTime;
|
|||
|
if(remainTime <= 0)
|
|||
|
{
|
|||
|
_RemainTime.text = 0 + "";
|
|||
|
yield break;
|
|||
|
}
|
|||
|
_RemainTime.text = (remainTime / 60).ToString().PadLeft(2, '0') +":" + (remainTime % 60).ToString().PadLeft(2, '0');
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnPartInBtn()
|
|||
|
{
|
|||
|
ReqEnterWeddingFeast req = new ReqEnterWeddingFeast();
|
|||
|
req.nWeddingId = _CurWeedingBanQuetId;
|
|||
|
req.SendMsg();
|
|||
|
}
|
|||
|
}
|