// LOGIC public void Initialize() { StatsModule statsModule = GameServices.GetModuleMain <StatsModule>(); if (statsModule != null) { for (int conditionIndex = 0; conditionIndex < m_Conditions.Count; ++conditionIndex) { UserStatCondition condition = m_Conditions[conditionIndex]; if (condition != null) { condition.Initialize(statsModule); } } } if (m_CheckOnEvent) { if (m_EventName != "") { Messenger.AddListener(m_EventName, OnEvent); } } }
public void ShowSelectedLeaderboardUI() { if (GameServices.IsInitialized()) { if (selectedLeaderboard != null) { GameServices.ShowLeaderboardUI(selectedLeaderboard.Name); } else { NativeUI.Alert("Alert", "Please select a leaderboard first."); } } else { #if UNITY_ANDROID GameServices.Init(); #elif UNITY_IOS NativeUI.Alert("Service Unavailable", "The user is not logged in."); #else Debug.Log("Cannot show leaderboards: platform not supported."); #endif } }
public SportDataLOLClient(string primarySubscriptionKey, string ProjectionPrimarySubscriptionKey) { Uri scoreApiBaseUrl = LOLConfig.ScoreApiBaseUrl; Uri statApiBaseUrl = LOLConfig.StateApiBaseUrl; Uri ProjectionApiBaseUrl = LOLConfig.ProjectionApiBaseUrl; AreasServices = new AreaServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); CompetitionServices = new CompetitionServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); GameServices = new GameServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); MembershipServices = new MembershipServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); PlayerServices = new PlayerServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); SeasonServices = new SeasonServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); TeamServices = new TeamServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); VenueServices = new VenueServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); StandingsServices = new StandingsServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ScheduleServices = new ScheduleServices(scoreApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ItemServices = new ItemServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey); SpellServices = new SpellServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ChampionServices = new ChampionServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey); BoxScoreServices = new BoxScoreServices(statApiBaseUrl.AbsoluteUri, primarySubscriptionKey); ProjectionServices = new ProjectionServices(ProjectionApiBaseUrl.AbsoluteUri, ProjectionPrimarySubscriptionKey); }
private void IniciarSesionButton_Click(object sender, RoutedEventArgs e) { string NombreJugador = NombreTextBoxIniciarSesion.Text.Trim(); string ContraseñaJugador = ContaseñaTextBoxIniciarSesion.Password.Trim(); try { InstanceContext instanceContext = new InstanceContext(this); GameServices loginService = new GameServices(instanceContext); if (ValidarDatosIngresadosInicioDeSesion(NombreJugador, ContraseñaJugador)) { loginService.IniciarSesion(NombreJugador, ContraseñaJugador); } else { MessageBox.Show(Application.Current.Resources["Datos inválidos, intente nuevamente"].ToString()); } } catch (EndpointNotFoundException) { MessageBox.Show(Application.Current.Resources["OperacionInvalida"].ToString()); } }
public static List <Platforms> getPlatform(string[] dataPlatforms) { List <Platforms> p = new List <Platforms>(); foreach (Platforms dataPlatform in Enum.GetValues(typeof(Platforms))) { foreach (string platfrom in dataPlatforms) { if (platfrom != "") { string res = GameServices.existPlatform(platfrom); if (res != "") { if (dataPlatform.ToString().ToUpper() == res.ToUpper()) { p.Add(dataPlatform); } } } } } return(p); }
void OnScoreUpdated(int score) { if (disable) { return; } string acmName = null; foreach (ScoreAchievement acm in achievements) { if (score == acm.scoreToUnlock) { acmName = acm.achievementName; break; } } // Unlock achievement if (acmName != null) { GameServices.UnlockAchievement(acmName); } }
private void InitializeGameServices() { lock (GameServicesLock) { if (mServices != null) { return; } using (var builder = GameServicesBuilder.Create()) { using (var config = clientImpl.CreatePlatformConfiguration(mConfiguration)) { // We need to make sure that the invitation delegate // is registered before the services object is // initialized - otherwise we might miss a callback if // the game was opened because of a user accepting an // invitation through a system notification. RegisterInvitationDelegate(mConfiguration.InvitationDelegate); builder.SetOnAuthFinishedCallback(HandleAuthTransition); builder.SetOnTurnBasedMatchEventCallback( (eventType, matchId, match) => mTurnBasedClient.HandleMatchEvent( eventType, matchId, match)); builder.SetOnMultiplayerInvitationEventCallback( HandleInvitation); if (mConfiguration.EnableSavedGames) { builder.EnableSnapshots(); } string[] scopes = mConfiguration.Scopes; for (int i = 0; i < scopes.Length; i++) { builder.AddOauthScope(scopes[i]); } if (mConfiguration.IsHidingPopups) { builder.SetShowConnectingPopup(false); } Debug.Log("Building GPG services, implicitly attempts silent auth"); mAuthState = AuthState.SilentPending; mServices = builder.Build(config); mEventsClient = new NativeEventClient(new EventManager(mServices)); mQuestsClient = new NativeQuestClient(new QuestManager(mServices)); mVideoClient = new NativeVideoClient(new VideoManager(mServices)); mTurnBasedClient = new NativeTurnBasedMultiplayerClient(this, new TurnBasedManager(mServices)); mTurnBasedClient.RegisterMatchDelegate(mConfiguration.MatchDelegate); mRealTimeClient = new NativeRealtimeMultiplayerClient(this, new RealtimeManager(mServices)); if (mConfiguration.EnableSavedGames) { mSavedGameClient = new NativeSavedGameClient(new SnapshotManager(mServices)); } else { mSavedGameClient = new UnsupportedSavedGamesClient( "You must enable saved games before it can be used. " + "See PlayGamesClientConfiguration.Builder.EnableSavedGames."); } mAuthState = AuthState.SilentPending; InitializeTokenClient(); } } } }
public SpriteLibrary(GameServices gs) : base(gs) { // For storing referenced image files. this.textureLibrary = new TextureLibrary(gs); }
/// <summary> /// Set the font to use while rendering. /// </summary> /// <param name="spriteFontName">Filename of the font.</param> public void SetFont(string spriteFontName) { Font = GameServices.GetService <ContentManager>().Load <SpriteFont>(spriteFontName); }
public void Initialize(List <IEntityComponent> entityComponents, Guid entityId) { Content = GameServices.GetService <ContentManager>(); }
protected override void BeginRun() { GameServices.BeginRun(); //This only happens once in a game. base.BeginRun(); }
private void SuccessToConnectedToServer() { ShowStatus($"Successfully connected to the Server. Trying to register as Player"); GameServices.RegisterAsPlayer(SuccessToRegisterAsPlayer, ErrorToRegisterAsPlayer); }
private void Disconnect() { InitializeSlots(); GameServices.Disconnect(); }
internal TurnBasedManager(GameServices services) { this.mGameServices = services; }
private void ThroneRoomEntranceCutscene() { if (ShroomGame.actualGameState == GameState.LevelTutorial && parentGameObject.PositionZ < -1050f && parentGameObject.PositionZ > -1200f && GameServices.GetService <ShroomGame>().levelOneCompleted&& !GameServices.GetService <ShroomGame>().roomEntranceCutscene) { GameServices.GetService <ShroomGame>().roomEntranceCutscene = true; GameServices.GetService <ShroomGame>().bossFight = true; GameServices.GetService <ShroomGame>().musicManager.StopSong(); GameServices.GetService <ShroomGame>().musicManager.PlaySong("fight"); GameServices.GetService <ShroomGame>().musicManager.IsRepeating = true; new Cutscene(GameServices.GetService <ShroomGame>().Content.Load <Texture2D>("Cutscene/3,0"), 12f, "Narrator: When our hero came to his senses, he found the door to the throne room wide open.", "Narrator: He noticed that King pushed weakened Borovikus to defense."); new Cutscene(GameServices.GetService <ShroomGame>().Content.Load <Texture2D>("Cutscene/3,0"), 12f, "King: Finally you are here! Help me, kill the traitor!", "Narrator: But our hero had already figured out who the real traitor was."); } }
private void SpecialTimeAbilities() { if (eWasPressed | rWasPressed) { ShroomGame.fadeAmount = MathHelper.Clamp((float)(Timer.gameTime.TotalGameTime.TotalMilliseconds - timeOfPress) / timeSkillsDelay, 0, 1); } else if (Timer.gameTime.TotalGameTime.TotalMilliseconds > timeSkillDoneTime + timeSkillsDelay) { ShroomGame.fadeAmount = 1.0f - MathHelper.Clamp((float)(Timer.gameTime.TotalGameTime.TotalMilliseconds - timeSkillDoneTime) / timeSkillsDelay, 0, 1); } // timeStop if (canUseQ) { if (inputManager.Keyboard[Keys.Q].WasPressed) { GameServices.GetService <ShroomGame>().usedQ = true; if (timeStop || TimeEnergy == 0) { audioComponent?.PlaySound2D("timeSpeed"); timeStop = false; } else if (!timeStop && TimeEnergy > 1) { audioComponent?.PlaySound2D("timeSlow"); timeStop = true; } } } if (canUseE) { if (inputManager.Keyboard[Keys.E].WasPressed && TimeEnergy >= 5 && !eWasPressed) { GameServices.GetService <ShroomGame>().usedE = true; eWasPressed = true; timeOfPress = Timer.gameTime.TotalGameTime.TotalMilliseconds; } } if (canUseR) { if (inputManager.Keyboard[Keys.R].WasPressed && TimeEnergy >= 3 && !rWasPressed && playerHat.GetComponent <AnimationManager>().isCurrentAnimation("throw")) { GameServices.GetService <ShroomGame>().usedR = true; rWasPressed = true; timeOfPress = Timer.gameTime.TotalGameTime.TotalMilliseconds; audioComponent?.PlaySound2D("teleport"); } } if (eWasPressed && Timer.gameTime.TotalGameTime.TotalMilliseconds > timeOfPress + timeSkillsDelay) { timeSkillDoneTime = Timer.gameTime.TotalGameTime.TotalMilliseconds; eWasPressed = false; TimeEnergy -= 5; this.parentGameObject.Position = lastPositions[lastPositions.Count / 2]; Hp = lastHPs[lastHPs.Count / 2]; ReLocateIndicies(lastPositions); ReLocateIndicies(lastHPs); } if (rWasPressed && Timer.gameTime.TotalGameTime.TotalMilliseconds > timeOfPress + timeSkillsDelay) { timeSkillDoneTime = Timer.gameTime.TotalGameTime.TotalMilliseconds; rWasPressed = false; TimeEnergy -= 3; this.parentGameObject.Position = new Vector3((this.playerHat.GetBoundingBox().Min.X + this.playerHat.GetBoundingBox().Max.X) / 2.0f, playerPositionYBeforeThrow, (this.playerHat.GetBoundingBox().Min.Z + this.playerHat.GetBoundingBox().Max.Z) / 2.0f); playerHat.GetComponent <AnimationManager>().AnimationBreak(); playerLeg.GetComponent <AnimationManager>().AnimationBreak(); playerHat.GetComponent <AnimationManager>().PlayAnimation("idle", true); playerLeg.GetComponent <AnimationManager>().PlayAnimation("idle", true); } }
private void OnEnable() { InitializeSlots(); GameServices.RequestStatus(); }
internal LeaderboardManager(GameServices services) { mServices = Misc.CheckNotNull(services); }
private void ConnectAsViewer() { SetButtonsInteractable(false); ShowStatus($"Tring to Connect to the Server as Viewer"); GameServices.ConnectToServer(SuccessToConnectedViewerToServer, ErrorToConnectToServer); }
internal OnStateResultProxy(GameServices services, OnStateLoadedListener listener) : base(ResultCallbackClassname) { mServices = Misc.CheckNotNull(services); mListener = listener; }
public void LoadLocalUserScore() { GameServices.LoadLocalUserScore(EM_GameServicesConstants.Leaderboard_Max_Distance, OnLocalUserScoreLoaded); }
internal AndroidAppStateClient(GameServices services) { mServices = Misc.CheckNotNull(services); }
public override void Initialize() { Content = GameServices.GetService <ContentManager>(); World.Initialize(); }
private static AndroidJavaObject GetApiClient(GameServices services) { return(JavaUtils.JavaObjectFromPointer(C.InternalHooks_GetApiClient(services.AsHandle()))); }
/// <summary> /// Reports score to leaderboard. /// </summary> public void ReportScore(int score, string ldbName) { GameServices.ReportScore(score, ldbName); }
internal StatsManager(GameServices services) { mServices = Misc.CheckNotNull(services); }
public LevelMapLibrary(GameServices gs) : base(gs) { // For storing referenced tile maps. this.tileMapLibrary = new TileMapLibrary(gs); }
public void TestIsGameFinishedNegativeNobodyFinished() { GameTable gameTable = MakeInitialGameTable; Assert.AreEqual(false, GameServices.IsGameFinished(gameTable)); }
internal PlayerManager(GameServices services) { mGameServices = Misc.CheckNotNull(services); }
public void Initialize() { LevelIntro = new LevelIntro(this); AllDrawableGameObjects.AddRange(GameServices.GetService <List <Player> >()); }
public override void OnEnter() { GameServices.SignOut(); Finish(); }
public Game(string data, List <string> gameDataRankingsLine) { bool error = false; //hacemos el split de la cadena data string[] splitDataGame = data.Split('-'); //almacenar datos del Game List <Platforms> listP = new List <Platforms>(); if (splitDataGame.Length == 4) { if (splitDataGame[3] == "") { System.Console.WriteLine("Error :list plataform not exist in dataGame"); } else { string[] splitPlatforms = splitDataGame[3].Split(','); if (splitPlatforms.Length > 1) { this.platforms = GameServices.getPlatform(splitPlatforms); this.name = splitDataGame[0]; foreach (Genres genre in System.Enum.GetValues(typeof(Genres))) { if (genre.ToString().ToLower() == splitDataGame[1].ToLower()) { this.genre = genre; } } this.releaseDate = int.Parse(splitDataGame[2]); } else { System.Console.WriteLine("Error :list plataform not exist in dataGame"); } } } //to doooooooo controlar el error y meter datos ranking if (error != true) { foreach (string gameData in gameDataRankingsLine) { string[] splitData = gameData.Split('-'); foreach (Platforms platform in this.Platforms) { string ss = splitData[0].ToLower(); if (ss == platform.ToString().ToLower()) { string dataR = string.Format("{0}-{1}", splitData[1], splitData[2]); Ranking r = new Ranking(dataR); Dictionary <Platforms, Ranking> dictionaryData = new Dictionary <Platforms, Ranking>(); dictionaryData.Add(platform, r); this.rankings = dictionaryData; } } } } else { System.Console.WriteLine("Error :can not save dataGame"); } }