diff --git a/Assets/Res/Main/Entity/MyRoomManager.prefab b/Assets/Res/Main/Entity/MyRoomManager.prefab index e5f5c96..072cb7e 100644 --- a/Assets/Res/Main/Entity/MyRoomManager.prefab +++ b/Assets/Res/Main/Entity/MyRoomManager.prefab @@ -126,7 +126,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7736143046250787917} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 6442dc8070ceb41f094e44de0bf87274, type: 3} m_Name: diff --git a/Assets/Res/Main/Entity/UIManager.prefab b/Assets/Res/Main/Entity/UIManager.prefab index 8592a6f..2689338 100644 --- a/Assets/Res/Main/Entity/UIManager.prefab +++ b/Assets/Res/Main/Entity/UIManager.prefab @@ -9,7 +9,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 9156766140375124690} - - component: {fileID: 38952591794927206} m_Layer: 0 m_Name: UIManager m_TagString: Untagged @@ -32,15 +31,3 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &38952591794927206 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 9144517237380066900} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 2d1ed5819e87e0f4ebbdf4dad51fcb7a, type: 3} - m_Name: - m_EditorClassIdentifier: diff --git a/Assets/Res/Main/Scene/MirrorRoomOffline.unity b/Assets/Res/Main/Scene/MirrorRoomOffline.unity index dde2c5f..29751c1 100644 --- a/Assets/Res/Main/Scene/MirrorRoomOffline.unity +++ b/Assets/Res/Main/Scene/MirrorRoomOffline.unity @@ -132,11 +132,6 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1568052019122780073, guid: 2257ed29939b08f48a2886709375ae69, - type: 3} - propertyPath: m_Enabled - value: 0 - objectReference: {fileID: 0} - target: {fileID: 4760332684612964771, guid: 2257ed29939b08f48a2886709375ae69, type: 3} propertyPath: m_LocalPosition.x diff --git a/Assets/Res/Main/UIPanel/SettingsWindow.prefab b/Assets/Res/Main/UIPanel/SettingsWindow.prefab index eb71793..88eadf0 100644 --- a/Assets/Res/Main/UIPanel/SettingsWindow.prefab +++ b/Assets/Res/Main/UIPanel/SettingsWindow.prefab @@ -5371,10 +5371,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4d6ce7fe9c8bcb144bfed87170589a6e, type: 3} m_Name: m_EditorClassIdentifier: - generalPanel: {fileID: 4929832501435178744} - audioPanel: {fileID: 2478601437905449858} - graphicsPanel: {fileID: 7082806397231928786} - displayPanel: {fileID: 6551384662084563704} + generalPanel: {fileID: 4535673477861328621} + audioPanel: {fileID: 3733547730907787236} + graphicsPanel: {fileID: 41461428167766573} + displayPanel: {fileID: 561068071673071071} generalTab: {fileID: 2750116641401440055} audioTab: {fileID: 1661438359137702215} graphicsTab: {fileID: 5210410202606032641} diff --git a/Assets/Samples/Input System/1.14.2/On-Screen Controls/ScreenTest.cs b/Assets/Samples/Input System/1.14.2/On-Screen Controls/ScreenTest.cs index ba7b213..a27ac05 100644 --- a/Assets/Samples/Input System/1.14.2/On-Screen Controls/ScreenTest.cs +++ b/Assets/Samples/Input System/1.14.2/On-Screen Controls/ScreenTest.cs @@ -15,14 +15,14 @@ public class ScreenTest : MonoBehaviour startPos = ParentObj.anchoredPosition; inputAction.action.Enable(); inputAction.action.performed += ScreenTouchTest; - onScreenStick.onPointerDown += () => - { - ParentObj.anchoredPosition = onScreenStick.PointerDownPos; - }; - onScreenStick.onPointerUp += () => - { - ParentObj.anchoredPosition = startPos; - }; + //onScreenStick.onPointerDown += () => + //{ + // ParentObj.anchoredPosition = onScreenStick.PointerDownPos; + //}; + //onScreenStick.onPointerUp += () => + //{ + // ParentObj.anchoredPosition = startPos; + //}; } private void ScreenTouchTest(InputAction.CallbackContext obj) diff --git a/Assets/Scripts/HotUpdate/Main/GameStart.cs b/Assets/Scripts/HotUpdate/Main/GameStart.cs index c7d13dd..c477914 100644 --- a/Assets/Scripts/HotUpdate/Main/GameStart.cs +++ b/Assets/Scripts/HotUpdate/Main/GameStart.cs @@ -6,13 +6,32 @@ using YooAsset; public class GameStart : MonoBehaviour { SceneHandle sceneHandle; + void Start() { DontDestroyOnLoad(gameObject); - StartCoroutine(LoadScene()); - //StartCoroutine(LoadUIManager()); + StartCoroutine(StartupSequence()); } - IEnumerator LoadScene() + + IEnumerator StartupSequence() + { + Debug.Log("开始游戏启动流程..."); + + yield return StartCoroutine(InitializeGameSystems()); + + yield return StartCoroutine(LoadMainScene()); + + Debug.Log("游戏启动流程完成"); + } + + IEnumerator InitializeGameSystems() + { + Debug.Log("初始化游戏系统..."); + GameSystem.Inst.Init(); + Debug.Log("游戏系统初始化完成"); + yield return null; + } + IEnumerator LoadMainScene() { sceneHandle = YooAssets.LoadSceneAsync("MirrorRoomOffline"); //sceneHandle = YooAssets.LoadSceneAsync("Game"); @@ -23,17 +42,6 @@ public class GameStart : MonoBehaviour }; yield return sceneHandle; } - //IEnumerator LoadUIManager() - //{ - // AssetHandle _handle = YooAssets.LoadAssetAsync("UIManager"); - // _handle.Completed += (handle) => - // { - // GameObject go = Instantiate((GameObject)_handle.AssetObject); - // DontDestroyOnLoad(go); - // Debug.Log(_handle.AssetObject); - // }; - // yield return _handle; - //} IEnumerator LoadNetWorkHUD() { AssetHandle _handle = YooAssets.LoadAssetAsync("MyNetWorkHUD"); @@ -44,12 +52,4 @@ public class GameStart : MonoBehaviour }; yield return _handle; } - // Update is called once per frame - void Update() - { - //if(sceneHandle!=null && sceneHandle.IsValid) - //{ - // Debug.Log(sceneHandle.Progress); - //} - } } diff --git a/Assets/Scripts/HotUpdate/Main/GameSystem.cs b/Assets/Scripts/HotUpdate/Main/GameSystem.cs new file mode 100644 index 0000000..5c9343e --- /dev/null +++ b/Assets/Scripts/HotUpdate/Main/GameSystem.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class GameSystem : Singleton +{ + public UIManager UI { get; private set; } + public SettingsManager Settings { get; private set; } + + public GraphicsManager Graphics { get; private set; } + public void Init() + { + UI = UIManager.Inst; + Settings = SettingsManager.Inst; + Graphics = GraphicsManager.Inst; + } + +} diff --git a/Assets/Scripts/HotUpdate/Main/GameSystem.cs.meta b/Assets/Scripts/HotUpdate/Main/GameSystem.cs.meta new file mode 100644 index 0000000..52d4c71 --- /dev/null +++ b/Assets/Scripts/HotUpdate/Main/GameSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1f34cd41201fbe34d9c5cb62ffabda99 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/HotUpdate/Main/Player/NetWorkThirdCharacterController.cs b/Assets/Scripts/HotUpdate/Main/Player/NetWorkThirdCharacterController.cs index ecd462d..a8146d8 100644 --- a/Assets/Scripts/HotUpdate/Main/Player/NetWorkThirdCharacterController.cs +++ b/Assets/Scripts/HotUpdate/Main/Player/NetWorkThirdCharacterController.cs @@ -119,16 +119,16 @@ public class NetWorkThirdCharacterController : NetworkBehaviour if (!isLocalPlayer) return; if (context.performed) { - //isCursorLocked = SettingsManager.Inst.isShow(); - //UpdateCursorState(); - //if (SettingsManager.Inst.isShow()) - //{ - // SettingsManager.Inst.CloseSettingWindow(); - //} - //else - //{ - // SettingsManager.Inst.OpenSettingWindow(); - //} + isCursorLocked = !isCursorLocked; + UpdateCursorState(); + if (GameSystem.Inst.UI.CheckShow(nameof(SettingsWindow))) + { + GameSystem.Inst.UI.HideWindow(nameof(SettingsWindow)); + } + else + { + GameSystem.Inst.UI.ShowWindow(nameof(SettingsWindow)); + } } } public void OnAlt(InputAction.CallbackContext context) diff --git a/Assets/Scripts/HotUpdate/Main/Player/ThirdCharacterController.cs b/Assets/Scripts/HotUpdate/Main/Player/ThirdCharacterController.cs index 446091f..ccdd974 100644 --- a/Assets/Scripts/HotUpdate/Main/Player/ThirdCharacterController.cs +++ b/Assets/Scripts/HotUpdate/Main/Player/ThirdCharacterController.cs @@ -115,14 +115,14 @@ public class ThirdCharacterController : MonoBehaviour { isCursorLocked = !isCursorLocked; UpdateCursorState(); - //if (SettingsManager.Inst.isShow()) - //{ - // SettingsManager.Inst.CloseSettingWindow(); - //} - //else - //{ - // SettingsManager.Inst.OpenSettingWindow(); - //} + if (GameSystem.Inst.UI.CheckShow(nameof(SettingsWindow))) + { + GameSystem.Inst.UI.HideWindow(nameof(SettingsWindow)); + } + else + { + GameSystem.Inst.UI.ShowWindow(nameof(SettingsWindow)); + } } } public void OnFire(InputAction.CallbackContext context) diff --git a/Assets/Scripts/HotUpdate/Main/UI/Base/UIBasePanel.cs b/Assets/Scripts/HotUpdate/Main/UI/Base/UIBasePanel.cs index 752c0d5..7582925 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/Base/UIBasePanel.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/Base/UIBasePanel.cs @@ -8,4 +8,14 @@ public abstract class UIBasePanel : MonoBehaviour public virtual void OnHide() { } public virtual void Refresh() { } + public virtual void Show() + { + gameObject.SetActive(true); + OnShow(); + } + public virtual void Hide() + { + gameObject.SetActive(false); + OnHide(); + } } diff --git a/Assets/Scripts/HotUpdate/Main/UI/Base/UIBaseWindow.cs b/Assets/Scripts/HotUpdate/Main/UI/Base/UIBaseWindow.cs index 15d41a9..ddc6216 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/Base/UIBaseWindow.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/Base/UIBaseWindow.cs @@ -11,7 +11,7 @@ public abstract class UIBaseWindow : MonoBehaviour } public virtual void Hide() { - gameObject.SetActive(true); + gameObject.SetActive(false); OnHide(); } protected virtual void OnShow() { } diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/AudioPanel.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/AudioPanel.cs index 391bb5d..798d606 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/AudioPanel.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/AudioPanel.cs @@ -6,22 +6,22 @@ public class AudioPanel : UIBasePanel, ISettingsPanel { [SerializeField] private Slider masterVolumeSlider; [SerializeField] private AudioMixer audioMixer; - - private void OnEnable() + float masterVolume; + public override void OnShow() { - masterVolumeSlider.value = SettingsManager.Inst.CurrentSettings.masterVolume; + masterVolume = masterVolumeSlider.value = SettingsManager.Inst.CurrentSettings.masterVolume; if (audioMixer == null) audioMixer = FindAnyObjectByType(); } public void OnMasterVolumeChanged(float value) { - SettingsManager.Inst.CurrentSettings.masterVolume = value; + masterVolume = value; SetVolume(value); } public void ApplySettings() { - SetVolume(SettingsManager.Inst.CurrentSettings.masterVolume); + SettingsManager.Inst.CurrentSettings.masterVolume = masterVolume; } private void SetVolume(float volume) @@ -32,6 +32,6 @@ public class AudioPanel : UIBasePanel, ISettingsPanel public void ResetToDefault() { - throw new System.NotImplementedException(); + SettingsManager.Inst.CurrentSettings.masterVolume = masterVolume = SettingsManager.Inst.DefSetting.masterVolume; } } \ No newline at end of file diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GeneralPanel.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GeneralPanel.cs index dcc2674..e404bf4 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GeneralPanel.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GeneralPanel.cs @@ -5,29 +5,22 @@ using UnityEngine.UI; public class GeneralPanel : UIBasePanel,ISettingsPanel { [SerializeField] private TMP_InputField serverAddressInput; - + string serverAddress; public override void OnShow() { serverAddressInput.text = SettingsManager.Inst.CurrentSettings.serverAddress; - base.Refresh(); } - public override void Refresh() - { - base.Refresh(); - } - public void OnServerAddressChanged(string value) { - SettingsManager.Inst.CurrentSettings.serverAddress = value; + serverAddress = value; } - public void ApplySettings() { - // SettingsManager.Inst.CurrentSettings.serverAddress = value; + SettingsManager.Inst.CurrentSettings.serverAddress = serverAddress; } public void ResetToDefault() { - + SettingsManager.Inst.CurrentSettings.serverAddress = serverAddress = SettingsManager.Inst.DefSetting.serverAddress; } } \ No newline at end of file diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs new file mode 100644 index 0000000..06834d8 --- /dev/null +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using YooAsset; + +public class GraphicsManager : Singleton +{ + public GraphicsSetting graphicsSetting; + private UniversalRenderPipelineAsset _urpAsset; + private VolumeProfile urpVolumeProfile; + public GraphicsManager() + { + _urpAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset; + + if (_urpAsset == null) + { + Debug.LogError("URP Asset null"); + } + urpVolumeProfile = YooAssets.LoadAssetSync("SampleSceneProfile").AssetObject as VolumeProfile; + if (urpVolumeProfile == null) + { + Debug.LogError("VolumeProfile null"); + } + graphicsSetting = SettingsManager.Inst.CurrentSettings.graphicsSettings; + ApplySettings(); + } + public void ApplySettings() + { + SettingsManager.Inst.CurrentSettings.graphicsSettings = graphicsSetting; + QualitySettings.vSyncCount = graphicsSetting.vsyncEnabled ? 1 : 0; + _urpAsset.shadowDistance = graphicsSetting.shadowDistance; + _urpAsset.msaaSampleCount = (int)Mathf.Pow(2, graphicsSetting.qualityLevel); + _urpAsset.renderScale = graphicsSetting.renderScale; + } +} +[System.Serializable] +public class GraphicsSetting +{ + public int qualityLevel = 2; + public bool vsyncEnabled = true; + public float shadowDistance = 50f; + public int antiAliasing = 2; + public bool bloomEnabled = true; + public float renderScale = 1.0f; + public bool isCustom = false; + + public GraphicsSetting() { } + + public GraphicsSetting(int quality, bool vsync, float shadows, int aa, bool bloom, float scale) + { + qualityLevel = quality; + vsyncEnabled = vsync; + shadowDistance = shadows; + antiAliasing = aa; + bloomEnabled = bloom; + renderScale = scale; + } +} \ No newline at end of file diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs.meta b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs.meta new file mode 100644 index 0000000..6fcbbea --- /dev/null +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 557d237147ace7e4bb16964db0441340 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsPanel.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsPanel.cs index 00b48b7..5de2b0d 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsPanel.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/GraphicsPanel.cs @@ -15,160 +15,51 @@ public class GraphicsPanel : UIBasePanel, ISettingsPanel [SerializeField] private Toggle bloomToggle; [SerializeField] private Slider renderScaleSlider; - [Header("Graphics References")] - [SerializeField] private VolumeProfile urpVolumeProfile; - - [Header("Quality Presets")] - [SerializeField] - private QualityPreset[] qualityPresets = new QualityPreset[4] + public override void OnShow() { - new QualityPreset("Low", 0, false, 20f, 0, false, 0.8f), - new QualityPreset("Medium", 1, false, 40f, 1, true, 1.0f), - new QualityPreset("High", 2, true, 60f, 2, true, 1.2f), - new QualityPreset("Ultra", 3, true, 100f, 2, true, 1.5f) - }; - - [System.Serializable] - public class QualityPreset - { - public string name; - public int qualityLevel; - public bool vsyncEnabled; - public float shadowDistance; - public int antiAliasing; - public bool bloomEnabled; - public float renderScale; - - public QualityPreset(string name, int qualityLevel, bool vsyncEnabled, float shadowDistance, - int antiAliasing, bool bloomEnabled, float renderScale) - { - this.name = name; - this.qualityLevel = qualityLevel; - this.vsyncEnabled = vsyncEnabled; - this.shadowDistance = shadowDistance; - this.antiAliasing = antiAliasing; - this.bloomEnabled = bloomEnabled; - this.renderScale = renderScale; - } - } - - private UniversalRenderPipelineAsset _urpAsset; - private Bloom _bloom; - private void OnEnable() - { - StartCoroutine(InitializeDelayed()); - } - - private IEnumerator InitializeDelayed() - { - yield return null; - - _urpAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset; - - if (_urpAsset == null) - { - Debug.LogError("URP Asset null"); - yield break; - } - - if (urpVolumeProfile != null && !urpVolumeProfile.TryGet(out _bloom)) - { - Debug.LogWarning("Volume Profile Bloom null"); - } - - //InitializeQualityDropdown(); var settings = SettingsManager.Inst.CurrentSettings; - qualityDropdown.SetValueWithoutNotify(settings.qualityLevel); - vsyncToggle.SetIsOnWithoutNotify(settings.vsyncEnabled); - shadowDistanceSlider.SetValueWithoutNotify(settings.shadowDistance); - antiAliasingDropdown.SetValueWithoutNotify(settings.antiAliasing); - bloomToggle.SetIsOnWithoutNotify(settings.bloomEnabled); - renderScaleSlider.SetValueWithoutNotify(settings.renderScale); - ApplySettings(); + qualityDropdown.SetValueWithoutNotify(settings.graphicsSettings.qualityLevel); + vsyncToggle.SetIsOnWithoutNotify(settings.graphicsSettings.vsyncEnabled); + shadowDistanceSlider.SetValueWithoutNotify(settings.graphicsSettings.shadowDistance); + antiAliasingDropdown.SetValueWithoutNotify(settings.graphicsSettings.antiAliasing); + bloomToggle.SetIsOnWithoutNotify(settings.graphicsSettings.bloomEnabled); + renderScaleSlider.SetValueWithoutNotify(settings.graphicsSettings.renderScale); } - //private void InitializeQualityDropdown() - //{ - // qualityDropdown.ClearOptions(); - // foreach (var preset in qualityPresets) - // { - // qualityDropdown.options.Add(new TMP_Dropdown.OptionData(preset.name)); - // } - //} public void OnQualityChanged(int index) { - - SettingsManager.Inst.CurrentSettings.qualityLevel = index; - var settings = SettingsManager.Inst.CurrentSettings; - - if (index >= 0 && index < qualityPresets.Length) - { - var preset = qualityPresets[index]; - // 应锟斤拷预锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟 - vsyncToggle.SetIsOnWithoutNotify(preset.vsyncEnabled); - shadowDistanceSlider.SetValueWithoutNotify(preset.shadowDistance); - antiAliasingDropdown.SetValueWithoutNotify(preset.antiAliasing); - bloomToggle.SetIsOnWithoutNotify(preset.bloomEnabled); - renderScaleSlider.SetValueWithoutNotify(preset.renderScale); - } - - // 锟斤拷锟斤拷应锟斤拷锟斤拷锟斤拷 - OnVSyncChanged(settings.vsyncEnabled); - OnShadowDistanceChanged(settings.shadowDistance); - OnAntiAliasingChanged(settings.antiAliasing); - OnBloomChanged(settings.bloomEnabled); - OnRenderScaleChanged(settings.renderScale); + GameSystem.Inst.Graphics.graphicsSetting.qualityLevel = index; } public void OnVSyncChanged(bool value) { - SettingsManager.Inst.CurrentSettings.vsyncEnabled = value; - QualitySettings.vSyncCount = value ? 1 : 0; + GameSystem.Inst.Graphics.graphicsSetting.vsyncEnabled = value; } public void OnShadowDistanceChanged(float value) { - SettingsManager.Inst.CurrentSettings.shadowDistance = value; - if (_urpAsset != null) - _urpAsset.shadowDistance = value; + GameSystem.Inst.Graphics.graphicsSetting.shadowDistance = value; } public void OnAntiAliasingChanged(int index) { - SettingsManager.Inst.CurrentSettings.antiAliasing = index; - if (_urpAsset != null) - _urpAsset.msaaSampleCount = (int)Mathf.Pow(2, index); + GameSystem.Inst.Graphics.graphicsSetting.antiAliasing = index; } public void OnBloomChanged(bool value) { - SettingsManager.Inst.CurrentSettings.bloomEnabled = value; - if (_bloom != null) - _bloom.active = value; + GameSystem.Inst.Graphics.graphicsSetting.bloomEnabled = value; } public void OnRenderScaleChanged(float value) { - SettingsManager.Inst.CurrentSettings.renderScale = value; - if (_urpAsset != null) - _urpAsset.renderScale = value; + GameSystem.Inst.Graphics.graphicsSetting.renderScale = value; } public void ApplySettings() { - if (_urpAsset == null) return; - - var settings = SettingsManager.Inst.CurrentSettings; - if (settings.qualityLevel != 4) - QualitySettings.SetQualityLevel(settings.qualityLevel); - QualitySettings.vSyncCount = settings.vsyncEnabled ? 1 : 0; - - _urpAsset.shadowDistance = settings.shadowDistance; - _urpAsset.msaaSampleCount = (int)Mathf.Pow(2, settings.antiAliasing); - _urpAsset.renderScale = settings.renderScale; - - if (_bloom != null) _bloom.active = settings.bloomEnabled; + GameSystem.Inst.Graphics.ApplySettings(); } public void ResetToDefault() diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsManager.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsManager.cs index 1612c56..3baa4ea 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsManager.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsManager.cs @@ -7,6 +7,7 @@ public class SettingsManager: Singleton { private GameSettings _currentSettings; public GameSettings CurrentSettings => _currentSettings; + public GameSettings DefSetting = new GameSettings(); private string settingsPath; public SettingsManager() { @@ -33,9 +34,14 @@ public class SettingsManager: Singleton string json = JsonUtility.ToJson(_currentSettings, true); File.WriteAllText(settingsPath, json); } + #region 鍥惧儚 + #endregion 鍥惧儚 + + #region 鍏朵粬 + #endregion 鍏朵粬 public void ResetToDefaultSettings() { - _currentSettings = new GameSettings(); + _currentSettings = DefSetting; SaveSettings(); } } @@ -43,16 +49,17 @@ public class SettingsManager: Singleton [System.Serializable] public class GameSettings { - public string serverAddress = "http://127.0.0.1:8080"; + public string serverAddress ; public float masterVolume = 0.75f; - public int qualityLevel = 2; - public bool vsyncEnabled = true; - public float shadowDistance = 50f; - public int antiAliasing = 2; - public bool bloomEnabled = true; - public float renderScale = 1.0f; + //public int qualityLevel = 2; + //public bool vsyncEnabled = true; + //public float shadowDistance = 50f; + //public int antiAliasing = 2; + //public bool bloomEnabled = true; + //public float renderScale = 1.0f; + public GraphicsSetting graphicsSettings; public int resolutionIndex = 0; public bool fullscreen = true; diff --git a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsWindow.cs b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsWindow.cs index fd432d9..4c0ae92 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsWindow.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/SettingWindow/SettingsWindow.cs @@ -34,7 +34,7 @@ public class SettingsWindow : UIBaseWindow displayTab.onClick.AddListener(() => SwitchPanel(displayPanel)); applyButton.onClick.AddListener(ApplyAllSettings); - cancelButton.onClick.AddListener(() => { UIManager.Inst.HideWindow(gameObject.name); }); + cancelButton.onClick.AddListener(() => { UIManager.Inst.HideWindow(nameof(SettingsWindow)); }); defaultsButton.onClick.AddListener(ResetToDefaults); quitButton.onClick.AddListener(() => { Application.Quit(); }); } @@ -72,7 +72,7 @@ public class SettingsWindow : UIBaseWindow SettingsManager.Inst.SaveSettings(); - UIManager.Inst.HideWindow(gameObject.name); + UIManager.Inst.HideWindow(nameof(SettingsWindow)); } public void ResetToDefaults() diff --git a/Assets/Scripts/HotUpdate/Main/UI/UIManager.cs b/Assets/Scripts/HotUpdate/Main/UI/UIManager.cs index 43acf1d..a08349c 100644 --- a/Assets/Scripts/HotUpdate/Main/UI/UIManager.cs +++ b/Assets/Scripts/HotUpdate/Main/UI/UIManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using YooAsset; -public class UIManager : SingletonMono +public class UIManager : Singleton { Transform uiRoot; Dictionary openedWindows = new Dictionary(); @@ -20,9 +20,10 @@ public class UIManager : SingletonMono { YooAssets.LoadAssetAsync(windowName).Completed += handle => { - GameObject go = Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform); + GameObject go = GameObject.Instantiate((GameObject)handle.AssetObject, GameManager.Inst.MainUICanvas.transform); var window = go.GetComponent(); window.Show(); + openedWindows[windowName] = window; onShow?.Invoke(window); }; } @@ -33,5 +34,20 @@ public class UIManager : SingletonMono { openedWindows[windowName].Hide(); } + else + { + Debug.Log("未找到该名字窗口,使用窗口类名试试"); + } + } + public bool CheckShow(string windowName) + { + if (openedWindows.ContainsKey(windowName)) + { + return openedWindows[windowName].gameObject.activeSelf; + } + else + { + return false; + } } } diff --git a/Assets/Settings/AssetBundleCollectorConfig.xml b/Assets/Settings/AssetBundleCollectorConfig.xml index 2de1119..794c0f2 100644 --- a/Assets/Settings/AssetBundleCollectorConfig.xml +++ b/Assets/Settings/AssetBundleCollectorConfig.xml @@ -28,5 +28,8 @@ + + + \ No newline at end of file diff --git a/Assets/Settings/AssetBundleCollectorSetting.asset b/Assets/Settings/AssetBundleCollectorSetting.asset index a40f984..8ac88c4 100644 --- a/Assets/Settings/AssetBundleCollectorSetting.asset +++ b/Assets/Settings/AssetBundleCollectorSetting.asset @@ -136,3 +136,16 @@ MonoBehaviour: FilterRuleName: CollectShaderVariants AssetTags: UserData: + - GroupName: Setting + GroupDesc: + AssetTags: + ActiveRuleName: EnableGroup + Collectors: + - CollectPath: Assets/Settings/SampleSceneProfile.asset + CollectorGUID: a6560a915ef98420e9faacc1c7438823 + CollectorType: 0 + AddressRuleName: AddressByFileName + PackRuleName: PackDirectory + FilterRuleName: CollectAll + AssetTags: + UserData: diff --git a/Assets/Settings/SampleSceneProfile.asset b/Assets/Settings/SampleSceneProfile.asset index 37e401d..a999896 100644 --- a/Assets/Settings/SampleSceneProfile.asset +++ b/Assets/Settings/SampleSceneProfile.asset @@ -13,45 +13,40 @@ MonoBehaviour: m_Name: Bloom m_EditorClassIdentifier: active: 1 - m_AdvancedMode: 0 - threshold: - m_OverrideState: 1 - m_Value: 1 - min: 0 - intensity: - m_OverrideState: 1 - m_Value: 1 - min: 0 - scatter: - m_OverrideState: 0 - m_Value: 0.7 - min: 0 - max: 1 - clamp: - m_OverrideState: 0 - m_Value: 65472 - min: 0 - tint: - m_OverrideState: 0 - m_Value: {r: 1, g: 1, b: 1, a: 1} - hdr: 0 - showAlpha: 0 - showEyeDropper: 1 - highQualityFiltering: - m_OverrideState: 0 - m_Value: 0 skipIterations: m_OverrideState: 0 m_Value: 1 - min: 0 - max: 16 + threshold: + m_OverrideState: 1 + m_Value: 1 + intensity: + m_OverrideState: 1 + m_Value: 1 + scatter: + m_OverrideState: 0 + m_Value: 0.7 + clamp: + m_OverrideState: 0 + m_Value: 65472 + tint: + m_OverrideState: 0 + m_Value: {r: 1, g: 1, b: 1, a: 1} + highQualityFiltering: + m_OverrideState: 0 + m_Value: 0 + downscale: + m_OverrideState: 0 + m_Value: 0 + maxIterations: + m_OverrideState: 0 + m_Value: 6 dirtTexture: m_OverrideState: 0 m_Value: {fileID: 0} + dimension: 1 dirtIntensity: m_OverrideState: 0 m_Value: 0 - min: 0 --- !u!114 &-7011558710299706105 MonoBehaviour: m_ObjectHideFlags: 3 @@ -65,26 +60,18 @@ MonoBehaviour: m_Name: Vignette m_EditorClassIdentifier: active: 1 - m_AdvancedMode: 0 color: m_OverrideState: 0 m_Value: {r: 0, g: 0, b: 0, a: 1} - hdr: 0 - showAlpha: 0 - showEyeDropper: 1 center: m_OverrideState: 0 m_Value: {x: 0.5, y: 0.5} intensity: m_OverrideState: 1 m_Value: 0.25 - min: 0 - max: 1 smoothness: m_OverrideState: 1 m_Value: 0.4 - min: 0.01 - max: 1 rounded: m_OverrideState: 0 m_Value: 0 @@ -98,7 +85,7 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} - m_Name: SampleSceneProfile + m_Name: Assets/Settings/SampleSceneProfile.asset m_EditorClassIdentifier: components: - {fileID: 849379129802519247} @@ -117,7 +104,30 @@ MonoBehaviour: m_Name: Tonemapping m_EditorClassIdentifier: active: 1 - m_AdvancedMode: 0 mode: m_OverrideState: 1 m_Value: 1 + neutralHDRRangeReductionMode: + m_OverrideState: 0 + m_Value: 2 + acesPreset: + m_OverrideState: 0 + m_Value: 3 + hueShiftAmount: + m_OverrideState: 0 + m_Value: 0 + detectPaperWhite: + m_OverrideState: 0 + m_Value: 0 + paperWhite: + m_OverrideState: 0 + m_Value: 300 + detectBrightnessLimits: + m_OverrideState: 0 + m_Value: 1 + minNits: + m_OverrideState: 0 + m_Value: 0.005 + maxNits: + m_OverrideState: 0 + m_Value: 1000 diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index f722bc0..0f2335b 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -6,10 +6,10 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedSceneGuid-0: - value: 550256005d025d58090c082113735e4447164c7b797925672b2f1935e1b6326b + value: 5300050454035b5f590a0d2341705c441715487929717231297d4a31bab26160 flags: 0 RecentlyUsedSceneGuid-1: - value: 5300050454035b5f590a0d2341705c441715487929717231297d4a31bab26160 + value: 550256005d025d58090c082113735e4447164c7b797925672b2f1935e1b6326b flags: 0 RecentlyUsedSceneGuid-2: value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a