using System;
|
using Cysharp.Threading.Tasks;
|
using UnityEngine;
|
public class FestivalActivityRechargeBaseWin : FunctionsBaseWin
|
{
|
[SerializeField] TextEx timeText;
|
[SerializeField] ButtonEx closeButton;
|
FestivalActivityManager manager => FestivalActivityManager.Instance;
|
protected override void InitComponent()
|
{
|
base.InitComponent();
|
closeButton.SetListener(CloseWindow);
|
}
|
protected override void OnPreOpen()
|
{
|
base.OnPreOpen();
|
GlobalTimeEvent.Instance.secondEvent += OnSecondEvent;
|
tabButtons[0].redpoint.redpointId = FestivalActivityManager.Instance.GetRedPointId(FestivalActivityRepointType.TotalRecharge);
|
tabButtons[1].redpoint.redpointId = FestivalActivityManager.Instance.GetRedPointId(FestivalActivityRepointType.TotDayRecharge);
|
OnSecondEvent();
|
}
|
protected override void OnPreClose()
|
{
|
base.OnPreClose();
|
GlobalTimeEvent.Instance.secondEvent -= OnSecondEvent;
|
}
|
|
protected override async void OpenSubUIByTabIndex()
|
{
|
switch (functionOrder)
|
{
|
case 0:
|
currentSubUI = await UIManager.Instance.OpenWindowAsync<FestivalActivityRechargeTotalWin>();
|
break;
|
case 1:
|
currentSubUI = await UIManager.Instance.OpenWindowAsync<FestivalActivityRechargeTotDayWin>();
|
break;
|
}
|
}
|
|
private void OnSecondEvent()
|
{
|
var act = manager.GetActInfo();
|
if (act == null)
|
{
|
timeText.text = Language.Get("OSActivity6");
|
return;
|
}
|
timeText.text = Language.Get("TotalRecharge08", TimeUtility.SecondsToShortDHMS(act.GetResetSurplusTime()));
|
}
|
|
}
|