public override void OnConnect(GameControllerBase mainGame) { base.OnConnect(mainGame); Debug.Log("MainGame: Connected"); // Setup our Inventory and Quest Engine InventoryEngine.Instance.Initialize(mainGame); QuestEngine.Instance.Initialize(mainGame); DialogEngine.Instance.Initialize(mainGame); PBGameMaster.GameState = GameStateType.Connected; if (Application.platform == RuntimePlatform.WindowsEditor) { mainGame.Game.Avatar.Token = "b184145cd5405aa0cadd91c724198613";//"f8caa53b14f9d5d35fdc84756c5ff8ba"; } else if (Application.platform == RuntimePlatform.WindowsPlayer) { mainGame.Game.Avatar.Token = "f61297bd64ce510052c3864b2fe22d02"; } if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXPlayer) { if (_loaderPref.GetInt(PBConstants.PREF_LOGGEDIN) == 1) { PBGameMaster.GameState = GameStateType.Authenticating; string username = _loaderPref.GetString(PBConstants.PREF_USERNAME); string password = _loaderPref.GetString(PBConstants.PREF_PASSWORD); Debug.Log("MainGame: Logging in with Username: "******", Password: "******"MainGame: Authenticating... with Token: " + mainGame.Game.Avatar.Token); mainGame.Game.Avatar.Authenticate(mainGame.Game.Avatar.Token); } }
public override void OnAuthenticated(GameControllerBase mainGame, bool isAuth) { base.OnAuthenticated(mainGame, isAuth); if (isAuth == false) // not authenticated { if (mainGame.loginWindow == null) { mainGame.Game.Avatar.Disconnect(); } else { PBGameMaster.GameState = GameStateType.Disconnected; mainGame.loginWindow.InfoText = "Failed..."; _loaderPref.SetInt(PBConstants.PREF_LOGGEDIN, 0); mainGame.ShowLoginWindow(); } } else { if (mainGame.loginWindow != null) { mainGame.loginWindow.Hide(); } _loaderPref.SetInt(PBConstants.PREF_LOGGEDIN, 1); _loaderPref.SetString(PBConstants.PREF_USERNAME, mainGame.Game.Avatar.Username); _loaderPref.SetString(PBConstants.PREF_PASSWORD, mainGame.Game.Avatar.Password); mainGame.Game.Avatar.LoadWorld(mainGame.Game.Settings.IsPrivateRoom); PBGameMaster.GameState = GameStateType.Loading; } }