模块加载改为排序加载
This commit is contained in:
parent
44fffc2b5a
commit
f54e479c9b
@ -172,8 +172,8 @@ public class ActionHelper
|
|||||||
}
|
}
|
||||||
case "LoadRes":
|
case "LoadRes":
|
||||||
{
|
{
|
||||||
var strAction = (XMLTool.StringListAction)act;
|
var dictAction = (XMLTool.DictionaryAction)act;
|
||||||
return LoadResAction.Allocate(act.Value, strAction.args[0]);
|
return LoadResAction.Allocate(act.Value, dictAction.args);
|
||||||
}
|
}
|
||||||
case "Audio":
|
case "Audio":
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using XMLTool;
|
using XMLTool;
|
||||||
@ -21,14 +22,16 @@ namespace QFramework
|
|||||||
|
|
||||||
string fileName;
|
string fileName;
|
||||||
string type;
|
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();
|
var retNode = mPool.Allocate();
|
||||||
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||||||
retNode.Deinited = false;
|
retNode.Deinited = false;
|
||||||
retNode.Reset();
|
retNode.Reset();
|
||||||
retNode.fileName = fileName;
|
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;
|
retNode.OnFinished = OnFinished;
|
||||||
return retNode;
|
return retNode;
|
||||||
}
|
}
|
||||||
@ -55,7 +58,10 @@ namespace QFramework
|
|||||||
XDocument doc = XDocument.Parse(xmlStr);
|
XDocument doc = XDocument.Parse(xmlStr);
|
||||||
// »ñÈ¡¸ùÔªËØ
|
// »ñÈ¡¸ùÔªËØ
|
||||||
XElement moduleXml = doc.Root;
|
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;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Xml.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using XMLTool;
|
using XMLTool;
|
||||||
|
|
||||||
@ -35,6 +36,6 @@ public class Global : Singleton<Global>
|
|||||||
|
|
||||||
public static AppType appTpe = AppType.UnKnow;
|
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);
|
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>();
|
yield return UIKit.OpenPanelAsync<UIModeSelect>();
|
||||||
UIKit.HidePanel<UILoading>();
|
UIKit.HidePanel<UILoading>();
|
||||||
|
|
||||||
|
|||||||
@ -362,7 +362,7 @@ namespace XMLTool
|
|||||||
var animName = action.Attribute("animName");
|
var animName = action.Attribute("animName");
|
||||||
if (animName != null)
|
if (animName != null)
|
||||||
{
|
{
|
||||||
act.args.Add("animName",animName.Value);
|
act.args.Add("animName", animName.Value);
|
||||||
}
|
}
|
||||||
var frame = action.Attribute("frame");
|
var frame = action.Attribute("frame");
|
||||||
if (frame != null)
|
if (frame != null)
|
||||||
@ -585,7 +585,7 @@ namespace XMLTool
|
|||||||
XAttribute isShow = action.Attribute("isShow");
|
XAttribute isShow = action.Attribute("isShow");
|
||||||
if (isShow != null)
|
if (isShow != null)
|
||||||
{
|
{
|
||||||
act.args.Add("isShow",isShow.Value);
|
act.args.Add("isShow", isShow.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
XAttribute isDevice = action.Attribute("isDevice");
|
XAttribute isDevice = action.Attribute("isDevice");
|
||||||
@ -784,15 +784,16 @@ namespace XMLTool
|
|||||||
break;
|
break;
|
||||||
case "LoadRes":
|
case "LoadRes":
|
||||||
{
|
{
|
||||||
var act = new StringListAction();
|
var act = new DictionaryAction();
|
||||||
XAttribute resType = action.Attribute("resType");
|
XAttribute resType = action.Attribute("resType");
|
||||||
if (resType != null)
|
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;
|
newAction = act;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user