1: fit ui on 16:9 aspect ratios

This commit is contained in:
mangorifo
2024-02-05 00:40:21 +08:00
parent 088413a5d9
commit 159c74df2a
108 changed files with 12619 additions and 213 deletions
+20 -2
View File
@@ -1,6 +1,7 @@
using System.IO;
using TMPro;
using UnityEngine;
using UnityEngine.UIElements;
using System.Collections.Generic;
@@ -18,13 +19,16 @@ namespace JTN
};
[ShowOnly]
public string MissingFiles = "";
public GameObject DevMenu;
public GameObject ObjectWithUIDocument;
public void resoChange()
{
if (!PlayerPrefs.HasKey("FullscreenState"))
{
if (changeResolutionAutomatically && useStartupScriptHere)
{
Screen.SetResolution(1533, 720, false);
Screen.SetResolution(1533, 862, false);
Debug.Log("Changed game resolution to 1533x720");
}
}
@@ -35,10 +39,23 @@ namespace JTN
UtilsScript.SetFullscreen(bool.Parse(PlayerPrefs.GetString("FullscreenState")));
}
}
public void ActivateContainer()
{
UIDocument UIDoc = ObjectWithUIDocument.GetComponent<UIDocument>();
VisualElement root = UIDoc.rootVisualElement;
root.Q<VisualElement>("Container").visible = true;
}
private void Start()
{
if (useStartupScriptHere)
{
UIDocument UIDoc = ObjectWithUIDocument.GetComponent<UIDocument>();
VisualElement root = UIDoc.rootVisualElement;
root.Q<Button>("OpenDevMenu").clicked += () => {
root.Q<VisualElement>("Container").visible = false;
DevMenu.SetActive(true);
};
resoChange();
if (!PlayerPrefs.HasKey("PostProcessingEnabled"))
PlayerPrefs.SetInt("PostProcessingEnabled", 1);
@@ -56,7 +73,8 @@ namespace JTN
}
else
{
MessageText.text = $"{MissingAssetFiles} asset(s) that are required to run the game have been moved, deleted or renamed.\n\nSearched for but was not found:<size=28>{MissingFiles}";
root.Q<VisualElement>("ExtraContent").visible = true;
root.Q<Label>("Message").text = $"{MissingAssetFiles} asset(s) that are required to run the game have been moved, deleted or renamed.\n\nSearched for but was not found:<size=28>{MissingFiles}";
}
}
}
+3 -3
View File
@@ -180,12 +180,12 @@ namespace JTN
if (FullscreenState)
{
//Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
Screen.SetResolution(1533, 720, true);
Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
//Screen.SetResolution(1533, 862, true);
} else
{
Screen.fullScreenMode = FullScreenMode.Windowed;
Screen.SetResolution(1533, 720, false);
Screen.SetResolution(1533, 862, false);
}
}
public void DisableAnim(Animation anim)