static public PBDefaults GetProfile(string profileName) { if (profiles.ContainsKey(profileName)) { return profiles[profileName]; } else { PBDefaults profile = new PBDefaults(); profiles.Add(profileName, profile); return profile; } }
protected virtual void Start() { // Initialize the Assets Manager AssetsManager.Initialize(); _wayPoint = (GameObject)AssetsManager.Instantiate(Resources.Load("3D/Waypoint/waypoint")); _wayPoint.animation.wrapMode = WrapMode.Loop; _wayPoint.animation.Play(); _wayPoint.renderer.enabled = false; // Remove any visible window WindowManager.IsVisible = false; // Set banner visibility to false Messenger<bool>.Broadcast(Messages.BANNER_SETVISIBILITY, false); // Load the Preferences Defaults _loaderPref = PBDefaults.GetProfile(PBConstants.PROFILE_PREF); _inGamePref = PBDefaults.GetProfile(PBConstants.PROFILE_INGAME); /* // Check if IslandGame is called from Loader scene, otherwise, put warning and switch back to Loader for Preps if (_loaderPref.GetInt(PBConstants.PREF_LOADER) != 99) { Debug.LogWarning("MainGame: Island scene must be loaded from Loader, switching to loader now"); Application.LoadLevel("Loader"); return; }*/ // Create Game Object Detector _detector = new Detector(this); try { if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer) { ConnectToGameServer(null); } // Call external get_session_id, so web player can get token from the website Application.ExternalCall("get_session_id"); } catch (System.Exception ex) { Debug.Log(ex.ToString()); } PBGameState.ProcessEvent((c) => c.Start(this)); }
public PBConnectedState() : base(GameStateType.Connected) { _loaderPref = PBDefaults.GetProfile(PBConstants.PROFILE_PREF); }