private void OnLoadedAllProduct(MyEvent obj) { Debug.Log("queueloader Complete"); mainPageUIController.dispatchEvent(new LoadEvent(LoadEvent.CloseLoadingPage)); QueueSimpleLoader queueloader = obj.data as QueueSimpleLoader; OriginalProjectData data = queueloader.bringData as OriginalProjectData; undoHelper.SetCurrentData(data); }
private void OnLoadedAllProductCache(MyEvent obj) { Debug.Log("queueloader Complete"); mainPageUIController.dispatchEvent(new LoadEvent(LoadEvent.CloseLoadingPage)); QueueSimpleLoader queueloader = obj.data as QueueSimpleLoader; object[] objs = queueloader.bringData as object[]; string enterType = objs[0].ToString(); OriginalProjectData data = objs[1] as OriginalProjectData; switch (enterType) { case "4": case "5": undoHelper.SetCurrentData(data); break; default: undoHelper.SetCurrentData(data, false); break; } }
private void onloaded(object obj) { SimpleOutterLoader loader = obj as SimpleOutterLoader; if (loader.state == SimpleLoadedState.Failed) { //Debug.LogError(loader.uri); return; } string json = loader.loadedData.ToString(); object jsonData = MyJsonTool.FromJson(json); MsgFromIOS.InfoFromIOS info = loader.bringData as MsgFromIOS.InfoFromIOS; OriginalProjectData data = new OriginalProjectData(); Dictionary <string, object> dic = jsonData as Dictionary <string, object>; ///在线端数据 if (dic.ContainsKey("products")) { //data.DeSerialize(dic); } ///移动端新数据 else if (dic.ContainsKey("version")) { data.DeSerialize(dic); } ///移动端旧数据 或 错误数据 else { data.DeSerialize(dic); } switch (info.enterType) { case "4": case "5": data.isTemplate = true; data.isNew = true; data.templateId = info.projectId; data.id = ""; data.tempId = jsonCacheManager.GetNewSchemeTempId(); break; default: data.id = info.projectId; data.tempId = info.tempId; data.isNew = false; break; } //data.templateId = info.templateId; data.tempEffectMetas.Clear(); List <object> matelist = info.msg as List <object>; for (int i = 0; i < matelist.Count; i++) { data.tempEffectMetas.Add(matelist[i].ToString()); } //放到队列加载后 //undoHelper.SetCurrentData(data); switch (info.enterType) { case "3": case "5": mainpageMachine.setState(ToThreeDState.Name); break; default: mainpageMachine.setState(ToTwoDState.Name); break; } float minX = 0; float maxX = 0; float minY = 0; float maxY = 0; for (int i = 0; i < data.data.pointList.Count; i++) { Vector2 v2 = data.data.pointList[i].pos; if (v2.x < minX) { minX = v2.x; } if (v2.x > maxX) { maxX = v2.x; } if (v2.y < minY) { minY = v2.y; } if (v2.y > maxY) { maxY = v2.y; } } Vector2 pos = Vector2.zero; pos.x = (minX + maxX) / 2; pos.y = (minY + maxY) / 2; CameraControler.Instance.ResetAllCamera(pos); QueueSimpleLoader queueloader = new QueueSimpleLoader(data); for (int i = 0; i < data.data.productList.Count; i++) { Product product = data.data.productList[i]; if (product.assetBundlePath.IndexOf("http://") == -1) { continue; //if (string.IsNullOrEmpty(product.model3d)) continue; } SimpleOutterLoader outLoader = LoaderPool.WaitOutterLoad(product.assetBundlePath, SimpleLoadDataType.prefabAssetBundle, null, product, onloadedBforClone); queueloader.AddQueueItem(outLoader); } if (queueloader.getCount != 0) { queueloader.addEventListener(LoadEvent.QueueProgress, OnAllProductProgress); queueloader.addEventListener(LoadEvent.QueueComplete, OnLoadedAllProduct); } else { undoHelper.SetCurrentData(data); } }