diff --git a/Assets/Jianghu/Materials/Skill/Xuruoshi/龙纹22.mat b/Assets/Jianghu/Materials/Skill/Xuruoshi/龙纹22.mat index e38598befe..f69327b5d8 100755 --- a/Assets/Jianghu/Materials/Skill/Xuruoshi/龙纹22.mat +++ b/Assets/Jianghu/Materials/Skill/Xuruoshi/龙纹22.mat @@ -11,7 +11,11 @@ Material: m_Shader: {fileID: 4800000, guid: 0a016a83287664641b867743f19faf14, type: 3} m_Parent: {fileID: 0} m_ModifiedSerializedProperties: 0 - m_ValidKeywords: [] + m_ValidKeywords: + - _DISSOLVETEXUVS_NORMAL + - _DISTORTTEXUVS_NORMAL + - _MAINTEXUVS_NORMAL + - _MASKTEXUVS_NORMAL m_InvalidKeywords: - _DISSOLVETEXAR_ON - _DISTORTTEXAR_ON @@ -118,8 +122,11 @@ Material: - _DissolveFactor: 0 - _DissolveSoft: 0.1 - _DissolveTexAR: 1 + - _DissolveTexClampU: 0 + - _DissolveTexClampV: 0 - _DissolveTexRotate: 0 - _DissolveTexUSpeed: 0 + - _DissolveTexUVS: 0 - _DissolveTexVSpeed: 0 - _DissolveWide: 0.05 - _DistortDissolveTex: 0 @@ -127,8 +134,11 @@ Material: - _DistortMainTex: 0 - _DistortMaskTex: 0 - _DistortTexAR: 1 + - _DistortTexClampU: 0 + - _DistortTexClampV: 0 - _DistortTexRotate: 0 - _DistortTexUSpeed: 0 + - _DistortTexUVS: 0 - _DistortTexVSpeed: 0 - _Dst: 1 - _DstBlend: 0 @@ -146,12 +156,18 @@ Material: - _GlossyReflections: 0 - _MainAlpha: 1 - _MainTexAR: 0 + - _MainTexClampU: 0 + - _MainTexClampV: 0 - _MainTexRotate: 0 - _MainTexUSpeed: 0 + - _MainTexUVS: 0 - _MainTexVSpeed: 0 - _MaskTexAR: 1 + - _MaskTexClampU: 0 + - _MaskTexClampV: 0 - _MaskTexRotate: 0 - _MaskTexUSpeed: 0 + - _MaskTexUVS: 0 - _MaskTexVSpeed: 0 - _Metallic: 0 - _OcclusionStrength: 1 diff --git a/Assets/ModelRenderer/Art/Gfx/gfx/策划联入/状态效果/睡眠.prefab b/Assets/ModelRenderer/Art/Gfx/gfx/策划联入/状态效果/睡眠.prefab index 670d4fd0d9..dd94f04f0f 100644 --- a/Assets/ModelRenderer/Art/Gfx/gfx/策划联入/状态效果/睡眠.prefab +++ b/Assets/ModelRenderer/Art/Gfx/gfx/策划联入/状态效果/睡眠.prefab @@ -27,7 +27,7 @@ Transform: m_GameObject: {fileID: 3345156173100108586} serializedVersion: 2 m_LocalRotation: {x: 0.2602121, y: -0, z: -0, w: 0.96555156} - m_LocalPosition: {x: 0, y: 0.768, z: 0.516} + m_LocalPosition: {x: 0, y: 0.77, z: 0.15} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -223,7 +223,7 @@ ParticleSystem: serializedVersion: 2 minMaxState: 0 minColor: {r: 1, g: 1, b: 1, a: 1} - maxColor: {r: 0.8509804, g: 0, b: 0, a: 1} + maxColor: {r: 0.8509804, g: 0, b: 0, a: 0.078431375} maxGradient: serializedVersion: 2 key0: {r: 1, g: 1, b: 1, a: 1} @@ -4860,7 +4860,7 @@ Transform: m_GameObject: {fileID: 4120882056815218602} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0.38268343, z: 0, w: 0.92387956} - m_LocalPosition: {x: -0.508, y: -0, z: 0.508} + m_LocalPosition: {x: -0.508, y: 0, z: 0.14} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -5056,7 +5056,7 @@ ParticleSystem: serializedVersion: 2 minMaxState: 0 minColor: {r: 1, g: 1, b: 1, a: 1} - maxColor: {r: 0.88235295, g: 0.88235295, b: 0, a: 1} + maxColor: {r: 0.88235295, g: 0.88235295, b: 0, a: 0.078431375} maxGradient: serializedVersion: 2 key0: {r: 1, g: 1, b: 1, a: 1} @@ -9693,7 +9693,7 @@ Transform: m_GameObject: {fileID: 5457975807946421928} serializedVersion: 2 m_LocalRotation: {x: 0, y: -0.21439447, z: 0, w: 0.9767472} - m_LocalPosition: {x: -0.092, y: 0, z: 0.618} + m_LocalPosition: {x: -0.092, y: 0, z: 0.25} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -9889,7 +9889,7 @@ ParticleSystem: serializedVersion: 2 minMaxState: 0 minColor: {r: 1, g: 1, b: 1, a: 1} - maxColor: {r: 0, g: 0.62352943, b: 0, a: 1} + maxColor: {r: 0, g: 0.62352943, b: 0, a: 0.078431375} maxGradient: serializedVersion: 2 key0: {r: 1, g: 1, b: 1, a: 1} @@ -14526,7 +14526,7 @@ Transform: m_GameObject: {fileID: 6908437790466538459} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 1.199999} + m_LocalPosition: {x: 0, y: 0, z: 0.576} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/ModelRenderer/Art/music/AudioMixer.mixer b/Assets/ModelRenderer/Art/music/AudioMixer.mixer index 3ea5da9c16..efe8d433e8 100644 --- a/Assets/ModelRenderer/Art/music/AudioMixer.mixer +++ b/Assets/ModelRenderer/Art/music/AudioMixer.mixer @@ -15,7 +15,15 @@ AudioMixerController: m_SuspendThreshold: -80 m_EnableSuspend: 1 m_UpdateMode: 0 - m_ExposedParameters: [] + m_ExposedParameters: + - guid: c70051188a2b45d47913547284bd20c9 + name: Embien + - guid: e6047e4635949884d8c295c97f0fce16 + name: Master + - guid: efca7bbb62585cc4b9af42bd7a4d8fc7 + name: Music + - guid: 1f9dd418cef5b684e8e38e42f4bb5011 + name: SFX m_AudioMixerGroupViews: - guids: - 6c7ceeaecc4101f428a095a7c22f80b6 @@ -69,7 +77,8 @@ AudioMixerSnapshotController: m_Name: Snapshot m_AudioMixer: {fileID: 24100000} m_SnapshotID: b262f163ad71db94abd9bf7edbb8700c - m_FloatValues: {} + m_FloatValues: + e6047e4635949884d8c295c97f0fce16: 0 m_TransitionOverrides: {} --- !u!243 &217038053835239290 AudioMixerGroupController: diff --git a/Assets/PerfectWorld/Config/Resources/GameRunConfig.asset b/Assets/PerfectWorld/Config/Resources/GameRunConfig.asset index 00b2e3516b..8555e2805c 100644 --- a/Assets/PerfectWorld/Config/Resources/GameRunConfig.asset +++ b/Assets/PerfectWorld/Config/Resources/GameRunConfig.asset @@ -14,23 +14,23 @@ MonoBehaviour: m_EditorClassIdentifier: viewDistanceCfg: - title: Config 1 - fShow: 200 - fHide: 400 + fShow: 100 + fHide: 150 - title: Config 2 - fShow: 400 - fHide: 600 + fShow: 150 + fHide: 200 - title: Config 3 - fShow: 600 - fHide: 800 + fShow: 200 + fHide: 250 - title: Config 4 - fShow: 800 - fHide: 1000 + fShow: 250 + fHide: 300 - title: Config 5 - fShow: 1000 - fHide: 1200 + fShow: 300 + fHide: 350 - title: Config 6 - fShow: 1200 - fHide: 1400 + fShow: 350 + fHide: 400 viewDistanceNPCCfg: - title: Config 1 fShow: 25 @@ -69,3 +69,4 @@ MonoBehaviour: - title: Config 6 fShow: 100 fHide: 115 + audioMixer: {fileID: 24100000, guid: 9c6a7598ca0dfcd4fa51470ebbdd7549, type: 2} diff --git a/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab b/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab new file mode 100644 index 0000000000..8875b38722 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab @@ -0,0 +1,48 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2231146345831581285 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1787898784501235526} + - component: {fileID: 7110842102777986025} + m_Layer: 0 + m_Name: InGameGraphicOption + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1787898784501235526 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2231146345831581285} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7110842102777986025 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2231146345831581285} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: cfa24c9da248b9d4aa36c50fb688c146, type: 3} + m_Name: + m_EditorClassIdentifier: + _renderPipelineAsset: {fileID: 11400000, guid: 5e6cbd92db86f4b18aec3ed561671858, type: 2} + _cinemachineVirtualCamera: {fileID: 0} diff --git a/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab.meta b/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab.meta new file mode 100644 index 0000000000..071346b7a7 --- /dev/null +++ b/Assets/PerfectWorld/Prefab/InGameGraphicOption.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d38fe8448215a1842bfa3d094f3d307a +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PerfectWorld/Prefab/UI/DlgSetting.prefab b/Assets/PerfectWorld/Prefab/UI/DlgSetting.prefab index da9ebb0a2d..abda070869 100644 --- a/Assets/PerfectWorld/Prefab/UI/DlgSetting.prefab +++ b/Assets/PerfectWorld/Prefab/UI/DlgSetting.prefab @@ -2220,7 +2220,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -2248,9 +2248,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6683dd582fa268c45af1ece39633a804, type: 3} m_Name: m_EditorClassIdentifier: - txt_level_of_foresight: {fileID: 6815914334339467742} - txt_level_of_distance_npc_and_mst: {fileID: 6757030218926432192} - txt_level_of_distance_player_other: {fileID: 7832569378395798648} + slideCtrlViewDistance: {fileID: 8696581003082592840} + slideCtrlViewDistanceNPC: {fileID: 7374187120158384910} + slideCtrlViewDistanceEP: {fileID: 7472743271469780325} + tog_shadow: {fileID: 7259619490849805827} + tog_fog: {fileID: 651538557502335558} + tog_fullResolution: {fileID: 4715089688479236368} --- !u!1 &2318400620048361636 GameObject: m_ObjectHideFlags: 0 @@ -2512,7 +2515,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &2089140126047700709 RectTransform: m_ObjectHideFlags: 0 @@ -2528,10 +2531,10 @@ RectTransform: - {fileID: 581815824710635089} m_Father: {fileID: 8038141400472399988} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 103.69825, y: -174} + m_SizeDelta: {x: 200, y: 70} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &453846082467036817 CanvasRenderer: @@ -3420,7 +3423,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &6804777851036107864 RectTransform: m_ObjectHideFlags: 0 @@ -3436,10 +3439,10 @@ RectTransform: - {fileID: 4206321553251368956} m_Father: {fileID: 8038141400472399988} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 103.69825, y: -104} + m_SizeDelta: {x: 200, y: 70} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5720369861187438293 CanvasRenderer: @@ -4924,6 +4927,8 @@ MonoBehaviour: tab_unactive: {fileID: 21300000, guid: 7639c755994ee114e9a7e89a404e3e7b, type: 3} activeTextColor: {r: 1, g: 1, b: 1, a: 1} inactiveTextColor: {r: 0.8078432, g: 0.70980394, b: 0.4784314, a: 1} + settingSoundCtrl: {fileID: 434286385280809297} + settingGraphicCtrl: {fileID: 8600430431389761751} --- !u!1 &5199199209685304065 GameObject: m_ObjectHideFlags: 0 @@ -5420,7 +5425,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -5462,6 +5467,9 @@ MonoBehaviour: txt_level_of_bgm: {fileID: 3978261999845214409} txt_level_of_sfx: {fileID: 284675133552538515} txt_level_of_master: {fileID: 7313494243364841233} + slideCtrlBgrMusic: {fileID: 6513137742691945821} + slideCtrlSFX: {fileID: 8468446591860041645} + slideCtrlMaster: {fileID: 8903301988286719733} --- !u!1 &5328116772109506526 GameObject: m_ObjectHideFlags: 0 @@ -6391,7 +6399,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "Giao di\u1EC7n" + m_text: "\u0110\u1ED3 h\u1ECDa" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} @@ -7197,7 +7205,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &5725138947417197620 RectTransform: m_ObjectHideFlags: 0 @@ -7214,10 +7222,10 @@ RectTransform: - {fileID: 8978764815918038982} m_Father: {fileID: 8859678125751154879} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 86.35, y: -47.22} + m_SizeDelta: {x: 172.7, y: 66.44} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &7259619490849805827 MonoBehaviour: @@ -7778,12 +7786,12 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3036543998602838576} - - {fileID: 4557984836195278630} - {fileID: 8038141400472399988} - {fileID: 2519067213881106736} - {fileID: 6578534598388793505} - {fileID: 8529560139773339323} - {fileID: 3317306654959440989} + - {fileID: 4557984836195278630} m_Father: {fileID: 3172616695210653156} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} diff --git a/Assets/PerfectWorld/Scene/Bootstrap.unity b/Assets/PerfectWorld/Scene/Bootstrap.unity index b737300a12..01f75cbb7c 100644 --- a/Assets/PerfectWorld/Scene/Bootstrap.unity +++ b/Assets/PerfectWorld/Scene/Bootstrap.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5caea7b0b45c434cbea3545800922c7604e8773fe7cbcf675b091934c7c39505 -size 306512 +oid sha256:20826e4631ccd8df95267f53f85e8dd91287f8a8b5c61eeeb700e7f859c7b35e +size 304738 diff --git a/Assets/PerfectWorld/Scene/LoginScene.unity b/Assets/PerfectWorld/Scene/LoginScene.unity index a8309c5b00..df0c001bbc 100644 --- a/Assets/PerfectWorld/Scene/LoginScene.unity +++ b/Assets/PerfectWorld/Scene/LoginScene.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:133267e461382e8feb9da7fa610607c52255abb519753fb55dab36ddd758f54d -size 114097 +oid sha256:3105731ad4156d02d8b41374a80252c3abe294e5e221dd917303e3cc99c247b4 +size 111490 diff --git a/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs b/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs index c81e944db7..f7f2a2ddba 100644 --- a/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs +++ b/Assets/PerfectWorld/Scripts/Common/AutoInitializer.cs @@ -1,5 +1,6 @@ using BrewMonster.Network; using System; +using System.Collections; using System.Collections.Generic; using System.Reflection; using UnityEngine; diff --git a/Assets/PerfectWorld/Scripts/GameData/GameRunConfig.cs b/Assets/PerfectWorld/Scripts/GameData/GameRunConfig.cs index 39a1c234ee..76e85ad6ae 100644 --- a/Assets/PerfectWorld/Scripts/GameData/GameRunConfig.cs +++ b/Assets/PerfectWorld/Scripts/GameData/GameRunConfig.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; +using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.Serialization; @@ -13,10 +14,11 @@ namespace BrewMonster [SerializeField] private List viewDistanceCfg; [SerializeField] private List viewDistanceNPCCfg; [SerializeField] private List viewDistanceEPCfg; - + [SerializeField] private AudioMixer audioMixer; public List GetViewDistanceCfg { get => viewDistanceCfg;} public List GetViewDistanceNPCCfg { get => viewDistanceNPCCfg;} public List GetViewDistanceEPCfg { get => viewDistanceEPCfg;} + public AudioMixer GetAudioMixer { get => audioMixer;} } [Serializable] diff --git a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs index 824914f420..e69fdb6be6 100644 --- a/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs +++ b/Assets/PerfectWorld/Scripts/MainFiles/EC_Game.cs @@ -1,4 +1,5 @@ using BrewMonster; +using BrewMonster.Scripts; using BrewMonster.Scripts.Task; using CSNetwork; using CSNetwork.GPDataType; @@ -14,6 +15,7 @@ using UnityEngine.AddressableAssets; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.ResourceManagement.AsyncOperations; +using UnityEngine.UIElements; namespace BrewMonster.Network { @@ -49,6 +51,18 @@ namespace BrewMonster.Network private readonly static string keySettingActiveShadow = "_keySettingActiveShadow"; private readonly static string keySettingActiveFullResolution = "_keySettingActiveFullResolution"; private readonly static string keySettingActiveFog = "_keySettingActiveFog"; + + private readonly static string keySettingVolumeSoundMaster = "_keySettingVolumeSoundMaster"; + private readonly static string keySettingVolumeSoundSFX = "_keySettingVolumeSoundSFX"; + private readonly static string keySettingVolumeBgrMusic = "_keySettingVolumeBgrMusic"; + private readonly static string keySettingSoundMaster = "_keySettingSoundMaster"; + private readonly static string keySettingSoundSFX = "_keySettingSoundSFX"; + private readonly static string keySettingBgrMusic = "_keySettingBgrMusic"; + + private readonly static string keyMaster = "Master"; + private readonly static string keyMusic = "Music"; + private readonly static string keySFX = "SFX"; + private static ViewDistance m_viewDistance; private static ViewDistance m_viewDistanceNPC; private static ViewDistance m_viewDistanceEP; @@ -643,12 +657,23 @@ namespace BrewMonster.Network public static void InitSetting() { - int index = PlayerPrefs.GetInt(keySettingViewDistance, defaultValue: 5); - m_viewDistance = GameRunConfigSO.GetViewDistanceCfg[index]; - index = PlayerPrefs.GetInt(keySettingViewDistanceNPC, defaultValue: 5); - m_viewDistanceNPC = GameRunConfigSO.GetViewDistanceNPCCfg[index]; - index = PlayerPrefs.GetInt(keySettingViewDistanceEP, defaultValue: 5); - m_viewDistanceEP = GameRunConfigSO.GetViewDistanceEPCfg[index]; + int index = PlayerPrefs.GetInt(keySettingViewDistance, defaultValue: 6); + m_viewDistance = GameRunConfigSO.GetViewDistanceCfg[index - 1]; + index = PlayerPrefs.GetInt(keySettingViewDistanceNPC, defaultValue: 6); + m_viewDistanceNPC = GameRunConfigSO.GetViewDistanceNPCCfg[index - 1]; + index = PlayerPrefs.GetInt(keySettingViewDistanceEP, defaultValue: 6); + m_viewDistanceEP = GameRunConfigSO.GetViewDistanceEPCfg[index - 1]; + + SetSettingActiveFog(GetSettingActiveFog()); + SetSettingActiveFullResolution(GetSettingActiveFullResolution()); + SetSettingActiveShadow(GetSettingActiveShadow()); + } + + public static void InitSettingAudio() + { + SetVolumeBgrMusic(GetVolumeBgrMusic()); + SetVolumeSoundSFX(GetVolumeSoundSFX()); + SetVolumeSoundMaster(GetVolumeSoundMaster()); } public static ViewDistance GetSettingViewDistance() @@ -674,25 +699,202 @@ namespace BrewMonster.Network public static void SetSettingActiveShadow(bool value) { - + PlayerPrefs.SetInt(keySettingActiveShadow, value ? 1 : 0); + if (value) + { + + } + else + { + + } } public static void SetSettingActiveFullResolution(bool value) { - + PlayerPrefs.SetInt(keySettingActiveFullResolution, value ? 1 : 0); + InGameGraphicOption.Instance.SetRenderScale(value ? 1f : 0.7f); + InGameGraphicOption.Instance.SetMSAA(value ? 4 : 1); + } + + public static void SetSettingActiveFog(bool value) + { + PlayerPrefs.SetInt(keySettingActiveFog, value ? 1 : 0); + RenderSettings.fog = value; + } + + public static void SetSettingViewDistance(int value) + { + PlayerPrefs.SetInt(keySettingViewDistance, value); + m_viewDistance = GameRunConfigSO.GetViewDistanceCfg[value - 1]; + InGameGraphicOption.Instance.SetRenderDistance(m_viewDistance.fHide); + } + + public static void SetSettingViewDistanceNPC(int value) + { + PlayerPrefs.SetInt(keySettingViewDistanceNPC, value); + m_viewDistanceNPC = GameRunConfigSO.GetViewDistanceNPCCfg[value - 1]; + } + + public static void SetSettingViewDistanceEP(int value) + { + PlayerPrefs.SetInt(keySettingViewDistanceEP, value); + m_viewDistanceEP = GameRunConfigSO.GetViewDistanceEPCfg[value - 1]; + } + + public static int GetValueSettingViewDistance() + { + return PlayerPrefs.GetInt(keySettingViewDistance, defaultValue: 6); + } + + public static int GetValueSettingViewDistanceNPC() + { + return PlayerPrefs.GetInt(keySettingViewDistanceNPC, defaultValue: 6); + } + + public static int GetValueSettingViewDistanceEP() + { + return PlayerPrefs.GetInt(keySettingViewDistanceEP, defaultValue: 6); } public static bool GetSettingActiveFullResolution() { - int index = PlayerPrefs.GetInt(keySettingActiveFullResolution, defaultValue: 1); + int index = PlayerPrefs.GetInt(keySettingActiveFullResolution, defaultValue: 6); return index == 1; } public static bool GetSettingActiveFog() { - int index = PlayerPrefs.GetInt(keySettingActiveFog, defaultValue: 1); + int index = PlayerPrefs.GetInt(keySettingActiveFog, defaultValue: 6); return index == 1; } + + public static void SetActiveSoundMaster(bool value) + { + PlayerPrefs.SetInt(keySettingSoundMaster, value ? 1 : 0); + if (value) + { + float index = PlayerPrefs.GetInt(keySettingVolumeSoundMaster, defaultValue: 6); + float dB = Mathf.Log10(index / 6) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMaster, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMaster, dB); + } + } + + public static bool GetActiveSoundMaster() + { + return PlayerPrefs.GetInt(keySettingSoundMaster, 1) == 1; + } + + public static int GetVolumeSoundMaster() + { + return PlayerPrefs.GetInt(keySettingVolumeSoundMaster, 6); + } + + public static void SetVolumeSoundMaster(int value) + { + bool isActive = GetActiveSoundMaster(); + PlayerPrefs.SetInt(keySettingVolumeSoundMaster, value); + if (isActive) + { + float dB = Mathf.Log10(value / 6) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMaster, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMaster, dB); + } + } + + public static void SetActiveSoundSFX(bool value) + { + PlayerPrefs.SetInt(keySettingSoundSFX, value ? 1 : 0); + if (value) + { + float index = PlayerPrefs.GetInt(keySettingVolumeSoundSFX, defaultValue: 6); + float dB = Mathf.Log10(index / 6) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keySFX, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keySFX, dB); + } + } + + public static bool GetActiveSoundSFX() + { + return PlayerPrefs.GetInt(keySettingSoundSFX, 1) == 1; + } + + public static void SetVolumeSoundSFX(int value) + { + bool isActive = GetActiveSoundMaster() && GetActiveSoundSFX(); + PlayerPrefs.SetInt(keySettingVolumeSoundSFX, value); + if (isActive) + { + float dB = Mathf.Log10(value / 6f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keySFX, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keySFX, dB); + } + } + + public static int GetVolumeSoundSFX() + { + return PlayerPrefs.GetInt(keySettingVolumeSoundSFX, 6); + } + + public static void SetActiveBgrMusic(bool value) + { + PlayerPrefs.SetInt(keySettingBgrMusic, value ? 1 : 0); + if (value) + { + float index = PlayerPrefs.GetInt(keySettingVolumeBgrMusic, defaultValue: 6); + float dB = Mathf.Log10(index / 6f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMusic, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMusic, dB); + } + } + + public static bool GetActiveBgrMusic() + { + return PlayerPrefs.GetInt(keySettingBgrMusic, 1) == 1; + } + + public static void SetVolumeBgrMusic(int value) + { + bool isActive = GetActiveSoundMaster() && GetActiveBgrMusic(); + PlayerPrefs.SetInt(keySettingVolumeBgrMusic, value); + if (isActive) + { + float dB = Mathf.Log10(value / 6f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMusic, dB); + } + else + { + float dB = Mathf.Log10(0.0001f) * 20; // setting sound is 6 + GameRunConfigSO.GetAudioMixer.SetFloat(keyMusic, dB); + } + } + + public static int GetVolumeBgrMusic() + { + return PlayerPrefs.GetInt(keySettingVolumeBgrMusic, 6); + } + #endregion } } diff --git a/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs b/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs new file mode 100644 index 0000000000..a315d2ae03 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs @@ -0,0 +1,52 @@ +using Unity.Cinemachine; +using UnityEngine; +using UnityEngine.Experimental.GlobalIllumination; +using UnityEngine.Rendering.Universal; + +namespace BrewMonster.Scripts +{ + public class InGameGraphicOption : MonoSingleton + { + [SerializeField] private UniversalRenderPipelineAsset _renderPipelineAsset; + [SerializeField] private CinemachineCamera _cinemachineVirtualCamera; + + + #region public functions + + /// How far the objects are rendered in the scene. + /// + public void SetRenderDistance(float distance) + { + distance = Mathf.Clamp(distance, 50f, 500f); + _cinemachineVirtualCamera.Lens.FarClipPlane = distance; + } + + /// + /// The scale of the render pipeline.
+ /// The value should be between 0.6 and 1.5. + ///
+ public void SetRenderScale(float scale) + { + scale = Mathf.Clamp(scale, 0.6f, 1.5f); + _renderPipelineAsset.renderScale = scale; + } + + + public void SetMSAA(int msaaLevel) + { + // Valid: 0,2,4 + if (msaaLevel != 0 && msaaLevel != 2 && msaaLevel != 4) + return; + + _renderPipelineAsset.msaaSampleCount = msaaLevel; + } + + + //TODO: figure out a solution for this. + public void SetActiveShadow(bool active) + { + + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs.meta b/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs.meta new file mode 100644 index 0000000000..36d4299576 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/InGameGraphicOption.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: cfa24c9da248b9d4aa36c50fb688c146 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs b/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs new file mode 100644 index 0000000000..162daad920 --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs @@ -0,0 +1,41 @@ +using UnityEngine; + +namespace BrewMonster.Scripts +{ + public class InGameOptionButtionTest : MonoBehaviour + { + private bool _isHighQuality = false; + + + private void Start() + { + SetLowQuality(); + } + + public void OnGraphicSettingButtonClicked() + { + if (_isHighQuality) + SetLowQuality(); + else + SetHighQuality(); + } + + + + private void SetLowQuality() + { + InGameGraphicOption.Instance.SetRenderDistance(200f); + InGameGraphicOption.Instance.SetRenderScale(0.6f); + InGameGraphicOption.Instance.SetMSAA(0); + _isHighQuality = false; + } + + private void SetHighQuality() + { + InGameGraphicOption.Instance.SetRenderDistance(500f); + InGameGraphicOption.Instance.SetRenderScale(1f); + InGameGraphicOption.Instance.SetMSAA(4); + _isHighQuality = true; + } + } +} diff --git a/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs.meta b/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs.meta new file mode 100644 index 0000000000..39ef4ccd1e --- /dev/null +++ b/Assets/PerfectWorld/Scripts/Managers/InGameOptionButtionTest.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 3cc6b94c2473af549a27a71783be1641 \ No newline at end of file diff --git a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs index d0ec0c68d9..78f939d355 100644 --- a/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs +++ b/Assets/PerfectWorld/Scripts/NPC/CECNPC.cs @@ -133,8 +133,8 @@ public class CECNPC : CECObject BMLogger.LogError("HoangDev npcVisual"); } m_pNPCModelPolicy.SetNpcVisual(npcVisual); - m_npcUI = GetComponentInChildren(); - + m_npcUI = GetComponentInChildren(true); + m_npcUI.gameObject.SetActive(true); // 2) Cắt “đuôi” ngay sau phần cố định info_npc int fixedSize = System.Runtime.InteropServices.Marshal.SizeOf(); @@ -1170,7 +1170,10 @@ public class CECNPC : CECObject // UINPC.Start can run before async model instantiate; refresh anchor once SMR hierarchy exists. // UINPC.Start可能在异步模型实例化之前执行;SMR层次就绪后刷新名牌锚点。 - m_npcUI?.RefreshWorldNameplatePosition(); + if(m_npcUI != null && m_npcUI.gameObject.activeInHierarchy) + { + m_npcUI?.RefreshWorldNameplatePosition(); + } //QueueECModelForLoad(MTL_ECM_NPC, GetNPCInfo().nid, GetBornStamp(), GetServerPos(), szModelFile, tid); } diff --git a/Assets/PerfectWorld/Scripts/Sound/AudioManager.cs b/Assets/PerfectWorld/Scripts/Sound/AudioManager.cs index a59c019a0b..ea68f06c2b 100644 --- a/Assets/PerfectWorld/Scripts/Sound/AudioManager.cs +++ b/Assets/PerfectWorld/Scripts/Sound/AudioManager.cs @@ -20,7 +20,6 @@ public class AudioManager : MonoBehaviour if (Instance == null) { Instance = this; - DontDestroyOnLoad(gameObject); } else { @@ -29,6 +28,9 @@ public class AudioManager : MonoBehaviour } DiscoverAudioSources(); + + // set the audio settings after all the audio sources are discovered + BrewMonster.Network.EC_Game.InitSettingAudio(); } private void DiscoverAudioSources() diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/DlgSetting.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/DlgSetting.cs index 60b772a5e1..9a715f4d46 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/DlgSetting.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/DlgSetting.cs @@ -1,3 +1,4 @@ +using BrewMonster.Network; using BrewMonster.UI; using System.Collections; using TMPro; @@ -31,6 +32,11 @@ namespace BrewMonster private Button[] tabButtons; + [SerializeField] private SettingSound settingSoundCtrl; + [SerializeField] private SettingInterface settingGraphicCtrl; + + int curTab = 1; + public override void Awake() { tabButtons = new[] @@ -49,6 +55,11 @@ namespace BrewMonster btn_setting.onClick.AddListener(OnBtnSetting); btn_sound.onClick.AddListener(OnBtnSound); btn_close.onClick.AddListener(OnBtnClose); + btn_confirm.onClick.AddListener(OnClickBtnConfirm); + + curTab = 1; + UpdateUITabs(); + OnBtnInterface(); } public override void OnDisable() @@ -58,11 +69,14 @@ namespace BrewMonster btn_setting.onClick.RemoveListener(OnBtnSetting); btn_sound.onClick.RemoveListener(OnBtnSound); btn_close.onClick.RemoveListener(OnBtnClose); + btn_confirm.onClick.RemoveListener(OnClickBtnConfirm); } private void OnBtnSystem() { SetActiveTab(btn_system); + curTab = 0; + UpdateUITabs(); } private void OnBtnInterface() @@ -70,11 +84,15 @@ namespace BrewMonster SetActiveTab(btn_interface); content_interface.SetActive(true); content_sound.SetActive(false); + curTab = 1; + UpdateUITabs(); } private void OnBtnSetting() { SetActiveTab(btn_setting); + curTab = 2; + UpdateUITabs(); } private void OnBtnSound() @@ -82,6 +100,8 @@ namespace BrewMonster SetActiveTab(btn_sound); content_interface.SetActive(false); content_sound.SetActive(true); + curTab = 3; + UpdateUITabs(); } private void SetActiveTab(Button activeButton) @@ -109,5 +129,34 @@ namespace BrewMonster { CECUIManager.Instance.HideCurrentUIInStack(); } + + private void OnClickBtnConfirm() + { + EC_Game.SetActiveSoundMaster(settingSoundCtrl.GetActiveSoundMaster()); + EC_Game.SetActiveSoundSFX(settingSoundCtrl.GetActiveSFX()); + EC_Game.SetActiveBgrMusic(settingSoundCtrl.GetActiveBgrMusic()); + + EC_Game.SetSettingActiveShadow(settingGraphicCtrl.GetValueToggleShadow()); + EC_Game.SetSettingActiveFullResolution(settingGraphicCtrl.GetValueToggleFullResolution()); + EC_Game.SetSettingActiveFog(settingGraphicCtrl.GetValueToggleFog()); + + EC_Game.SetVolumeBgrMusic(settingSoundCtrl.GetVolumeBgrMusic()); + EC_Game.SetVolumeSoundMaster(settingSoundCtrl.GetVolumeMaster()); + EC_Game.SetVolumeSoundSFX(settingSoundCtrl.GetVolumeSFX()); + + EC_Game.SetSettingViewDistance(settingGraphicCtrl.GetValueViewDistance()); + EC_Game.SetSettingViewDistanceEP(settingGraphicCtrl.GetValueViewDistanceEP()); + EC_Game.SetSettingViewDistanceNPC(settingGraphicCtrl.GetValueViewDistanceNPC()); + + OnBtnClose(); + } + + private void UpdateUITabs() + { + for(int i = 0; i < tabButtons.Length; i++) + { + tabButtons[i].image.sprite = (curTab == i) ? tab_active: tab_unactive; + } + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingInterface.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingInterface.cs index c3cc3e7d98..dc48199612 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingInterface.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingInterface.cs @@ -1,6 +1,7 @@ using BrewMonster.Assets.PerfectWorld.Scripts.UI; using BrewMonster.Common; using BrewMonster.Managers; +using BrewMonster.Network; using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; using BrewMonster.UI; @@ -19,27 +20,84 @@ namespace BrewMonster { public class SettingInterface : MonoBehaviour { - [Header("Slider Value Level")] - private float valueLevel1 = 0; - private float valueLevel2 = 0.194f; - private float valueLevel3 = 0.409f; - private float valueLevel4 = 0.603f; - private float valueLevel5 = 0.793f; - private float valueLevel6 = 1f; + [SerializeField] private SliderController slideCtrlViewDistance; + [SerializeField] private SliderController slideCtrlViewDistanceNPC; + [SerializeField] private SliderController slideCtrlViewDistanceEP; - [Header("slider Text Level")] - [SerializeField] private TextMeshProUGUI txt_level_of_foresight; - [SerializeField] private TextMeshProUGUI txt_level_of_distance_npc_and_mst; - [SerializeField] private TextMeshProUGUI txt_level_of_distance_player_other; + [SerializeField] private Toggle tog_shadow; + [SerializeField] private Toggle tog_fog; + [SerializeField] private Toggle tog_fullResolution; private void OnEnable() { - + UpdateUIPanel(); } private void OnDisable() { + tog_shadow.onValueChanged.RemoveAllListeners(); + tog_fog.onValueChanged.RemoveAllListeners(); + tog_fullResolution.onValueChanged.RemoveAllListeners(); + } + private void UpdateUIPanel() + { + tog_shadow.isOn = EC_Game.GetSettingActiveShadow(); + tog_fog.isOn = EC_Game.GetSettingActiveFog(); + tog_fullResolution.isOn = EC_Game.GetSettingActiveFullResolution(); + + tog_shadow.onValueChanged.AddListener(OnToggleShadowChange); + tog_fog.onValueChanged.AddListener(OnToggleFog); + tog_fullResolution.onValueChanged.AddListener(OnToggleFullResolution); + + slideCtrlViewDistance.InitSlide(EC_Game.GetValueSettingViewDistance()); + slideCtrlViewDistanceNPC.InitSlide(EC_Game.GetValueSettingViewDistanceNPC()); + slideCtrlViewDistanceEP.InitSlide(EC_Game.GetValueSettingViewDistanceEP()); + } + + private void OnToggleShadowChange(bool value) + { + tog_shadow.isOn = value; + } + + private void OnToggleFog(bool value) + { + tog_fog.isOn = value; + } + + private void OnToggleFullResolution(bool value) + { + tog_fullResolution.isOn = value; + } + + public int GetValueViewDistance() + { + return slideCtrlViewDistance.GetValueCurrentSlide(); + } + + public int GetValueViewDistanceEP() + { + return slideCtrlViewDistanceEP.GetValueCurrentSlide(); + } + + public int GetValueViewDistanceNPC() + { + return slideCtrlViewDistanceNPC.GetValueCurrentSlide(); + } + + public bool GetValueToggleShadow() + { + return tog_shadow.isOn; + } + + public bool GetValueToggleFog() + { + return tog_fog.isOn; + } + + public bool GetValueToggleFullResolution() + { + return tog_fullResolution.isOn; } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingSound.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingSound.cs index d8777062db..be6cc1ebe4 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingSound.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SettingSound.cs @@ -1,6 +1,7 @@ using BrewMonster.Assets.PerfectWorld.Scripts.UI; using BrewMonster.Common; using BrewMonster.Managers; +using BrewMonster.Network; using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; using BrewMonster.UI; @@ -43,14 +44,6 @@ namespace BrewMonster private Color textOnColor = new Color(0.96f, 0.84f, 0.61f); private Color textOffColor = new Color(0.6f, 0.6f, 0.6f); - [Header("Slider Value Level")] - private float valueLevel1 = 0; - private float valueLevel2 = 0.173f; - private float valueLevel3 = 0.393f; - private float valueLevel4 = 0.603f; - private float valueLevel5 = 0.797f; - private float valueLevel6 = 1f; - [Header("slider Text Level")] [SerializeField] private TextMeshProUGUI txt_level_of_bgm; [SerializeField] private TextMeshProUGUI txt_level_of_sfx; @@ -60,16 +53,26 @@ namespace BrewMonster private Coroutine sfxCoroutine; private Coroutine masterCoroutine; + [SerializeField] private SliderController slideCtrlBgrMusic; + [SerializeField] private SliderController slideCtrlSFX; + [SerializeField] private SliderController slideCtrlMaster; private void OnEnable() { + tog_bgm.isOn = EC_Game.GetActiveBgrMusic(); UpdateSwitchInstant(tog_bgm, handle_bmg, txt_bgm); + tog_sfx.isOn = EC_Game.GetActiveSoundSFX(); UpdateSwitchInstant(tog_sfx, handle_sfx, txt_sfx); + tog_master.isOn = EC_Game.GetActiveSoundMaster(); UpdateSwitchInstant(tog_master, handle_master, txt_master); tog_bgm.onValueChanged.AddListener(OnBgmChanged); tog_sfx.onValueChanged.AddListener(OnSfxChanged); tog_master.onValueChanged.AddListener(OnMasterChanged); + + slideCtrlBgrMusic.InitSlide(EC_Game.GetVolumeBgrMusic()); + slideCtrlSFX.InitSlide(EC_Game.GetVolumeSoundSFX()); + slideCtrlMaster.InitSlide(EC_Game.GetVolumeSoundMaster()); } private void OnDisable() @@ -87,6 +90,7 @@ namespace BrewMonster } bgmCoroutine = StartCoroutine(SlideSwitchCoroutine(tog_bgm, handle_bmg, txt_bgm)); // TODO: Add logic to change BGM volume or mute state + //EC_Game.SetActiveBgrMusic(isOn); } private void OnSfxChanged(bool isOn) @@ -97,6 +101,7 @@ namespace BrewMonster } sfxCoroutine = StartCoroutine(SlideSwitchCoroutine(tog_sfx, handle_sfx, txt_sfx)); // TODO: Add logic to change SFX volume or mute state + //EC_Game.SetActiveSoundSFX(isOn); } private void OnMasterChanged(bool isOn) @@ -107,6 +112,7 @@ namespace BrewMonster } masterCoroutine = StartCoroutine(SlideSwitchCoroutine(tog_master, handle_master, txt_master)); // TODO: Add logic to change Master volume or mute state + //EC_Game.SetActiveSoundMaster(isOn); } private void UpdateSwitchInstant(Toggle toggle, RectTransform handle, TextMeshProUGUI statusText) @@ -183,5 +189,35 @@ namespace BrewMonster statusText.rectTransform.anchoredPosition = new Vector2(textTargetX, statusText.rectTransform.anchoredPosition.y); } } + + public int GetVolumeBgrMusic() + { + return slideCtrlBgrMusic.GetValueCurrentSlide(); + } + + public int GetVolumeSFX() + { + return slideCtrlSFX.GetValueCurrentSlide(); + } + + public int GetVolumeMaster() + { + return slideCtrlMaster.GetValueCurrentSlide(); + } + + public bool GetActiveBgrMusic() + { + return tog_bgm.isOn; + } + + public bool GetActiveSFX() + { + return tog_sfx.isOn; + } + + public bool GetActiveSoundMaster() + { + return tog_master.isOn; + } } } diff --git a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SliderController.cs b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SliderController.cs index 56c9f95ae1..3a1c0bdf97 100644 --- a/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SliderController.cs +++ b/Assets/PerfectWorld/Scripts/UI/Dialogs/Setting/SliderController.cs @@ -1,6 +1,7 @@ using BrewMonster.Assets.PerfectWorld.Scripts.UI; using BrewMonster.Common; using BrewMonster.Managers; +using BrewMonster.Network; using BrewMonster.Scripts; using BrewMonster.Scripts.Managers; using BrewMonster.UI; @@ -25,17 +26,17 @@ namespace BrewMonster public Slider slider; public TextMeshProUGUI sliderValueText; - [Header("Action Event")] - private UnityEvent[] levelEvents = new UnityEvent[6]; + //[Header("Action Event")] + //private UnityEvent[] levelEvents = new UnityEvent[6]; - private int currentLevel = -1; + //private int currentLevel = -1; + //Action OnSlideValueChange = null; private void OnEnable() { if(slider != null) { slider.onValueChanged.AddListener(OnSliderValueChange); - UpdateLevelFromSlider(); } } @@ -47,6 +48,12 @@ namespace BrewMonster } } + public void InitSlide(int curlevel) + { + slider.value = curlevel; + UpdateSliderText(curlevel); + } + private void OnSliderValueChange(float value) { UpdateLevelFromSlider(); @@ -58,12 +65,6 @@ namespace BrewMonster return; int level = GetLevelFromValue(slider.value); - if(level != currentLevel) - { - currentLevel = level; - Invoke(level); - } - UpdateSliderText(level); } @@ -82,15 +83,20 @@ namespace BrewMonster sliderValueText.text = $"Mức {level}"; } - public void Invoke(int level) + public int GetValueCurrentSlide() { - int index = level - 1; - if(index < 0 || index >= levelEvents.Length) - { - return; - } - - levelEvents[index]?.Invoke(); + return (int)slider.value; } + + //public void Invoke(int level) + //{ + // int index = level - 1; + // if(index < 0 || index >= levelEvents.Length) + // { + // return; + // } + + // levelEvents[index]?.Invoke(); + //} } } diff --git a/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs b/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs index e280a14d1b..be623b402b 100644 --- a/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs +++ b/Assets/PerfectWorld/Scripts/UI/MiniMap/CDlgMiniMap.cs @@ -148,11 +148,11 @@ namespace PerfectWorld.UI.MiniMap UniTask.RunOnThreadPool(async () => { - await WatchNPCMiniMapData(npcMan, token); + await UpdateNPCMiniMapDataTask(npcMan, token); }, false, cancellationToken: token).Forget(); } - private async UniTask WatchNPCMiniMapData(CECNPCMan npcMan, CancellationToken token) + private async UniTask UpdateNPCMiniMapDataTask(CECNPCMan npcMan, CancellationToken token) { List lastNPCData = new(); @@ -168,7 +168,8 @@ namespace PerfectWorld.UI.MiniMap _pendingNPCMiniMapData = currentNPCData; } - lastNPCData = currentNPCData; + lastNPCData.Clear(); + lastNPCData.AddRange(currentNPCData); _needRenderNPCMiniMap = true; } @@ -207,6 +208,10 @@ namespace PerfectWorld.UI.MiniMap return true; } + /// + /// Render the following objects on the minimap:
+ /// - NPC_ESSENCE
+ ///
private void RenderNPCMiniMap() { List npcData; diff --git a/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs b/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs index 3b967f2252..36e5ac4805 100644 --- a/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs +++ b/Assets/PerfectWorld/Scripts/World/LitModelHolder.cs @@ -16,9 +16,9 @@ public class LitModelHolder : MonoSingleton [Header("Distance Streaming")] [Tooltip("The distance from the host player to the object to be loaded immediately.")] - [SerializeField] private float _loadImmediateDistance => EC_Game.GetSettingViewDistance().fShow; // 200f + [SerializeField] private float _loadImmediateDistance; // 200f [Tooltip("Objects need to go outside of this distance to be unloaded.")] - [SerializeField] private float _unloadDistance => EC_Game.GetSettingViewDistance().fHide; // 400f + [SerializeField] private float _unloadDistance; // 400f [Header("Performance")] [SerializeField] private float _checkIntervalSeconds = 0.25f; @@ -226,6 +226,13 @@ public class LitModelHolder : MonoSingleton _hasLastHostPos = true; _lastHostPosOxz = _currentHostPosOxz; + + + + _loadImmediateDistance = EC_Game.GetSettingViewDistance().fShow; + _unloadDistance = EC_Game.GetSettingViewDistance().fHide; + immediateSqr = _loadImmediateDistance * _loadImmediateDistance; + paddingSqr = _unloadDistance * _unloadDistance; TickStreaming(_currentHostPosOxz, immediateSqr, paddingSqr, destroyToken); diff --git a/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs b/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs index 78942d4328..260ccdfc9b 100644 --- a/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs +++ b/Assets/PerfectWorld/Scripts/World/TerrainHolder.cs @@ -17,8 +17,8 @@ namespace BrewMonster public class TerrainHolder : MonoBehaviour { [SerializeField] private AddressableObject[] _addressableObjects; - [SerializeField] private float _loadImmediateDistance => EC_Game.GetSettingViewDistance().fShow; //150f; - [SerializeField] private float _unloadDistance => EC_Game.GetSettingViewDistance().fHide; //300f; + [SerializeField] private float _loadImmediateDistance; //150f; + [SerializeField] private float _unloadDistance; //300f; [SerializeField] private float _minHostMoveToUpdate = 5f; private List _candidatesForLoading = new List(); @@ -103,6 +103,8 @@ namespace BrewMonster //if (_unloadDistance < _loadImmediateDistance) // _unloadDistance = _loadImmediateDistance; + + float immediateSqr = _loadImmediateDistance * _loadImmediateDistance; float paddingSqr = _unloadDistance * _unloadDistance; float minMoveSqr = _minHostMoveToUpdate * _minHostMoveToUpdate; @@ -127,6 +129,11 @@ namespace BrewMonster _hasLastHostPos = true; _lastHostPosOxz = _currentHostPosOxz; + _loadImmediateDistance = EC_Game.GetSettingViewDistance().fShow; + _unloadDistance = EC_Game.GetSettingViewDistance().fHide; + immediateSqr = _loadImmediateDistance * _loadImmediateDistance; + paddingSqr = _unloadDistance * _unloadDistance; + TickStreaming(_currentHostPosOxz, immediateSqr, paddingSqr); } diff --git a/Assets/Prefabs/QualityBtn.prefab b/Assets/Prefabs/QualityBtn.prefab new file mode 100644 index 0000000000..3977a519ba --- /dev/null +++ b/Assets/Prefabs/QualityBtn.prefab @@ -0,0 +1,214 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2725964181764938372 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9079041945482710805} + - component: {fileID: 8638675331407853245} + - component: {fileID: 2668140200533103676} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9079041945482710805 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2725964181764938372} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7681425590765782574} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8638675331407853245 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2725964181764938372} + m_CullTransparentMesh: 1 +--- !u!114 &2668140200533103676 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2725964181764938372} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Graphic + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + m_sharedMaterial: {fileID: 9092487103257209053, guid: 369c2e14814cc9a4b8e3ad4e37769134, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &4276923075264027147 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7681425590765782574} + - component: {fileID: 1087046858359492222} + - component: {fileID: 602748786618097678} + m_Layer: 5 + m_Name: QualityBtn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7681425590765782574 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4276923075264027147} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 9079041945482710805} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 183.11, y: -38} + m_SizeDelta: {x: 126.2101, y: 55.4429} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1087046858359492222 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4276923075264027147} + m_CullTransparentMesh: 1 +--- !u!114 &602748786618097678 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4276923075264027147} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 diff --git a/Assets/Prefabs/QualityBtn.prefab.meta b/Assets/Prefabs/QualityBtn.prefab.meta new file mode 100644 index 0000000000..690ebaf167 --- /dev/null +++ b/Assets/Prefabs/QualityBtn.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c136c867abc478f49a5045af11bfd46e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: