uChema
3 年前
当前提交
4ad4a353
共有 90 个文件被更改,包括 5681 次插入 和 1667 次删除
-
1UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-String-Tables-English (en).asset
-
1UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-String-Tables-French (fr).asset
-
1UOP1_Project/Assets/AddressableAssetsData/AssetGroups/Localization-String-Tables-Italian (it).asset
-
11UOP1_Project/Assets/Art/UI/FinalUI/_Settings/BG_Setting_Row.png
-
104UOP1_Project/Assets/LocalizationFiles/AssetTables/UI/UI Misc Shared Data.asset
-
104UOP1_Project/Assets/LocalizationFiles/AssetTables/UI/UI Misc_en.asset
-
72UOP1_Project/Assets/LocalizationFiles/AssetTables/UI/UI Misc_fr.asset
-
6UOP1_Project/Assets/LocalizationFiles/AssetTables/UI/UI Misc_it.asset
-
37UOP1_Project/Assets/Prefabs/UI/MainMenu/ButtonMenu.prefab
-
912UOP1_Project/Assets/Prefabs/UI/MainMenu/Canvas-MainMenu.prefab
-
86UOP1_Project/Assets/Prefabs/UI/MainMenu/MainMenu_Panel.prefab
-
4UOP1_Project/Assets/Prefabs/UI/Shared/Popup/GenericButton.prefab
-
140UOP1_Project/Assets/Prefabs/UI/WIP/Settings/Setting_Field.prefab
-
15UOP1_Project/Assets/Prefabs/UI/WIP/Settings/Tab_Item.prefab
-
146UOP1_Project/Assets/Samples/Localization/0.11.1-preview/Language Selection Menu (UGUI)/LanguageSelectionMenuUGUIDropdown.cs
-
67UOP1_Project/Assets/Scenes/Managers/PersistentManagers.unity
-
932UOP1_Project/Assets/Scenes/Menus/MainMenu.unity
-
163UOP1_Project/Assets/Scenes/Settings System.unity
-
3UOP1_Project/Assets/ScriptableObjects/SaveSystem/SaveSystem.asset
-
33UOP1_Project/Assets/Scripts/Audio/AudioManager.cs
-
1UOP1_Project/Assets/Scripts/Gameplay/GameStateSO.cs
-
80UOP1_Project/Assets/Scripts/Input/GameInput.cs
-
13UOP1_Project/Assets/Scripts/Input/InputReader.cs
-
22UOP1_Project/Assets/Scripts/SaveSystem/Save.cs
-
15UOP1_Project/Assets/Scripts/SaveSystem/SaveSystem.cs
-
60UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSystem.cs
-
2UOP1_Project/Assets/Scripts/Systems/Settings/SettingsGraphicsComponent.cs.meta
-
2UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSO.cs.meta
-
578UOP1_Project/Assets/Scripts/UI/Inventory/UIInventory.cs
-
8UOP1_Project/Assets/Scripts/UI/Inventory/UIActionButton.cs
-
33UOP1_Project/Assets/Scripts/UI/Settings/UIPaginationFiller.cs
-
55UOP1_Project/Assets/Scripts/UI/Settings/UISettingFieldsFiller.cs
-
68UOP1_Project/Assets/Scripts/UI/Settings/UISettingItemFiller.cs
-
35UOP1_Project/Assets/Scripts/UI/Settings/UISettingTabFiller.cs
-
22UOP1_Project/Assets/Scripts/UI/Settings/UISettingTabsFiller.cs
-
25UOP1_Project/Assets/Scripts/UI/Settings/UISettings.cs
-
3UOP1_Project/Assets/Scripts/UI/UIMenuManager.cs
-
6UOP1_Project/Assets/Scripts/UI/UIPause.cs
-
166UOP1_Project/Assets/Scripts/UI/UIPopup.cs
-
2UOP1_Project/Assets/Scripts/UI/UIGenericButton.cs
-
4UOP1_Project/Assets/Settings/Graphics/URPAsset.asset
-
60UOP1_Project/Assets/Settings/Input/GameInput.inputactions
-
2UOP1_Project/ProjectSettings/QualitySettings.asset
-
2UOP1_Project/Assets/Scripts/SetButtonNavigation.cs.meta
-
12UOP1_Project/Assets/Art/UI/FinalUI/_Settings/BtnArrowLeftSelected.png
-
120UOP1_Project/Assets/Art/UI/FinalUI/_Settings/BtnArrowLeftSelected.png.meta
-
11UOP1_Project/Assets/Art/UI/FinalUI/_Settings/BtnArrowRightSelected.png
-
120UOP1_Project/Assets/Art/UI/FinalUI/_Settings/BtnArrowRightSelected.png.meta
-
449UOP1_Project/Assets/Prefabs/UI/Shared/Settings_Buttons_Panel.prefab
-
7UOP1_Project/Assets/Prefabs/UI/Shared/Settings_Buttons_Panel.prefab.meta
-
1001UOP1_Project/Assets/Prefabs/UI/WIP/Settings/Settings_Panel_PR.prefab
-
7UOP1_Project/Assets/Prefabs/UI/WIP/Settings/Settings_Panel_PR.prefab.meta
-
15UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeMasterVolume_Channel.asset
-
8UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeMasterVolume_Channel.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeMusicVolume_Channel.asset
-
8UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeMusicVolume_Channel.asset.meta
-
15UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeSfxVolume_Channel.asset
-
8UOP1_Project/Assets/ScriptableObjects/EventChannels/ChangeSfxVolume_Channel.asset.meta
-
8UOP1_Project/Assets/ScriptableObjects/Events/Settings.meta
-
18UOP1_Project/Assets/Scripts/Events/ScriptableObjects/FloatEventChannelSO.cs
-
11UOP1_Project/Assets/Scripts/Events/ScriptableObjects/FloatEventChannelSO.cs.meta
-
74UOP1_Project/Assets/Scripts/SetButtonNavigation.cs
-
169UOP1_Project/Assets/Scripts/Systems/Settings/SettingsAudioComponent.cs
-
368UOP1_Project/Assets/Scripts/Systems/Settings/SettingsGraphicsComponent.cs
-
118UOP1_Project/Assets/Scripts/Systems/Settings/SettingsLanguageComponent.cs
-
52UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSO.cs
-
121UOP1_Project/Assets/Scripts/Systems/Settings/UISettingsController.cs
-
15UOP1_Project/Assets/ScriptableObjects/Events/Settings/SaveSettingsEvent.asset
-
8UOP1_Project/Assets/ScriptableObjects/Events/Settings/SaveSettingsEvent.asset.meta
-
22UOP1_Project/Assets/ScriptableObjects/Events/Settings/Settings.asset
-
8UOP1_Project/Assets/ScriptableObjects/Events/Settings/Settings.asset.meta
-
8UOP1_Project/Assets/Scripts/Systems/Settings/GraphicsPresets.asset.meta
-
41UOP1_Project/Assets/Scripts/Systems/Settings/SettingsPresetsScriptableObject.cs
-
56UOP1_Project/Assets/Scripts/Systems/Settings/SettingsUIController.cs
-
44UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSystemAudioComponent.cs
-
44UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSystemGeneralComponent.cs
-
208UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSystemGraphicsComponent.cs
-
24UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSystemSubComponents.cs
-
33UOP1_Project/Assets/Scripts/Systems/Settings/GraphicsPresets.asset
-
0/UOP1_Project/Assets/Scripts/Systems/Settings/SettingsAudioComponent.cs.meta
-
0/UOP1_Project/Assets/Scripts/Systems/Settings/SettingsLanguageComponent.cs.meta
-
0/UOP1_Project/Assets/Scripts/Systems/Settings/UISettingsController.cs.meta
-
0/UOP1_Project/Assets/Scripts/Systems/Settings/SettingsGraphicsComponent.cs.meta
-
0/UOP1_Project/Assets/Scripts/Systems/Settings/SettingsSO.cs.meta
-
0/UOP1_Project/Assets/Scripts/UI/Inventory/UIActionButton.cs.meta
-
0/UOP1_Project/Assets/Scripts/UI/Inventory/UIActionButton.cs
-
0/UOP1_Project/Assets/Scripts/UI/UIGenericButton.cs.meta
-
0/UOP1_Project/Assets/Scripts/UI/UIGenericButton.cs
-
0/UOP1_Project/Assets/Scripts/SetButtonNavigation.cs.meta
932
UOP1_Project/Assets/Scenes/Menus/MainMenu.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
163
UOP1_Project/Assets/Scenes/Settings System.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using UnityEngine; |
|||
using UnityEngine.Localization; |
|||
using UnityEngine.Localization.Settings; |
|||
using UnityEngine.Rendering.Universal; |
|||
[SerializeField] SettingsSystemGeneralComponent generalComponent; |
|||
[SerializeField] SettingsSystemGraphicsComponent graphicsComponent; |
|||
[SerializeField] SettingsSystemAudioComponent audioComponent; |
|||
[SerializeField] private VoidEventChannelSO SaveSettingsEvent = default; |
|||
public SettingsSystemGeneralComponent.LanguageSetting Language => generalComponent.Language; |
|||
public bool FullScreen => graphicsComponent.FullScreen; |
|||
public float MusicVolume => audioComponent.MusicVolume; |
|||
public float SfxVolume => audioComponent.SfxVolume; |
|||
[SerializeField] private SettingsSO _currentSettings = default; |
|||
[SerializeField] private UniversalRenderPipelineAsset _urpAsset = default; |
|||
[SerializeField] private SaveSystem _saveSystem = default; |
|||
} |
|||
[SerializeField] private FloatEventChannelSO _changeMasterVolumeEventChannel = default; |
|||
[SerializeField] private FloatEventChannelSO _changeSFXVolumeEventChannel = default; |
|||
[SerializeField] private FloatEventChannelSO _changeMusicVolumeEventChannel = default; |
|||
|
|||
private void Awake() |
|||
{ |
|||
_saveSystem.LoadSaveDataFromDisk(); |
|||
_currentSettings.LoadSavedSettings(_saveSystem.saveData); |
|||
SetCurrentSettings(); |
|||
} |
|||
private void OnEnable() |
|||
{ |
|||
SaveSettingsEvent.OnEventRaised += SaveSettings; |
|||
} |
|||
private void OnDisable() |
|||
{ |
|||
SaveSettingsEvent.OnEventRaised -= SaveSettings; |
|||
} |
|||
/// <summary>
|
|||
/// Set current settings
|
|||
/// </summary>
|
|||
void SetCurrentSettings() |
|||
{ |
|||
_changeMusicVolumeEventChannel.RaiseEvent(_currentSettings.MusicVolume);//raise event for volume change
|
|||
_changeSFXVolumeEventChannel.RaiseEvent(_currentSettings.SfxVolume); //raise event for volume change
|
|||
_changeMasterVolumeEventChannel.RaiseEvent(_currentSettings.MasterVolume); //raise event for volume change
|
|||
|
|||
Resolution currentResolution = Screen.resolutions[_currentSettings.ResolutionsIndex]; |
|||
Screen.SetResolution(currentResolution.width, currentResolution.height, _currentSettings.IsFullscreen); |
|||
_urpAsset.shadowDistance = _currentSettings.ShadowDistance; |
|||
_urpAsset.msaaSampleCount = _currentSettings.AntiAliasingIndex; |
|||
|
|||
LocalizationSettings.SelectedLocale = _currentSettings.CurrentLocale; |
|||
} |
|||
void SaveSettings() |
|||
{ |
|||
_saveSystem.SaveDataToDisk(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 296f74e550e36d24698a48d69871ed45 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -100 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Android |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 3f82274ed59c3cc45879eb9740a5f0e1 |
|||
TextureImporter: |
|||
internalIDToNameTable: [] |
|||
externalObjects: {} |
|||
serializedVersion: 11 |
|||
mipmaps: |
|||
mipMapMode: 0 |
|||
enableMipMap: 0 |
|||
sRGBTexture: 1 |
|||
linearTexture: 0 |
|||
fadeOut: 0 |
|||
borderMipMap: 0 |
|||
mipMapsPreserveCoverage: 0 |
|||
alphaTestReferenceValue: 0.5 |
|||
mipMapFadeDistanceStart: 1 |
|||
mipMapFadeDistanceEnd: 3 |
|||
bumpmap: |
|||
convertToNormalMap: 0 |
|||
externalNormalMap: 0 |
|||
heightScale: 0.25 |
|||
normalMapFilter: 0 |
|||
isReadable: 0 |
|||
streamingMipmaps: 0 |
|||
streamingMipmapsPriority: 0 |
|||
vTOnly: 0 |
|||
grayScaleToAlpha: 0 |
|||
generateCubemap: 6 |
|||
cubemapConvolution: 0 |
|||
seamlessCubemap: 0 |
|||
textureFormat: 1 |
|||
maxTextureSize: 2048 |
|||
textureSettings: |
|||
serializedVersion: 2 |
|||
filterMode: -1 |
|||
aniso: -1 |
|||
mipBias: -100 |
|||
wrapU: 1 |
|||
wrapV: 1 |
|||
wrapW: -1 |
|||
nPOTScale: 0 |
|||
lightmap: 0 |
|||
compressionQuality: 50 |
|||
spriteMode: 1 |
|||
spriteExtrude: 1 |
|||
spriteMeshType: 1 |
|||
alignment: 0 |
|||
spritePivot: {x: 0.5, y: 0.5} |
|||
spritePixelsToUnits: 100 |
|||
spriteBorder: {x: 0, y: 0, z: 0, w: 0} |
|||
spriteGenerateFallbackPhysicsShape: 1 |
|||
alphaUsage: 1 |
|||
alphaIsTransparency: 1 |
|||
spriteTessellationDetail: -1 |
|||
textureType: 8 |
|||
textureShape: 1 |
|||
singleChannelComponent: 0 |
|||
flipbookRows: 1 |
|||
flipbookColumns: 1 |
|||
maxTextureSizeSet: 0 |
|||
compressionQualitySet: 0 |
|||
textureFormatSet: 0 |
|||
ignorePngGamma: 0 |
|||
applyGammaDecoding: 0 |
|||
platformSettings: |
|||
- serializedVersion: 3 |
|||
buildTarget: DefaultTexturePlatform |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Standalone |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
- serializedVersion: 3 |
|||
buildTarget: Android |
|||
maxTextureSize: 2048 |
|||
resizeAlgorithm: 0 |
|||
textureFormat: -1 |
|||
textureCompression: 1 |
|||
compressionQuality: 50 |
|||
crunchedCompression: 0 |
|||
allowsAlphaSplitting: 0 |
|||
overridden: 0 |
|||
androidETC2FallbackOverride: 0 |
|||
forceMaximumCompressionQuality_BC6H_BC7: 0 |
|||
spriteSheet: |
|||
serializedVersion: 2 |
|||
sprites: [] |
|||
outline: [] |
|||
physicsShape: [] |
|||
bones: [] |
|||
spriteID: 5e97eb03825dee720800000000000000 |
|||
internalID: 0 |
|||
vertices: [] |
|||
indices: |
|||
edges: [] |
|||
weights: [] |
|||
secondaryTextures: [] |
|||
spritePackingTag: |
|||
pSDRemoveMatte: 0 |
|||
pSDShowRemoveMatteOption: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!1 &8026090063042488726 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 5107333375139220170} |
|||
- component: {fileID: 8937912904929031395} |
|||
- component: {fileID: 8384286114095243352} |
|||
- component: {fileID: 3157257367172658743} |
|||
m_Layer: 5 |
|||
m_Name: Settings_Buttons_Panel |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &5107333375139220170 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8026090063042488726} |
|||
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_Children: |
|||
- {fileID: 2170013751155781727} |
|||
- {fileID: 644463406097883330} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
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: 1248, y: 0} |
|||
m_Pivot: {x: 0.5, y: 0} |
|||
--- !u!222 &8937912904929031395 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8026090063042488726} |
|||
m_CullTransparentMesh: 1 |
|||
--- !u!114 &8384286114095243352 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8026090063042488726} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Padding: |
|||
m_Left: 50 |
|||
m_Right: 50 |
|||
m_Top: 0 |
|||
m_Bottom: 0 |
|||
m_ChildAlignment: 0 |
|||
m_Spacing: 50 |
|||
m_ChildForceExpandWidth: 1 |
|||
m_ChildForceExpandHeight: 1 |
|||
m_ChildControlWidth: 1 |
|||
m_ChildControlHeight: 0 |
|||
m_ChildScaleWidth: 0 |
|||
m_ChildScaleHeight: 0 |
|||
m_ReverseArrangement: 0 |
|||
--- !u!114 &3157257367172658743 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 8026090063042488726} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalFit: 0 |
|||
m_VerticalFit: 2 |
|||
--- !u!1001 &923518121487106531 |
|||
PrefabInstance: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_Modification: |
|||
m_TransformParent: {fileID: 5107333375139220170} |
|||
m_Modifications: |
|||
- target: {fileID: 297632141197697312, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Name |
|||
value: ResetButton |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Pivot.x |
|||
value: 0.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Pivot.y |
|||
value: 0.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_RootOrder |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMax.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMax.y |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMin.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMin.y |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_SizeDelta.x |
|||
value: 549 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_SizeDelta.y |
|||
value: 100 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.w |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchoredPosition.x |
|||
value: 923.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchoredPosition.y |
|||
value: -50 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442596, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_text |
|||
value: Reset |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442596, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_fontSize |
|||
value: 40 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_StringReference.m_TableEntryReference.m_KeyId |
|||
value: 26376909243670528 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_StringReference.m_TableReference.m_TableCollectionName |
|||
value: GUID:457af5455987a4876acc4332c3a761e5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_UpdateString.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName |
|||
value: TMPro.TextMeshProUGUI, Unity.TextMeshPro |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_Mode |
|||
value: 4 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_SelectOnUp |
|||
value: |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_SelectOnLeft |
|||
value: |
|||
objectReference: {fileID: 8467727145872617650} |
|||
m_RemovedComponents: [] |
|||
m_SourcePrefab: {fileID: 100100000, guid: 344bb0b18b7db4b4e8874973eb391ca1, type: 3} |
|||
--- !u!224 &644463406097883330 stripped |
|||
RectTransform: |
|||
m_CorrespondingSourceObject: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
m_PrefabInstance: {fileID: 923518121487106531} |
|||
m_PrefabAsset: {fileID: 0} |
|||
--- !u!114 &7165087327910551599 stripped |
|||
MonoBehaviour: |
|||
m_CorrespondingSourceObject: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
m_PrefabInstance: {fileID: 923518121487106531} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 77b26c7a54d143a7b78bcba222262814, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
--- !u!1001 &1890411066639880574 |
|||
PrefabInstance: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_Modification: |
|||
m_TransformParent: {fileID: 5107333375139220170} |
|||
m_Modifications: |
|||
- target: {fileID: 297632141197697312, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Name |
|||
value: SaveButton |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Pivot.x |
|||
value: 0.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Pivot.y |
|||
value: 0.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_RootOrder |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMax.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMax.y |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMin.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchorMin.y |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_SizeDelta.x |
|||
value: 549 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_SizeDelta.y |
|||
value: 100 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalPosition.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.w |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalRotation.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchoredPosition.x |
|||
value: 324.5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_AnchoredPosition.y |
|||
value: -50 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.x |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.y |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_LocalEulerAnglesHint.z |
|||
value: 0 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442596, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_text |
|||
value: Save |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442596, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_fontSize |
|||
value: 40 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_StringReference.m_TableEntryReference.m_KeyId |
|||
value: 26376705492770816 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_StringReference.m_TableReference.m_TableCollectionName |
|||
value: GUID:457af5455987a4876acc4332c3a761e5 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 297632142728442599, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_UpdateString.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName |
|||
value: TMPro.TextMeshProUGUI, Unity.TextMeshPro |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: IsSelected |
|||
value: 1 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_Mode |
|||
value: 4 |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_SelectOnUp |
|||
value: |
|||
objectReference: {fileID: 0} |
|||
- target: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
propertyPath: m_Navigation.m_SelectOnRight |
|||
value: |
|||
objectReference: {fileID: 7165087327910551599} |
|||
m_RemovedComponents: [] |
|||
m_SourcePrefab: {fileID: 100100000, guid: 344bb0b18b7db4b4e8874973eb391ca1, type: 3} |
|||
--- !u!224 &2170013751155781727 stripped |
|||
RectTransform: |
|||
m_CorrespondingSourceObject: {fileID: 297632141197697313, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
m_PrefabInstance: {fileID: 1890411066639880574} |
|||
m_PrefabAsset: {fileID: 0} |
|||
--- !u!114 &8467727145872617650 stripped |
|||
MonoBehaviour: |
|||
m_CorrespondingSourceObject: {fileID: 8052293337922855372, guid: 344bb0b18b7db4b4e8874973eb391ca1, |
|||
type: 3} |
|||
m_PrefabInstance: {fileID: 1890411066639880574} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 77b26c7a54d143a7b78bcba222262814, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|
|||
fileFormatVersion: 2 |
|||
guid: 21bf92a4b9386f2478adede01a87825c |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
UOP1_Project/Assets/Prefabs/UI/WIP/Settings/Settings_Panel_PR.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: cef07ea384e17ef4bb3abfbd08391f33 |
|||
PrefabImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: b763d3df319430442a72566d481de948, type: 3} |
|||
m_Name: ChangeMasterVolume_Channel |
|||
m_EditorClassIdentifier: |
|||
description: |
|
|||
fileFormatVersion: 2 |
|||
guid: ac033eaf5f8c5154e8df7c10fe3755ad |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: b763d3df319430442a72566d481de948, type: 3} |
|||
m_Name: ChangeMusicVolume_Channel |
|||
m_EditorClassIdentifier: |
|||
description: |
|
|||
fileFormatVersion: 2 |
|||
guid: 13e4f5dfe966e1447ba01306e125c0c0 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: b763d3df319430442a72566d481de948, type: 3} |
|||
m_Name: ChangeSfxVolume_Channel |
|||
m_EditorClassIdentifier: |
|||
description: |
|
|||
fileFormatVersion: 2 |
|||
guid: 4f26356559fe2254fb6d1f23601bd896 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 0bf90d5b2a939e74b9f4c9afcd540f84 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
|
|||
/// <summary>
|
|||
/// This class is used for Events that have one int argument.
|
|||
/// Example: An Achievement unlock event, where the int is the Achievement ID.
|
|||
/// </summary>
|
|||
|
|||
[CreateAssetMenu(menuName = "Events/Float Event Channel")] |
|||
public class FloatEventChannelSO : EventChannelBaseSO |
|||
{ |
|||
public UnityAction<float> OnEventRaised; |
|||
public void RaiseEvent(float value) |
|||
{ |
|||
if (OnEventRaised != null) |
|||
OnEventRaised.Invoke(value); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: b763d3df319430442a72566d481de948 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
public class SetButtonNavigation : MonoBehaviour |
|||
{ |
|||
UIGenericButton[] genericButtons; |
|||
UISettingItemFiller[] listSettingItems; |
|||
private void Start() |
|||
{ |
|||
listSettingItems = GetComponentsInChildren<UISettingItemFiller>(); |
|||
|
|||
genericButtons = GetComponentsInChildren<UIGenericButton>(); |
|||
MultiInputButton buttonToSelectOnDown = default; |
|||
MultiInputButton buttonToSelectOnUp = default; |
|||
for (int i = 0; i < listSettingItems.Length; i++) |
|||
{ |
|||
Navigation newNavigation = new Navigation(); |
|||
|
|||
newNavigation.mode = Navigation.Mode.Explicit; |
|||
|
|||
newNavigation.selectOnLeft = listSettingItems[i].gameObject.GetComponent<MultiInputButton>().navigation.selectOnLeft; |
|||
newNavigation.selectOnRight = listSettingItems[i].gameObject.GetComponent<MultiInputButton>().navigation.selectOnRight; |
|||
|
|||
if (i + 1 < listSettingItems.Length) |
|||
{ |
|||
buttonToSelectOnDown = listSettingItems[i + 1].gameObject.GetComponent<MultiInputButton>(); |
|||
|
|||
} |
|||
else if (genericButtons.Length > 0) |
|||
{ |
|||
|
|||
buttonToSelectOnDown = genericButtons[0].gameObject.GetComponent<MultiInputButton>(); |
|||
SetGenericButtonsNavigations(listSettingItems[i].gameObject.GetComponent<MultiInputButton>()); |
|||
} |
|||
|
|||
if (i - 1 >= 0) |
|||
buttonToSelectOnUp = listSettingItems[i - 1].gameObject.GetComponent<MultiInputButton>(); |
|||
|
|||
newNavigation.selectOnDown = buttonToSelectOnDown; |
|||
newNavigation.selectOnUp = buttonToSelectOnUp; |
|||
listSettingItems[i].gameObject.GetComponent<MultiInputButton>().navigation = newNavigation; |
|||
listSettingItems[i].SetNavigation(buttonToSelectOnDown, buttonToSelectOnUp); |
|||
} |
|||
} |
|||
private void OnEnable() |
|||
{ |
|||
if (listSettingItems == null) |
|||
{ |
|||
listSettingItems = GetComponentsInChildren<UISettingItemFiller>(); |
|||
} |
|||
if (listSettingItems.Length > 0) |
|||
if (listSettingItems[0].GetComponent<MultiInputButton>() != null) |
|||
//select first item
|
|||
listSettingItems[0].GetComponent<MultiInputButton>().Select(); |
|||
} |
|||
void SetGenericButtonsNavigations(MultiInputButton itemUp) |
|||
{ |
|||
for (int i = 0; i < genericButtons.Length; i++) |
|||
{ |
|||
Navigation newNavigation = new Navigation(); |
|||
newNavigation.mode = Navigation.Mode.Explicit; |
|||
if (i + 1 < genericButtons.Length) |
|||
newNavigation.selectOnRight = genericButtons[i + 1].gameObject.GetComponent<MultiInputButton>(); |
|||
if (i - 1 > 0) |
|||
newNavigation.selectOnLeft = genericButtons[i - 1].gameObject.GetComponent<MultiInputButton>(); |
|||
|
|||
newNavigation.selectOnUp = itemUp; |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
|
|||
public class SettingsAudioComponent : MonoBehaviour |
|||
{ |
|||
[SerializeField] UISettingItemFiller _masterVolumeField; |
|||
[SerializeField] UISettingItemFiller _musicVolumeField; |
|||
[SerializeField] UISettingItemFiller _sfxVolumeField; |
|||
|
|||
[SerializeField] UIGenericButton _saveButton; |
|||
[SerializeField] UIGenericButton _resetButton; |
|||
|
|||
[Header("Broadcasting")] |
|||
[SerializeField] private FloatEventChannelSO _masterVolumeEventChannel = default; |
|||
[SerializeField] private FloatEventChannelSO _sFXVolumeEventChannel = default; |
|||
[SerializeField] private FloatEventChannelSO _musicVolumeEventChannel = default; |
|||
private float _musicVolume { get; set; } |
|||
private float _sfxVolume { get; set; } |
|||
private float _masterVolume { get; set; } |
|||
private float _savedMusicVolume { get; set; } |
|||
private float _savedSfxVolume { get; set; } |
|||
private float _savedMasterVolume { get; set; } |
|||
|
|||
int _maxVolume = 10; |
|||
|
|||
public event UnityAction<float, float, float> _save = delegate { }; |
|||
private void OnEnable() |
|||
{ |
|||
_musicVolumeField._nextOption += IncreaseMusicVolume; |
|||
_musicVolumeField._previousOption += DecreaseMusicVolume; |
|||
_saveButton.Clicked += SaveVolumes; |
|||
_resetButton.Clicked += ResetVolumes; |
|||
_sfxVolumeField._nextOption += IncreaseSFXVolume; |
|||
_sfxVolumeField._previousOption += DecreaseSFXVolume; |
|||
_masterVolumeField._nextOption += IncreaseMasterVolume; |
|||
_masterVolumeField._previousOption += DecreaseMasterVolume; |
|||
|
|||
} |
|||
private void OnDisable() |
|||
{ |
|||
ResetVolumes(); // reset volumes on disable. If not saved, it will reset to initial volumes.
|
|||
_musicVolumeField._nextOption -= IncreaseMusicVolume; |
|||
_musicVolumeField._previousOption -= DecreaseMusicVolume; |
|||
_saveButton.Clicked -= SaveVolumes; |
|||
_resetButton.Clicked -= ResetVolumes; |
|||
_sfxVolumeField._nextOption -= IncreaseSFXVolume; |
|||
_sfxVolumeField._previousOption -= DecreaseSFXVolume; |
|||
_masterVolumeField._nextOption -= IncreaseMasterVolume; |
|||
_masterVolumeField._previousOption -= DecreaseMasterVolume; |
|||
|
|||
} |
|||
public void Setup(float musicVolume, float sfxVolume, float masterVolume) |
|||
{ |
|||
_masterVolume = masterVolume; |
|||
_musicVolume = sfxVolume; |
|||
_sfxVolume = musicVolume; |
|||
|
|||
_savedMasterVolume = _masterVolume; |
|||
_savedMusicVolume = _musicVolume; |
|||
_savedSfxVolume = _sfxVolume; |
|||
|
|||
SetMusicVolumeField(); |
|||
SetSfxVolumeField(); |
|||
SetMasterVolumeField(); |
|||
} |
|||
private void SetMusicVolumeField() |
|||
{ |
|||
int paginationCount = _maxVolume + 1; // adding a page in the pagination since the count starts from 0
|
|||
int selectedPaginationIndex = Mathf.RoundToInt(_maxVolume * _musicVolume); |
|||
string selectedOption = Mathf.RoundToInt(_maxVolume * _musicVolume).ToString(); |
|||
|
|||
SetMusicVolume(); |
|||
|
|||
_musicVolumeField.FillSettingField(paginationCount, selectedPaginationIndex, selectedOption); |
|||
|
|||
|
|||
} |
|||
private void SetSfxVolumeField() |
|||
{ |
|||
int paginationCount = _maxVolume + 1;// adding a page in the pagination since the count starts from 0
|
|||
int selectedPaginationIndex = Mathf.RoundToInt(_maxVolume * _sfxVolume); |
|||
string selectedOption = Mathf.RoundToInt(_maxVolume * _sfxVolume).ToString(); |
|||
|
|||
SetSfxVolume(); |
|||
|
|||
_sfxVolumeField.FillSettingField(paginationCount, selectedPaginationIndex, selectedOption); |
|||
|
|||
} |
|||
private void SetMasterVolumeField() |
|||
{ |
|||
int paginationCount = _maxVolume + 1;// adding a page in the pagination since the count starts from 0
|
|||
int selectedPaginationIndex = Mathf.RoundToInt(_maxVolume * _masterVolume); |
|||
string selectedOption = Mathf.RoundToInt(_maxVolume * _masterVolume).ToString(); |
|||
|
|||
SetMasterVolume(); |
|||
|
|||
_masterVolumeField.FillSettingField(paginationCount, selectedPaginationIndex, selectedOption); |
|||
|
|||
} |
|||
private void SetMusicVolume() |
|||
{ |
|||
_musicVolumeEventChannel.RaiseEvent(_musicVolume);//raise event for volume change
|
|||
} |
|||
private void SetSfxVolume() |
|||
{ |
|||
_sFXVolumeEventChannel.RaiseEvent(_sfxVolume); //raise event for volume change
|
|||
|
|||
} |
|||
private void SetMasterVolume() |
|||
{ |
|||
_masterVolumeEventChannel.RaiseEvent(_masterVolume); //raise event for volume change
|
|||
|
|||
} |
|||
|
|||
private void IncreaseMasterVolume() |
|||
{ |
|||
_masterVolume += 1 / (float)_maxVolume; |
|||
_masterVolume = Mathf.Clamp(_masterVolume, 0, 1); |
|||
SetMasterVolumeField(); |
|||
} |
|||
private void DecreaseMasterVolume() |
|||
{ |
|||
_masterVolume -= 1 / (float)_maxVolume; |
|||
_masterVolume = Mathf.Clamp(_masterVolume, 0, 1); |
|||
SetMasterVolumeField(); |
|||
} |
|||
private void IncreaseMusicVolume() |
|||
{ |
|||
_musicVolume += 1 / (float)_maxVolume; |
|||
_musicVolume = Mathf.Clamp(_musicVolume, 0, 1); |
|||
SetMusicVolumeField(); |
|||
} |
|||
private void DecreaseMusicVolume() |
|||
{ |
|||
|
|||
_musicVolume -= 1 / (float)_maxVolume; |
|||
_musicVolume = Mathf.Clamp(_musicVolume, 0, 1); |
|||
SetMusicVolumeField(); |
|||
} |
|||
private void IncreaseSFXVolume() |
|||
{ |
|||
_sfxVolume += 1 / (float)_maxVolume; |
|||
_sfxVolume = Mathf.Clamp(_sfxVolume, 0, 1); |
|||
|
|||
SetSfxVolumeField(); |
|||
} |
|||
private void DecreaseSFXVolume() |
|||
{ |
|||
|
|||
_sfxVolume -= 1 / (float)_maxVolume; |
|||
_sfxVolume = Mathf.Clamp(_sfxVolume, 0, 1); |
|||
SetSfxVolumeField(); |
|||
} |
|||
|
|||
private void ResetVolumes() |
|||
{ |
|||
Setup(_savedMusicVolume, _savedSfxVolume, _savedMasterVolume); |
|||
} |
|||
private void SaveVolumes() |
|||
{ |
|||
_savedMasterVolume = _masterVolume; |
|||
_savedMusicVolume = _musicVolume; |
|||
_savedSfxVolume = _sfxVolume; |
|||
//save Audio
|
|||
_save.Invoke(_musicVolume, _sfxVolume, _masterVolume); |
|||
} |
|||
|
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using TMPro; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Rendering.Universal; |
|||
|
|||
[System.Serializable] |
|||
public class ShadowDistanceTier |
|||
{ |
|||
public float Distance; |
|||
public string TierDescription; |
|||
} |
|||
|
|||
public class SettingsGraphicsComponent : MonoBehaviour |
|||
{ |
|||
[SerializeField] private List<ShadowDistanceTier> ShadowDistanceTierList = new List<ShadowDistanceTier>(); // filled from inspector
|
|||
|
|||
[SerializeField] private UniversalRenderPipelineAsset URPAsset = default; |
|||
|
|||
private int _savedResolutionIndex = default; |
|||
private int _savedAntiAliasingIndex = default; |
|||
private int _savedShadowDistanceTier = default; |
|||
private bool _savedFullscreenState = default; |
|||
|
|||
private int _currentResolutionIndex = default; |
|||
private List<Resolution> _resolutionsList = default; |
|||
[SerializeField] UISettingItemFiller _resolutionsField = default; |
|||
|
|||
/* private int _currentShadowQualityIndex = default; |
|||
private List<string> _shadowQualityList = default; |
|||
[SerializeField] private UISettingItemFiller _shadowQualityField = default;*/ |
|||
|
|||
private int _currentAntiAliasingIndex = default; |
|||
private List<string> _currentAntiAliasingList = default; |
|||
[SerializeField] private UISettingItemFiller _antiAliasingField = default; |
|||
|
|||
private int _currentShadowDistanceTier = default; |
|||
[SerializeField] private UISettingItemFiller _shadowDistanceField = default; |
|||
private bool _isFullscreen = default; |
|||
|
|||
[SerializeField] private UISettingItemFiller _fullscreenField = default; |
|||
|
|||
public event UnityAction<int, int, float, bool> _save = delegate { }; |
|||
|
|||
private Resolution _currentResolution; |
|||
|
|||
[SerializeField] private UIGenericButton _saveButton; |
|||
[SerializeField] private UIGenericButton _resetButton; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
_resolutionsField._nextOption += NextResolution; |
|||
_resolutionsField._previousOption += PreviousResolution; |
|||
|
|||
_shadowDistanceField._nextOption += NextShadowDistanceTier; |
|||
_shadowDistanceField._previousOption += PreviousShadowDistanceTier; |
|||
|
|||
_fullscreenField._nextOption += NextFullscreenState; |
|||
_fullscreenField._previousOption += PreviousFullscreenState; |
|||
|
|||
_antiAliasingField._nextOption += NextAntiAliasingTier; |
|||
_antiAliasingField._previousOption += PreviousAntiAliasingTier; |
|||
|
|||
_saveButton.Clicked += SaveSettings; |
|||
_resetButton.Clicked += ResetSettings; |
|||
|
|||
} |
|||
private void OnDisable() |
|||
{ |
|||
ResetSettings(); |
|||
_resolutionsField._nextOption -= NextResolution; |
|||
_resolutionsField._previousOption -= PreviousResolution; |
|||
|
|||
_shadowDistanceField._nextOption -= NextShadowDistanceTier; |
|||
_shadowDistanceField._previousOption -= PreviousShadowDistanceTier; |
|||
|
|||
_fullscreenField._nextOption -= NextFullscreenState; |
|||
_fullscreenField._previousOption -= PreviousFullscreenState; |
|||
|
|||
_antiAliasingField._nextOption -= NextAntiAliasingTier; |
|||
_antiAliasingField._previousOption -= PreviousAntiAliasingTier; |
|||
|
|||
_saveButton.Clicked -= SaveSettings; |
|||
_resetButton.Clicked -= ResetSettings; |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
public void Init() |
|||
{ |
|||
_resolutionsList = GetResolutionsList(); |
|||
_currentShadowDistanceTier = GetCurrentShadowDistanceTier(); |
|||
_currentAntiAliasingList = GetDropdownData(Enum.GetNames(typeof(MsaaQuality))); |
|||
|
|||
_currentResolution = Screen.currentResolution; |
|||
_currentResolutionIndex = GetCurrentResolutionIndex(); |
|||
_isFullscreen = GetCurrentFullscreenState(); |
|||
_currentAntiAliasingIndex = GetCurrentAntialiasing(); |
|||
|
|||
_savedResolutionIndex = _currentResolutionIndex; |
|||
_savedAntiAliasingIndex = _currentAntiAliasingIndex; |
|||
_savedShadowDistanceTier = _currentShadowDistanceTier; |
|||
_savedFullscreenState = _isFullscreen; |
|||
} |
|||
public void Setup() |
|||
{ |
|||
Init(); |
|||
SetResolutionField(); |
|||
SetShadowDistance(); |
|||
SetFullscreen(); |
|||
SetAntiAliasingField(); |
|||
} |
|||
|
|||
#region Resolution
|
|||
void SetResolutionField() |
|||
{ |
|||
string displayText = _resolutionsList[_currentResolutionIndex].ToString(); |
|||
displayText = displayText.Substring(0, displayText.IndexOf("@")); |
|||
|
|||
_resolutionsField.FillSettingField(_resolutionsList.Count, _currentResolutionIndex, displayText); |
|||
|
|||
} |
|||
List<Resolution> GetResolutionsList() |
|||
{ |
|||
List<Resolution> options = new List<Resolution>(); |
|||
for (int i = 0; i < Screen.resolutions.Length; i++) |
|||
{ |
|||
options.Add(Screen.resolutions[i]); |
|||
} |
|||
|
|||
return options; |
|||
} |
|||
int GetCurrentResolutionIndex() |
|||
{ |
|||
if (_resolutionsList == null) |
|||
{ _resolutionsList = GetResolutionsList(); } |
|||
int index = _resolutionsList.FindIndex(o => o.width == _currentResolution.width && o.height == _currentResolution.height); |
|||
return index; |
|||
} |
|||
void NextResolution() |
|||
{ |
|||
_currentResolutionIndex++; |
|||
_currentResolutionIndex = Mathf.Clamp(_currentResolutionIndex, 0, _resolutionsList.Count - 1); |
|||
OnResolutionChange(); |
|||
} |
|||
void PreviousResolution() |
|||
{ |
|||
_currentResolutionIndex--; |
|||
_currentResolutionIndex = Mathf.Clamp(_currentResolutionIndex, 0, _resolutionsList.Count - 1); |
|||
OnResolutionChange(); |
|||
} |
|||
void OnResolutionChange() |
|||
{ |
|||
_currentResolution = _resolutionsList[_currentResolutionIndex]; |
|||
Screen.SetResolution(_currentResolution.width, _currentResolution.height, _isFullscreen); |
|||
SetResolutionField(); |
|||
} |
|||
#endregion
|
|||
|
|||
#region ShadowDistance
|
|||
void SetShadowDistance() |
|||
{ |
|||
_shadowDistanceField.FillSettingField_Localized(ShadowDistanceTierList.Count, _currentShadowDistanceTier, ShadowDistanceTierList[_currentShadowDistanceTier].TierDescription); |
|||
} |
|||
int GetCurrentShadowDistanceTier() |
|||
{ |
|||
int tierIndex = -1; |
|||
if (ShadowDistanceTierList.Exists(o => o.Distance == URPAsset.shadowDistance)) |
|||
tierIndex = ShadowDistanceTierList.FindIndex(o => o.Distance == URPAsset.shadowDistance); |
|||
else |
|||
{ |
|||
Debug.LogError("Current shadow distance is not in the tier List " + URPAsset.shadowDistance); |
|||
} |
|||
return tierIndex; |
|||
|
|||
} |
|||
void NextShadowDistanceTier() |
|||
{ |
|||
_currentShadowDistanceTier++; |
|||
_currentShadowDistanceTier = Mathf.Clamp(_currentShadowDistanceTier, 0, ShadowDistanceTierList.Count); |
|||
OnShadowDistanceChange(); |
|||
} |
|||
void PreviousShadowDistanceTier() |
|||
{ |
|||
_currentShadowDistanceTier--; |
|||
_currentShadowDistanceTier = Mathf.Clamp(_currentShadowDistanceTier, 0, ShadowDistanceTierList.Count); |
|||
OnShadowDistanceChange(); |
|||
} |
|||
|
|||
void OnShadowDistanceChange() |
|||
{ |
|||
URPAsset.shadowDistance = ShadowDistanceTierList[_currentShadowDistanceTier].Distance; |
|||
SetShadowDistance(); |
|||
|
|||
} |
|||
#endregion
|
|||
|
|||
#region fullscreen
|
|||
void SetFullscreen() |
|||
{ |
|||
if (_isFullscreen) |
|||
{ |
|||
_fullscreenField.FillSettingField_Localized(2, 1, "On"); |
|||
} |
|||
else |
|||
{ |
|||
_fullscreenField.FillSettingField_Localized(2, 0, "Off"); |
|||
} |
|||
|
|||
} |
|||
bool GetCurrentFullscreenState() |
|||
{ |
|||
return Screen.fullScreen; |
|||
} |
|||
void NextFullscreenState() |
|||
{ |
|||
_isFullscreen = true; |
|||
OnFullscreenChange(); |
|||
} |
|||
void PreviousFullscreenState() |
|||
{ |
|||
_isFullscreen = false; |
|||
OnFullscreenChange(); |
|||
} |
|||
void OnFullscreenChange() |
|||
{ |
|||
Screen.fullScreen = _isFullscreen; |
|||
SetFullscreen(); |
|||
} |
|||
#endregion
|
|||
|
|||
#region Anti Aliasing
|
|||
void SetAntiAliasingField() |
|||
{ |
|||
string optionDisplay = _currentAntiAliasingList[_currentAntiAliasingIndex].Replace("_", ""); |
|||
_antiAliasingField.FillSettingField(_currentAntiAliasingList.Count, _currentAntiAliasingIndex, optionDisplay); |
|||
|
|||
} |
|||
int GetCurrentAntialiasing() |
|||
{ |
|||
return URPAsset.msaaSampleCount; |
|||
|
|||
} |
|||
void NextAntiAliasingTier() |
|||
{ |
|||
_currentAntiAliasingIndex++; |
|||
_currentAntiAliasingIndex = Mathf.Clamp(_currentAntiAliasingIndex, 0, _currentAntiAliasingList.Count - 1); |
|||
OnAntiAliasingChange(); |
|||
} |
|||
void PreviousAntiAliasingTier() |
|||
{ |
|||
_currentAntiAliasingIndex--; |
|||
_currentAntiAliasingIndex = Mathf.Clamp(_currentAntiAliasingIndex, 0, _currentAntiAliasingList.Count - 1); |
|||
OnAntiAliasingChange(); |
|||
} |
|||
|
|||
void OnAntiAliasingChange() |
|||
{ |
|||
URPAsset.msaaSampleCount = _currentAntiAliasingIndex; |
|||
SetAntiAliasingField(); |
|||
|
|||
} |
|||
#endregion
|
|||
|
|||
private List<string> GetDropdownData(string[] optionNames, params string[] customOptions) |
|||
{ |
|||
List<string> options = new List<string>(); |
|||
foreach (string option in optionNames) |
|||
{ |
|||
options.Add(option); |
|||
} |
|||
|
|||
foreach (string option in customOptions) |
|||
{ |
|||
options.Add(option); |
|||
} |
|||
return options; |
|||
} |
|||
|
|||
public void SaveSettings() |
|||
{ |
|||
float shadowDistance = ShadowDistanceTierList[_currentShadowDistanceTier].Distance; |
|||
_save.Invoke(_currentResolutionIndex, _currentAntiAliasingIndex, shadowDistance, _isFullscreen); |
|||
} |
|||
public void ResetSettings() |
|||
{ |
|||
_currentResolutionIndex = _savedResolutionIndex; |
|||
OnResolutionChange(); |
|||
_currentAntiAliasingIndex = _savedAntiAliasingIndex; |
|||
OnAntiAliasingChange(); |
|||
_currentShadowDistanceTier = _savedShadowDistanceTier; |
|||
OnShadowDistanceChange(); |
|||
_isFullscreen = _savedFullscreenState; |
|||
OnFullscreenChange(); |
|||
} |
|||
|
|||
|
|||
/* |
|||
#region ShadowQuality
|
|||
void SetShadowQualityField() |
|||
{ |
|||
_currentShadowQualityIndex = GetCurrentShadowQualityIndex(); |
|||
_shadowQualityList = GetDropdownData(Enum.GetNames(typeof(UnityEngine.Rendering.Universal.ShadowQuality))); |
|||
_shadowQualityField.FillSettingField_Localized(_shadowQualityList.Count, _currentShadowQualityIndex, _shadowQualityList[_currentShadowQualityIndex]); |
|||
|
|||
} |
|||
int GetCurrentShadowQualityIndex() |
|||
{ |
|||
UnityEngine.Rendering.Universal.ShadowQuality shadowQuality = UnityEngine.Rendering.Universal.ShadowQuality.Disabled; |
|||
if (URPAsset.supportsMainLightShadows && URPAsset.supportsSoftShadows) |
|||
{ |
|||
shadowQuality = UnityEngine.Rendering.Universal.ShadowQuality.SoftShadows; |
|||
|
|||
} |
|||
else if (URPAsset.supportsMainLightShadows) |
|||
{ |
|||
shadowQuality = UnityEngine.Rendering.Universal.ShadowQuality.HardShadows; |
|||
} |
|||
else |
|||
{ |
|||
shadowQuality = UnityEngine.Rendering.Universal.ShadowQuality.Disabled; |
|||
} |
|||
return (int)shadowQuality; |
|||
} |
|||
void SetNextShadowQuality() |
|||
{ |
|||
_currentShadowQualityIndex++; |
|||
_currentShadowQualityIndex = Mathf.Clamp(_currentShadowQualityIndex, 0, _shadowQualityList.Count - 1); |
|||
OnShadowQualityChange(); |
|||
} |
|||
void SetPreviousShadowQuality() |
|||
{ |
|||
_currentShadowQualityIndex--; |
|||
_currentShadowQualityIndex = Mathf.Clamp(_currentShadowQualityIndex, 0, _shadowQualityList.Count - 1); |
|||
OnShadowQualityChange(); |
|||
} |
|||
void OnShadowQualityChange() |
|||
{ |
|||
UnityEngine.Rendering.Universal.ShadowQuality shadowQuality = (UnityEngine.Rendering.Universal.ShadowQuality)_currentShadowQualityIndex; |
|||
|
|||
switch (shadowQuality) |
|||
{ |
|||
|
|||
case UnityEngine.Rendering.Universal.ShadowQuality.SoftShadows: |
|||
URPAsset.shadow = true; |
|||
URPAsset.supportsSoftShadows = true; |
|||
break; |
|||
|
|||
case UnityEngine.Rendering.Universal.ShadowQuality.HardShadows: |
|||
URPAsset.supportsMainLightShadows = true; |
|||
URPAsset.supportsSoftShadows = false; |
|||
break; |
|||
case UnityEngine.Rendering.Universal.ShadowQuality.Disabled: |
|||
URPAsset.supportsMainLightShadows = false; |
|||
URPAsset.supportsSoftShadows = false; |
|||
break; |
|||
} |
|||
SetShadowQualityField(); |
|||
} |
|||
|
|||
#endregion
|
|||
*/ |
|||
|
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using TMPro; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Localization; |
|||
using UnityEngine.Localization.Settings; |
|||
using UnityEngine.ResourceManagement.AsyncOperations; |
|||
|
|||
public class SettingsLanguageComponent : MonoBehaviour |
|||
{ |
|||
[SerializeField] UISettingItemFiller languageDropdown; |
|||
|
|||
AsyncOperationHandle m_InitializeOperation; |
|||
List<string> languageList = new List<string>(); |
|||
|
|||
public event UnityAction<Locale> _save = delegate { }; |
|||
private int _currentSelectedOption = 0; |
|||
private int _savedSelectedOption = default; |
|||
|
|||
[SerializeField] private UIGenericButton _saveButton; |
|||
[SerializeField] private UIGenericButton _resetButton; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
m_InitializeOperation = LocalizationSettings.SelectedLocaleAsync; |
|||
if (m_InitializeOperation.IsDone) |
|||
{ |
|||
InitializeCompleted(m_InitializeOperation); |
|||
} |
|||
else |
|||
{ |
|||
m_InitializeOperation.Completed += InitializeCompleted; |
|||
} |
|||
_saveButton.Clicked += SaveSettings; |
|||
_resetButton.Clicked += ResetSettings; |
|||
languageDropdown._nextOption += NextOption; |
|||
languageDropdown._previousOption += PreviousOption; |
|||
} |
|||
private void OnDisable() |
|||
{ |
|||
ResetSettings(); |
|||
|
|||
_saveButton.Clicked -= SaveSettings; |
|||
_resetButton.Clicked -= ResetSettings; |
|||
languageDropdown._nextOption -= NextOption; |
|||
languageDropdown._previousOption -= PreviousOption; |
|||
LocalizationSettings.SelectedLocaleChanged -= LocalizationSettings_SelectedLocaleChanged; |
|||
} |
|||
|
|||
void InitializeCompleted(AsyncOperationHandle obj) |
|||
{ |
|||
m_InitializeOperation.Completed -= InitializeCompleted; |
|||
// Create an option in the dropdown for each Locale
|
|||
languageList = new List<string>(); |
|||
|
|||
List<Locale> locales = LocalizationSettings.AvailableLocales.Locales; |
|||
|
|||
for (int i = 0; i < locales.Count; ++i) |
|||
{ |
|||
var locale = locales[i]; |
|||
if (LocalizationSettings.SelectedLocale == locale) |
|||
_currentSelectedOption = i; |
|||
|
|||
var displayName = locales[i].Identifier.CultureInfo != null ? locales[i].Identifier.CultureInfo.NativeName : locales[i].ToString(); |
|||
languageList.Add(displayName); |
|||
} |
|||
languageDropdown.FillSettingField(languageList.Count, _currentSelectedOption, languageList[_currentSelectedOption]); |
|||
_savedSelectedOption = _currentSelectedOption; |
|||
LocalizationSettings.SelectedLocaleChanged += LocalizationSettings_SelectedLocaleChanged; |
|||
} |
|||
|
|||
void NextOption() |
|||
{ |
|||
_currentSelectedOption++; |
|||
Debug.Log(_currentSelectedOption); |
|||
_currentSelectedOption = Mathf.Clamp(_currentSelectedOption, 0, languageList.Count - 1); |
|||
OnSelectionChanged(); |
|||
} |
|||
void PreviousOption() |
|||
{ |
|||
_currentSelectedOption--; |
|||
_currentSelectedOption = Mathf.Clamp(_currentSelectedOption, 0, languageList.Count - 1); |
|||
OnSelectionChanged(); |
|||
} |
|||
void OnSelectionChanged() |
|||
{ |
|||
// Unsubscribe from SelectedLocaleChanged so we don't get an unnecessary callback from the change we are about to make.
|
|||
LocalizationSettings.SelectedLocaleChanged -= LocalizationSettings_SelectedLocaleChanged; |
|||
|
|||
var locale = LocalizationSettings.AvailableLocales.Locales[_currentSelectedOption]; |
|||
LocalizationSettings.SelectedLocale = locale; |
|||
|
|||
// Resubscribe to SelectedLocaleChanged so that we can stay in sync with changes that may be made by other scripts.
|
|||
LocalizationSettings.SelectedLocaleChanged += LocalizationSettings_SelectedLocaleChanged; |
|||
} |
|||
|
|||
void LocalizationSettings_SelectedLocaleChanged(Locale locale) |
|||
{ |
|||
// We need to update the dropdown selection to match.
|
|||
var selectedIndex = LocalizationSettings.AvailableLocales.Locales.IndexOf(locale); |
|||
languageDropdown.FillSettingField(languageList.Count, selectedIndex, languageList[selectedIndex]); |
|||
|
|||
} |
|||
public void SaveSettings() |
|||
{ |
|||
Locale _currentLocale = LocalizationSettings.AvailableLocales.Locales[_currentSelectedOption]; |
|||
_savedSelectedOption = _currentSelectedOption; |
|||
_save.Invoke(_currentLocale); |
|||
} |
|||
public void ResetSettings() |
|||
{ |
|||
_currentSelectedOption = _savedSelectedOption; |
|||
OnSelectionChanged(); |
|||
} |
|||
|
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.Localization; |
|||
[CreateAssetMenu(fileName = "Settings", menuName = "Settings/Create new settings SO")] |
|||
|
|||
public class SettingsSO : ScriptableObject |
|||
{ |
|||
[SerializeField] float _masterVolume = default; |
|||
[SerializeField] float _musicVolume = default; |
|||
[SerializeField] float _sfxVolume = default; |
|||
[SerializeField] int _resolutionsIndex = default; |
|||
[SerializeField] int _antiAliasingIndex = default; |
|||
[SerializeField] float _shadowDistance = default; |
|||
[SerializeField] bool _isFullscreen = default; |
|||
[SerializeField] Locale _currentLocale = default; |
|||
public float MasterVolume => _masterVolume; |
|||
public float MusicVolume => _musicVolume; |
|||
public float SfxVolume => _sfxVolume; |
|||
public int ResolutionsIndex => _resolutionsIndex; |
|||
public int AntiAliasingIndex => _antiAliasingIndex; |
|||
public float ShadowDistance => _shadowDistance; |
|||
public bool IsFullscreen => _isFullscreen; |
|||
public Locale CurrentLocale => _currentLocale; |
|||
public void SaveAudioSettings(float newMusicVolume, float newSfxVolume, float newMasterVolume) |
|||
{ |
|||
_masterVolume = newMasterVolume; |
|||
_musicVolume = newMusicVolume; |
|||
_sfxVolume = newSfxVolume; |
|||
} |
|||
public void SaveGraphicsSettings(int newResolutionsIndex, int newAntiAliasingIndex, float newShadowDistance, bool fullscreenState) |
|||
{ |
|||
_resolutionsIndex = newResolutionsIndex; |
|||
_antiAliasingIndex = newAntiAliasingIndex; |
|||
_shadowDistance = newShadowDistance; |
|||
_isFullscreen = fullscreenState; |
|||
} |
|||
public void SaveLanguageSettings(Locale local) |
|||
{ |
|||
_currentLocale = local; |
|||
} |
|||
public SettingsSO() { } |
|||
public void LoadSavedSettings(Save savedFile) |
|||
{ |
|||
_masterVolume = savedFile._masterVolume; |
|||
_musicVolume = savedFile._musicVolume; |
|||
_sfxVolume = savedFile._sfxVolume; |
|||
_resolutionsIndex = savedFile._resolutionsIndex; |
|||
_antiAliasingIndex = savedFile._antiAliasingIndex; |
|||
_shadowDistance = savedFile._shadowDistance; |
|||
_isFullscreen = savedFile._isFullscreen; |
|||
_currentLocale = savedFile._currentLocale; |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Localization; |
|||
using UnityEngine.UI; |
|||
public enum SettingsType |
|||
{ |
|||
Language, |
|||
Graphics, |
|||
Audio, |
|||
} |
|||
public class UISettingsController : MonoBehaviour |
|||
{ |
|||
[SerializeField] private SettingsLanguageComponent _languageComponent; |
|||
[SerializeField] private SettingsGraphicsComponent _graphicsComponent; |
|||
[SerializeField] private SettingsAudioComponent _audioComponent; |
|||
[SerializeField] private UISettingTabsFiller _settingTabFiller = default; |
|||
[SerializeField] private SettingsSO _currentSettings; |
|||
[SerializeField] private List<SettingsType> _settingTabsList = new List<SettingsType>(); |
|||
private SettingsType _selectedTab = SettingsType.Audio; |
|||
[SerializeField] private InputReader _inputReader = default; |
|||
[SerializeField] private VoidEventChannelSO SaveSettingsEvent = default; |
|||
public UnityAction Closed; |
|||
private void OnEnable() |
|||
{ |
|||
_languageComponent._save += SaveLaguageSettings; |
|||
_audioComponent._save += SaveAudioSettings; |
|||
_graphicsComponent._save += SaveGraphicsSettings; |
|||
|
|||
_inputReader.menuCloseEvent += CloseScreen; |
|||
_inputReader.TabSwitched += SwitchTab; |
|||
|
|||
_settingTabFiller.FillTabs(_settingTabsList); |
|||
_settingTabFiller.ChooseTab += OpenSetting; |
|||
|
|||
OpenSetting(SettingsType.Audio); |
|||
|
|||
} |
|||
private void OnDisable() |
|||
{ |
|||
_inputReader.menuCloseEvent -= CloseScreen; |
|||
_inputReader.TabSwitched -= SwitchTab; |
|||
|
|||
_languageComponent._save -= SaveLaguageSettings; |
|||
_audioComponent._save -= SaveAudioSettings; |
|||
_graphicsComponent._save -= SaveGraphicsSettings; |
|||
} |
|||
public void CloseScreen() |
|||
{ |
|||
Closed.Invoke(); |
|||
} |
|||
|
|||
|
|||
|
|||
void OpenSetting(SettingsType settingType) |
|||
{ |
|||
_selectedTab = settingType; |
|||
switch (settingType) |
|||
{ |
|||
case SettingsType.Language: |
|||
_currentSettings.SaveLanguageSettings(_currentSettings.CurrentLocale); |
|||
break; |
|||
case SettingsType.Graphics: |
|||
_graphicsComponent.Setup(); |
|||
break; |
|||
case SettingsType.Audio: |
|||
_audioComponent.Setup(_currentSettings.MusicVolume, _currentSettings.SfxVolume, _currentSettings.MasterVolume); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
|
|||
_languageComponent.gameObject.SetActive(settingType == SettingsType.Language); |
|||
_graphicsComponent.gameObject.SetActive((settingType == SettingsType.Graphics)); |
|||
_audioComponent.gameObject.SetActive(settingType == SettingsType.Audio); |
|||
_settingTabFiller.SelectTab(settingType); |
|||
|
|||
} |
|||
void SwitchTab(float orientation) |
|||
{ |
|||
|
|||
if (orientation != 0) |
|||
{ |
|||
bool isLeft = orientation < 0; |
|||
int initialIndex = _settingTabsList.FindIndex(o => o == _selectedTab); |
|||
if (initialIndex != -1) |
|||
{ |
|||
if (isLeft) |
|||
{ |
|||
initialIndex--; |
|||
} |
|||
else |
|||
{ |
|||
initialIndex++; |
|||
} |
|||
|
|||
initialIndex = Mathf.Clamp(initialIndex, 0, _settingTabsList.Count - 1); |
|||
} |
|||
|
|||
OpenSetting(_settingTabsList[initialIndex]); |
|||
} |
|||
} |
|||
public void SaveLaguageSettings(Locale local) |
|||
{ |
|||
_currentSettings.SaveLanguageSettings(local); |
|||
SaveSettingsEvent.RaiseEvent(); |
|||
} |
|||
public void SaveGraphicsSettings(int newResolutionsIndex, int newAntiAliasingIndex, float newShadowDistance, bool fullscreenState) |
|||
{ |
|||
_currentSettings.SaveGraphicsSettings(newResolutionsIndex, newAntiAliasingIndex, newShadowDistance, fullscreenState); |
|||
SaveSettingsEvent.RaiseEvent(); |
|||
} |
|||
void SaveAudioSettings(float musicVolume, float sfxVolume, float masterVolume) |
|||
{ |
|||
_currentSettings.SaveAudioSettings(musicVolume, sfxVolume, masterVolume); |
|||
|
|||
SaveSettingsEvent.RaiseEvent(); |
|||
} |
|||
|
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 7fafac715ff920c4383fed91a38a351e, type: 3} |
|||
m_Name: SaveSettingsEvent |
|||
m_EditorClassIdentifier: |
|||
description: |
|
|||
fileFormatVersion: 2 |
|||
guid: e6ff8a48cab21e046a6cdb61bab35111 |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 141e21bdb3dba4642b62b856fd06879b, type: 3} |
|||
m_Name: Settings |
|||
m_EditorClassIdentifier: |
|||
_masterVolume: 1 |
|||
_musicVolume: 1 |
|||
_sfxVolume: 1 |
|||
_resolutionsIndex: 2 |
|||
_antiAliasingIndex: 0 |
|||
_shadowDistance: 0 |
|||
_isFullscreen: 0 |
|||
_currentLocale: {fileID: 0} |
|
|||
fileFormatVersion: 2 |
|||
guid: 10a9cfb7ceadb294da93b9773e89074b |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 11400000 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: 8cdf9b9e9fa3444209be445de7a2a6ac |
|||
NativeFormatImporter: |
|||
externalObjects: {} |
|||
mainObjectFileID: 0 |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
[CreateAssetMenu(fileName = "GraphicsPresets", menuName = "Graphics/Presets", order = 1)] |
|||
public class SettingsPresetsScriptableObject : ScriptableObject |
|||
{ |
|||
public List<AdvancedGraphics> presetList; |
|||
|
|||
[Serializable] |
|||
public struct AdvancedGraphics |
|||
{ |
|||
public GraphicsQualityLevel qualityLevel; |
|||
public ShadowQuality shadowQuality; |
|||
public AnisotropicFiltering anisotropicFiltering; |
|||
public int antiAliasing; |
|||
public float shadowDistance; |
|||
public bool custom; |
|||
} |
|||
|
|||
public enum GraphicsQualityLevel |
|||
{ |
|||
Low, |
|||
Middle, |
|||
High |
|||
} |
|||
|
|||
public AdvancedGraphics GetPresetByQualityLevel(GraphicsQualityLevel level) |
|||
{ |
|||
foreach (AdvancedGraphics preset in presetList) |
|||
{ |
|||
if (level == preset.qualityLevel) |
|||
{ |
|||
return preset; |
|||
} |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
public class SettingsUIController : MonoBehaviour |
|||
{ |
|||
[SerializeField] GameObject generalSettings, graphicsSettings, audioSettings, inputSettings; |
|||
[SerializeField] Button generalSettingsButton, graphicsSettingsButton, audioSettingsButton, inputSettingsButton, saveGraphicsSettingsButton, cancelGraphicsSettingsButton; |
|||
|
|||
public enum SettingsType |
|||
{ |
|||
General, |
|||
Graphics, |
|||
Audio, |
|||
Input |
|||
} |
|||
|
|||
public void OpenGeneralSettings() |
|||
{ |
|||
OpenSetting(SettingsType.General); |
|||
} |
|||
|
|||
public void OpenGraphicsSettings() |
|||
{ |
|||
OpenSetting(SettingsType.Graphics); |
|||
} |
|||
|
|||
public void OpenAudioSettings() |
|||
{ |
|||
OpenSetting(SettingsType.Audio); |
|||
} |
|||
|
|||
public void OpenInputSettings() |
|||
{ |
|||
OpenSetting(SettingsType.Input); |
|||
} |
|||
|
|||
public void OnSaveGraphicsSettings() |
|||
{ |
|||
saveGraphicsSettingsButton.interactable = false; |
|||
} |
|||
|
|||
void OpenSetting(SettingsType settingType) |
|||
{ |
|||
generalSettings.SetActive(settingType == SettingsType.General); |
|||
graphicsSettings.SetActive((settingType == SettingsType.Graphics)); |
|||
audioSettings.SetActive(settingType == SettingsType.Audio); |
|||
inputSettings.SetActive(settingType == SettingsType.Input); |
|||
|
|||
generalSettingsButton.interactable = settingType != SettingsType.General; |
|||
graphicsSettingsButton.interactable = settingType != SettingsType.Graphics; |
|||
audioSettingsButton.interactable = settingType != SettingsType.Audio; |
|||
inputSettingsButton.interactable = settingType != SettingsType.Input; |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
public class SettingsSystemAudioComponent : SettingsSystemSubComponents |
|||
{ |
|||
[SerializeField] Slider musicVolumeSlider; |
|||
[SerializeField] Slider sfxVolumeSlider; |
|||
|
|||
public float MusicVolume { get; private set; } |
|||
public float SfxVolume { get; private set; } |
|||
|
|||
void Start() |
|||
{ |
|||
Setup(); |
|||
} |
|||
|
|||
protected override void Setup() |
|||
{ |
|||
//TODO: load previous music volume setting
|
|||
MusicVolume = 50f; |
|||
musicVolumeSlider.SetValueWithoutNotify(MusicVolume); |
|||
//TODO: load previous sfx volume setting
|
|||
SfxVolume = 50f; |
|||
sfxVolumeSlider.SetValueWithoutNotify(SfxVolume); |
|||
} |
|||
|
|||
#region UI CALLBACKS
|
|||
|
|||
//TODO: clamp volume to [0, 1] or [0, 100]? Change Slider min max value in editor depending on use case
|
|||
public void OnChangeMusicVolume(float volume) |
|||
{ |
|||
MusicVolume = Mathf.Clamp(volume, 0.0f, 100.0f); |
|||
} |
|||
|
|||
//TODO: clamp volume to [0, 1] or [0, 100]? Change Slider min max value in editor depending on use case
|
|||
public void OnChangeSfxVolume(float volume) |
|||
{ |
|||
SfxVolume = Mathf.Clamp(volume, 0.0f, 100.0f); |
|||
} |
|||
|
|||
#endregion
|
|||
} |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using TMPro; |
|||
using UnityEngine; |
|||
|
|||
public class SettingsSystemGeneralComponent : SettingsSystemSubComponents |
|||
{ |
|||
[SerializeField] TMP_Dropdown languageDropdown; |
|||
|
|||
SettingsSystem settingsSystem; |
|||
public LanguageSetting Language { get; private set; } |
|||
|
|||
public enum LanguageSetting |
|||
{ |
|||
English, |
|||
German, |
|||
//TODO: which languages are going to be supported?
|
|||
} |
|||
|
|||
void Start() |
|||
{ |
|||
Setup(); |
|||
} |
|||
|
|||
protected override void Setup() |
|||
{ |
|||
settingsSystem = transform.parent.GetComponent<SettingsSystem>(); |
|||
languageDropdown.AddOptions(GetDropdownData(Enum.GetNames(typeof(LanguageSetting)))); |
|||
//TODO: Load previous serialized session data via Load/Save class
|
|||
Language = SettingsSystemGeneralComponent.LanguageSetting.English; |
|||
languageDropdown.SetValueWithoutNotify((int) Language); |
|||
} |
|||
|
|||
#region UI CALLBACKS
|
|||
|
|||
public void OnChangeLanguage(int languageIndex) |
|||
{ |
|||
Language = (LanguageSetting) languageIndex; |
|||
Debug.Log("Language set to: " + Language); |
|||
} |
|||
|
|||
#endregion
|
|||
} |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using TMPro; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
public class SettingsSystemGraphicsComponent : SettingsSystemSubComponents |
|||
{ |
|||
[SerializeField] TMP_Dropdown resolutionsDropdown; |
|||
[SerializeField] TMP_Dropdown shadowQualityDropdown; |
|||
[SerializeField] TMP_Dropdown anisotropicFilteringDropdown; |
|||
[SerializeField] TMP_Dropdown graphicsPresetsDropdown; |
|||
[SerializeField] Slider antiAliasingSlider; |
|||
[SerializeField] Slider shadowDistanceSlider; |
|||
[SerializeField] Toggle fullscreenToggle; |
|||
[SerializeField] TextMeshProUGUI antiAliasingText; |
|||
[SerializeField] TextMeshProUGUI shadowDistanceText; |
|||
[SerializeField] SettingsPresetsScriptableObject settingsPresets; |
|||
|
|||
bool setupComplete; |
|||
|
|||
//Advanced graphic settings
|
|||
SettingsPresetsScriptableObject.AdvancedGraphics currentAdvancedGraphics, previousAdvancedGraphics; |
|||
int currentQualityIndex, previousQualityIndex; |
|||
|
|||
//Fullscreen settings
|
|||
public bool FullScreen { get; private set; } |
|||
bool previouslyInFullScreen; |
|||
|
|||
//Resolution setting
|
|||
Resolution currentResolution, previousResolution; |
|||
|
|||
void OnEnable() |
|||
{ |
|||
if (!setupComplete) |
|||
{ |
|||
Setup(); |
|||
} |
|||
} |
|||
|
|||
protected override void Setup() |
|||
{ |
|||
resolutionsDropdown.AddOptions(GetResolutionsDropdownData()); |
|||
graphicsPresetsDropdown.AddOptions(GetDropdownData(Enum.GetNames(typeof(SettingsPresetsScriptableObject.GraphicsQualityLevel)), "Custom")); |
|||
anisotropicFilteringDropdown.AddOptions(GetDropdownData(Enum.GetNames(typeof(AnisotropicFiltering)))); |
|||
shadowQualityDropdown.AddOptions(GetDropdownData(Enum.GetNames(typeof(ShadowQuality)))); |
|||
|
|||
//RESOLUTION
|
|||
//TODO: apparently, unity keeps the resolution which was set in the last session. But there is no method to get this resolution in the next session
|
|||
//TODO: because Screen.currentResolution in windowed mode gives back the resolution of the desktop, not the unity window resolution
|
|||
currentResolution = Screen.resolutions[Screen.resolutions.Length - 1]; //Initially set highest possible resolution on device
|
|||
previousResolution = currentResolution; |
|||
Screen.SetResolution(currentResolution.width, currentResolution.height, Screen.fullScreenMode, currentResolution.refreshRate); |
|||
SelectCurrentResolution(); |
|||
|
|||
//FULLSCREEN MODE
|
|||
//TODO: load previous session fullscreen setting
|
|||
FullScreen = Screen.fullScreenMode == FullScreenMode.ExclusiveFullScreen; |
|||
previouslyInFullScreen = FullScreen; |
|||
fullscreenToggle.SetIsOnWithoutNotify(FullScreen); |
|||
|
|||
//QUALITY PRESET
|
|||
//TODO: instead of hardcoding the level here, load data from previous session
|
|||
currentQualityIndex = (int) SettingsPresetsScriptableObject.GraphicsQualityLevel.Low; |
|||
previousQualityIndex = currentQualityIndex; |
|||
currentAdvancedGraphics = settingsPresets.presetList[currentQualityIndex]; //Set to lowest preset initially
|
|||
previousAdvancedGraphics = currentAdvancedGraphics; |
|||
graphicsPresetsDropdown.SetValueWithoutNotify(currentAdvancedGraphics.custom ? graphicsPresetsDropdown.options.Count-1 : currentQualityIndex); |
|||
UpdateUI(); |
|||
setupComplete = true; |
|||
} |
|||
|
|||
List<TMP_Dropdown.OptionData> GetResolutionsDropdownData() |
|||
{ |
|||
List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>(); |
|||
for (int i = 0; i < Screen.resolutions.Length; i++) |
|||
{ |
|||
options.Add(new TMP_Dropdown.OptionData(Screen.resolutions[i].ToString())); |
|||
} |
|||
|
|||
return options; |
|||
} |
|||
|
|||
void UpdateUI() |
|||
{ |
|||
anisotropicFilteringDropdown.SetValueWithoutNotify((int) currentAdvancedGraphics.anisotropicFiltering); |
|||
antiAliasingSlider.SetValueWithoutNotify(currentAdvancedGraphics.antiAliasing); |
|||
shadowDistanceSlider.SetValueWithoutNotify(currentAdvancedGraphics.shadowDistance); |
|||
shadowQualityDropdown.SetValueWithoutNotify((int) currentAdvancedGraphics.shadowQuality); |
|||
shadowDistanceText.text = currentAdvancedGraphics.shadowDistance.ToString(); |
|||
antiAliasingText.text = currentAdvancedGraphics.antiAliasing.ToString(); |
|||
fullscreenToggle.SetIsOnWithoutNotify(FullScreen); |
|||
graphicsPresetsDropdown.SetValueWithoutNotify(currentAdvancedGraphics.custom ? graphicsPresetsDropdown.options.Count-1 : currentQualityIndex); |
|||
} |
|||
|
|||
#region UI CALLBACKS
|
|||
|
|||
public void OnChangeFullscreen(bool fullScreen) |
|||
{ |
|||
Screen.fullScreenMode = fullScreen ? FullScreenMode.ExclusiveFullScreen : FullScreenMode.Windowed; |
|||
FullScreen = fullScreen; |
|||
} |
|||
|
|||
public void OnChangeResolution(int resolutionIndex) |
|||
{ |
|||
Debug.Log("Index: " + resolutionIndex); |
|||
currentResolution = Screen.resolutions[resolutionIndex]; |
|||
Screen.SetResolution(currentResolution.width, currentResolution.height, Screen.fullScreenMode, currentResolution.refreshRate); |
|||
} |
|||
|
|||
public void OnChangeAnisotropicFiltering(int anisoLevel) |
|||
{ |
|||
currentAdvancedGraphics.anisotropicFiltering = (AnisotropicFiltering) anisoLevel; |
|||
currentAdvancedGraphics.custom = true; |
|||
UpdateUI(); |
|||
} |
|||
|
|||
public void OnChangeAntialiasing(float value) |
|||
{ |
|||
currentAdvancedGraphics.antiAliasing = (int) value; |
|||
currentAdvancedGraphics.custom = true; |
|||
UpdateUI(); |
|||
} |
|||
|
|||
public void OnChangeShadowDistance(float shadowDistanceValue) |
|||
{ |
|||
//TODO: configure min max value in slider
|
|||
currentAdvancedGraphics.shadowDistance = shadowDistanceValue; |
|||
currentAdvancedGraphics.custom = true; |
|||
UpdateUI(); |
|||
} |
|||
|
|||
public void OnChangeShadowQuality(int level) |
|||
{ |
|||
currentAdvancedGraphics.shadowQuality = (ShadowQuality) level; |
|||
currentAdvancedGraphics.custom = true; |
|||
UpdateUI(); |
|||
} |
|||
|
|||
public void OnChangeQualityPreset(int level) |
|||
{ |
|||
if (level >= settingsPresets.presetList.Count) |
|||
{ |
|||
//Custom level chosen
|
|||
currentAdvancedGraphics.custom = true; |
|||
} |
|||
else |
|||
{ |
|||
currentAdvancedGraphics = settingsPresets.presetList[level]; |
|||
} |
|||
currentQualityIndex = level; |
|||
UpdateUI(); |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
void SelectCurrentResolution() |
|||
{ |
|||
int resolutionIndex = 0; |
|||
//TODO: is resolution persistent once it is set? Need to test in build
|
|||
for (int i = 0; i < Screen.resolutions.Length; i++) |
|||
{ |
|||
if (currentResolution.width == Screen.resolutions[i].width && |
|||
currentResolution.height == Screen.resolutions[i].height && |
|||
currentResolution.refreshRate == Screen.resolutions[i].refreshRate) |
|||
{ |
|||
resolutionIndex = i; |
|||
} |
|||
} |
|||
|
|||
resolutionsDropdown.SetValueWithoutNotify(resolutionIndex); |
|||
} |
|||
|
|||
public void OnSaveGraphicsSettings() |
|||
{ |
|||
QualitySettings.anisotropicFiltering = currentAdvancedGraphics.anisotropicFiltering; |
|||
QualitySettings.antiAliasing = currentAdvancedGraphics.antiAliasing; |
|||
QualitySettings.shadowDistance = currentAdvancedGraphics.shadowDistance; |
|||
QualitySettings.shadows = currentAdvancedGraphics.shadowQuality; |
|||
|
|||
previousAdvancedGraphics = currentAdvancedGraphics; |
|||
previousQualityIndex = currentQualityIndex; |
|||
previousResolution = currentResolution; |
|||
previouslyInFullScreen = FullScreen; |
|||
Debug.Log("Saving resolution state: " + currentResolution); |
|||
Debug.Log(("Saving fullscreen mode state: " + previouslyInFullScreen)); |
|||
} |
|||
|
|||
public void OnCancelGraphicsSettings() |
|||
{ |
|||
currentAdvancedGraphics = previousAdvancedGraphics; |
|||
currentQualityIndex = previousQualityIndex; |
|||
QualitySettings.anisotropicFiltering = currentAdvancedGraphics.anisotropicFiltering; |
|||
QualitySettings.antiAliasing = currentAdvancedGraphics.antiAliasing; |
|||
QualitySettings.shadowDistance = currentAdvancedGraphics.shadowDistance; |
|||
QualitySettings.shadows = currentAdvancedGraphics.shadowQuality; |
|||
Screen.SetResolution(previousResolution.width, previousResolution.height, previouslyInFullScreen ? FullScreenMode.ExclusiveFullScreen : FullScreenMode.Windowed, previousResolution.refreshRate); |
|||
// It might be a good idea to wait for the end of frame here with a coroutine, because setResolution actually is executed at the end of the next frame
|
|||
//TODO: Observe this for issues in future
|
|||
currentResolution = previousResolution; |
|||
FullScreen = previouslyInFullScreen; |
|||
SelectCurrentResolution(); |
|||
UpdateUI(); |
|||
Debug.Log("New Resolution: " + previousResolution); |
|||
Debug.Log("New fullscreen mode: " + FullScreen); |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using TMPro; |
|||
using UnityEngine; |
|||
|
|||
public abstract class SettingsSystemSubComponents : MonoBehaviour |
|||
{ |
|||
protected List<TMP_Dropdown.OptionData> GetDropdownData(string[] optionNames, params string[] customOptions) |
|||
{ |
|||
List<TMP_Dropdown.OptionData> options = new List<TMP_Dropdown.OptionData>(); |
|||
foreach (string option in optionNames) |
|||
{ |
|||
options.Add(new TMP_Dropdown.OptionData(option)); |
|||
} |
|||
|
|||
foreach (string option in customOptions) |
|||
{ |
|||
options.Add(new TMP_Dropdown.OptionData(option)); |
|||
} |
|||
return options; |
|||
} |
|||
|
|||
protected abstract void Setup(); |
|||
} |
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!114 &11400000 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 0} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 8d1813776c092430c8317fdd5290dc57, type: 3} |
|||
m_Name: GraphicsPresets |
|||
m_EditorClassIdentifier: |
|||
presetList: |
|||
- qualityLevel: 0 |
|||
shadowQuality: 0 |
|||
anisotropicFiltering: 0 |
|||
antiAliasing: 0 |
|||
shadowDistance: 20 |
|||
custom: 0 |
|||
- qualityLevel: 1 |
|||
shadowQuality: 1 |
|||
anisotropicFiltering: 1 |
|||
antiAliasing: 2 |
|||
shadowDistance: 50 |
|||
custom: 0 |
|||
- qualityLevel: 2 |
|||
shadowQuality: 2 |
|||
anisotropicFiltering: 2 |
|||
antiAliasing: 8 |
|||
shadowDistance: 100 |
|||
custom: 0 |
撰写
预览
正在加载...
取消
保存
Reference in new issue