mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
Optimize scene loading
This commit is contained in:
1 parent
7542781e78
commit
f1547a34ec
3 files changed
+42
-18
No files matched your search
@@ -36,12 +36,14 @@ namespace DynamicTranslationLoader
|
||||
}
|
||||
|
||||
Hooks.InstallHooks();
|
||||
|
||||
TranslateAll();
|
||||
}
|
||||
|
||||
|
||||
void LevelFinishedLoading(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
TranslateAll();
|
||||
TranslateScene(scene);
|
||||
}
|
||||
|
||||
public static string Translate(string input)
|
||||
@@ -49,8 +51,11 @@ namespace DynamicTranslationLoader
|
||||
if (translations.ContainsKey(input))
|
||||
return translations[input];
|
||||
|
||||
if (!untranslated.Contains(input))
|
||||
if (!untranslated.Contains(input) &&
|
||||
!translations.ContainsValue(input.Trim()))
|
||||
{
|
||||
untranslated.Add(input);
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
@@ -61,17 +66,21 @@ namespace DynamicTranslationLoader
|
||||
{
|
||||
//gameObject.text = "Harsh is shit";
|
||||
|
||||
if (translations.ContainsKey(gameObject.text))
|
||||
gameObject.text = translations[gameObject.text];
|
||||
else if (!untranslated.Contains(gameObject.text) &&
|
||||
!translations.ContainsValue(gameObject.text.Trim()))
|
||||
{
|
||||
untranslated.Add(gameObject.text);
|
||||
}
|
||||
|
||||
gameObject.text = Translate(gameObject.text);
|
||||
}
|
||||
}
|
||||
|
||||
void TranslateScene(Scene scene)
|
||||
{
|
||||
foreach (GameObject obj in scene.GetRootGameObjects())
|
||||
foreach (TextMeshProUGUI gameObject in obj.GetComponentsInChildren<TextMeshProUGUI>(true))
|
||||
{
|
||||
//gameObject.text = "Harsh is shit";
|
||||
|
||||
gameObject.text = Translate(gameObject.text);
|
||||
}
|
||||
}
|
||||
|
||||
void Dump()
|
||||
{
|
||||
string output = "";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using BepInEx;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace InputUnlocker
|
||||
@@ -11,12 +12,26 @@ namespace InputUnlocker
|
||||
public override string Name => "Input Length Unlocker";
|
||||
public override Version Version => new Version("1.0");
|
||||
|
||||
void Awake()
|
||||
{
|
||||
foreach (InputField gameObject in GameObject.FindObjectsOfType<InputField>())
|
||||
{
|
||||
UnlockInput(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void LevelFinishedLoading(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
foreach (UnityEngine.UI.InputField gameObject in GameObject.FindObjectsOfType<UnityEngine.UI.InputField>())
|
||||
{
|
||||
gameObject.characterLimit = 999;
|
||||
}
|
||||
foreach (GameObject obj in scene.GetRootGameObjects())
|
||||
foreach (InputField gameObject in obj.GetComponentsInChildren<InputField>(true))
|
||||
{
|
||||
UnlockInput(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void UnlockInput(InputField input)
|
||||
{
|
||||
input.characterLimit = 999;
|
||||
}
|
||||
|
||||
#region MonoBehaviour
|
||||
|
||||
@@ -36,17 +36,17 @@ namespace SliderUnlocker
|
||||
|
||||
Assembly illusion = typeof(CvsAccessory).Assembly;
|
||||
|
||||
var sceneObjects = scene.GetRootGameObjects();
|
||||
|
||||
foreach (Type type in illusion.GetTypes())
|
||||
{
|
||||
if (type.Name.ToUpper().StartsWith("CVS") &&
|
||||
type != typeof(CvsDrawCtrl) &&
|
||||
type != typeof(CvsColor))
|
||||
{
|
||||
cvsInstances.AddRange(GameObject.FindObjectsOfType(type));
|
||||
|
||||
foreach(GameObject gameObject in Resources.FindObjectsOfTypeAll<GameObject>())
|
||||
foreach (var obj in sceneObjects)
|
||||
{
|
||||
cvsInstances.AddRange(gameObject.GetComponents(type));
|
||||
cvsInstances.AddRange(obj.GetComponentsInChildren(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user