private void StartTweenMoney()
 {
     //Logger.LogWarp.LogError("StartTweenMoney");
     m_Animator.enabled = false;
     //LoadingMgr.Inst.StartCoroutine(PlayMoneyAnimation());
     RunCoroutine.Run(PlayMoneyAnimation());
 }
    private void DoTweenMoneyEffect(int index)
    {
        //Logger.LogWarp.LogError("DoTweenMoneyEffect " + index + " " + m_TargetPosition + " " + moveTime);
        MoneyEffectData data = m_MoneyEffectChildList[index];

        data.Trans.localScale = scale;
        //Vector2 p2 = Vector2.zero;
        Vector2 p2 = data.Trans.position;

        //if (tweenPos != null)
        //{
        //    if (tweenPos.IsPlaying())
        //    {
        //        tweenPos.Complete();
        //    }
        //    tweenPos.Kill();

        //}

        tweenPos = DOTween.To(() => p2, x => p2 = x, m_TargetPosition, moveTime);
        tweenPos.SetEase(Ease.InSine);
        //data.effect.SetActive(true);
        //Debug.Log("m_TargetPosition=" + m_TargetPosition);
        tweenPos.OnUpdate(() =>
        {
            //Logger.LogWarp.LogError(data.Trans.name + " " + p2);
            data.Trans.position = p2;
        });
        tweenPos.OnComplete(() =>
        {
            //Logger.LogWarp.LogError("tweenPos.OnComplete " + m_CurPlayCount + " " + m_MaxCount);
            data.Trans.localScale = Vector3.zero;

            m_CurPlayCount++;
            //EventManager.Trigger(EventEnum.MoneyEffectPlayUpdate, m_MoneyType);
            //ShakePhone.ShakeLight();
            if ((m_CurPlayCount + 1) >= m_MaxCount)
            {
                m_CurPlayCount = 0;
                switch (m_MoneyType)
                {
                case MoneyType.Diamond:
                    m_DiamondEffectObj.SetActive(true);
                    break;

                case MoneyType.Money:
                    m_MoneyEffectObj.SetActive(true);
                    break;

                case MoneyType.Physic:
                    physicEffectObj.SetActive(true);
                    break;
                }

                RunCoroutine.Run(PlayCompleteEffect());
            }
        });
    }
        public void LoadScene(string scenePath, System.Action callback)
        {
            loadFinished = false;

            ResHelper.LoadScene(scenePath);
            SceneManager.sceneLoaded += (a, b) =>
            {
                loadFinished = true;
            };
            if (callback != null)
            {
                RunCoroutine.Run(CoLoadFinished(callback));
            }
        }
        void LoadAssetAsync <T>(string assetName, E_LoadAsset eloadAsset, System.Action <T> callback)
            where T : IAssetGetter, new()
        {
            T      getter;
            string bundleName = GetBundleName(assetName);

            if (LoadAssetFromNameAssetHolder(assetName, bundleName, out getter))
            {
                callback(getter);
            }

            //BundleAsyncRequest bundleRequest = new BundleAsyncRequest(assetName, eloadAsset, callback);
            BundleAsyncRequest bundleRequest = new BundleAsyncRequest(assetName, eloadAsset);

            bundleAsyncs.Enqueue(bundleRequest);
            RunCoroutine.Run(CoBundleAsyncRequest <T>(bundleRequest, callback));
        }
示例#5
0
    public static void GetInst()
    {
        if (null == crtGo)
        {
            crtGo        = GameObject.Find("CrtRunner");
            crtGo        = new GameObject("CrtRunner");
            runCoroutine = crtGo.GetComponent <RunCoroutine>();
            if (!runCoroutine)
            {
                runCoroutine = crtGo.AddComponent <RunCoroutine>();
            }

            if (Application.isPlaying)
            {
                GameObject.DontDestroyOnLoad(crtGo);
            }
        }
    }
        void LoadAssetAsync <T>(string assetName, E_LoadAsset eloadAsset, System.Action <T> callback)
            where T : IAssetGetter, new()
        {
            T      getter;
            string bundleName = GetBundleName(assetName);

            if (LoadAssetFromNameAssetHolder(assetName, bundleName, out getter))
            {
                if (callback != null)
                {
                    callback(getter);
                }
                return;
            }

            BundleAsyncRequest bundleRequest = new BundleAsyncRequest(assetName, eloadAsset);

            Logger.LogWarp.Log(assetName + " request " + bundleRequest.currRequestID);
            bundleAsyncs.Enqueue(bundleRequest);
            RunCoroutine.Run(CoBundleAsyncRequest <T>(bundleRequest, callback));
        }
        public void LoadObjectAsync(string path, System.Action <Object> callback)
        {
            int pathHash = path.GetHashCode();

            Object obj = null;

            //没有缓存,没有异步加载
            if (!objCache.TryGetValue(pathHash, out obj) && !asyncRequests.Contains(pathHash))
            {
                RunCoroutine.Run(CoLoadObjectAsync(path, pathHash, callback));
                return;
            }

            //没有缓存,但有异步加载
            if (!objCache.TryGetValue(pathHash, out obj) && asyncRequests.Contains(pathHash))
            {
                RunCoroutine.Run(CoWaitAsync(pathHash, callback));
                return;
            }

            callback?.Invoke(obj);
        }
示例#8
0
 public void CopyAssetBundle(string source, string dest, System.Action <string> callback = null)
 {
     Logger.LogWarp.Log("CopyAssetBundle " + source + " " + dest);
     RunCoroutine.Run(CoCopyAssetBundle(source, dest, callback));
 }
 public void LoadSceneAsync(string sceneName, Action callback, Action <float> progress = null)
 {
     RunCoroutine.Run(ILoadSceneAsync(sceneName, callback, progress));
 }