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 { 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(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(this, E_UI_Layer.System, (p) => { AudioManager.tipsSource = Camera.main.AddComponent(); }); }); } private IEnumerator Post() { Dictionary headers = new Dictionary(); WWWForm wWWForm = new WWWForm(); headers.Add("", ""); yield return new WaitForSeconds(0.5f); StartCoroutine(PostString("", wWWForm, headers, "", data => { Debug.Log("提交结果:" + data); })); } public static T LoadData(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(jsonStr); } else { Debug.LogError(fileName + ".json not found"); return default(T); } } // Update is called once per frame void Update() { } }