using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; public class console : MonoBehaviour { public GameObject UIObj; public InputField consoleInput; public Text consoleOutput; public PostProcessVolume pp; public Camera playerCam; //PostProcessingStuff Bloom bloom; AutoExposure exposure; AmbientOcclusion occlusion; void Start() { pp.profile.TryGetSettings(out bloom); pp.profile.TryGetSettings(out exposure); pp.profile.TryGetSettings(out occlusion); } // Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.BackQuote)) { bool isActive = !UIObj.activeSelf; UIObj.SetActive(isActive); consoleInput.interactable = isActive; if (isActive) consoleInput.Select(); } if (Input.GetKeyDown(KeyCode.Return)) { OnConsoleSubmit(); } } public void OnConsoleInput(string text) { //Debug.Log(text); } public void OnConsoleSubmit() { string input = consoleInput.text.ToLower(); char[] splitChars = { ' ' }; string[] inputs = input.Split(splitChars, System.StringSplitOptions.RemoveEmptyEntries ); try { switch (inputs[0]) { case "set": switch (inputs[1]) { case "fov": Camera.main.fieldOfView = int.Parse(inputs[2]); println($"Done, cam fov : {Camera.main.fieldOfView}"); break; case "bloom": switch (inputs[2]) { case "threshold": bloom.threshold.value = float.Parse(inputs[3]); println($"Done, bloom threshold at {bloom.threshold.value}"); break; default: bloom.intensity.value = float.Parse(inputs[2]); println($"Done, bloom intensity at {bloom.intensity.value}"); break; } break; case "exposure": switch (inputs[2]) { case "max": exposure.maxLuminance.value = float.Parse(inputs[3]); println($"Done, exposure max at {exposure.maxLuminance.value}"); break; case "min": exposure.minLuminance.value = float.Parse(inputs[3]); println($"Done, exposure min at {exposure.minLuminance.value}"); break; } break; case "occlusion": switch (inputs[2]) { case "thickness": occlusion.thicknessModifier.value = float.Parse(inputs[3]); println($"Done, occlusion thickness at {occlusion.thicknessModifier.value}"); break; default: occlusion.intensity.value = float.Parse(inputs[2]); println($"Done, occlusion intensity at {occlusion.intensity.value}"); break; } break; default: println("Please specify a value to set, are you retarded?"); break; } break; case "help": println("Here are the commands you can use"); println(""); println("set fov "); println("set bloom "); println("set bloom threshold "); println("set occlusion "); println("set occlusion threshold "); println(""); break; default: println("Please enter a valid command"); break; } } catch(Exception e) { println($"Error : {e.Message}"); // throw e; } consoleInput.text = ""; } public void print(string input) { consoleOutput.text += input; } public void println(string input) { consoleOutput.text += input; consoleOutput.text += Environment.NewLine; } }