80 lines
2.1 KiB
C#
80 lines
2.1 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
using static InterfaceManager;
|
|
public class Bootstrap : SingletonMono<Bootstrap>
|
|
{
|
|
public static UIManager UIMgr { get; private set; }
|
|
public EventCenter eventCenter;
|
|
public ScenesManager scenesManager;
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
UIMgr = new UIManager();
|
|
eventCenter = new EventCenter();
|
|
scenesManager = new ScenesManager();
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
UIMgr.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
|
|
{
|
|
eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.1f);
|
|
scenesManager.LoadSceneAsyn(this, "MainScene", () =>
|
|
{
|
|
Debug.Log("¼ÓÔØ³¡¾°³É¹¦");
|
|
eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.9f);
|
|
});
|
|
UIMgr.ShowPanel<UI_BGPanel>(this, E_UI_Layer.System, (p) =>
|
|
{
|
|
AudioManager.tipsSource = Camera.main.AddComponent<AudioSource>();
|
|
});
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerator Post()
|
|
{
|
|
Dictionary<string, string> headers = new Dictionary<string, string>();
|
|
WWWForm wWWForm = new WWWForm();
|
|
headers.Add("", "");
|
|
yield return new WaitForSeconds(0.5f);
|
|
StartCoroutine(PostString("", wWWForm, headers, "", data =>
|
|
{
|
|
Debug.Log("Ìá½»½á¹û:" + data);
|
|
}));
|
|
}
|
|
|
|
|
|
public static T LoadData<T>(string fileName)
|
|
{
|
|
var filePath = Path.Combine(Application.streamingAssetsPath, "StateTrendConfig", fileName)+".json";
|
|
if (File.Exists(filePath))
|
|
{
|
|
var jsonStr = File.ReadAllText(filePath);
|
|
Debug.Log("jsonStr:" + jsonStr);
|
|
return JsonConvert.DeserializeObject<T>(jsonStr);
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError(fileName + ".json not found");
|
|
return default(T);
|
|
}
|
|
}
|
|
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
}
|