public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.WorldInTransitionComplete) { if (id == EventId.PlanetRelocate) { this.CurrentPlanetActiveTournament = this.GetActiveTournamentOnCurrentPlanet(); } } else if (Service.Get <GameStateMachine>().CurrentState is HomeState) { if (this.showConflictPopup) { this.showConflictPopup = false; this.SetConflictPopupIsShown(); AlertScreen.ShowModal(false, null, Service.Get <Lang>().Get("VICTORY_BONUS_MESSAGE", new object[0]), null, null); } else if (this.NotifyEndForTournamentVO != null) { this.ShowTournamentEnded(); } else { TournamentRank tournamentCurrentRank = this.currentPlayer.TournamentProgress.GetTournamentCurrentRank(this.CurrentPlanetActiveTournament.Uid); Service.Get <ScreenController>().AddScreen(new TournamentTierChangedScreen(tournamentCurrentRank)); string newValue = ServerTime.Time.ToString(); Service.Get <ServerPlayerPrefs>().SetPref(ServerPref.TournamentTierChangeTimeViewed, newValue); SetPrefsCommand command = new SetPrefsCommand(false); Service.Get <ServerAPI>().Enqueue(command); } Service.Get <EventManager>().UnregisterObserver(this, EventId.WorldInTransitionComplete); } return(EatResponse.NotEaten); }
public EatResponse OnEvent(EventId id, object cookie) { if (id != EventId.WorldInTransitionComplete) { if (id == EventId.ServerAdminMessage) { AdminMessage adminMessage = cookie as AdminMessage; for (int i = 0; i < adminMessage.Messages.Count; i++) { AdminMessageData adminMessageData = adminMessage.Messages[i]; if (!this.seenMessages.Contains(adminMessageData.Uid)) { this.seenMessages.Add(adminMessageData.Uid); this.queuedMessages.Enqueue(adminMessageData); if (Service.Get <GameStateMachine>().CurrentState is HomeState || Service.Get <GameStateMachine>().CurrentState is EditBaseState) { this.DisplayAdminMessagesOnQueue(false); } } } } } else if (Service.Get <GameStateMachine>().CurrentState is HomeState) { if (!this.haveShownLoginNotification) { SetPrefsCommand command = new SetPrefsCommand(false); Service.Get <ServerAPI>().Enqueue(command); } this.DisplayAdminMessagesOnQueue(Service.Get <CurrentPlayer>().CampaignProgress.FueInProgress); } return(EatResponse.NotEaten); }
private void OnNotificationScreenClosed(bool gotoStoreFront) { if (gotoStoreFront) { Service.BILoggingController.TrackGameAction("rateapp", "yes", this.numTimesViewed.ToString(), null, 1); Service.ServerPlayerPrefs.SetPref(ServerPref.RatedApp, "1"); SetPrefsCommand command = new SetPrefsCommand(false); Service.ServerAPI.Sync(command); GameUtils.TryAndOpenAppropriateStorePage(); } else { Service.BILoggingController.TrackGameAction("rateapp", "no", this.numTimesViewed.ToString(), null, 1); } this.parent.ChildComplete(this); }
private void OnNotificationScreenClosed(bool gotoStoreFront) { if (gotoStoreFront) { Service.Get <BILoggingController>().TrackGameAction("rateapp", "yes", this.numTimesViewed.ToString(), null, 1); Service.Get <ServerPlayerPrefs>().SetPref(ServerPref.RatedApp, "1"); SetPrefsCommand command = new SetPrefsCommand(false); Service.Get <ServerAPI>().Sync(command); string text = "ms-windows-store:PDP?PFN=Disney.StarWarsCommander_6rarf9sa4v8jt"; if (!string.IsNullOrEmpty(text)) { Application.OpenURL(text); } } else { Service.Get <BILoggingController>().TrackGameAction("rateapp", "no", this.numTimesViewed.ToString(), null, 1); } this.parent.ChildComplete(this); }
public override void Execute() { base.Execute(); if (!GameConstants.RATE_MY_APP_ENABLED) { this.parent.ChildComplete(this); return; } if (Service.Get <GalaxyViewController>().IsPlanetDetailsScreenOpeningOrOpen()) { this.parent.ChildComplete(this); return; } if (Service.Get <EnvironmentController>().IsRestrictedProfile()) { this.parent.ChildComplete(this); return; } if (Service.Get <ServerPlayerPrefs>().GetPref(ServerPref.RatedApp) == "1") { this.parent.ChildComplete(this); return; } if (Service.Get <ScreenController>().GetHighestLevelScreen <MissionCompleteScreen>() == null) { Service.Get <EventManager>().RegisterObserver(this, EventId.ScreenClosing, EventPriority.Default); Service.Get <ScreenController>().AddScreen(new RateAppScreen()); } else { Service.Get <EventManager>().RegisterObserver(this, EventId.MissionCompleteScreenDisplayed, EventPriority.Default); } this.numTimesViewed = Convert.ToInt32(Service.Get <ServerPlayerPrefs>().GetPref(ServerPref.NumRateAppViewed), CultureInfo.InvariantCulture); this.numTimesViewed++; Service.Get <ServerPlayerPrefs>().SetPref(ServerPref.NumRateAppViewed, this.numTimesViewed.ToString()); SetPrefsCommand command = new SetPrefsCommand(false); Service.Get <ServerAPI>().Enqueue(command); }