module支持有序加载

This commit is contained in:
shenjianxing 2025-01-08 17:20:18 +08:00
parent f54e479c9b
commit ee4c50c696
2 changed files with 21 additions and 14 deletions

View File

@ -58,10 +58,15 @@ namespace QFramework
XDocument doc = XDocument.Parse(xmlStr); XDocument doc = XDocument.Parse(xmlStr);
// »ñÈ¡¸ùÔªËØ // »ñÈ¡¸ùÔªËØ
XElement moduleXml = doc.Root; XElement moduleXml = doc.Root;
if (string.IsNullOrEmpty(index))
{
// ÎÞÐò¼ÓÔØ
XmlParser.LoadModule(moduleXml, Global.Instance.appData);
}
else
{
Global.moduleDict.Add(index, moduleXml); Global.moduleDict.Add(index, moduleXml);
}
// 直接加载会导致无序
//XmlParser.LoadModule(moduleXml, Global.Instance.appData);
} }
} }
}); });

View File

@ -41,8 +41,8 @@ public class Launch : MonoBehaviour
yield return new WaitUntil(() => isLoadFinished == true); yield return new WaitUntil(() => isLoadFinished == true);
if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null) if (Global.Instance.appData.preLoad != null && Global.Instance.appData.preLoad.action != null)
{ {
yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this); yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this, () =>
} {
// 暂时放在这里 // 暂时放在这里
if (Global.moduleDict.Count > 0) if (Global.moduleDict.Count > 0)
{ {
@ -55,6 +55,8 @@ public class Launch : MonoBehaviour
} }
} }
} }
});
}
yield return UIKit.OpenPanelAsync<UIModeSelect>(); yield return UIKit.OpenPanelAsync<UIModeSelect>();
UIKit.HidePanel<UILoading>(); UIKit.HidePanel<UILoading>();