postprocessing options (1)

This commit is contained in:
mangorifo
2024-01-31 22:53:00 +08:00
parent 64fbc0031a
commit 2951c4d538
310 changed files with 2144 additions and 143 deletions
Executable file → Normal file
View File
Executable file → Normal file
View File
Executable file → Normal file
View File
+29 -14
View File
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.UI;
public class HomeWorld_Initialize : MonoBehaviour
@@ -28,6 +28,9 @@ public class HomeWorld_Initialize : MonoBehaviour
public RectTransform SettingsPanel;
private Resolution GameResolutionPre;
public Toggle FullscreenToggle;
public Toggle PostProcessingToggle;
public SettingsPanel SettingsPanelScript;
private async void Start()
{
@@ -42,19 +45,19 @@ public class HomeWorld_Initialize : MonoBehaviour
OpenMenuClip1 = await JTN.Utils.LoadClip(Path.Combine(Application.streamingAssetsPath, StartingClipName));
if (audioSource && OpenMenuClip1)
audioSource.PlayOneShot(OpenMenuClip1, PlayVolume);
/* if (SettingsPanel)
{
if (Screen.currentResolution.height != GameResolutionPre.height)
{
SettingsPanel.sizeDelta = new Vector2(SettingsPanel.sizeDelta.x, Screen.currentResolution.height);
GameResolutionPre = Screen.currentResolution;
}
if (Screen.currentResolution.width != GameResolutionPre.width)
{
SettingsPanel.sizeDelta = new Vector2(Screen.currentResolution.width, SettingsPanel.sizeDelta.y);
GameResolutionPre = Screen.currentResolution;
}
}*/
/* if (SettingsPanel)
{
if (Screen.currentResolution.height != GameResolutionPre.height)
{
SettingsPanel.sizeDelta = new Vector2(SettingsPanel.sizeDelta.x, Screen.currentResolution.height);
GameResolutionPre = Screen.currentResolution;
}
if (Screen.currentResolution.width != GameResolutionPre.width)
{
SettingsPanel.sizeDelta = new Vector2(Screen.currentResolution.width, SettingsPanel.sizeDelta.y);
GameResolutionPre = Screen.currentResolution;
}
}*/
if (PlayerPrefs.HasKey("FullscreenState") && FullscreenToggle)
{
@@ -66,6 +69,18 @@ public class HomeWorld_Initialize : MonoBehaviour
FullscreenToggle.isOn = false;
}
}
if (PlayerPrefs.GetInt("PostProcessingEnabled") == 1)
{
foreach (PostProcessVolume volume in SettingsPanelScript.PostProcessingVolumes)
volume.enabled = true;
PostProcessingToggle.isOn = true;
} else
{
foreach (PostProcessVolume volume in SettingsPanelScript.PostProcessingVolumes)
volume.enabled = false;
PostProcessingToggle.isOn = false;
}
}
private void FixedUpdate()
Executable file → Normal file
+15 -5
View File
@@ -9,6 +9,8 @@ public class TimeController : MonoBehaviour
{
public TMP_Text TODIndicator;
public Slider TODSlider;
public bool UseLocalTime = false;
[HideInInspector]
public GameObject sun;
[HideInInspector]
@@ -46,15 +48,23 @@ public class TimeController : MonoBehaviour
// Update is called once per frame
void Update()
{
SunUpdate();
if (UseLocalTime)
{
timeOfDay = DateTime.Now.Hour + (DateTime.Now.Minute * 0.01f);
SunUpdate();
}
else
{
SunUpdate();
timeOfDay += (Time.deltaTime / secondsPerDay) * timeMultiplier;
if (timeOfDay >= 24)
timeOfDay = 0;
}
timeOfDay += (Time.deltaTime / secondsPerDay) * timeMultiplier;
StringTimeOfDay = FormatTime(timeOfDay, MilitaryTime);
PublicFormattedTimeOfDay = StringTimeOfDay;
if (timeOfDay >= 24)
timeOfDay = 0;
if (TODIndicator)
TODIndicator.text = StringTimeOfDay;
Executable file → Normal file
View File
Executable file → Normal file
View File
Executable file → Normal file
+12 -1
View File
@@ -1,7 +1,6 @@
using TMPro;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
public class SettingsPanel : MonoBehaviour
@@ -11,6 +10,8 @@ public class SettingsPanel : MonoBehaviour
public bool DisableSettingsPanelWhenLinkedGameobjectIsActivated = false;
public TMP_Dropdown GraphicsQualityDropdown;
public PostProcessVolume PostProcessVolume;
public List<PostProcessVolume> PostProcessingVolumes = new() { };
private void Update()
{
if (settingsPanel && DisableSettingsPanelWhenLinkedGameobjectIsActivated && settingsPanelDeactivator.activeInHierarchy)
@@ -20,6 +21,16 @@ public class SettingsPanel : MonoBehaviour
}
}
public void AcTogglePostProcessing(bool IsEnabled) {
if (IsEnabled)
PlayerPrefs.SetInt("PostProcessingEnabled", 1);
else
PlayerPrefs.SetInt("PostProcessingEnabled", 0);
foreach (PostProcessVolume volume in PostProcessingVolumes)
volume.enabled = IsEnabled;
}
private void Start()
{
if (GraphicsQualityDropdown)
View File