public void AddPhyRes(string resPath, PhyResouce phyRes) { if (GetPhyRes(resPath) != null) { return; } phyResDic[resPath] = phyRes; }
public UnityEngine.Object getInitiateObject() { PhyResouce pRes = ResourceManager.Instance.GetPhyRes(resPath); if (pRes != null) { UnityEngine.Object obj = pRes.assetBundle.mainAsset; return(GameObject.Instantiate(obj)); } return(null); }
private void OnSceneLoadComplete() { LogicResouce lRes = ResourceManager.Instance.GetLogicRes(SceneRes); //LogicResourceBuilder builder = null; LightmapSettings.lightmapsMode = LightmapsMode.Single; LightmapSettings.lightmapsMode = LightmapsMode.Single; Dictionary <int, Texture2D> lightMapDic = new Dictionary <int, Texture2D>(); foreach (string s in lRes.phyResList) { if (s.Contains("LightmapFar")) { string[] strs = s.Split(new char[] { '-', '.' }); if (strs != null && strs.Length > 0) { int index = Int32.Parse(strs[strs.Length - 2]);//strs[Length - 1]; if (lightMapDic.ContainsKey(index)) { } else { lightMapDic.Add(index, ResourceManager.Instance.GetPhyRes(s).getTexture()); } } } if (s.Contains("LightProbe")) { PhyResouce probe = ResourceManager.Instance.GetPhyRes(s); if (probe != null) { LightProbes probes = (LightProbes)probe.assetBundle.mainAsset; LightmapSettings.lightProbes = probes; } } } LightmapData[] ldarr = new LightmapData[lightMapDic.Count]; foreach (KeyValuePair <int, Texture2D> kv in lightMapDic) { LightmapData ld = new LightmapData(); ld.lightmapFar = kv.Value; ldarr[kv.Key] = ld; } LightmapSettings.lightmaps = ldarr; PhyResouce res = ResourceManager.Instance.GetPhyRes(SceneRes); UnityEngine.Object obj = res.assetBundle.mainAsset; GameObject.Instantiate(obj); }
private bool isAllLogicRootComplete() { foreach (LogicLoadRequest r in logicReqDic.Values) { PhyResouce res = ResourceManager.Instance.GetPhyRes(r.resPath); if (res == null) { return(false); } } return(true); }
// public void Update() { if (loadProcess != null) { if (loadProcess.isLoading == true) { loadProcess.Update(); } } List <string> removeLoadList = new List <string>(); //遍历loadimplement foreach (LoadImplement l in loadImplDic.Values) { if (l.www.isDone == true) { if (l.www.error == null) { if (l.createReq == null) { l.createReq = AssetBundle.CreateFromMemory(l.www.bytes); } if (l.createReq.isDone == true) { // GameDefine.GameMethod.DebugError("Load Res Success:" + l.resPath); PhyResouce phyRes = new PhyResouce(); phyRes.resPath = l.resPath; phyRes.phyResType = l.phyResType; phyRes.assetBundle = l.createReq.assetBundle; //if(phyResDic.ContainsKey(phyRes.resPath) == true) //{ // Debug.LogError("already have:"+phyRes.resPath); //} //else // Debug.LogError("phy res :" + phyRes.resPath); phyResDic.Add(phyRes.resPath, phyRes); // } removeLoadList.Add(l.resPath); } } else { GameDefine.GameMethod.DebugError("Load Res Failed:" + l.www.url + "======" + l.resPath + " error is:" + l.www.error.ToString()); removeLoadList.Add(l.resPath); } } } foreach (string s in removeLoadList) { LoadImplement l = getLoadImplement(s); if (l.onResLoaded != null) { l.onResLoaded(l.resPath); } loadImplDic.Remove(s); } List <string> removeBuilderList = new List <string>(); foreach (LogicResourceBuilder builder in logicResBuilder.Values) { bool allLoaded = true; foreach (string s in builder.resLists) { if (GetPhyRes(s) == null) { allLoaded = false; break; } } if (allLoaded == true) { removeBuilderList.Add(builder.resPath); if (builder.onLogicResourceBuilded != null) { builder.onLogicResourceBuilded(builder.resPath); } LogicResouce logicRes = new LogicResouce(); logicRes.resPath = builder.resPath; logicRes.logicResType = builder.logicResType; logicRes.phyResList = builder.resLists; if (logicResDic.ContainsKey(logicRes.resPath) == true) { logicResDic[logicRes.resPath] = logicRes; } else { logicResDic.Add(logicRes.resPath, logicRes); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } } foreach (string s in removeBuilderList) { logicResBuilder.Remove(s); } // }