public override void enter() { base.enter(); if (toggleButton.onDown == false) { setState(EditTypeOnSelect.Free); return; } //Debug.Log(obj.name); colli = null; disView = null; if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { MyTickManager.Add(phoneUpdate); } else { MyTickManager.Add(update); } awake(); //选择一个墙 更改距离 }
private bool add(float deletime, Action <object> handle, object data) { HandleTask task; if (tryGetTask(handle, out task)) { return(false); } task = new ObjActionTask(handle, deletime, data); list.Add(task); if (list.Count == 1) { MyTickManager.Add(render); } return(true); }
private bool add(float deletime, Action handle) { HandleTask task; if (tryGetTask(handle, out task)) { //Debug.LogWarning(handle.Method.Name + " false"); return(false); } //Debug.LogWarning(handle.Method.Name + " true"); task = new ActionTask(handle, deletime); list.Add(task); if (list.Count == 1) { MyTickManager.Add(render); } return(true); }
public void Enter() { if (GlobalConfig.isMyDebug == true) { #if UNITY_ANDROID || UNITY_IPHONE //安卓 if (needUpdate == true) { MyTickManager.Add(mPhoneUpdate); } enterPhone(); #else if (needUpdate == true) { MyTickManager.Add(mUpdate); } enterNotPhone(); #endif } else { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { //Debug.Log("RuntimePlatform.Android"); if (needUpdate == true) { MyTickManager.Add(mPhoneUpdate); } enterPhone(); } else { //Debug.Log("RuntimePlatform.Win7"); if (needUpdate == true) { MyTickManager.Add(mUpdate); } enterNotPhone(); } } enter(); }
public override void enter() { base.enter(); //if (template.skin.activeSelf == false) //{ // template.skin.SetActive(true); // MyTickManager.Add(update); //} //else //{ // setState(MainPageFreeState.Name); //} if (toggleButton.onDown == false) { setState(MainPageFreeState.Name); return; } template.skin.SetActive(true); MyTickManager.Add(update); }
public override void enter() { base.enter(); //if (toggleButton.onDown == false) //{ // setState(EditTypeOnSelect.Free); // UITool.SetActionFalse(optionPage.RectRotation.gameObject); // return; //} //UITool.SetActionTrue(optionPage.RectRotation.gameObject); productData = machine.selectGoodsState2D.target; viewTarget = machine.selectGoodsState2D.viewTarget; rotateObj = machine.selectGoodsState2D.rotateObj; Vector3 size = machine.selectGoodsState2D.targetProduct.size; targetSize = size.x * Vector3.right + size.z * Vector3.up; targetOffset = size.x / viewTarget.transform.localScale.x * Vector3.right + size.z / viewTarget.transform.localScale.y * Vector3.up; center = getV2(productData.position); startAngle = productData.rotate; if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { if (Input.touchCount < 1) { setState(EditTypeOnSelect.Free); return; } oldPos = startPos = inputCamera.ScreenToWorldPoint(Input.GetTouch(0).position); MyTickManager.Add(phoneUpdate); } else { oldPos = startPos = inputCamera.ScreenToWorldPoint(Input.mousePosition); MyTickManager.Add(update); } }
private IEnumerator load(object[] arg1) { //加载成功 但是加载到的数据不对 bool loadedIsWrong = false; string path = url; path = path.Replace("midea-products.oss-cn-shanghai.aliyuncs.com/", "pms.3dshome.net/"); Debug.LogWarning("OutterLoad:" + path); www = new WWW(path); if (checkProgress) { MyTickManager.Add(Progress); } yield return(www); //yield return new WaitForSeconds(2);//模拟慢网速 if (checkProgress) { MyTickManager.Remove(Progress); } //if (www == null) //{ // state = SimpleLoadedState.Failed; // loadedData = null; // string message = string.Format("加载文件失败:{0}", url); // Debug.Log(message); //} //else { if (string.IsNullOrEmpty(www.error)) { state = SimpleLoadedState.Success; switch (type) { case SimpleLoadDataType.prefabAssetBundle: //string realName = System.IO.Path.GetFileNameWithoutExtension(url); AssetBundle bundle = www.assetBundle; if (bundle != null) { UnityEngine.Object[] objs = bundle.LoadAllAssets(); for (int i = 0; i < objs.Length; i++) { if (objs[i].GetType() == typeof(GameObject)) { if (objs[i].name == modelName) { GameObject data = objs[i] as GameObject; data.name = uri; if (OnLoadprefabBeforClone != null) { OnLoadprefabBeforClone(data, bringData); } if (justLoad == false) { ResourcesPool.PrefabData prefab = resourcePool.addPrefab(httpUrl, data); if (canceled == false && justEndReturn == false) { loadedData = prefab.GetNew(); } } //loadedData = objs[i]; //resourcePool.addPrefab(url, loadedData); } } } if (localHas == false && string.IsNullOrEmpty(uri) == false) { if (cacheManager != null) { cacheManager.AddCache(httpUrl, www.bytes); } } if (justLoad == false) { bundle.Unload(false); } else { bundle.Unload(true); } } else { loadedIsWrong = true; Debug.LogError("加载到的资源不是AssetBundle!path = " + www.url); } break; case SimpleLoadDataType.texture2D: if (localHas == false && string.IsNullOrEmpty(uri) == false) { if (cacheManager != null) { cacheManager.AddCache(httpUrl, www.bytes); } } if (www.assetBundle != null) { if (justLoad == false) { loadedData = www.assetBundle.mainAsset as Texture2D;; resourcePool.addTexture(httpUrl, loadedData); www.assetBundle.Unload(false); } else { www.assetBundle.Unload(true); } } else { if (justLoad == false) { loadedData = www.texture; resourcePool.addTexture(httpUrl, loadedData); } } break; case SimpleLoadDataType.Json: string json = System.Text.Encoding.UTF8.GetString(www.bytes); int index = json.IndexOf("{"); if (index == -1) { index = json.IndexOf("["); } if (index > 0) { json = json.Substring(index); } //同一个Json可能会变化 不记录上次的 因为有可能是过时的 //if(localHas == false && string.IsNullOrEmpty(uri) == false) SaveToLocal(www.bytes); if (justLoad == false) { loadedData = json; } break; case SimpleLoadDataType.Byte: default: loadedData = null; string message = string.Format("加载文件类型:{0} 失败:", type); Debug.Log(message); break; } } else { state = SimpleLoadedState.Failed; loadedData = null; string message = string.Format("加载文件失败:{0} Error:{1}", www.url, www.error); Debug.LogWarning(message); } www.Dispose(); //Debug.LogWarning("OnLoaded"); if (loadedIsWrong == false)//没加载到资源 或者 加载到且正确 { OnLoaded(); } else { //加载资源且错误 等于加载失败 this.state = SimpleLoadedState.Failed; LoadNext(); EndOnly(); resourcePool.LoadErrorData(this); } }
public override void enter() { base.enter(); startAngle = target.rotate; rotateToScreenPos = prefabs.mainCamera.WorldToScreenPoint(target.GetV3Withheight()); if (GlobalConfig.isMyDebug == true) { #if !UNITY_ANDROID && !UNITY_IPHONE //安卓 if (Input.GetMouseButton(0) == false) { setState(EditTypeOnSelect.Free); return; } oldPos = startPos = Input.mousePosition; MyTickManager.Add(update); #else if (Input.touchCount != 1) { setState(EditTypeOnSelect.Free); return; } startPos = Input.GetTouch(0).position; MyTickManager.Add(phoneUpdate); #endif } else { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { if (Input.touchCount != 1) { setState(EditTypeOnSelect.Free); return; } startPos = Input.GetTouch(0).position; MyTickManager.Add(phoneUpdate); } else { if (Input.GetMouseButton(0) == false) { setState(EditTypeOnSelect.Free); return; } oldPos = startPos = Input.mousePosition; MyTickManager.Add(update); } } if (rotateicon == null) { rotateicon = prefabs.GetNewInstance_rotateicon(); } Vector3 worldpos = prefabs.uiCamera.ScreenToWorldPoint(startPos); worldpos.z = 0; rotateicon.transform.position = worldpos; rotateicon.SetActive(true); }
public override void enter() { base.enter(); machine.selectGoods3DState.onhandle = true; if (GlobalConfig.isMyDebug == true) { #if !UNITY_ANDROID && !UNITY_IPHONE //安卓 if (Input.GetMouseButton(0) == false) { setState(EditTypeOnSelect.Free); return; } startPos = Input.mousePosition; oldPos = startPos; MyTickManager.Add(update); #else if (Input.touchCount != 1) { setState(EditTypeOnSelect.Free); return; } startPos = Input.GetTouch(0).position; MyTickManager.Add(phoneUpdate); #endif } else { if (Application.platform != RuntimePlatform.Android && Application.platform != RuntimePlatform.IPhonePlayer) { if (Input.GetMouseButton(0) == false) { setState(EditTypeOnSelect.Free); return; } startPos = Input.mousePosition; oldPos = startPos; MyTickManager.Add(update); } else { if (Input.touchCount != 1) { setState(EditTypeOnSelect.Free); return; } startPos = Input.GetTouch(0).position; MyTickManager.Add(phoneUpdate); } } startHeight = target.height; Ray ray = prefabs.mainCamera.ScreenPointToRay(startPos); startY = ray.origin.y; Vector3 cameraPos = prefabs.mainCamera.transform.position; Vector3 pos = machine.selectGoods3DState.GetDisFloorPos(); float dis = Vector3.Distance(cameraPos, pos); Vector3 screenPos = prefabs.mainCamera.ScreenPointToRay(Vector3.right * Screen.width / 2 + Vector3.up * Screen.height / 2).origin; float screenDis = Vector3.Distance(cameraPos, screenPos); multiply = dis / screenDis * 2; }
new public void Enter() { enter(); MyTickManager.Add(update); }