public void UpdateFromCloud() { if (ApplicationDZ.loadedLevelName != Game.MainMenuLevelName) //update only in main menu { return; } FetchPlayerPersistantInfo action = new FetchPlayerPersistantInfo(CloudUser.instance.authenticatedUserID); GameCloudManager.AddAction(action); }
// PRIVATE METHODS public IEnumerator CheckDailyRewards_Coroutine() { yield return(new WaitForSeconds(1.0f)); while (m_UserId != null) { if (Ftue.IsActive == true) { yield return(new WaitForSeconds(0.5f)); } else if (m_Menu == null || m_Menu.IsAnyPopupVisible() == true) { yield return(new WaitForSeconds(1.0f)); } else { GetDailyRewards rewards = new GetDailyRewards(m_UserId); GameCloudManager.AddAction(rewards); while (rewards.isDone == false) { yield return(new WaitForEndOfFrame()); } #if !FAKE_DAILY_REWARDS if (rewards.HasReward == true) #endif { FetchPlayerPersistantInfo ppi = new FetchPlayerPersistantInfo(m_UserId); GameCloudManager.AddAction(ppi); while (ppi.isDone == false) { yield return(new WaitForEndOfFrame()); } #if !FAKE_DAILY_REWARDS UserGuideAction_DailyRewards.HasInstant |= rewards.HasInstant; UserGuideAction_DailyRewards.HasConditional |= rewards.HasConditional; #else UserGuideAction_DailyRewards.HasInstant |= true; UserGuideAction_DailyRewards.HasConditional |= true; #endif } yield return(new WaitForSeconds(60.0f * 60)); // wait one hour } } }
// PRIVATE MEMBERS IEnumerator Close_Coroutine() { m_CloseButton.IsDisabled = true; m_SpinButton.IsDisabled = true; if (m_NeedsFetchPPI == true) { m_NeedsFetchPPI = false; FetchPlayerPersistantInfo action = new FetchPlayerPersistantInfo(CloudUser.instance.authenticatedUserID); GameCloudManager.AddAction(action); while (action.isDone == false) { yield return(new WaitForEndOfFrame()); } } Owner.Back(); }
void OnApplicationPause(bool pause) { if (pause == true) { InputManager.FlushInput(); SaveSettings(); } if (pause == false) { //Pro Tapjoy a SponsorPay: kdyz se vracime do applikace a je zobrazene menu, updatuj ppi (aby hrac videl pridane goldy). if (GuiFrontendMain.IsVisible || GuiFrontendIngame.IsVisible) { if (CloudUser.instance != null && CloudUser.instance.isUserAuthenticated) { //Debug.Log("On application pause false, fetching ppi"); FetchPlayerPersistantInfo action = new FetchPlayerPersistantInfo(CloudUser.instance.authenticatedUserID); GameCloudManager.AddAction(action); } } } }
protected override void OnViewUpdate() { if (IsVisible) { if (ShopDataBridge.Instance.IsIAPInProgress()) { switch (ShopDataBridge.Instance.GetIAPState()) { case InAppAsyncOpState.Waiting: return; case InAppAsyncOpState.Finished: //IAP success, fetch ppi with new golds FetchPlayerPersistantInfo action = new FetchPlayerPersistantInfo(CloudUser.instance.authenticatedUserID); GameCloudManager.AddAction(action); //Debug.Log("IAP finished: " + BuyIAPItem ); CloseDialog(E_PopupResultCode.Success, 02030048); return; case InAppAsyncOpState.Failed: CloseDialog(E_PopupResultCode.Failed, 02030049); return; case InAppAsyncOpState.Cancelled: CloseDialog(E_PopupResultCode.Cancel, 02030050); return; case InAppAsyncOpState.CannotVerify: CloseDialog(E_PopupResultCode.Failed, 02030072); return; } } } base.OnViewUpdate(); }
IEnumerator AuthenticateUser_Corutine() { UnigueUserID userID = new UnigueUserID(primaryKey, passwordHash, productID); string deviceID = SysUtils.GetUniqueDeviceID(); string facebookID = string.Empty; SetAuthenticationStatus(E_AuthenticationStatus.InProgress); // capa // ------------------------------------------------------------------------- // retrieve facebook id... if (FacebookPlugin.Instance.CurrentUser != null) { facebookID = FacebookPlugin.Instance.CurrentUser.ID; } // ------------------------------------------------------------------------- // authenticate user... // capa // SetAuthenticationStatus(E_AuthenticationStatus.InProgress); { AuthenticateUser action = new AuthenticateUser(userID, deviceID, facebookID); GameCloudManager.AddAction(action); // wait for async action... while (action.isDone == false) { yield return(new WaitForEndOfFrame()); } // process action result... if (action.isFailed == true) { SetAuthenticationStatus(E_AuthenticationStatus.Failed, action.failInfo); yield break; } authenticatedUserID = userID; // this will be overwritten later ProcessAuthenticationData() m_UserAcctKind = E_UserAcctKind.Normal; // rip data from sub-actions string err; if (ProcessAuthenticationData(action.actions, out err) == false) { SetAuthenticationStatus(E_AuthenticationStatus.Failed, err); yield break; } } #if UNITY_IPHONE || TEST_IOS_VENDOR_ID // pair guest account with vendorID if (m_UserAcctKind == E_UserAcctKind.Guest) { yield return(StartCoroutine(PairGuestAccountWithVendorID_Coroutine(userID))); } #endif // ------------------------------------------------------------------------- // Retrive player persistent info... SetAuthenticationStatus(E_AuthenticationStatus.RetrievingPPI); { BaseCloudAction action = new FetchPlayerPersistantInfo(userID); GameCloudManager.AddAction(action); // wait for async action... while (action.isDone == false) { yield return(new WaitForEndOfFrame()); } // process action result... if (action.isFailed == true) { SetAuthenticationStatus(E_AuthenticationStatus.Failed, "Can't retrive Player Data"); yield break; } //Debug.Log("Authentication process succeful"); } // ------------------------------------------------------------------------- SetAuthenticationStatus(E_AuthenticationStatus.Ok); // ------------------------------------------------------------------------- // raise authentication changed event OnAuthenticationChanged(true); // ------------------------------------------------------------------------- // raise premium acct changed event CheckPremiumAcct(true); }
void FetchPPIFromCloud() { FetchPlayerPersistantInfo action = new FetchPlayerPersistantInfo(CloudUser.instance.authenticatedUserID); GameCloudManager.AddAction(action); }