65 lines
1.8 KiB
C#
Raw Normal View History

2025-01-02 12:15:45 +08:00
using CG.Framework;
2025-04-23 13:36:40 +08:00
using CG.UTility;
2025-01-02 12:15:45 +08:00
using System;
2025-04-25 13:18:03 +08:00
using System.Collections;
using System.IO;
2025-04-23 13:36:40 +08:00
using UnityEngine;
2025-04-25 13:18:03 +08:00
using UnityEngine.Networking;
2025-01-02 12:15:45 +08:00
/********************************************************************************
*Create By CG
*Function <EFBFBD><EFBFBD>ҳ״̬
*********************************************************************************/
namespace ZXK.LouDiXvMuNiu
{
public class HomeState : State
{
public override string _SceneName => "Home";
public HomeState(StateContext stateContext) : base(stateContext)
{
}
public override void EnterState()
{
UI_Manage.Instance.ShowPanel("HomePanel", Type.GetType("ZXK.LouDiXvMuNiu.HomePanel"), UIGroup.Main);
2025-04-25 13:18:03 +08:00
#if UNITY_WEBGL
GameManager.Instance.StartCoroutine(LoadTimer());
#else
2025-04-23 13:36:40 +08:00
DateManager.UpdateTime(Tip, Tip, success: () =>
{
2025-04-25 13:18:03 +08:00
2025-04-23 13:36:40 +08:00
});
2025-04-25 13:18:03 +08:00
#endif
2025-04-23 13:36:40 +08:00
}
2025-04-25 13:18:03 +08:00
IEnumerator LoadTimer()
{
string path = Path.Combine(Application.streamingAssetsPath, "Timer.txt");
using (UnityWebRequest request = new UnityWebRequest(path))
{
request.downloadHandler = new DownloadHandlerBuffer();
yield return request.SendWebRequest();
if (string.IsNullOrEmpty(request.error))
{
string datas = DecryptFileReader.ReadAndDecryptData(request.downloadHandler.data);
DateManager.UpdateTime(datas,Tip, Tip, success: () =>
{
});
}
else
{
Debug.LogError(request.error);
}
}
}
2025-04-23 13:36:40 +08:00
public void Tip(string str)
{
PopUpMng.PopAlert("", str, <><C8B7>", () =>
{
Application.Quit();
});
2025-01-02 12:15:45 +08:00
}
}
}