84 lines
2.4 KiB
C#
Raw Normal View History

2024-12-14 18:27:59 +08:00
using FlappyBird;
using QAssetBundle;
using QFramework;
using QFramework.Example;
using System.Collections;
using UnityEngine;
using XMLTool;
public class Launch : MonoBehaviour
{
ResLoader loader;
private void Awake()
{
loader = ResLoader.Allocate();
StartCoroutine(StartApp());
2025-03-24 14:32:22 +08:00
#if VR
Utility.FindObj("FlyCamera")?.SetActive(false);
#endif
2024-12-14 18:27:59 +08:00
}
IEnumerator StartApp()
{
yield return ResKit.InitAsync();
2024-12-18 16:20:06 +08:00
bool isLoadFinished = false;
2024-12-16 13:25:22 +08:00
loader.Add2Load(Global.appXmlPath.ToLocalTextResName(), (success, res) =>
2024-12-14 18:27:59 +08:00
{
if (success)
{
Global.Instance.appData = XmlParser.ParseXml(res.As<LocalTextRes>().text);
2024-12-14 18:27:59 +08:00
}
});
loader.LoadAsync(() =>
{
2024-12-18 16:20:06 +08:00
isLoadFinished = true;
2024-12-14 18:27:59 +08:00
ActionKit.Delay(2f, () =>
{
loader.Recycle2Cache();
loader = null;
});
});
2024-12-18 16:20:06 +08:00
yield return UIKit.OpenPanelAsync<UILoading>();
2025-03-27 15:48:22 +08:00
StringEventSystem.Global.Send("CloseDefaultLoading");
2025-03-27 13:14:48 +08:00
yield return UIKit.OpenPanelAsync<UIDeviceTip>(canvasLevel: UILevel.PopUI);
UIKit.GetPanel<UIDeviceTip>().Hide();
2024-12-18 16:20:06 +08:00
yield return new WaitUntil(() => isLoadFinished == true);
2024-12-19 11:52:56 +08:00
if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null)
{
2025-01-08 17:20:18 +08:00
yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this, () =>
2025-01-08 17:05:35 +08:00
{
2025-01-08 17:20:18 +08:00
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (Global.moduleDict.Count > 0)
2025-01-08 17:05:35 +08:00
{
2025-01-08 17:20:18 +08:00
for (int i = 0; i < Global.moduleDict.Count; i++)
{
string index = (i + 1).ToString();
if (Global.moduleDict.ContainsKey(index))
{
XmlParser.LoadModule(Global.moduleDict[index], Global.Instance.appData);
}
}
2025-01-08 17:05:35 +08:00
}
2025-01-08 17:20:18 +08:00
});
2025-01-08 17:05:35 +08:00
}
2024-12-14 18:27:59 +08:00
yield return UIKit.OpenPanelAsync<UIModeSelect>();
2024-12-18 16:20:06 +08:00
UIKit.HidePanel<UILoading>();
2024-12-14 18:27:59 +08:00
// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
//foreach (var item in Global.Instance.appData.ActionDict)
//{
// var act = ActionHelper.GetAction(item.Value);
// act.Start(this, () => Debug.LogError("<22><><EFBFBD>ɡ<EFBFBD><C9A1><EFBFBD><EFBFBD><EFBFBD>"));
//}
}
2024-12-18 16:20:06 +08:00
2024-12-27 17:25:30 +08:00
2024-12-14 18:27:59 +08:00
}