private void OnDonateConfirm(UXButton button) { SquadMsg message; if (this.isWarRequest) { message = SquadMsgUtils.CreateWarDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null); } else { message = SquadMsgUtils.CreateDonateMessage(this.recipientId, this.troopsToDonate, this.GetNumberOfTroopsDonated(), this.requestId, new SquadController.ActionCallback(this.OnDonationComplete), null); } SquadController squadController = Service.Get <SquadController>(); squadController.TakeAction(message); ProcessingScreen.Show(); }
private void OnGetLBPlayers(bool success) { if (!success) { this.OnDataUpdateFailure(); return; } if (!this.Visible) { ProcessingScreen.Hide(); return; } if (this.curTab == SocialTabs.Leaders) { LeaderboardList <PlayerLBEntity> leaderboardList = this.GetLeaderboardList(); base.OnPlayersListLoaded((leaderboardList != null) ? leaderboardList.List : null, new Action(this.PopulatePlayersOnGrid)); } }
public void JoinSquad(string biSource) { if (this.squad == null) { return; } Lang lang = Service.Get <Lang>(); this.biSource = biSource; Squad squad = Service.Get <CurrentPlayer>().Squad; if (this.button.VisuallyDisabled) { string msg; SquadUtils.CanCurrentPlayerJoinSquad(Service.Get <CurrentPlayer>(), Service.Get <SquadController>().StateManager.GetCurrentSquad(), this.squad, Service.Get <Lang>(), out msg); this.ShowInfoText(msg); return; } this.button.Enabled = false; Service.Get <EventManager>().SendEvent(EventId.SquadNext, null); if (this.squad.InviteType != 1) { Service.Get <ScreenController>().AddScreen(new SquadJoinRequestScreen(this.squad, new SquadController.ActionCallback(this.OnApplyToSquadComplete), this.button)); return; } if (squad == null) { ProcessingScreen.Show(); this.ActualJoinSquad(); return; } if (!SquadUtils.CanLeaveSquad()) { string message = Service.Get <Lang>().Get("IN_WAR_CANT_LEAVE_SQUAD", new object[0]); AlertScreen.ShowModal(false, null, message, null, null, true); return; } YesNoScreen.ShowModal(lang.Get("ALERT", new object[0]), lang.Get("JOIN_LEAVE_SQUAD_ALERT", new object[] { squad.SquadName, this.squad.SquadName }), false, lang.Get("JOIN_CTA", new object[0]), lang.Get("ACCOUNT_CONFLICT_CONFIRM_CANCEL", new object[0]), new OnScreenModalResult(this.OnLeaveAndJoinSquad), this.squad, false); Service.Get <EventManager>().SendEvent(EventId.UISquadLeaveConfirmation, squad.SquadID + "|join|" + this.squad.SquadID); }
public static void StaticReset() { Camera[] allCameras = Camera.allCameras; int i = 0; int num = allCameras.Length; while (i < num) { allCameras[i].enabled = false; i++; } UnityUtils.StaticReset(); GameServicesManager.StaticReset(); MultipleEmittersPool.StaticReset(); if (Service.AudioManager != null) { Service.AudioManager.CleanUp(); } if (Service.WWWManager != null) { Service.WWWManager.CancelAll(); } if (Service.AssetManager != null) { Service.AssetManager.ReleaseAll(); } if (Service.EntityController != null) { Service.EntityController.StaticReset(); } if (Service.StaticDataController != null) { Service.StaticDataController.Exterminate(); } if (Service.ISocialDataController != null) { Service.ISocialDataController.StaticReset(); } JsonParser.StaticReset(); CollisionFilters.StaticReset(); ProcessingScreen.StaticReset(); YesNoScreen.StaticReset(); DynamicRadiusView.StaticReset(); }
public void Login(OnAllDataFetchedDelegate callback) { if (this.HaveAllData) { callback(); return; } if (this.IsLoggedIn) { return; } this.allDataFetchedCallbacks.Add(callback); ProcessingScreen.Show(); Service.Get <Engine>().ForceGarbageCollection(null); FacebookManager.OnFacebookLoggedIn = new FacebookDelegate(this.OnFacebookLogin); FacebookManager.OnFacebookLogInFailed = new FacebookDelegate(this.OnFacebookLoginFailed); FacebookManager.Instance.Login(); Service.Get <BILoggingController>().TrackAuthorization("allow", "f"); }
private void OnInviteToSquadClicked(UXButton button) { this.secondaryButton.Enabled = false; string fbFriendId = null; string fbAccessToken = null; Dictionary <string, SocialFriendData> playerIdToFriendData = Service.ISocialDataController.PlayerIdToFriendData; SocialFriendData socialFriendData = null; if (playerIdToFriendData != null && playerIdToFriendData.TryGetValue(this.player.PlayerID, out socialFriendData)) { fbFriendId = socialFriendData.Id; fbAccessToken = AccessToken.CurrentAccessToken.TokenString; } SquadMsg message = SquadMsgUtils.CreateSendInviteMessage(this.player.PlayerID, fbFriendId, fbAccessToken, new SquadController.ActionCallback(this.OnInviteToSquadComplete), null); Service.SquadController.TakeAction(message); Service.EventManager.SendEvent(EventId.SquadNext, null); ProcessingScreen.Show(); }
private void LoadLeaders() { PlanetVO selectedPlanet = this.planetSelectionDropDown.GetSelectedPlanet(); string planetId = (selectedPlanet == null) ? null : selectedPlanet.Uid; ProcessingScreen.Show(); if (!Service.Get <LeaderboardController>().ShouldRefreshData(PlayerListType.Leaders, planetId)) { if (this.gridLoadHelper.IsAddedItems || this.gridLoadHelper.IsBusyAddingItems) { base.ResetGrid(); } LeaderboardList <PlayerLBEntity> leaderboardList = this.GetLeaderboardList(); base.OnPlayersListLoaded((leaderboardList != null) ? leaderboardList.List : null, new Action(this.PopulatePlayersOnGrid)); return; } base.ResetGrid(); Service.Get <LeaderboardController>().UpdateLeaders(selectedPlanet, new LeaderboardController.OnUpdateData(this.OnGetLBPlayers)); }
private void OnGetLBSquads(bool success) { if (success) { ProcessingScreen.Hide(); if (!this.Visible) { return; } if (this.curTab == SocialTabs.Squads) { this.AddItemsToLeaderboardGrid(); } } else { this.OnDataUpdateFailure(); } }
public void OnReplayLoaded(GetReplayResponse response, object cookie) { ProcessingScreen.Hide(); this.replayResponseData = response; if (this.replayResponseData == null) { this.OnReplayLoadFailed(2110u, null); return; } BattlePlaybackState.GoToBattlePlaybackState(this); BattleRecord replayData = response.ReplayData; BattleEntry entryData = response.EntryData; replayData.RecordId = entryData.RecordID; entryData.SharerPlayerId = this.replayOwnerPlayerId; bool flag = Service.CurrentPlayer.PlayerId == entryData.AttackerID || this.replayOwnerPlayerId == entryData.AttackerID; entryData.Won = ((!flag) ? (entryData.EarnedStars == 0) : (entryData.EarnedStars > 0)); Service.EventManager.SendEvent(EventId.BattleRecordRetrieved, this.replayResponseData); }
private void FacebookLoginLogicAfterGetSelfDataResponse() { string @string = PlayerPrefs.GetString("FB_ID", null); SharedPlayerPrefs sharedPlayerPrefs = Service.Get <SharedPlayerPrefs>(); string text = null; if (sharedPlayerPrefs != null) { text = sharedPlayerPrefs.GetPref <string>("FB_ID"); } if ((!string.IsNullOrEmpty(text) && text.CompareTo(FacebookManager.Instance.getUserId()) != 0) || (!string.IsNullOrEmpty(@string) && @string.CompareTo(FacebookManager.Instance.getUserId()) != 0)) { ProcessingScreen.Hide(); Lang lang = Service.Get <Lang>(); string title = lang.Get("IAP_DISABLED_ANDROID_TITLE", new object[0]); string message = lang.Get("FACEBOOK_YOU_ARE_USING_ANOTHER_ACCOUNT", new object[0]); AlertScreen.ShowModal(false, title, message, new OnScreenModalResult(this.OnFacebookOverrideWarningClosed), null); return; } this.FinishFacebookLogin(); }
public void LoadTournamentLeaders() { PlanetVO selectedPlanet = this.planetSelectionDropDown.GetSelectedPlanet(); string text = (selectedPlanet == null) ? null : selectedPlanet.Uid; if (string.IsNullOrEmpty(text)) { return; } if (!Service.Get <LeaderboardController>().ShouldRefreshData(PlayerListType.TournamentLeaders, text)) { if (this.gridLoadHelper.IsAddedItems || this.gridLoadHelper.IsBusyAddingItems) { base.ResetGrid(); } this.AddItemsToLeaderboardGrid(); return; } base.ResetGrid(); ProcessingScreen.Show(); Service.Get <LeaderboardController>().UpdateTournamentLeaders(selectedPlanet, new LeaderboardController.OnUpdateData(this.OnGetLBTournament)); }
private void OnSquadDetailsUpdated(Squad squad, bool success) { ProcessingScreen.Hide(); if (this.IsClosedOrClosing()) { return; } if (!success) { string message = this.lang.Get("GENERIC_SQUAD_INFO_ISSUE", new object[0]); AlertScreen.ShowModal(false, null, message, null, null); return; } if (squad != null) { string detailsString; bool showRequestButton = SquadUtils.CanCurrentPlayerJoinSquad(Service.Get <CurrentPlayer>(), Service.Get <SquadController>().StateManager.GetCurrentSquad(), squad, Service.Get <Lang>(), out detailsString); this.DisplaySquadInfoView(squad, showRequestButton, detailsString); return; } success = false; }
private void OnVisitNeighborSuccess(VisitNeighborResponse response, object cookie) { ProcessingScreen.Hide(); if (response == null) { this.processing = false; return; } this.NeighborPlayer = new GamePlayer(); this.NeighborPlayer.PlayerName = response.Name; this.NeighborPlayer.Faction = response.Faction; this.NeighborPlayer.Map = response.MapData; this.NeighborPlayer.Inventory = response.InventoryData; this.NeighborPlayer.AttackRating = response.AttackRating; this.NeighborPlayer.DefenseRating = response.DefenseRating; this.NeighborPlayer.AttacksWon = response.AttacksWon; this.NeighborPlayer.DefensesWon = response.DefensesWon; this.NeighborPlayer.Squad = response.Squad; this.NeighborPlayer.UnlockedLevels = response.UpgradesData; this.NeighborSquadTroops = response.SquadTroops; NeighborMapDataLoader mapDataLoader = new NeighborMapDataLoader(response); IState currentState = Service.Get <GameStateMachine>().CurrentState; AbstractTransition transition; if (currentState is GalaxyState) { transition = new GalaxyMapToBaseTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, false); } else if (currentState is WarBoardState) { transition = new WarboardToWarbaseTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, false); } else { transition = new WorldToWorldTransition(new NeighborVisitState(), mapDataLoader, new TransitionCompleteDelegate(this.OnTransitionComplete), false, true); } Service.Get <WorldTransitioner>().StartTransition(transition); }
private void AssetsCompleteDelegate(object cookie) { ProcessingScreen.Hide(); Service.EventManager.RegisterObserver(this, EventId.PlayCrateAnimVfx); Service.EventManager.RegisterObserver(this, EventId.CrateRewardAnimDone); Service.UXController.HideAll(); Service.ScreenController.AddScreen(this.screen, true, false); this.assetMeshDataMonoBehavior = this.crateController.GetComponent <AssetMeshDataMonoBehaviour>(); Transform transform = this.assetMeshDataMonoBehavior.OtherGameObjects[0].transform; Transform transform2 = this.assetMeshDataMonoBehavior.OtherGameObjects[1].transform; this.crateVfxParticles = transform2.gameObject.GetComponent <ParticleSystem>(); this.crateBurstParticles = this.assetMeshDataMonoBehavior.OtherGameObjects[2].GetComponent <ParticleSystem>(); this.crateRayEffect = transform2.Find(this.crateObj.name).gameObject; this.beamsEffect = this.crateRayEffect.transform.Find("beams"); this.sparkleEffect = this.crateRayEffect.transform.Find("sparkles"); this.crateRayEffect.SetActive(true); this.crateObj.transform.SetParent(transform); this.crateObj.transform.localPosition = Vector3.zero; Renderer[] componentsInChildren = this.crateObj.GetComponentsInChildren <Renderer>(true); int i = 0; int num = componentsInChildren.Length; while (i < num) { Renderer renderer = componentsInChildren[i]; if (renderer.sharedMaterial != null && renderer.sharedMaterial.HasProperty("_OutlineInnerWidth") && renderer.sharedMaterial.HasProperty("_Outline")) { renderer.sharedMaterial.SetFloat("_Outline", 0f); renderer.sharedMaterial.SetFloat("_OutlineInnerWidth", 0f); } i++; } Transform[] componentsInChildren2 = this.crateObj.GetComponentsInChildren <Transform>(true); GameObject gameObject = null; if (componentsInChildren2 != null) { int num2 = componentsInChildren2.Length; for (int j = 0; j < num2; j++) { GameObject gameObject2 = componentsInChildren2[j].gameObject; string name = gameObject2.name; if ("crate" == name) { gameObject = gameObject2; break; } } } this.crateObj.name = "crate"; if (gameObject != null) { transform2.SetParent(gameObject.transform); } else { transform2.SetParent(this.crateObj.transform); } transform2.localPosition = Vector3.zero; this.crateController.SetActive(true); this.crateAnimator = this.crateController.GetComponent <Animator>(); this.crateAnimator.SetTrigger("DropCrate"); this.FindChildAnims(); this.crateLandTimer = Service.ViewTimerManager.CreateViewTimer(this.crateVO.CrateRewardAnimLandTime, false, new TimerDelegate(this.OnCrateLanded), null); this.IsLoaded = true; this.UpdateCrateAnimState(InventoryCrateAnimationState.Falling); }
private void OnDataUpdateFailure() { ProcessingScreen.Hide(); this.top50Button.Enabled = false; this.findMeButton.Enabled = false; }
private void PopulatePlayersOnGrid() { ProcessingScreen.Hide(); this.AddItemsToLeaderboardGrid(); }
private void OnFacebookLoginFailed() { this.IsLoggingIn = false; ProcessingScreen.Hide(); this.allDataFetchedCallbacks.Clear(); }
public void PurchaseCooldownSkipResponse(object response) { this.UpdatePlayerPerksData(response); ProcessingScreen.Hide(); }
private void OnAccountRegisterFailure(uint status, object cookie) { RegisterExternalAccountCommand registerExternalAccountCommand = (RegisterExternalAccountCommand)cookie; Lang lang = Service.Get <Lang>(); string title = lang.Get("ACCOUNT_SYNC_ERROR", new object[0]); string message = null; if (status == 1318u) { switch (registerExternalAccountCommand.RequestArgs.Provider) { case AccountProvider.FACEBOOK: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_FACEBOOK", new object[0]); break; case AccountProvider.GAMECENTER: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GAMECENTER", new object[0]); break; case AccountProvider.GOOGLEPLAY: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GOOGLEPLAY", new object[0]); break; } ProcessingScreen.Hide(); AlertScreen.ShowModal(false, title, message, null, null); return; } if (status == 2200u) { ProcessingScreen.Hide(); AccountSyncScreen screen = AccountSyncScreen.CreateSyncConflictScreen(registerExternalAccountCommand); Service.Get <ScreenController>().AddScreen(screen); return; } if (status != 2201u) { return; } switch (registerExternalAccountCommand.RequestArgs.Provider) { case AccountProvider.FACEBOOK: if (this.externalAccountInfo.FacebookAccountId != null && this.externalAccountInfo.FacebookAccountId != FacebookManager.Instance.getUserId()) { message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]); } else if (this.externalAccountInfo.FacebookAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]); } break; case AccountProvider.GAMECENTER: if (this.externalAccountInfo.GameCenterAccountId != null && this.externalAccountInfo.GameCenterAccountId != GameServicesManager.GetUserId()) { message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER", new object[0]); } else if (this.externalAccountInfo.FacebookAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER_FACEBOOK", new object[0]); } break; case AccountProvider.GOOGLEPLAY: if (this.externalAccountInfo.GooglePlayAccountId != null && this.externalAccountInfo.GooglePlayAccountId != GameServicesManager.GetUserId()) { message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY", new object[0]); } else if (this.externalAccountInfo.FacebookAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY_FACEBOOK", new object[0]); } break; } ProcessingScreen.Hide(); AlertScreen.ShowModal(false, title, message, null, null); }
private void OnAccountRegisterFailure(uint status, object cookie) { RegisterExternalAccountCommand registerExternalAccountCommand = (RegisterExternalAccountCommand)cookie; Lang lang = Service.Lang; string title = lang.Get("ACCOUNT_SYNC_ERROR", new object[0]); string message = null; string derivedExternalAccountId = registerExternalAccountCommand.ResponseResult.DerivedExternalAccountId; if (status != 2200u) { if (status != 2201u) { if (status == 1318u) { switch (registerExternalAccountCommand.RequestArgs.Provider) { case AccountProvider.FACEBOOK: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_FACEBOOK", new object[0]); break; case AccountProvider.GAMECENTER: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GAMECENTER", new object[0]); break; case AccountProvider.GOOGLEPLAY: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_GOOGLEPLAY", new object[0]); break; case AccountProvider.RECOVERY: message = lang.Get("ACCOUNT_SYNC_AUTH_ERROR_RECOVERY", new object[0]); break; } ProcessingScreen.Hide(); AlertScreen.ShowModal(false, title, message, null, null); } } else { switch (registerExternalAccountCommand.RequestArgs.Provider) { case AccountProvider.FACEBOOK: if (this.externalAccountInfo.DerivedFacebookAccountId != null && this.externalAccountInfo.DerivedFacebookAccountId != derivedExternalAccountId) { message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK", new object[0]); } else if (this.externalAccountInfo.DerivedGooglePlayAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_FACEBOOK_GOOGLEPLAY", new object[0]); } break; case AccountProvider.GAMECENTER: if (this.externalAccountInfo.DerivedGameCenterAccountId != null && this.externalAccountInfo.DerivedGameCenterAccountId != derivedExternalAccountId) { message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER", new object[0]); } else if (this.externalAccountInfo.DerivedFacebookAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_GAMECENTER_FACEBOOK", new object[0]); } break; case AccountProvider.GOOGLEPLAY: if (this.externalAccountInfo.DerivedGooglePlayAccountId != null && this.externalAccountInfo.DerivedGooglePlayAccountId != derivedExternalAccountId) { message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY", new object[0]); } else if (this.externalAccountInfo.DerivedFacebookAccountId != null) { message = lang.Get("ACCOUNT_SYNC_ERROR_GOOGLEPLAY_FACEBOOK", new object[0]); } break; case AccountProvider.RECOVERY: message = lang.Get("ACCOUNT_SYNC_ERROR_RECOVERY", new object[0]); break; } ProcessingScreen.Hide(); AlertScreen.ShowModal(false, title, message, null, null); } } else { ProcessingScreen.Hide(); AccountSyncScreen accountSyncScreen = AccountSyncScreen.CreateSyncConflictScreen(registerExternalAccountCommand); if (registerExternalAccountCommand.RequestArgs.Provider == AccountProvider.RECOVERY) { accountSyncScreen.OverrideDescription(lang.Get("ACCOUNT_SYNC_CONFLICT_RECOVERY", new object[0])); } Service.ScreenController.AddScreen(accountSyncScreen); } }
private void OnDonationComplete(bool success, object cookie) { ProcessingScreen.Hide(); this.CloseView(); }
private void OnVisitNeighborFailure(uint id, object cookie) { ProcessingScreen.Hide(); }
private void OnBuySuccess(BuyTargetedOfferResponse response, object cookie) { ProcessingScreen.Hide(); this.HandleTargetedOfferSuccess(response.CrateDataTO, this.CurrentTargetedOffer); this.UpdateFromTargetedOfferSummary(response.TargetedOffers); }