Exemple #1
0
        public Task TestGetConfigCancel()
        {
            CancellationTokenSource tokenSource = new CancellationTokenSource();

            tokenSource.Cancel();
            return(ParseConfig.GetAsync(tokenSource.Token).ContinueWith(t => Assert.IsTrue(t.IsCanceled)));
        }
Exemple #2
0
    private void Start()
    {
        DataObj.isFree = false;
        Application.targetFrameRate = 60;

        ParseConfig.GetAsync().ContinueWith(t =>
        {
            ParseConfig config = t.Result;
            getConfigNow       = true;
        });



        DataObj.cachePath = Application.persistentDataPath + "/";

        //if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        //{
        //    DataObj.cachePath = Application.dataPath + "/Resources/";
        //}else{
        //    DataObj.cachePath = Application.persistentDataPath + "/Resources/Cache/";
        //}

        //Advertisement.Initialize("2801060", true);
        if (DataObj.isFree)
        {
            dpEntry.SetActive(false);
        }

        languageNow = PlayerPrefs.GetString("language");
        changeAllText();
    }
Exemple #3
0
 public Task TestGetConfig()
 {
     return(ParseConfig.GetAsync().ContinueWith(t => {
         Assert.AreEqual("testValue", t.Result["testKey"]);
         Assert.AreEqual("testValue", t.Result.Get <string>("testKey"));
     }));
 }
Exemple #4
0
 public void UpdateConfig(Action callback)
 {
     ParseConfig.GetAsync().ContinueWith(t =>
     {
         lock (threadCallMutex)
         {
             mainThreadCalls.Add(callback);
         }
     });
 }
Exemple #5
0
 public Task TestGetConfig()
 {
     return(ParseConfig.GetAsync().ContinueWith(t => {
         if (t.Result.TryGetValue("testKey", out string result) == true)
         {
             Assert.AreEqual("testValue", result);
         }
         Assert.AreEqual("testValue", t.Result.Get <string>("testKey"));
     }));
 }
Exemple #6
0
 private void fetchConfig()
 {
     ParseConfig.GetAsync().ContinueWith(t => {
         if (t.IsFaulted || t.IsCanceled)
         {
             GameData.Instance.config = ParseConfig.CurrentConfig;
             Debug.LogError("Failed to retrieve config.");
         }
         else
         {
             GameData.Instance.config = t.Result;
             Debug.Log("Config retrieval successful.");
         }
     });
 }
Exemple #7
0
        public async Task <String> getParseConfigElement(string keyName)
        {
            try
            {
                config = await ParseConfig.GetAsync();
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
                config = ParseConfig.CurrentConfig;
            }

            String parseConfigText = null;
            bool   searchResult    = config.TryGetValue <String>(keyName, out parseConfigText);

            if (searchResult)
            {
                return(parseConfigText);
            }
            else
            {
                return(null);
            }
        }