Exemplo n.º 1
0
    private void OnOffline(FageEvent fevent)
    {
        FageConnectionManager.Instance.RemoveEventListener(FageEvent.SENSOR_PING, OnPing);
        _requestId = -1;

        FageBundleLoader loader = FageBundleLoader.Instance;

        if (Utility.HasKey(_KEY))
        {
            FageConfig.LoadFromText(Utility.GetPrefString(_KEY));
            loader.ReserveState("FageBundleLoaderDownload");
        }
        else
        {
            loader.SetUpdateTime();
            loader.ReserveState("FageBundleLoaderDownload");
        }
    }
Exemplo n.º 2
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        FageBundleLoader loader = stateMachine as FageBundleLoader;

        if ((loader.expireTime < (Time.unscaledTime - loader.GetUpdateTime())) || loader.flagUpdate)
        {
            loader.flagUpdate = false;
            loader.ReserveState("FageBundleLoaderCheck");
        }
        else if (loader.flagLoad)
        {
            loader.ReserveState("FageBundleLoaderLoad");
        }
        else if (loader.flagDownload)
        {
            loader.flagDownload = false;
            loader.ReserveState("FageBundleLoaderDownload");
        }
    }
Exemplo n.º 3
0
    public override void Excute(FageStateMachine stateMachine)
    {
        base.Excute(stateMachine);
        FageBundleLoader loader = stateMachine as FageBundleLoader;

        if (request != null)
        {
            if (request.isDone)
            {
                string name = queueAsset.Dequeue() as string;
                loader.GetLoadedAssets().Add(name, request.asset);
                request = null;
            }
        }
        else
        {
            if ((queueAsset == null) || (queueAsset.Count == 0))
            {
                if (queueBundle.Count > 0)
                {
                    AssetBundle ab = queueBundle.Dequeue() as AssetBundle;
                    loader.GetLoadedBundles().Add(ab.name);
                }

                if ((queueBundle == null) || (queueBundle.Count == 0))
                {
                    loader.ReserveState("FageBundleLoaderIdle");
                    loader.SetUpdateTime();
                    loader.DispatchEvent(new FageEvent(FageEvent.COMPLETE));
                }
                else
                {
                    AssetBundle ab = queueBundle.Peek() as AssetBundle;
                    queueAsset = new Queue(ab.GetAllAssetNames());
                }
            }
            else
            {
                AssetBundle ab   = queueBundle.Peek() as AssetBundle;
                string      name = queueAsset.Peek() as string;
                request = ab.LoadAssetAsync(name);
            }
        }
    }