备份CatanBuilding瘦身独立工程

This commit is contained in:
JSD\13999
2026-05-26 16:15:54 +08:00
commit 2d0e6a61b7
12001 changed files with 2431925 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
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)
{
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);
}
}
}