Example #1
0
 void Awake()
 {
     _instance         = this;
     _timeLastUpdate   = Time.unscaledTime;
     _loadedScene      = new List <string> ();
     _loadedBundle     = new List <string> ();
     _loadedAsset      = new Dictionary <string, object> ();
     _downloadedBundle = new Dictionary <string, AssetBundle> ();
     FageConfig.LoadFromText(setting.text);
 }
    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");
        }
    }
    private void OnResponse(FageEvent fevent)
    {
        FageWebEvent wevent = fevent as FageWebEvent;

        if ((wevent == null) || (wevent.requestId != _requestId))
        {
            return;
        }

        if (string.IsNullOrEmpty(wevent.www.error))
        {
            string str = wevent.www.text;
            FageConfig.LoadFromText(str);
            Utility.SetPrefString(_KEY, str);
            FageBundleLoader.Instance.ReserveState("FageBundleLoaderDownload");
        }
        else
        {
            OnOffline(null);
        }
    }