66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using CG.Framework;
|
|
using CG.UTility;
|
|
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
/********************************************************************************
|
|
*Create By CG
|
|
*Function Ö÷ҳ״̬
|
|
*********************************************************************************/
|
|
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);
|
|
|
|
#if UNITY_WEBGL
|
|
GameManager.Instance.StartCoroutine(LoadTimer());
|
|
#else
|
|
DateManager.UpdateTime(Tip, Tip, success: () =>
|
|
{
|
|
|
|
});
|
|
#endif
|
|
}
|
|
|
|
IEnumerator LoadTimer()
|
|
{
|
|
string path = Path.Combine(Application.streamingAssetsPath, "Timer.txt");
|
|
Debug.LogError(path);
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void Tip(string str)
|
|
{
|
|
PopUpMng.PopAlert("", str, "È·¶¨", () =>
|
|
{
|
|
Application.Quit();
|
|
});
|
|
}
|
|
}
|
|
}
|