private void UnSaveShare() { if (schemeManifest.isUnUpLoaded == false) { Share(); return; } if (string.IsNullOrEmpty(schemeManifest.templateId) == true) { Debug.LogWarning("本地方案不保存无法分享"); } else { OriginalProjectData originalProjectData = jsonCacheManager.GetCurrentOriginalProjectData(); originalProjectData.id = schemeManifest.templateId; //101007 分享 title content photo HT5url collectTypr MsgToIOS msg = new MsgToIOS(); msg.code = "101007"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.shareType = 0; msg.info.projectData = originalProjectData; msg.info.projectData.meta = originalProjectData.meta; UnityIOSMsg.sendToIOS(msg); } }
private void SendInfo() { MsgToIOS msg = new MsgToIOS(); msg.code = "101003"; UnityIOSMsg.sendToIOS(msg); }
private void OnShareMainOffer() { Debug.Log("分享主报价"); //Debug.Log("报价分享"); //101007 分享 title content photo HT5url collectTypr if (currentCannotEditorablePricedata.isTargetUnUpload == true) { Debug.LogWarning("请先上传方案"); MessageBox.Instance.ShowOkCancelClose("", "请先上传方案", null, SaveToScheme); //提示:请先上传方案! return; } if (currentCannotEditorablePricedata.isUnUpload == true) { Debug.LogWarning("请先上传报价"); MessageBox.Instance.ShowOkCancelClose("", "请先上传报价", null, BeforeSaveOffer); //提示:请先上传报价或者正在上传! return; } 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 SaveOffer() { MsgToIOS msg = new MsgToIOS(); msg.code = "101101"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.priceData = currentCannotEditorablePricedata; UnityIOSMsg.sendToIOS(msg, IOSEvent.SetOfferId, SetOfferId); //machine.setState(SaveState.Name); }
public override void enter() { base.enter(); MsgToIOS msg = new MsgToIOS(); msg.code = "101008"; MsgToIOS.InfoToIOS info = new MsgToIOS.InfoToIOS(); info.goodsId = target.seekId; info.image = targetProduct.tempTexture; info.collectType = 1;/*data.isNew == true ? 1 : 0;*/ msg.info = info; UnityIOSMsg.sendToIOS(msg); }
private void AddMaterial() { if (Application.platform == RuntimePlatform.IPhonePlayer) { MsgToIOS msg = new MsgToIOS(); msg.code = "101002"; UnityIOSMsg.sendToIOS(msg, IOSEvent.SelectGoods, OnSelected); } else { tempDo(); } }
private void Share() { OriginalProjectData originalProjectData = jsonCacheManager.GetCurrentOriginalProjectData(); //101007 分享 title content photo HT5url collectTypr MsgToIOS msg = new MsgToIOS(); msg.code = "101007"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.shareType = 0; msg.info.projectData = originalProjectData; msg.info.projectData.meta = originalProjectData.meta; UnityIOSMsg.sendToIOS(msg); }
private void ShareImage(MyEvent obj) { MsgToIOS msg = new MsgToIOS(); msg.code = "101007"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.shareType = 2; msg.info.templateId = schemeManifest.templateId; if (schemeManifest.tempEffectMetas.Count != 0) { msg.info.msg = schemeManifest.tempEffectMetas[0]; } UnityIOSMsg.sendToIOS(msg); }
public override void enter() { base.enter(); //打开IOS界面选择切换的物体返回 if (Application.platform == RuntimePlatform.IPhonePlayer) { MsgToIOS msg = new MsgToIOS(); msg.code = "101002"; UnityIOSMsg.sendToIOS(msg, IOSEvent.SelectGoods, OnSelected); } else { tempDo(); } }
public override void enter() { base.enter(); if (Application.platform == RuntimePlatform.IPhonePlayer) { MsgToIOS msg = new MsgToIOS(); msg.code = "101009"; UnityIOSMsg.sendToIOS(msg); setState(MainPageFreeState.Name); } else { tempDo(); } setState(MainPageFreeState.Name); inputMachine.setState(FreeState2D.NAME); }
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); }
public override void enter() { base.enter(); if (undoHelper.currentData.SaveId != 0) { //请先上传方案 Debug.LogWarning("分享 是否保存方案"); MessageBox.Instance.ShowOkCancelClose("分享方案", "是否保存方案", UnSaveShare, SaveSchemeToShare); } else if (schemeManifest.isUnUpLoaded == true) { if (string.IsNullOrEmpty(schemeManifest.templateId) == true) { //请先上传方案 Debug.LogWarning("分享 是否保存方案"); MessageBox.Instance.ShowOkCancelClose("分享方案", "请先上传方案", null, SaveSchemeToShare); } else { OriginalProjectData originalProjectData = jsonCacheManager.GetCurrentOriginalProjectData(); originalProjectData.id = schemeManifest.templateId; //101007 分享 title content photo HT5url collectTypr MsgToIOS msg = new MsgToIOS(); msg.code = "101007"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.shareType = 0; msg.info.projectData = originalProjectData; msg.info.projectData.meta = originalProjectData.meta; UnityIOSMsg.sendToIOS(msg); } } else { Share(); } if (inputMachine.currentInputIs2D) { inputMachine.setState(FreeState2D.NAME); } else { inputMachine.setState(FreeState3D.NAME); } }
private void onSelectToggle(bool isTrue) { //selectToggle.isOn = !selectToggle.isOn; Debug.Log(produce.seekId); if (isTrue == true) { MsgToIOS msg = new MsgToIOS(); msg.code = "101008"; MsgToIOS.InfoToIOS info = new MsgToIOS.InfoToIOS(); info.goodsId = produce.seekId; info.collectType = 1;//(isTrue == true)? 1:0; info.image = produce.tempTexture; msg.info = info; UnityIOSMsg.sendToIOS(msg, IOSEvent.Collect, OnCollect); MainPageUIController.Instance.SetCollected(produce.seekId, true); //if (cancelAddOffer != null) cancelAddOffer(this); return; } //itemData.isCollect = false; }
public static void sendToIOS(MsgToIOS msg, string ListionType = "", Action <MyEvent> handle = null) { if (string.IsNullOrEmpty(ListionType) == false) { myEventDispatcher.addEventListener(ListionType, handle); } string json = MyJsonTool.ToJson(msg); if (Application.platform == RuntimePlatform.IPhonePlayer) { //if (msg.code == "101002" || msg.code == "101003") //{ // Mode2DPrefabs.Instance.mainCamera.enabled = false; //} Debug.Log("sendToIOS:" + json); sendToIOS(json); } else { Debug.Log("sendToIOS + " + json); } }
public override void ready() { base.ready(); #region Top mainpage.exit.onClick.AddListener(onExit); mainpage.cancelSave.onClick.AddListener(onCancelSave); mainpage.confirmSave.onClick.AddListener(onConfirmSave); mainpage.exitSave.onClick.AddListener(onExitSave); mainpage.scheme.onClick.AddListener(onSchem); mainpage.open.onClick.AddListener(onOpen); mainpage.save.onClick.AddListener(onSave); mainpage.redo.onClick.AddListener(onReDo); mainpage.undo.onClick.AddListener(onUndo); mainpage.template.onClick.AddListener(onTemp); mainpage.innerLine.onClick.AddListener(onInner); mainpage.middleLine.onClick.AddListener(onMiddle); mainpage.measurement.onClick.AddListener(onMeasurement); mainpage.show.onClick.AddListener(onShow); mainpage.render.onClick.AddListener(onRender); mainpage.offer.onClick.AddListener(onOffer); mainpage.cameraView.onClick.AddListener(onCameraView); mainpage.share.onClick.AddListener(onShare); mainpage.twoD.onClick.AddListener(onTwoD); mainpage.thereD.onClick.AddListener(onThreeD); mainpage.material.onClick.AddListener(onMaterial); mainpage.loadExit.onClick.AddListener(Exit); #endregion #region Center mainpage.addButton.onClick.AddListener(onAdd); #endregion #region Bottom mainpage.query.onClick.AddListener(onQuery); mainpage.setup.onClick.AddListener(onSet_Up); #endregion #region ChildNode SchemePageController.Instance.SetData(mainpage.SkinScheme); KeyPageController.Instance.SetData(mainpage.SkinKeyBoard); SetWallController.Instance.SetData(mainpage.SkinSetWall); OptionsController.Instance.SetData(mainpage.SkinSelelctOptions); #endregion machine.Ready(); #region initialize machine.setState(MainPageFreeState.Name); cameraControl.mainCamera = mode2dprefab.mainCamera; cameraControl.uiCamera = mode2dprefab.uiCamera; //cameraControl.helpCamera = mode2dprefab.helpCamera; //CameraData data2D = new CameraData(LayerMask.GetMask("UI"), Vector3.forward * -30, Vector3.zero, true, 5); //CameraData data3D = new CameraData(LayerMask.GetMask("Default"), Vector3.forward * -12 + Vector3.up * 19, Vector3.right * 53); //data2D.setCamera(cameraControl.helpCamera); //data3D.setCamera(cameraControl.mainCamera); //CameraTextureData cameraData = new CameraTextureData(cameraControl.helpCamera); cameraMachine.setState(CameraState2D.NAME); inputMachine.setState(FreeState2D.NAME); #endregion #region aboutCache if (localOfferCache.isReady) { LocalOfferLoadReady(null); } else { localOfferCache.addEventListener(MyCacheEvent.loadReady, LocalOfferLoadReady); } if (serverOfferCache.isReady) { ServerOfferLoadReady(null); } else { serverOfferCache.addEventListener(MyCacheEvent.loadReady, ServerOfferLoadReady); } mainpageData.addEventListener(MainPageUIDataEvent.SchemeIdChanged, OnSchemeIdChange); #endregion this.addEventListener(LoadEvent.OpenLoadingPage, OpenLoadingPage); this.addEventListener(LoadEvent.RefreshLoadingPage, RefreshLoadingPage); this.addEventListener(LoadEvent.CloseLoadingPage, CloseLoadingPage); MsgToIOS msg = new MsgToIOS(); msg.code = "101001"; UnityIOSMsg.sendToIOS(msg); }
//private void SaveOffer() //{ // TestPrice price = new TestPrice(); // price.prices = undoHelper.currentData.schemeManifest.prices; // string json = MyJsonTool.ToJson(price); // WriteToLocal(Application.dataPath + "/offer.json", json); //} private IEnumerator Func(object[] arg1) { yield return(new WaitForEndOfFrame()); OriginalProjectData data = new OriginalProjectData(); //Camera camera3D = prefabs.mainCamera; //if (inputMachine.currentInputIs2D) //{ // view3D.RefreshView(); // prefabs.helpCamera.gameObject.SetActive(true); // camera3D = prefabs.helpCamera; //} TouchCaptureScreen.Instance.AoutCaptureScreenImage(); yield return(new WaitForSeconds(0.01f)); yield return(new WaitForEndOfFrame()); yield return(new WaitForSeconds(0.01f)); yield return(new WaitForEndOfFrame()); Texture2D texture = TouchCaptureScreen.Instance.texture; //CaptureScreen.Instance.CaptureCamera(camera3D); //mainpage.image.texture = texture; string textureEncoding = ""; if (texture != null) { byte[] bytes = texture.EncodeToJPG(); GameObject.DestroyImmediate(texture, true); texture = null; Resources.UnloadUnusedAssets(); if (inputMachine.currentInputIs2D) { //prefabs.helpCamera.gameObject.SetActive(false); } textureEncoding = System.Convert.ToBase64String(bytes, 0, bytes.Length, Base64FormattingOptions.None ); Debug.LogWarning("截屏成功"); } else { Debug.LogWarning("截屏失败"); } //if (Application.platform == RuntimePlatform.WindowsEditor) //{ // Debug.Log(textureEncoding); // WriteToLocal(Application.dataPath + "/OriginalProjectJson/textureEncoding/texture.txt", textureEncoding); //} schemeManifest.meta = data.meta = "data:image/jpeg;base64," + textureEncoding; originalInputData.BeforetSerializeFieldDo(); data.data = originalInputData; //SchemeManifest schemeManifest = schemePageControl.schemeManifest; data.name = schemeManifest.name; data.description = schemeManifest.description; data.isNew = schemeManifest.isNew; data.id = schemeManifest.id; data.tempId = schemeManifest.tempId; data.priceIdList = schemeManifest.prices; data.version = schemeManifest.version; string json = MyJsonTool.ToJson(data); jsonCacheManager.AddSchemeCache(data, json); MsgToIOS msg = new MsgToIOS(); msg.code = "101004"; MsgToIOS.InfoToIOS info = new MsgToIOS.InfoToIOS(); info.projectData = data; info.type = data.isNew == true ? 0 : 1; msg.info = info; if (info.type == 0) { UnityIOSMsg.sendToIOS(msg, IOSEvent.SetSchemeId, CreatScheme); } else { UnityIOSMsg.sendToIOS(msg); controller.dispatchEvent(new MyEvent(MySaveSchemeToShare.SaveSchemeToShare)); } setState(MainPageFreeState.Name); undoHelper.ResetSaveId(); }
private void OnGenerateOffer() { Debug.Log("生成报价"); if (currentEditorablePricedata == null) { return; } if (undoHelper.currentData.SaveId != 0) { this.addEventListener(SchemeEvent.SaveSchemeToGenerateOffer, SaveSchemeToGenerateOffer); MessageBox.Instance.ShowOkCancelClose("生成报价单", "生成报价前请先保存方案", null, SaveSchemeToOffer); return; } PriceData newpriceData = new PriceData(); newpriceData.priceList = new List <ItemData>(); newpriceData.isNew = true; newpriceData.tempId = jsonCacheManager.GetNewOfferTempId(); newpriceData.targetServerId = schemeManifest.id; newpriceData.targetTempId = schemeManifest.tempId; for (int i = 0; i < currentEditorablePricedata.priceList.Count; i++) { ItemPrice item = currentEditorablePricedata.priceList[i] as ItemPrice; if (item.isSelect == false) { continue; } ItemPrice newitem = new ItemPrice(); newitem.seekId = item.seekId; Product product = uiData.getProduct(newitem.seekId); newitem.image = product.tempTexture; newitem.productName = product.name; newitem.count = item.count; newpriceData.priceList.Add(newitem); } uiData.AddPriceData(newpriceData); jsonCacheManager.AddOfferCache(newpriceData); schemeManifest.prices.Add(newpriceData.tempId.ToString()); schemeManifestScroll.Display(offerList); OpenOffer(newpriceData); //currentPricedata = newpriceData; //CommonChangeChildActive(scheme.setMainOffer); //setMainOfferScroll.Display(newpriceData.priceList); if (newpriceData.isTargetUnUpload == true) { //方案还未上传 一定无法生成报价 return; } //上传报价 MsgToIOS msg = new MsgToIOS(); msg.code = "101101"; msg.info = new MsgToIOS.InfoToIOS(); msg.info.priceData = newpriceData; UnityIOSMsg.sendToIOS(msg, IOSEvent.SetOfferId, SetOfferId); }