171 lines
4.3 KiB
C#
171 lines
4.3 KiB
C#
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using GCGame.Table;
|
|||
|
using System;
|
|||
|
using Games.GlobeDefine;
|
|||
|
|
|||
|
// 皇陵探宝
|
|||
|
// 字典描述
|
|||
|
// 6747 皇陵探宝今日采集描述 今日采集次数
|
|||
|
// 6748 皇陵探宝今日采集数字格式 {0}/{1}
|
|||
|
// 6749 皇陵探宝今日已获得描述 已获
|
|||
|
// 6750 皇陵探宝倒计时格式 倒计时 {0}
|
|||
|
public class TombRaiderCopyInfoCtr : MonoBehaviour {
|
|||
|
|
|||
|
private static TombRaiderCopyInfoCtr instance;
|
|||
|
public static TombRaiderCopyInfoCtr Instance
|
|||
|
{
|
|||
|
get { return instance; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public Text countDown;
|
|||
|
|
|||
|
public Text todayCountDesc;
|
|||
|
public Text todayCountDescCount;
|
|||
|
|
|||
|
public List<GameObject> collectInfos;
|
|||
|
public List<Text> collectDescs;
|
|||
|
public List<Image> collectTypes;
|
|||
|
public List<Text> collectCounts;
|
|||
|
|
|||
|
public Button exitBtn;
|
|||
|
|
|||
|
private void Awake()
|
|||
|
{
|
|||
|
if(instance == null)
|
|||
|
{
|
|||
|
instance = this;
|
|||
|
exitBtn.onClick.AddListener(OnExitBtnClick);
|
|||
|
animBtn.onClick.AddListener(OnAnimBtnClick);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public void OnEnable()
|
|||
|
{
|
|||
|
OnAnimBtnClick();
|
|||
|
}
|
|||
|
|
|||
|
private void OnDestroy()
|
|||
|
{
|
|||
|
instance = null;
|
|||
|
}
|
|||
|
|
|||
|
private void OnExitBtnClick()
|
|||
|
{
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|||
|
{
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.AskLeaveCopy();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ShowCountDownTime()
|
|||
|
{
|
|||
|
StopAllCoroutines();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
int timeEnd = ActivityDataManager.Instance.GetActivityOverTime((int)ActivityDataManager.Activity_Type.ACTIVITY_TYPE_TOMBRAIDER);
|
|||
|
if(timeEnd <= 0 )
|
|||
|
{
|
|||
|
StartCoroutine(CountTime(0));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
StartCoroutine(CountTime((int)Time.realtimeSinceStartup + timeEnd));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private IEnumerator CountTime(int stopTime)
|
|||
|
{
|
|||
|
countDown.gameObject.SetActive(true);
|
|||
|
float j = 0.0f;
|
|||
|
long remainTime = (long)(stopTime - Time.realtimeSinceStartup);
|
|||
|
for (; remainTime >= 0; --remainTime)
|
|||
|
{
|
|||
|
string time = string.Format("{0}:{1}", (remainTime / 60).ToString().PadLeft(2, '0'), (remainTime % 60).ToString().PadLeft(2, '0'));
|
|||
|
countDown.text = StrDictionary.GetClientDictionaryString("#{6750}", time);
|
|||
|
for (; j < 1.0f; j += Time.deltaTime)
|
|||
|
{
|
|||
|
yield return 0;
|
|||
|
}
|
|||
|
|
|||
|
j -= 1.0f;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public class CopyCollectInfo
|
|||
|
{
|
|||
|
public int collectType;
|
|||
|
public long num;
|
|||
|
}
|
|||
|
|
|||
|
public class TestPacket
|
|||
|
{
|
|||
|
public int copyId;
|
|||
|
//public int countDownTime;
|
|||
|
public int todayCollectCount;
|
|||
|
public int maxCollectCount;
|
|||
|
public List<CopyCollectInfo> copyCollectInfos;
|
|||
|
}
|
|||
|
|
|||
|
string tempStr = "";
|
|||
|
public void Show(RespGetTombRaiderInfo packet)
|
|||
|
{
|
|||
|
todayCountDesc.text = StrDictionary.GetClientDictionaryString("#{6747}");
|
|||
|
todayCountDescCount.text = StrDictionary.GetClientDictionaryString("#{6748}", packet.collectCount, packet.totalCount);
|
|||
|
|
|||
|
for (int i = 0; i < collectInfos.Count; ++i)
|
|||
|
{
|
|||
|
if(i < packet.collectItemList.Count)
|
|||
|
{
|
|||
|
Tab_CommonItem tab = TableManager.GetCommonItemByID(packet.collectItemList[i].id, 0);
|
|||
|
if(tab == null)
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
collectInfos[i].SetActive(true);
|
|||
|
collectDescs[i].text = StrDictionary.GetClientDictionaryString("#{6749}", tab.Name, packet.collectItemList[i].count.ToString());
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
collectInfos[i].SetActive(false);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
ShowCountDownTime();
|
|||
|
}
|
|||
|
|
|||
|
#region 动画相关
|
|||
|
|
|||
|
public Animator panelAnim;
|
|||
|
public Button animBtn;
|
|||
|
private bool isShow = false;
|
|||
|
|
|||
|
private void OnAnimBtnClick()
|
|||
|
{
|
|||
|
isShow = !isShow;
|
|||
|
if(isShow)
|
|||
|
{
|
|||
|
panelAnim.Play("Show");
|
|||
|
|
|||
|
GCGame.Utils.HideMainTopRightUI();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
panelAnim.Play("Hide");
|
|||
|
|
|||
|
GCGame.Utils.ShowMainTopRightUI();
|
|||
|
if (TombRadierMapHelper.Instance != null)
|
|||
|
{
|
|||
|
TombRadierMapHelper.Instance.ReFresh();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
}
|