fix playerprefs usage + rename audiobundles

This commit is contained in:
mangorifo
2024-02-04 17:52:19 +08:00
parent b3bb082a6b
commit 4804b2e0e5
12 changed files with 616 additions and 192 deletions
+14 -26
View File
@@ -11,6 +11,7 @@ namespace JTN
{
public class Utils : MonoBehaviour
{
/*
public bool scrolling;
public GameObject objectRot;
public GameObject sn;
@@ -19,6 +20,7 @@ namespace JTN
private float tm = 0;
private bool once = false;
private GameObject currentObjectRot;
*/
public string GameObjectList;
public bool DestroyParentIfNotDevelopment = false;
@@ -107,34 +109,22 @@ namespace JTN
}
private void Start()
{
if (scrolling)
{
currentObjectRot = Instantiate(objectRot, sn.transform.position, sn.transform.rotation);
}
GameObject[] allObjects = UnityEngine.Object.FindObjectsOfType<GameObject>();
foreach (GameObject go in allObjects)
GameObjectList = GameObjectList + ", " + go.name;
if (!Debug.isDebugBuild || Application.platform != RuntimePlatform.WindowsEditor)
Destroy(Parent);
if (PlayerPrefs.HasKey("QualityLevel"))
QualitySettings.SetQualityLevel(PlayerPrefs.GetInt("QualityLevel"));
if (PlayerPrefs.HasKey("FullscreenState"))
SetFullscreen(bool.Parse(PlayerPrefs.GetString("FullscreenState")));
}
private void FixedUpdate()
{
if (scrolling)
{
if (tm < srate)
{
tm += Time.deltaTime;
}
else if (!once && tm < srate)
{
tm = 0;
currentObjectRot = Instantiate(objectRot, sn.transform.position, sn.transform.rotation);
}
currentObjectRot.GetComponent<RectTransform>().position = currentObjectRot.GetComponent<RectTransform>().position + (Vector3.forward * movespeed) * Time.deltaTime;
once = true;
}
if (LoadSceneOnObjectActivateOrDeactivate && AdvancedLevelManager)
if (RunOnDeactivate)
@@ -179,22 +169,20 @@ namespace JTN
{
obj.SetActive(false);
}
public void SetFullscreen (bool FullscreenState)
public void SetFullscreen(bool FullscreenState)
{
Debug.Log($"Set fullscreen pref to {FullscreenState}");
PlayerPrefs.SetString("FullscreenState", $"{FullscreenState}");
if (FullscreenState)
{
PlayerPrefs.SetInt("FullscreenState", 1);
Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
Screen.SetResolution(1533, 720, false);
}
else
//Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
Screen.SetResolution(1533, 720, true);
} else
{
PlayerPrefs.SetInt("FullscreenState", 0);
Screen.fullScreenMode = FullScreenMode.Windowed;
Screen.SetResolution(1533, 720, false);
}
}
public void DisableAnim(Animation anim)
{