模块加载改为排序加载
This commit is contained in:
parent
44fffc2b5a
commit
f54e479c9b
@ -172,8 +172,8 @@ public class ActionHelper
|
||||
}
|
||||
case "LoadRes":
|
||||
{
|
||||
var strAction = (XMLTool.StringListAction)act;
|
||||
return LoadResAction.Allocate(act.Value, strAction.args[0]);
|
||||
var dictAction = (XMLTool.DictionaryAction)act;
|
||||
return LoadResAction.Allocate(act.Value, dictAction.args);
|
||||
}
|
||||
case "Audio":
|
||||
{
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using XMLTool;
|
||||
@ -21,14 +22,16 @@ namespace QFramework
|
||||
|
||||
string fileName;
|
||||
string type;
|
||||
public static LoadResAction Allocate(string fileName, string type, System.Action OnFinished = null)
|
||||
string index;
|
||||
public static LoadResAction Allocate(string fileName, Dictionary<string, string> datas, System.Action OnFinished = null)
|
||||
{
|
||||
var retNode = mPool.Allocate();
|
||||
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||||
retNode.Deinited = false;
|
||||
retNode.Reset();
|
||||
retNode.fileName = fileName;
|
||||
retNode.type = type;
|
||||
retNode.type = datas.ContainsKey("resType") ? datas["resType"] : string.Empty;
|
||||
retNode.index = datas.ContainsKey("index") ? datas["index"] : string.Empty;
|
||||
retNode.OnFinished = OnFinished;
|
||||
return retNode;
|
||||
}
|
||||
@ -55,7 +58,10 @@ namespace QFramework
|
||||
XDocument doc = XDocument.Parse(xmlStr);
|
||||
// »ñÈ¡¸ùÔªËØ
|
||||
XElement moduleXml = doc.Root;
|
||||
XmlParser.LoadModule(moduleXml, Global.Instance.appData);
|
||||
Global.moduleDict.Add(index, moduleXml);
|
||||
|
||||
// Ö±½Ó¼ÓÔØ»áµ¼ÖÂÎÞÐò
|
||||
//XmlParser.LoadModule(moduleXml, Global.Instance.appData);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -2,6 +2,7 @@ using QFramework;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using XMLTool;
|
||||
|
||||
@ -35,6 +36,6 @@ public class Global : Singleton<Global>
|
||||
|
||||
public static AppType appTpe = AppType.UnKnow;
|
||||
|
||||
|
||||
public static Dictionary<string, XElement> moduleDict = new Dictionary<string, XElement>();
|
||||
|
||||
}
|
||||
|
||||
@ -43,6 +43,18 @@ public class Launch : MonoBehaviour
|
||||
{
|
||||
yield return ActionHelper.GetActionAndSub(Global.Instance.appData.preLoad.action).Start(this);
|
||||
}
|
||||
// 暂时放在这里
|
||||
if (Global.moduleDict.Count > 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
yield return UIKit.OpenPanelAsync<UIModeSelect>();
|
||||
UIKit.HidePanel<UILoading>();
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ namespace XMLTool
|
||||
var animName = action.Attribute("animName");
|
||||
if (animName != null)
|
||||
{
|
||||
act.args.Add("animName",animName.Value);
|
||||
act.args.Add("animName", animName.Value);
|
||||
}
|
||||
var frame = action.Attribute("frame");
|
||||
if (frame != null)
|
||||
@ -585,7 +585,7 @@ namespace XMLTool
|
||||
XAttribute isShow = action.Attribute("isShow");
|
||||
if (isShow != null)
|
||||
{
|
||||
act.args.Add("isShow",isShow.Value);
|
||||
act.args.Add("isShow", isShow.Value);
|
||||
}
|
||||
|
||||
XAttribute isDevice = action.Attribute("isDevice");
|
||||
@ -784,15 +784,16 @@ namespace XMLTool
|
||||
break;
|
||||
case "LoadRes":
|
||||
{
|
||||
var act = new StringListAction();
|
||||
var act = new DictionaryAction();
|
||||
XAttribute resType = action.Attribute("resType");
|
||||
if (resType != null)
|
||||
{
|
||||
act.args.Add(resType.Value);
|
||||
act.args.Add("resType", resType.Value);
|
||||
}
|
||||
else
|
||||
XAttribute index = action.Attribute("index");
|
||||
if (index != null)
|
||||
{
|
||||
act.args.Add("");
|
||||
act.args.Add("index", index.Value);
|
||||
}
|
||||
newAction = act;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user