public Task TestGetConfigCancel() { CancellationTokenSource tokenSource = new CancellationTokenSource(); tokenSource.Cancel(); return(ParseConfig.GetAsync(tokenSource.Token).ContinueWith(t => Assert.IsTrue(t.IsCanceled))); }
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(); }
public Task TestGetConfig() { return(ParseConfig.GetAsync().ContinueWith(t => { Assert.AreEqual("testValue", t.Result["testKey"]); Assert.AreEqual("testValue", t.Result.Get <string>("testKey")); })); }
public void UpdateConfig(Action callback) { ParseConfig.GetAsync().ContinueWith(t => { lock (threadCallMutex) { mainThreadCalls.Add(callback); } }); }
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")); })); }
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."); } }); }
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); } }