private void SetOfferId(MyEvent obj) { IOSEvent e = obj as IOSEvent; MsgFromIOS.InfoFromIOS info = e.data as MsgFromIOS.InfoFromIOS; //根据临时tempId找到数据 PriceData priceData = GetPriceData(info.tempId); PriceData priceData = uiData.GetPriceData(info.tempId.ToString()); if (priceData == null) { return; } //删除本地临时缓存-未上传服务器的数据 jsonCacheManager.RemoveOfferCache(priceData.tempId); //移除字典中按本地临时id存储的数据--为后面用新正式的id重新存入 uiData.RemovePriceData(priceData.targetId, priceData.stringId); //移除当前数据的报价列表中的临时info.tempId schemeManifest.prices.Remove(info.tempId.ToString()); // 给数据赋值服务器给的新id priceData.serverId = info.priceId; priceData.serverId = info.priceId; //存入服务器报价缓存 jsonCacheManager.AddOfferCache(priceData); //重新存入字典 报价不会变动 下一次也可以直接使用 防止下次使用再去加载 uiData.AddPriceData(priceData); //添加当前数据的报价列表info.priceId schemeManifest.prices.Add(info.priceId); //抛报价本地变服务器的事件 此处用处不大 SetOfferId(MyEvent obj)本身就是监听的UnityIOSMsg的事件 this.dispatchEvent(new MainPageUIDataEvent(MainPageUIDataEvent.OfferIdChanged, e.data)); }
private void OnSchemeIdChanged(MyEvent obj) { this.removeEventListener(MainPageUIDataEvent.SchemeIdChanged, OnSchemeIdChanged); MsgFromIOS.InfoFromIOS info = obj.data as MsgFromIOS.InfoFromIOS; if (currentCannotEditorablePricedata.targetId == info.tempId.ToString()) { currentCannotEditorablePricedata.targetServerId = info.projectId; } //MessageBox.instance.Show("请先上传报价", "", null, BeforeSaveOffer, null, MessageBoxButton.CancelOK); BeforeSaveOffer(); }
private void CreatScheme(MyEvent obj) { //UnityIOSMsg.removeListioner(IOSEvent.CreatScheme, CreatScheme); IOSEvent e = obj as IOSEvent; MsgFromIOS.InfoFromIOS info = (MsgFromIOS.InfoFromIOS)e.data; schemeManifest.id = info.projectId; schemeManifest.isNew = false; cacheLocalSchemeManager.RemoveSchemeCache(schemeManifest.tempId); jsonCacheManager.SaveSchemeToLocal(); //抛方案本地变服务器的事件 用于临时方案临时报价列表-变成-服务器方案临时报价列表 mainpageData.dispatchEvent(new MainPageUIDataEvent(MainPageUIDataEvent.SchemeIdChanged, info)); controller.dispatchEvent(new MyEvent(MySaveSchemeToShare.SaveSchemeToShare)); schemePageControl.dispatchEvent(new MyEvent(SchemeEvent.GenerateOffer)); }
private void EnterDesign(MsgFromIOS.InfoFromIOS info) { GlobalConfig.running = true; if (Application.platform != RuntimePlatform.IPhonePlayer) { info.msg = new List <object>() { "http://cf-hsm-prod-assets.homestyler.com/i/4abd1bba-6d61-481e-9008-25295599e006/iso.jpg" }; } switch (info.enterType) { case "1": undoHelper.CreatNewEnter(); mainpageMachine.setState(ToTwoDState.Name); break; case "2": //进入2D case "3": //进入3D case "4": //进入新建方案2D 预置指定模板 case "5": //进入新建方案3D 预置指定模板 mainPageUIController.dispatchEvent(new LoadEvent(LoadEvent.OpenLoadingPage)); string id = info.projectId; int tempId = info.tempId; if (string.IsNullOrEmpty(id) == true) { if (localCache.HasCached(tempId)) { LoaderPool.CacheLoad(tempId, SimpleLoadDataType.JsonScheme, OnCacheLoaded, info); return; } } else { if (serverCache.HasCached(id)) { LoaderPool.CacheLoad(id, SimpleLoadDataType.JsonScheme, OnCacheLoaded, info); return; } } LoaderPool.OutterLoad(info.json, SimpleLoadDataType.Json, onloaded, info); break; default: break; } }
private void OnOfferIdChanged(MyEvent obj) { this.removeEventListener(MainPageUIDataEvent.OfferIdChanged, OnOfferIdChanged); MsgFromIOS.InfoFromIOS info = obj.data as MsgFromIOS.InfoFromIOS; if (currentCannotEditorablePricedata.stringId == info.tempId.ToString()) { currentCannotEditorablePricedata.serverId = info.priceId; } MsgToIOS msg = new MsgToIOS(); msg.code = "101007"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.shareType = 1; msg.info.priceData = currentCannotEditorablePricedata; UnityIOSMsg.sendToIOS(msg); }
private void OnSchemeIdChange(MyEvent obj) { MainPageUIDataEvent e = obj as MainPageUIDataEvent; MsgFromIOS.InfoFromIOS info = (MsgFromIOS.InfoFromIOS)e.data; Dictionary <string, PriceData> outDic; if (mainpageData.allPriceDic.TryGetValue(info.tempId.ToString(), out outDic)) { mainpageData.allPriceDic.Remove(info.tempId.ToString()); mainpageData.allPriceDic.Add(info.projectId, outDic); foreach (PriceData offer in outDic.Values) { offer.targetServerId = info.projectId; jsonCacheManager.AddOfferCache(offer); } } }
private void OnCollect(MyEvent obj) { IOSEvent e = obj as IOSEvent; MsgFromIOS.InfoFromIOS info = (MsgFromIOS.InfoFromIOS)e.data; switch (info.CollectType) { case "0": collecte.isOn = false; break; case "1": collecte.isOn = true; break; default: break; } }
private void OnCollect(MyEvent obj) { //UnityIOSMsg.removeListioner(IOSEvent.Collect, OnCollect); IOSEvent e = obj as IOSEvent; MsgFromIOS.InfoFromIOS info = (MsgFromIOS.InfoFromIOS)e.data; //if (info.result == "0") //{ // return; //} switch (info.CollectType) { case "0": selectToggle.isOn = false; break; case "1": selectToggle.isOn = true; break; default: 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); } }