예제 #1
0
    public void Load()
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogError("NeedLoadstring.IsNullOrEmpty(url) == true");
            return;
        }
        //Debug.LogWarning("NeedLoad"+url);
        state = SimpleLoadedState.Loading;

        ResourcesPool.LoadPoolData data;
        if (resourcePool.TryGet(keyUrl, out data))
        {
            data.newUseTime = Time.realtimeSinceStartup;
            //Debug.LogError("LoadInPool  +  keyUrl = " + keyUrl);
            MyCallLater.Add(LoadInPool, 0, data);

            return;
        }

        bool add = resourcePool.addLoading(this);

        if (add)
        {
            if (loaders.Count < LoaderCount)
            {
                loaders.Add(this);
                StartLoad();
            }
            else
            {
                loaderStack.Push(this);
            }
        }
    }
예제 #2
0
    public override void enter()
    {
        base.enter();
        if (inputMachine.currentInputIs2D)
        {
            inputMachine.setState(FreeState2D.NAME);
        }
        else
        {
            inputMachine.setState(FreeState3D.NAME);
        }
        if (Application.platform == RuntimePlatform.Android)
        {
            Application.Quit();
        }
        else if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            undoHelper.ClearView();
            RefreshView();
            GlobalConfig.running = false;
            SimpleLoader.CancelLoad();
            MyEventDispatcher.ClearAllMyEvent();
            MyCallLater.Add(0.1f, SendInfo);
        }
        else
        {
#if UNITY_EDITOR
            undoHelper.ClearView();
            RefreshView();
            GlobalConfig.running = false;
            SimpleLoader.CancelLoad();
            //UnityEditor.EditorApplication.isPlaying = false;
#endif
        }
    }
 public void LoadError(SimpleLoader loader)
 {
     addError(loader.keyUrl);
     for (int i = 0; i < loadinglist.Count; i++)
     {
         if (loadinglist[i] == loader.keyUrl)
         {
             loadinglist.RemoveAt(i);
             for (int k = 0; k < waitingLoaderlist.Count; k++)
             {
                 SimpleLoader item = waitingLoaderlist[k];
                 if (item.keyUrl == loader.keyUrl)
                 {
                     //item.onloaded();
                     item.progress = 1;
                     item.state    = loader.state;
                     item.dispatchEvent(new LoadEvent(LoadEvent.Complete, item));
                     waitingLoaderlist.RemoveAt(k);
                     k--;
                 }
             }
         }
     }
     MyCallLater.Add(1, RemoveError, loader.keyUrl);
 }
예제 #4
0
    public void Loading()
    {
        if (string.IsNullOrEmpty(url))
        {
            Debug.LogErrorFormat("NeedLoadString.IsNullOrEmpty(url) == true");
            return;
        }
        state = SimpleLoadState.Loading;
        BumPoolManager.BumPoolData data;
        // 资源池里面已经存在的数据
        if (BumLogic.poolManager.tryGet(url, out data))
        {
            data.newUseTime = Time.realtimeSinceStartup;
            MyCallLater.Add(LoadInPool, 0, data);
            return;
        }
        bool add = BumLogic.poolManager.addLoading(this);

        if (add)
        {
            if (loaders.Count < Loadercount)
            {
                loaders.Add(this);
                StartLoad();
            }
            else
            {
                loaderStack.Push(this);
            }
        }
    }
예제 #5
0
 /// <summary>
 /// 生产页面
 /// </summary>
 /// <param name="goClone"></param>
 public void SetData(GameObject goClone, bool noReset)
 {
     skin = goClone;
     if (page != null)
     {
         page.SetData(skin, noReset);
     }
     ready();
     MyCallLater.Add(awake);
 }
예제 #6
0
 public bool remove(int id)
 {
     if (targetList.IndexOf(id) != -1)
     {
         newRemoveTime = Time.realtimeSinceStartup;
         targetList.Remove(id);
         if (targetList.Count == 0)
         {
             MyCallLater.Add(waitingTime, removeFromResourcePool);
         }
     }
     return(true);
 }
        private void RemoveFromResoucePool()
        {
            float withoutUseTime = Time.realtimeSinceStartup - newRemoveTime;

            if (withoutUseTime > waitingTime)
            {
                disPos();
                resourcesPool.Remove(keyUrl);
            }
            else
            {
                MyCallLater.Add(waitingTime - withoutUseTime, RemoveFromResoucePool);
            }
        }
예제 #8
0
 public bool Remove(int id)
 {
     if (poolList.IndexOf(id) != -1)
     {
         newRemoveTime = Time.realtimeSinceStartup;
         poolList.Remove(id);
         if (poolList.Count == 0)
         {
             MyCallLater.Add(waitingTime, RemoveFromResoucePool);
         }
         return(true);
     }
     return(false);
 }
예제 #9
0
        public void removeFromResourcePool()
        {
            float withoutUseTime = Time.realtimeSinceStartup - newRemoveTime;

            if (withoutUseTime > waitingTime)
            {
                dispose();
                BumLogic.poolManager.remove(keyUrl);
            }
            else
            {
                MyCallLater.Add(waitingTime - withoutUseTime, removeFromResourcePool);
            }
        }
        private void RemoveFromResoucePool()
        {
            if (targets.Count > 0)
            {
                return;
            }
            float withoutUseTime = Time.realtimeSinceStartup - newRemoveTime;

            if (withoutUseTime >= waitingTime)
            {
                resourcesPool.Remove(keyUrl);
                disPos();
            }
            else
            {
                MyCallLater.Add(waitingTime - withoutUseTime, RemoveFromResoucePool);
            }
        }
 public bool Remove(int id)
 {
     if (targets.ContainsKey(id))
     {
         newRemoveTime = Time.realtimeSinceStartup;
         if (targets[id] != null)
         {
             GameObject.DestroyImmediate(targets[id], true);
         }
         targets.Remove(id);
         if (targets.Count == 0)
         {
             MyCallLater.Add(waitingTime, RemoveFromResoucePool);
         }
         return(true);
     }
     return(false);
 }
예제 #12
0
        public void removeFromResourcePool()
        {
            if (targetList.Count > 0)
            {
                return;
            }

            float withoutUseTime = Time.realtimeSinceStartup - newRemoveTime;

            if (withoutUseTime >= waitingTime)
            {
                BumLogic.poolManager.remove(keyUrl);
                dispose();
            }
            else
            {
                MyCallLater.Add(waitingTime - withoutUseTime, removeFromResourcePool);
            }
        }
 /// <summary>
 /// 当 手指抬起 执行
 /// </summary>
 /// <param name="eventData"></param>
 public void onPointerUp(PointerEventData eventData)
 {
     isDown            = false;
     scroRect.vertical = true;
     if (dragActive == false)
     {
         return;
     }
     if (dragToItem != null)
     {
         float   time = 0.2f;
         Vector2 pos  = schemeManifestScroll.GetLoaclPosByIndex(dragToItem.index);
         GoToPos(tranRect, pos);
         MyCallLater.Add(time, laterChange);
     }
     else
     {
         Vector2 pos = schemeManifestScroll.GetLoaclPosByIndex(index);
         GoToPos(tranRect, pos);
     }
     dragActive = false;
 }
예제 #14
0
 public void onPointerUp(PointerEventData eventData)
 {
     isDown            = false;
     scroRect.vertical = true;
     if (dragActive == false)
     {
         return;
     }
     if (dragToItem != null)
     {
         float   time = 0.2f;
         Vector2 pos  = uscroll.GetItemPos(dragToItem.index);
         GoToPos(rectTran, pos);
         MyCallLater.Add(time, laterChange);
     }
     else
     {
         Vector2 pos = uscroll.GetItemPos(index);
         GoToPos(rectTran, pos);
     }
     dragActive = false;
 }
    public override void mUpdate()
    {
        base.mUpdate();
        float delta = Input.GetAxis("Mouse ScrollWheel");

        if (delta != 0)
        {
            //ErrorDisplay.Log(delta);
            target.orthographicSize += delta;
            if (target.orthographicSize < 2)
            {
                target.orthographicSize = 2;
            }
            else if (Camera.main.orthographicSize > 50)
            {
                target.orthographicSize = 50;
            }
        }

        Vector3 v3 = Input.mousePosition;

        if (Input.GetMouseButtonDown(2))
        {
            oldPos = v3;
        }
        if (Input.GetMouseButton(2))
        {
            if (oldPos.x == v3.x && oldPos.y == v3.y)
            {
                return;
            }

            Vector2 offset = v3 - oldPos;
            oldPos = v3;
            //Debug.Log(offset + " / " + v2);
            target.transform.position -= (Vector3)offset / 100f;
            MyCallLater.Add(0.1f, RefreshView);
        }
    }
예제 #16
0
 public void loadError(SimpleLoader loader)
 {
     addError(loader.keyUrl);
     for (int i = 0; i < loadingkeyUrlList.Count; i++)
     {
         if (loadingkeyUrlList[i] == loader.keyUrl)
         {
             loadingkeyUrlList.RemoveAt(i);
             for (int k = 0; k < waitingLoaderList.Count; k++)
             {
                 SimpleLoader item = waitingLoaderList[k];
                 if (item.keyUrl == loader.keyUrl)
                 {
                     item.state = loader.state;
                     item.EndOnly();
                     waitingLoaderList.RemoveAt(k);
                     k--;
                 }
             }
         }
     }
     MyCallLater.Add(1, removeError, loader.keyUrl);
 }
예제 #17
0
 protected void showClickEffect(GameObject go)
 {
     go.SetActive(true);
     MyCallLater.Add(0.1f, hideImage, go);
 }
 protected override void OnNewUse()
 {
     base.OnNewUse();
     MyCallLater.Remove(RemoveFromResoucePool);
     MyCallLater.Add(waitingTime, RemoveFromResoucePool);
 }
예제 #19
0
 protected override void onNewUse()
 {
     base.onNewUse();
     MyCallLater.Remove(removeFromResourcePool);
     MyCallLater.Add(waitingTime, removeFromResourcePool);
 }