public IPromise <DataConfig> GetDataConfig() { if (dataConfig != null) { promise.Dispatch(dataConfig); } else { LoadDataConfig(); } return(promise); }
private void AddListeners() { PsdkEventSystem.Instance.onBannerShownEvent += () => { showBannersPromise.Dispatch(); showBannersPromise = new Promise(); _isShowingBanners = true; bannerAdsShownSignal.Dispatch(); }; PsdkEventSystem.Instance.onBannerCloseEvent += () => { bannerAdsClosedSignal.Dispatch(); }; PsdkEventSystem.Instance.onBannerHiddenEvent += () => { hideBannersPromise.Dispatch(); hideBannersPromise = new Promise(); bannerAdsHiddenSignal.Dispatch(); }; PsdkEventSystem.Instance.onBannerWillDisplayEvent += () => { bannerAdsWillDisplaySignal.Dispatch(); }; }
public IPromise Init() { firstSceneLoadedSignal.AddOnce(_ => { _firstSceneLoaded = true; }); ListenToPsdkEvents(); // Don't init psdk on Standalone builds (not supported) if (Application.platform.IsStandalone()) { initializedPromise.Dispatch(); } else { InitPsdkCore(); } return(initializedPromise); }
private void OnShowFail(IPromise <LocationResult> promise, ApplicationLocation location, string failMessage) { var result = new LocationResult { location = location, success = false, message = failMessage, }; promise.Dispatch(result); }
private void AddListeners() { PsdkEventSystem.Instance.onRewardedAdIsReadyEvent += () => { rewardedAdReadySignal.Dispatch(true); }; PsdkEventSystem.Instance.onRewardedAdIsNotReadyEvent += () => { rewardedAdReadySignal.Dispatch(false); }; PsdkEventSystem.Instance.onRewardedAdWillShowEvent += () => { rewardedAdWillShowSignal.Dispatch(); }; PsdkEventSystem.Instance.onRewardedAdDidClosedWithResultEvent += (watchedAd) => { Debug.Log(Tag + ".onRewardedAdDidClosedWithResultEvent - Ad watched:" + watchedAd); rewardedAdClosedSignal.Dispatch(watchedAd); // if made a promise to any clients that the ad will close - fulfill the promise: adClosedPromise.Dispatch(watchedAd); adClosedPromise = new Promise <bool>(); }; }
public void TestThenOrder() { promiseOneArg.Then(OneArgCallback); promiseOneArg.Then(OneArgCallbackTwo); promiseOneArg.Then(OneArgCallbackThree); promiseOneArg.Dispatch(add); Assert.AreEqual((add + (add * 2)) * add, value); value = 0; promiseOneArg = new Promise <int>(); promiseOneArg.Then(OneArgCallback); promiseOneArg.Then(OneArgCallbackThree); promiseOneArg.Then(OneArgCallbackTwo); promiseOneArg.Dispatch(add); Assert.AreEqual((add * add) + (add * 2), value); }
public IPromise Init() { promise.Dispatch(); return(promise); }
public void TestThenOrder() { promiseOneArg.Then(OneArgCallback); promiseOneArg.Then(OneArgCallbackTwo); promiseOneArg.Then(OneArgCallbackThree); promiseOneArg.Dispatch(add); Assert.AreEqual((add+(add * 2))*add, value); value = 0; promiseOneArg = new Promise<int>(); promiseOneArg.Then(OneArgCallback); promiseOneArg.Then(OneArgCallbackThree); promiseOneArg.Then(OneArgCallbackTwo); promiseOneArg.Dispatch(add); Assert.AreEqual((add*add)+(add*2), value); }
public void TestFourArgPromise() { promiseFourArg.Then(FourArgCallback); promiseFourArg.Dispatch(add, addTwo, addThree, addFour); Assert.AreEqual(add + addTwo + addThree + addFour, value); }
public void TestThreeArgPromise() { promiseThreeArg.Then(ThreeArgCallback); promiseThreeArg.Dispatch(add, addTwo, addThree); Assert.AreEqual(add + addTwo + addThree, value); }
public void TestOneArgPromise() { promiseOneArg.Then(OneArgCallback); promiseOneArg.Dispatch(add); Assert.AreEqual(add, value); }
public void TestNoArgPromise() { promise.Then(NoArgCallback); promise.Dispatch(); Assert.AreEqual(1, value); }
public IPromise TryConnectToServer() { if (!initialized) { promise.Dispatch(); return(promise); } // Avoid running model sync when uploading gld if (IsUploadScene()) { logger.Log(Tag, "Running in upload mode - skipping connection with the server..."); promise.Dispatch(); return(promise); } if (Application.isEditor && !GsdkSettingsData.Instance.IsConnectionEnabled) { logger.Log(Tag, "Editor Connection is disabled in gsdk settings - will not fetch GLD from the server"); promise.Dispatch(); return(promise); } syncType = SyncType.OnDemand; //Load configs Data.DataElement connConfig = GameApplication.GetConfiguration("connection"); string sType = (connConfig.IsNull || !connConfig.ContainsKey(SYNC_TYPE_KEY)) ? "Continuous" : (string)connConfig[SYNC_TYPE_KEY]; syncLoopLength = (connConfig.IsNull || !connConfig.ContainsKey(SYNC_LOOP_KEY)) ? syncLoopLength : (float)connConfig[SYNC_LOOP_KEY]; bool sEnabled = (connConfig.IsNull || !connConfig.ContainsKey(SYNC_ENABLED_KEY)) ? true : (bool)connConfig[SYNC_ENABLED_KEY]; if (!sEnabled) { _dataSyncEnabled = false; } try { syncType = (SyncType)Enum.Parse(typeof(SyncType), sType, true); } catch (Exception ex) { logger.LogError(Tag, string.Format("Wrong configuraton in connection config file, the {0} key is not of the type SyncType \n Message received:{1}", SYNC_TYPE_KEY, ex.Message)); } if (syncType != SyncType.Off) { _coroutineFactory.StartCoroutine(() => WaitForState(SyncLoopState.Connected)); } switch (syncType) { case SyncType.OnDemand: _coroutineFactory.StartCoroutine(() => StartOnDemandMode(false)); break; case SyncType.Continuous: _coroutineFactory.StartCoroutine(AsyncLoop); break; case SyncType.Off: promise.Dispatch(); break; default: break; } return(promise); }
public IPromise <bool> ShowAd() { promise.Dispatch(false); return(promise); }