コード例 #1
0
 public static bool CanAttemptToConnectToCDN()
 {
                 #if RC_BUILD
     return(true);
                 #else
     CloudStorageAPI        cloudStorageAPI        = new CloudStorageAPI(null);
     StreamingAssetsStorage streamingAssetsStorage = new StreamingAssetsStorage(Game.None, null);
     bool ret = true;
     streamingAssetsStorage.LoadStreamingAssetsFile(cloudStorageAPI.cloudData.P12Path, (error, p12Bytes) =>
     {
         if (!string.IsNullOrEmpty(error))
         {
             Log.Warning("Unable to load " + cloudStorageAPI.cloudData.P12Path);
             ret = false;
         }
     }, true);
     if (string.IsNullOrEmpty(cloudStorageAPI.cloudData.Password))
     {
         Log.Warning("No cloudData.Password specified " + cloudStorageAPI.cloudData.Password);
         ret = false;
     }
     if (!ret)
     {
         Log.Warning("You need to have both a .p12 file and password to run this locally");
     }
     return(ret);
                 #endif
 }
コード例 #2
0
        public void Init()
        {
            if (IsLoading == true || isCancel == true)
            {
                Cancel();
                return;
            }

            IsLoading = true;

            persistentStore = new PersistentDataStorage(Game.None);

            cacheDirectory = persistentStore.GetPersistentDataPath("");

            cache = new Dictionary <string, double>();
            if (persistentStore.FileExists(CacheName))
            {
                string tempOldCache = persistentStore.LoadText(CacheName);
                Log.Debug("old cache text = " + tempOldCache, Log.LogChannel.Download);
                string[] tempOldCacheLines = tempOldCache.Split('\n');
                for (int i = 0; i < tempOldCacheLines.Length; i++)
                {
                    if (!string.IsNullOrEmpty(tempOldCacheLines[i]))
                    {
                        string   rawLine           = tempOldCacheLines[i];
                        string[] rawLineComponents = rawLine.Split(':');
                        cache[rawLineComponents[0]] = double.Parse(rawLineComponents[1]);
                    }
                }
            }

            downloads = new List <string>();

            cloudStorageAPI             = new CloudStorageAPI(monoBehaviour);
            progress                    = new Progress();
            progress.StartingFileCount  = 1;
            progress.FileRemainingCount = 1;
                        #if RC_BUILD
            progress.Sections       = 2;
            progress.CurrentSection = 1;
            UpdateProgress();
            cloudStorageAPI.GetContentList(OnContentList, "");
                        #else
            progress.Sections       = 3;
            progress.CurrentSection = 1;
            UpdateProgress();
            cloudStorageAPI.AuthenticateWithGAE(OnAuthResponse, (downloadPercent) =>
            {
                progress.PercentOfCurrentLoadingFileDownloaded = downloadPercent;
                UpdateProgress();
            });
                        #endif
        }
コード例 #3
0
 public void Destroy(bool isSuccess = true, bool cancel = true)
 {
     isCancel  = cancel;
     IsLoading = false;
     if (manifest != null && manifest["version"] != null)
     {
         if (isSuccess)
         {
             WriteManifestVersion(manifest["version"].ToString());
         }
         else
         {
             AppendManifestVersion(manifest["version"].ToString());
         }
     }
     if (callback != null)
     {
         callback(isSuccess, InstanceId);
     }
     monoBehaviour    = null;
     callback         = null;
     cloudStorageAPI  = null;
     progressCallback = null;
 }