Files
MinFt/Client/Assets/Scripts/UI/Home/HomeBtnOneOnePack.cs
Liubing\LB 3d8d4d18f3 first commit
先修复一下,错误的场景

删除不必要的钓场资产

修复into场景

update:更新meta文件,修复报错

update:修复资源

修复第一章节建造

修复建造第三章

update:删除多余内容

update:更新README.md

update:还原图标

update:更新README

update:更新配置
2026-04-28 02:17:22 +08:00

72 lines
2.0 KiB
C#

using asap.core;
using GameCore;
using System;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
public class HomeBtnOneOnePack : MonoBehaviour, IUIRedPoint
{
public const string redKey = "Home.OneOne";
Image redpoint;
Button btn_enter;
TMP_Text text_time;
FishingEventData fishingEventData;
private void Awake()
{
fishingEventData = GContext.container.Resolve<FishingEventData>();
btn_enter = GetComponent<Button>();
redpoint = transform.Find("redpoint").GetComponent<Image>();
text_time = transform.Find("text_time").GetComponent<TMP_Text>();
if (fishingEventData.Pack1A1Data == null || fishingEventData.Pack1A1Data.index >= 2)
{
gameObject.SetActive(false);
return;
}
}
void OnEnable()
{
SetEndTime();
RedPointManager.Instance.AddRedPoint(redKey, this);
redpoint.enabled = RedPointManager.Instance.GetRedPointState(redKey);
}
private void Start()
{
btn_enter.onClick.AddListener(async () => await UIManager.Instance.GetUIAsync(UITypes.GiftPopupPanel_10));
}
public void SetRedPointState(bool state)
{
if (redpoint != null)
{
redpoint.enabled = state;
}
}
private void OnDisable()
{
RedPointManager.Instance.RemoveRedPoint(redKey);
}
void SetEndTime()
{
DateTime endTime = fishingEventData.GetEvent1A1EndTime();
TimeSpan now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
double seconds = now.TotalSeconds;
if (seconds < 1)
{
gameObject.SetActive(false);
}
else
{
this.AttachTimer((float)seconds,
() => { gameObject.SetActive(false); },
(elapsed) =>
{
now = endTime - ZZTimeHelper.UtcNow().UtcNowOffset();
text_time.text = ConvertTools.ConvertTime2(now.Days, now.Hours, now.Minutes, now.Seconds);
}, useRealTime: true);
}
}
}