mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-23 10:05:14 +00:00
settings resolution changer
This commit is contained in:
parent
be5aff5aae
commit
52ff2a7829
7 changed files with 2964 additions and 33 deletions
File diff suppressed because it is too large
Load diff
|
@ -21,6 +21,13 @@ namespace HeavenStudio
|
|||
public static string levelLocation;
|
||||
public static bool officialLevel;
|
||||
|
||||
public static int CustomScreenWidth = 1280;
|
||||
public static int CustomScreenHeight = 720;
|
||||
|
||||
public static readonly (int width, int height)[] DEFAULT_SCREEN_SIZES = new[] { (1280, 720), (1920, 1080), (2560, 1440), (3840, 2160)};
|
||||
public static readonly string[] DEFAULT_SCREEN_SIZES_STRING = new[] { "1280x720", "1920x1080", "2560x1440", "3840x2160", "Custom" };
|
||||
public static int ScreenSizeIndex = 0;
|
||||
|
||||
public enum Scenes : int
|
||||
{
|
||||
SplashScreen = 0,
|
||||
|
@ -98,23 +105,33 @@ namespace HeavenStudio
|
|||
fade.GetComponent<SpriteRenderer>().DOColor(Color.black, fadeDuration).OnComplete(() => { SceneManager.LoadScene(loadedScene); fade.GetComponent<SpriteRenderer>().DOColor(new Color(0, 0, 0, 0), fadeDuration).OnComplete(() => { Destroy(fade); }); });
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void WindowFullScreen()
|
||||
{
|
||||
Debug.Log("WindowFullScreen");
|
||||
// Toggle fullscreen
|
||||
Screen.fullScreen = !Screen.fullScreen;
|
||||
if (Screen.fullScreen)
|
||||
if (!Screen.fullScreen)
|
||||
{
|
||||
// Set the resolution to the display's current resolution
|
||||
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
|
||||
Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.FullScreenWindow);
|
||||
Screen.fullScreen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, false);
|
||||
Screen.SetResolution(1280, 720, FullScreenMode.Windowed);
|
||||
Screen.fullScreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void ChangeScreenSize()
|
||||
{
|
||||
FullScreenMode mode = Screen.fullScreenMode;
|
||||
if (ScreenSizeIndex == DEFAULT_SCREEN_SIZES_STRING.Length - 1)
|
||||
{
|
||||
Screen.SetResolution(CustomScreenWidth, CustomScreenHeight, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Screen.SetResolution(DEFAULT_SCREEN_SIZES[ScreenSizeIndex].width, DEFAULT_SCREEN_SIZES[ScreenSizeIndex].height, mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -467,11 +467,6 @@ namespace HeavenStudio.Editor
|
|||
}
|
||||
}
|
||||
|
||||
public void WindowFullScreen()
|
||||
{
|
||||
GlobalGameManager.WindowFullScreen();
|
||||
}
|
||||
|
||||
private void UpdateEditorStatus(bool updateTime)
|
||||
{
|
||||
if (discordDuringTesting || !Application.isEditor)
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
using TMPro;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class DispAudioSettings : MonoBehaviour
|
||||
{
|
||||
public TMP_Dropdown resolutionsDropdown;
|
||||
public GameObject customSetter;
|
||||
public TMP_InputField widthInputField, heightInputField;
|
||||
|
||||
private void Start() {
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
var vals = GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING;
|
||||
for (int i = 0; i < vals.Length; i++)
|
||||
{
|
||||
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
|
||||
optionData.text = vals[i];
|
||||
dropDownData.Add(optionData);
|
||||
}
|
||||
resolutionsDropdown.AddOptions(dropDownData);
|
||||
resolutionsDropdown.value = GlobalGameManager.ScreenSizeIndex;
|
||||
|
||||
resolutionsDropdown.onValueChanged.AddListener(delegate
|
||||
{
|
||||
GlobalGameManager.ScreenSizeIndex = resolutionsDropdown.value;
|
||||
|
||||
customSetter.SetActive(resolutionsDropdown.value == GlobalGameManager.DEFAULT_SCREEN_SIZES_STRING.Length - 1);
|
||||
});
|
||||
|
||||
widthInputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
GlobalGameManager.CustomScreenWidth = System.Math.Max(int.Parse(widthInputField.text), 64);
|
||||
widthInputField.text = GlobalGameManager.CustomScreenWidth.ToString();
|
||||
});
|
||||
heightInputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
GlobalGameManager.CustomScreenHeight = System.Math.Max(int.Parse(heightInputField.text), 64);
|
||||
heightInputField.text = GlobalGameManager.CustomScreenHeight.ToString();
|
||||
});
|
||||
}
|
||||
|
||||
public void WindowFullScreen()
|
||||
{
|
||||
GlobalGameManager.WindowFullScreen();
|
||||
}
|
||||
|
||||
public void WindowConfirmSize()
|
||||
{
|
||||
GlobalGameManager.ChangeScreenSize();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 752cb90567101a545ab1e2aeae732a9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -10,6 +10,7 @@ namespace HeavenStudio.Editor
|
|||
public class SettingsDialog : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject settingsMenu;
|
||||
//this may all be moved to a different script in the future
|
||||
|
||||
private void Start() {}
|
||||
|
||||
|
|
|
@ -129,11 +129,11 @@ PlayerSettings:
|
|||
vulkanEnableLateAcquireNextImage: 0
|
||||
vulkanEnableCommandBufferRecycling: 1
|
||||
m_SupportedAspectRatios:
|
||||
4:3: 0
|
||||
5:4: 0
|
||||
16:10: 0
|
||||
4:3: 1
|
||||
5:4: 1
|
||||
16:10: 1
|
||||
16:9: 1
|
||||
Others: 0
|
||||
Others: 1
|
||||
bundleVersion: 1.0
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
|
|
Loading…
Reference in a new issue