/// <summary> /// Apply the game settings. This function propagates the given settings to all game systems that need them. /// </summary> /// <param name="settings">The settings to apply.</param> public static void ApplySettings(GameSettings settings) { // TODO: try and catch exceptions for erroneous loaded values (i.e. array idx) and reset to default if error // set the control scheme ControlSchemeManager.UseScheme(settings.CurrentControlSchemeIndex); // set the resolution if (settings.CurrentResolutionIndex > Screen.resolutions.Length) { // if the resolution is invalid, set it to the lowest resolution Screen.SetResolution(Screen.resolutions[0].width, Screen.resolutions[0].height, settings.Fullscreen); } else { Screen.SetResolution(Screen.resolutions[settings.CurrentResolutionIndex].width, Screen.resolutions[settings.CurrentResolutionIndex].height, settings.Fullscreen); } // set framerate to limit or not Application.targetFrameRate = settings.LimitFramerate ? FRAMERATE_LIMIT : -1; // set retro shader affine intensity Shader.SetGlobalFloat("AffineIntensity", settings.AffineIntensity); // set the current dream journal DreamJournalManager.SetJournal(settings.CurrentJournalIndex); // set volumes SetMusicVolume(settings.MusicVolume); SetSFXVolume(settings.SFXVolume); // set the graphics quality QualitySettings.SetQualityLevel(settings.CurrentQualityIndex, true); Debug.Log("Applying game settings..."); Debug.Log("Affine intensity: " + settings.AffineIntensity); }
public IEnumerator LoadGameCoroutine() { // do game startup stuff here GameSettings.Initialize(); TResourceManager.RegisterHandler(new LBDHandler()); TResourceManager.RegisterHandler(new TIXHandler()); TResourceManager.RegisterHandler(new Texture2DHandler()); TResourceManager.RegisterHandler(new MaterialHandler()); ControlSchemeManager.Initialize(); DreamJournalManager.Initialize(); MapReader.MapScaleFactor = 1F; GameSettings.LoadSettings(); Shader.SetGlobalFloat("_FogStep", 0.08F); Shader.SetGlobalFloat("AffineIntensity", 0.5F); PsxVram.Initialize(); if (Application.isEditor) { // if we're running inside the editor, we want to have the mouse! GameSettings.SetCursorViewState(true); } yield return(LBDTilePool.InitialiseCoroutine()); // TODO //SaveGameManager.LoadGame(); OnGameDataLoaded.Raise(); }
public static void ProcessConsoleCommand(string command) { List <string> commandFragments = SplitConsoleCommand(command); switch (commandFragments[0].ToLowerInvariant()) { case "switchjournal": { DreamJournalManager.SwitchJournal(commandFragments[1]); break; } case "loadlevel": { string levelName = commandFragments[1]; // if there is a journal specified switch to it if (commandFragments.Count > 2) { DreamJournalManager.SwitchJournal(commandFragments[2]); } string levelPath = IOUtil.PathCombine(Application.streamingAssetsPath, "levels", DreamJournalManager.CurrentJournal, levelName + ".tmap"); // check if the level exists before doing anything if (!File.Exists(levelPath)) { Debug.LogError("Level " + levelName + " does not exist"); break; } // if we're not in a dream begin one with the specified level if (!DreamDirector.CurrentlyInDream) { DreamDirector.BeginDream(levelPath); ConsoleUI.SetConsoleState(false); break; } else { // otherwise just swap out the level for the specified one DreamDirector.SwitchDreamLevel(levelPath); break; } } case "textureset": { int set = int.Parse(commandFragments[1], CultureInfo.InvariantCulture); Shader.SetGlobalInt("_TextureSet", set); Debug.Log("Switched texture set to " + (TextureSet)set); break; } case "enddream": { DreamDirector.EndDream(); break; } case "greyman": { if (!DreamDirector.CurrentlyInDream) { Debug.LogWarning("Not in dream!"); break; } GreymanController c = GameObject.FindGameObjectWithTag("GreymanController").GetComponent <GreymanController>(); c.SpawnGreyman(); break; } default: { Debug.LogWarning("Did not recognize command: " + commandFragments[0]); break; } } }