先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
87 lines
2.9 KiB
C#
87 lines
2.9 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using GameCore;
|
|
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class FishingBuffInfoPopupPanel : MonoBehaviour
|
|
{
|
|
Timer buff_timer;
|
|
BuffInfoPopup buffInfoPopup;
|
|
Button btn_close;
|
|
private void Start()
|
|
{
|
|
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
|
btn_close.onClick.AddListener(Close);
|
|
}
|
|
public void InitPanel(FishBuff buff)
|
|
{
|
|
Transform root = transform.Find("root");
|
|
for (int i = 0; i < root.childCount; i++)
|
|
{
|
|
GameObject gameObj = root.GetChild(i).gameObject;
|
|
gameObj.SetActive(gameObj.name == buff.RemarkNode);
|
|
if (gameObj.name == buff.RemarkNode)
|
|
{
|
|
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
|
|
}
|
|
}
|
|
if (buffInfoPopup != null)
|
|
{
|
|
buffInfoPopup.InitPanel(buff);
|
|
buff_timer?.Cancel();
|
|
buffInfoPopup.SetBuffTime(LocalizationMgr.GetFormatTextValue("UI_COMMON_min", buff.CountDown / 60));
|
|
}
|
|
}
|
|
public void InitPanel(FishBuffTimeData buffTimeData)
|
|
{
|
|
FishBuff buff = GContext.container.Resolve<Tables>().TbFishBuff.GetOrDefault(buffTimeData.buffID);
|
|
Transform root = transform.Find("root");
|
|
for (int i = 0; i < root.childCount; i++)
|
|
{
|
|
GameObject gameObj = root.GetChild(i).gameObject;
|
|
gameObj.SetActive(gameObj.name == buff.RemarkNode);
|
|
if (gameObj.name == buff.RemarkNode)
|
|
{
|
|
buffInfoPopup = gameObj.GetComponent<BuffInfoPopup>();
|
|
}
|
|
}
|
|
if (buffInfoPopup != null)
|
|
{
|
|
buffInfoPopup.InitPanel(buff);
|
|
var buffTime = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
|
buff_timer?.Cancel();
|
|
double seconds = buffTime.TotalSeconds;
|
|
TimeSpan now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
|
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
|
|
buff_timer = this.AttachTimer((float)seconds,
|
|
() => { Close(); },
|
|
(elapsed) =>
|
|
{
|
|
if (buffTimeData.isEnd)
|
|
{
|
|
Close();
|
|
return;
|
|
}
|
|
now = buffTimeData.buffEndTime - ZZTimeHelper.UtcNow().UtcNowOffset();
|
|
if (now.TotalSeconds <= 0)
|
|
{
|
|
Close();
|
|
return;
|
|
}
|
|
buffInfoPopup.SetBuffTime(ConvertTools.ConvertTime2(now));
|
|
}, useRealTime: true);
|
|
}
|
|
}
|
|
void Close()
|
|
{
|
|
UIManager.Instance.DestroyUI(UITypes.FishingBuffInfoPopupPanel);
|
|
}
|
|
private void OnDestroy()
|
|
{
|
|
buff_timer?.Cancel();
|
|
buff_timer = null;
|
|
}
|
|
}
|