public override void exit()
    {
        if (GlobalConfig.isMyDebug == true)
        {
#if !UNITY_ANDROID && !UNITY_IPHONE  //安卓
            MyTickManager.Remove(update);
#else
            MyTickManager.Remove(phoneUpdate);
#endif
        }
        else
        {
            if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
            {
                MyTickManager.Remove(phoneUpdate);
            }
            else
            {
                MyTickManager.Remove(update);
            }
        }
        if (rotateicon != null)
        {
            rotateicon.SetActive(false);
        }
        base.exit();
    }
Beispiel #2
0
    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 void render()
    {
        copylist.Clear();
        copylist.InsertRange(0, list);
        float time = Time.time;

        for (int i = 0; i < copylist.Count; i++)
        {
            HandleTask task = copylist[i];
            if (task.calltime == time)
            {
                continue;
            }
            float runTime = task.calltime + task.deletime;
            if (time < runTime)
            {
                continue;
            }
            task.Do();
            //copylist.Remove(task);
            //i--;
            list.Remove(task);
        }
        if (copylist.Count == 0)
        {
            MyTickManager.Remove(render);
        }
    }
Beispiel #4
0
    protected void Start()
    {
        uguiHitUI = UGUIHitUI.Instance;
        GlobalConfig.isMyDebug = isDebug;
        EventSystem.current.gameObject.AddComponent <MyStandaloneInputModule>();
        tickManager = MyTickManager.Instance;
        tickManager.add(TouchManager.Instance.update);
        //tickManager.add(ErrorDisplay.Instance.Update);

        Mode2DPrefabs mode2dprefab = Mode2DPrefabs.Instance;

        CacheModelManager.Instance.LoadCache();
        CacheServerSchemeManager.Instance.LoadCache();
        CacheLocalSchemeManager.Instance.LoadCache();
        CacheServerOfferManager.Instance.LoadCache();
        CacheLocalOfferManager.Instance.LoadCache();

        Application.targetFrameRate           = 60;
        Application.runInBackground           = true;
        Application.backgroundLoadingPriority = ThreadPriority.Normal;
        //防黑屏/
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        UIManager.Open(PageType.MainPage);
    }
Beispiel #5
0
    protected void Awake()
    {
        tickManager = MyTickManager.Instance;

        Application.targetFrameRate           = 60;
        Application.runInBackground           = true;
        Application.backgroundLoadingPriority = ThreadPriority.Normal;
        //防黑屏/
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        UIManager.Open(PageType.LoginPage);
    }
 public override void exit()
 {
     MyTickManager.Remove(update);
     inputMachine.setState(FreeState2D.NAME);
     toggleButton.onDown = false;
     template.skin.SetActive(false);
     //if (machine.nextIsCurrent == false)
     //{
     //    toggleButton.onDown = false;
     //    template.skin.SetActive(false);
     //}
     base.exit();
 }
Beispiel #7
0
    public override void exit()
    {
        //toggleButton.onDown = false;
        //UITool.SetActionFalse(optionPage.RectRotation.gameObject);

        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            MyTickManager.Remove(phoneUpdate);
        }
        else
        {
            MyTickManager.Remove(update);
        }
        base.exit();
    }
    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);
    }
Beispiel #9
0
 public override void exit()
 {
     toggleButton.onDown = false;
     UITool.SetActionFalse(obj);
     mainPageContr.CloseInput();
     view2D.selectGoodsdisedWalldata = null;
     if (machine.nextIsCurrent == false)
     {
         RefreshView();
     }
     optionsPage.inputUnit.onClick.RemoveListener(onOpenInput);
     optionsPage.ok.onClick.RemoveListener(Ok);
     optionsPage.cancel.onClick.RemoveListener(Cancel);
     MyTickManager.Remove(update);
     base.exit();
 }
    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 void Exit()
    {
        if (GlobalConfig.isMyDebug == true)
        {
#if !UNITY_ANDROID && !UNITY_IPHONE  //安卓
            if (needUpdate == true)
            {
                MyTickManager.Remove(mUpdate);
            }
            exitNotPhone();
#else
            if (needUpdate == true)
            {
                MyTickManager.Remove(mPhoneUpdate);
            }
            exitPhone();
#endif
        }
        else
        {
            if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
            {
                if (needUpdate == true)
                {
                    MyTickManager.Remove(mPhoneUpdate);
                }
                exitPhone();
            }
            else
            {
                if (needUpdate == true)
                {
                    MyTickManager.Remove(mUpdate);
                }
                exitNotPhone();
            }
        }

        exit();
    }
    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);
    }
Beispiel #14
0
    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);
        }
    }
    public override void exit()
    {
        machine.selectGoods3DState.onhandle = false;
        if (GlobalConfig.isMyDebug == true)
        {
#if !UNITY_ANDROID && !UNITY_IPHONE  //安卓
            MyTickManager.Remove(update);
#else
            MyTickManager.Remove(phoneUpdate);
#endif
        }
        else
        {
            if (Application.platform != RuntimePlatform.Android && Application.platform != RuntimePlatform.IPhonePlayer)
            {
                MyTickManager.Remove(update);
            }
            else
            {
                MyTickManager.Remove(phoneUpdate);
            }
        }
        base.exit();
    }
Beispiel #16
0
    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);
        }
    }
 new public void Exit()
 {
     MyTickManager.Remove(update);
     exit();
 }
    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);
    }
 new public void Enter()
 {
     enter();
     MyTickManager.Add(update);
 }
 private void Close()
 {
     template.skin.SetActive(false);
     MyTickManager.Remove(update);
 }
    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;
    }