Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix(ui): fix loading screen
- Loading branch information
Showing
7 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| using HarmonyLib; | ||
|
|
||
| namespace TechtonicaVR.Debug; | ||
|
|
||
| [HarmonyPatch] | ||
| public class DisableLoadingScreenComplete | ||
| { | ||
| [HarmonyPatch(typeof(LoadingUI), "Update")] | ||
| [HarmonyPrefix] | ||
| public static bool Update() | ||
| { | ||
| // Set to false to disable loading screen skipping | ||
| return true; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using System; | ||
| using System.Linq; | ||
| using TechtonicaVR.Patches.LoadingScreen; | ||
| using UnityEngine; | ||
|
|
||
| namespace TechtonicaVR; | ||
|
|
||
| public class LoadingScreenPatch : MonoBehaviour | ||
| { | ||
|
|
||
| IPatch[] patches = [ | ||
| new LoadingScreenCanvasPatch(), | ||
| ]; | ||
|
|
||
| private float startTime = Time.time; | ||
|
|
||
| public static LoadingScreenPatch Create() | ||
| { | ||
| var instance = new GameObject(nameof(LoadingScreenPatch)).AddComponent<LoadingScreenPatch>(); | ||
|
|
||
| return instance; | ||
| } | ||
|
|
||
| void Start() | ||
| { | ||
| Plugin.Logger.LogDebug("Hello Loading Screen!"); | ||
| } | ||
|
|
||
| void Update() | ||
| { | ||
| patches = patches.Where(p => !p.Apply()).ToArray(); | ||
|
|
||
| if (!patches.Any()) | ||
| { | ||
| gameObject.SetActive(false); | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
plugin/src/patch/loading_screen/loading_screen_canvas_patch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using TechtonicaVR.VRCamera; | ||
| using UnityEngine; | ||
|
|
||
| namespace TechtonicaVR.Patches.LoadingScreen; | ||
|
|
||
| public class LoadingScreenCanvasPatch : GameObjectPatch | ||
| { | ||
| public LoadingScreenCanvasPatch() : base("Canvas") | ||
| { | ||
| } | ||
|
|
||
| protected override bool Apply(GameObject gameObject) | ||
| { | ||
| gameObject.transform.position = new Vector3(0, 0, 0); | ||
| gameObject.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); | ||
|
|
||
| var canvas = gameObject.GetComponent<Canvas>(); | ||
| canvas.renderMode = RenderMode.WorldSpace; | ||
|
|
||
| VRCameraManager.mainCamera.farClipPlane = 20f; | ||
|
|
||
| return true; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters