public static void ToggleOrthographic(Camera camera) { camera.orthographic = !camera.orthographic; BTInfoHUDManager.SetOrthographicText(camera.orthographic.ToString()); BTModMenuManager.SetOrthographicText(camera.orthographic ? "enabled" : "disabled"); }
public static void ToggleFog() { RenderSettings.fog = !RenderSettings.fog; BTInfoHUDManager.SetFogText(RenderSettings.fog.ToString()); BTModMenuManager.SetFogText(RenderSettings.fog ? "enabled" : "disabled"); }
public static void ToggleSkybox() { if (RenderSettings.skybox != null) { prevSkybox = RenderSettings.skybox; RenderSettings.skybox = null; BTInfoHUDManager.SetSkyboxText("False"); BTModMenuManager.SetSkyboxText("disabled"); } else { RenderSettings.skybox = prevSkybox; BTInfoHUDManager.SetSkyboxText("True"); BTModMenuManager.SetSkyboxText("enabled"); } }
public static void SetOrthographicSize(Camera camera, float orthographicSize) { camera.orthographicSize = orthographicSize; BTInfoHUDManager.SetOrthographicSizeText(orthographicSize.ToString()); }
public static void SetFOV(Camera camera, float fov) { camera.fieldOfView = fov; BTInfoHUDManager.SetFOVText(fov.ToString()); }
private static void PrepareUI() { if (canvasObject != null) { return; } AssetBundle uiBundle = null; try{ string bundlePath = (BTConfigHolder.basePath + "btuiBundle").Replace('/', Path.DirectorySeparatorChar); uiBundle = AssetBundle.LoadFromFile(bundlePath); if (uiBundle == null) { configHolder.LogMessage(LogType.Error, "failed to load bundleFile at path: " + bundlePath); return; } canvasObject = uiBundle.LoadAsset <GameObject>("Canvas"); if (canvasObject == null) { configHolder.LogMessage(LogType.Error, "failed to load CanvasObject from bundle"); return; } canvasObject = UnityEngine.Object.Instantiate <GameObject>(canvasObject); if (canvasObject == null) { configHolder.LogMessage(LogType.Error, "failed to instantiate CanvasObject"); return; } UnityEngine.Object.DontDestroyOnLoad(canvasObject); canvasComponent = canvasObject.GetComponent <Canvas>(); if (canvasComponent == null) { configHolder.LogMessage(LogType.Error, "failed to obtain Canvas component!"); return; } initialCanvasScale = canvasComponent.scaleFactor; modMenuObject = BTUIUtils.PrepareWindow(canvasObject, "ModMenuWindow"); if (modMenuObject == null) { configHolder.LogMessage(LogType.Error, "failed to load modMenuWindow from bundle"); return; } BTModMenuManager.Initialize(modMenuObject); animPlayerObject = BTUIUtils.PrepareWindow(canvasObject, "AnimPlayerWindow"); if (animPlayerObject == null) { configHolder.LogMessage(LogType.Error, "failed to load animPlayerWindow from bundle"); return; } BTAnimationPlayerManager.Initialize(animPlayerObject); infoHUDObject = BTUIUtils.PrepareWindow(canvasObject, "InfoHUD"); if (infoHUDObject == null) { configHolder.LogMessage(LogType.Error, "failed to load infoHudWindow from bundle"); return; } BTInfoHUDManager.Initialize(infoHUDObject); cutscenePlayerObject = BTUIUtils.PrepareWindow(canvasObject, "CutscenePlayerWindow"); if (cutscenePlayerObject == null) { configHolder.LogMessage(LogType.Error, "failed to load cutscenePlayerWindow from bundle"); return; } BTCutsceneManager.Initialize(cutscenePlayerObject); }catch (Exception e) { configHolder.LogMessage(LogType.Error, "caught exception while loading UI: " + e.ToString()); }finally{ if (uiBundle != null) { uiBundle.Unload(false); } } }