15 Commits

Author SHA1 Message Date
c89e845a6b fix typo in README 2026-03-12 16:31:59 +00:00
449953b393 Removed unused namespaces from ConfigManager. 2026-02-07 16:45:20 +02:00
95ea7a2625 Removed dead code. File.WriteAllText and File.ReadAllText seem to work fine (no need for file streaming). 2026-02-07 15:14:26 +02:00
2f12ef4aff Formatting fix. C# functions start with a uppercase letter. 2026-02-07 15:13:03 +02:00
2ba8b4d1b5 Moved the ConfigManager script to the Scripts folder and ConfigManager prefab to the Prefabs folder. 2026-02-07 15:11:12 +02:00
30c0652453 Project Settings file. I don't know what change is this... 2026-02-03 23:00:57 +02:00
85beb73f51 Do not commit config.json. Unity creates it itself and we do not want configs from different devs to end up in the repo. 2026-02-03 22:59:02 +02:00
011d9dfdda Restore Defaults button to restore the default settings. 2026-02-03 22:56:01 +02:00
2e7dc403ad Restore Defaults button images. 2026-02-03 22:55:29 +02:00
4bda55baca Locomotion speed default value fix. 2026-02-03 22:55:03 +02:00
ba1f0c855d Settings are now loaded from and saved to the config.json file. Reworked the UI structure a bit (the script that manage the settings have to be active before the UI is opened to actually take effect at game startup). Fixed several UI bugs (slider deselection, UI labels blocking the sliders, etc). 2026-02-03 21:47:16 +02:00
415484c1f0 Removed unused namespaces that hindered building. 2026-02-03 21:44:40 +02:00
2347d27c62 For some reason Unity changed something in the font asset... Maybe it is the glow effect. 2026-02-03 21:43:50 +02:00
74c2ca6a98 Managers folder meta file. 2026-02-02 22:45:06 +02:00
f3d0f206af Config manager. Just creating, reading and writing the config file for now. 2026-02-02 22:44:17 +02:00
31 changed files with 1141 additions and 286 deletions

4
.gitignore vendored
View File

@@ -103,3 +103,7 @@ NetrworkManagerUI.prefab
NetrworkManagerUI.prefab.meta NetrworkManagerUI.prefab.meta
CustomNetworkManager.prefab CustomNetworkManager.prefab
CustomNetworkManager.prefab.meta CustomNetworkManager.prefab.meta
# Project-specific files
config.json

View File

@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: 261e77f9774b3224b9f61ebaff302284
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
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
swizzle: 50462976
cookieLightType: 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: Server
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: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 262dce796e1903548b7a2a7909d20be4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: ab1a16880e37cfa499309fc8fd4250ba
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
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
swizzle: 50462976
cookieLightType: 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: Server
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: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -119,7 +119,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 0 m_IsActive: 1
--- !u!224 &2888630431832822380 --- !u!224 &2888630431832822380
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -128,7 +128,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 674832405591274748} m_GameObject: {fileID: 674832405591274748}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 6.199966} m_LocalPosition: {x: 0, y: 0, z: 6}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -137,8 +137,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 198, y: 29.999985} m_AnchoredPosition: {x: 25.8, y: -57.9}
m_SizeDelta: {x: 178.01, y: 338.4} m_SizeDelta: {x: 485, y: 46.5}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7009866660814900916 --- !u!222 &7009866660814900916
CanvasRenderer: CanvasRenderer:
@@ -168,9 +168,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_text: 'Warning: m_text: High speeds may cause nausea!
High speeds may cause nausea'
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: d564a6b9a8a781b438125b614edcc297, type: 2} m_fontAsset: {fileID: 11400000, guid: d564a6b9a8a781b438125b614edcc297, type: 2}
m_sharedMaterial: {fileID: 2467261418627247352, guid: d564a6b9a8a781b438125b614edcc297, m_sharedMaterial: {fileID: 2467261418627247352, guid: d564a6b9a8a781b438125b614edcc297,
@@ -205,7 +203,7 @@ MonoBehaviour:
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 4
m_VerticalAlignment: 256 m_VerticalAlignment: 256
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
@@ -236,7 +234,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 1.8959656, y: 6.638962, z: 3.9048767, w: 1.7601442}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -582,6 +580,7 @@ Transform:
- {fileID: 7867682990484010893} - {fileID: 7867682990484010893}
- {fileID: 385502688868600332} - {fileID: 385502688868600332}
- {fileID: 8911245181170312639} - {fileID: 8911245181170312639}
- {fileID: 4369549003892251738}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -711,8 +710,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -371.7, y: 0.000015258789} m_AnchoredPosition: {x: -429.3, y: 0.000015258789}
m_SizeDelta: {x: 469.55, y: 50.48} m_SizeDelta: {x: 319.7, y: 50.48}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1756154180137300123 --- !u!222 &1756154180137300123
CanvasRenderer: CanvasRenderer:
@@ -808,7 +807,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 2.8457031, y: 0, z: 2.8460312, w: 0}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -1140,6 +1139,149 @@ RectTransform:
m_AnchoredPosition: {x: -5.404525, y: 60.661545} m_AnchoredPosition: {x: -5.404525, y: 60.661545}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1647071810007517722
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4369549003892251738}
- component: {fileID: 18611445735460691}
- component: {fileID: 8343075384873062513}
- component: {fileID: 5285357331933866282}
- component: {fileID: 1310480035629572623}
- component: {fileID: 1510780549024052800}
- component: {fileID: 4307275810096043329}
- component: {fileID: 143507707063213418}
m_Layer: 12
m_Name: Settings
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4369549003892251738
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
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: 5343771095006709614}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &18611445735460691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 26a0dd79a025e5041a41f576b1aa4968, type: 3}
m_Name:
m_EditorClassIdentifier:
turnOffButton: {fileID: 3645818974320619446}
turnOnButton: {fileID: 1311809556432207317}
moveSpeedSlider: {fileID: 6956878155406096985}
locomotion: {fileID: 1565464911732960072}
--- !u!114 &8343075384873062513
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 0
slider: {fileID: 7370795858478176567}
--- !u!114 &5285357331933866282
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 3
slider: {fileID: 8524569723447833986}
--- !u!114 &1310480035629572623
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 5
slider: {fileID: 3954205046647893400}
--- !u!114 &1510780549024052800
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 4
slider: {fileID: 7262865820799039206}
--- !u!114 &4307275810096043329
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 1
slider: {fileID: 512852062931003448}
--- !u!114 &143507707063213418
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1647071810007517722}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1ebe1a3f8ef35a041a8ef39da672dd49, type: 3}
m_Name:
m_EditorClassIdentifier:
valueControllers:
- {fileID: 18611445735460691}
- {fileID: 8343075384873062513}
- {fileID: 5285357331933866282}
- {fileID: 1310480035629572623}
- {fileID: 1510780549024052800}
- {fileID: 4307275810096043329}
--- !u!1 &1694677102371321062 --- !u!1 &1694677102371321062
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2219,7 +2361,6 @@ GameObject:
- component: {fileID: 5495779272626688296} - component: {fileID: 5495779272626688296}
- component: {fileID: 270386226070323618} - component: {fileID: 270386226070323618}
- component: {fileID: 7370795858478176567} - component: {fileID: 7370795858478176567}
- component: {fileID: 9192465668386235667}
m_Layer: 5 m_Layer: 5
m_Name: Button m_Name: Button
m_TagString: Untagged m_TagString: Untagged
@@ -2346,19 +2487,6 @@ MonoBehaviour:
minValue: 0 minValue: 0
maxValue: 1 maxValue: 1
slideareaOffsetMultiplier: 0.9 slideareaOffsetMultiplier: 0.9
--- !u!114 &9192465668386235667
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3421967330093517364}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 0
--- !u!1 &3434260850308121859 --- !u!1 &3434260850308121859
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2412,7 +2540,6 @@ GameObject:
- component: {fileID: 5857106340495004348} - component: {fileID: 5857106340495004348}
- component: {fileID: 467034009919322666} - component: {fileID: 467034009919322666}
- component: {fileID: 3954205046647893400} - component: {fileID: 3954205046647893400}
- component: {fileID: 8737582689073729793}
m_Layer: 5 m_Layer: 5
m_Name: Button m_Name: Button
m_TagString: Untagged m_TagString: Untagged
@@ -2539,19 +2666,6 @@ MonoBehaviour:
minValue: 0 minValue: 0
maxValue: 1 maxValue: 1
slideareaOffsetMultiplier: 0.9 slideareaOffsetMultiplier: 0.9
--- !u!114 &8737582689073729793
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3504227185401202113}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 5
--- !u!1 &3847096334227967442 --- !u!1 &3847096334227967442
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2858,6 +2972,153 @@ MonoBehaviour:
m_FillOrigin: 0 m_FillOrigin: 0
m_UseSpriteMesh: 0 m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1 m_PixelsPerUnitMultiplier: 1
--- !u!1 &4399914816600051466
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3664260978476899140}
- component: {fileID: 7108608958374546862}
- component: {fileID: 2424293117796193332}
- component: {fileID: 5839269911837038846}
- component: {fileID: 8403009779207699600}
m_Layer: 5
m_Name: Restore Defaults Button
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3664260978476899140
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4399914816600051466}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -5.9}
m_LocalScale: {x: 0.05, y: 0.05, z: 0.05}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 4738851406616228330}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 399.3, y: 266.8}
m_SizeDelta: {x: 2155, y: 1076}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7108608958374546862
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4399914816600051466}
m_CullTransparentMesh: 1
--- !u!114 &2424293117796193332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4399914816600051466}
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: 21300000, guid: ab1a16880e37cfa499309fc8fd4250ba, type: 3}
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
--- !u!114 &5839269911837038846
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4399914816600051466}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 0
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 2
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 21300000, guid: 261e77f9774b3224b9f61ebaff302284,
type: 3}
m_PressedSprite: {fileID: 21300000, guid: 261e77f9774b3224b9f61ebaff302284, type: 3}
m_SelectedSprite: {fileID: 21300000, guid: ab1a16880e37cfa499309fc8fd4250ba, type: 3}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2424293117796193332}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 143507707063213418}
m_TargetAssemblyTypeName: RestoreDefaultsController, Assembly-CSharp
m_MethodName: OnRestoreDefaults
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &8403009779207699600
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4399914816600051466}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9c648a319c5c6aa47b3ef152a10657bf, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &4745390056551288905 --- !u!1 &4745390056551288905
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -3036,7 +3297,7 @@ RectTransform:
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -1849.8, y: 30} m_AnchoredPosition: {x: -1849.8, y: 30}
m_SizeDelta: {x: 90.1, y: 50.5} m_SizeDelta: {x: 89, y: 50.5}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1344781521441133505 --- !u!222 &1344781521441133505
CanvasRenderer: CanvasRenderer:
@@ -3539,7 +3800,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -2404.8, y: 34.7} m_AnchoredPosition: {x: -2600, y: 34.7}
m_SizeDelta: {x: 220, y: 49.6} m_SizeDelta: {x: 220, y: 49.6}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2306375091028476275 --- !u!222 &2306375091028476275
@@ -3605,7 +3866,7 @@ MonoBehaviour:
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 4
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
@@ -3636,7 +3897,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 14.186401, y: 0, z: -0.9451599, w: 0}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -3655,7 +3916,6 @@ GameObject:
- component: {fileID: 4467346825075014904} - component: {fileID: 4467346825075014904}
- component: {fileID: 1078020185355697329} - component: {fileID: 1078020185355697329}
- component: {fileID: 7262865820799039206} - component: {fileID: 7262865820799039206}
- component: {fileID: 8463522706283787556}
m_Layer: 5 m_Layer: 5
m_Name: Button m_Name: Button
m_TagString: Untagged m_TagString: Untagged
@@ -3782,19 +4042,6 @@ MonoBehaviour:
minValue: 0 minValue: 0
maxValue: 1 maxValue: 1
slideareaOffsetMultiplier: 0.9 slideareaOffsetMultiplier: 0.9
--- !u!114 &8463522706283787556
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5731468542189211806}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 4
--- !u!1 &5770108565631511295 --- !u!1 &5770108565631511295
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -5374,6 +5621,7 @@ RectTransform:
m_LocalScale: {x: 0.15, y: 0.15, z: 0.15} m_LocalScale: {x: 0.15, y: 0.15, z: 0.15}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 3664260978476899140}
- {fileID: 3355479367658290507} - {fileID: 3355479367658290507}
- {fileID: 4818343909123725175} - {fileID: 4818343909123725175}
m_Father: {fileID: 1774211016983706491} m_Father: {fileID: 1774211016983706491}
@@ -5429,13 +5677,14 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6798620428918177696} m_GameObject: {fileID: 6798620428918177696}
m_Enabled: 1 m_Enabled: 0
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 26a0dd79a025e5041a41f576b1aa4968, type: 3} m_Script: {fileID: 11500000, guid: 26a0dd79a025e5041a41f576b1aa4968, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
turnOffButton: {fileID: 3645818974320619446} turnOffButton: {fileID: 3645818974320619446}
turnOnButton: {fileID: 1311809556432207317} turnOnButton: {fileID: 1311809556432207317}
moveSpeedSlider: {fileID: 6956878155406096985}
locomotion: {fileID: 1565464911732960072} locomotion: {fileID: 1565464911732960072}
--- !u!1 &6976341305452677775 --- !u!1 &6976341305452677775
GameObject: GameObject:
@@ -5463,7 +5712,7 @@ RectTransform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6976341305452677775} m_GameObject: {fileID: 6976341305452677775}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1.0000267} m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@@ -5472,8 +5721,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -406.48022, y: 260} m_AnchoredPosition: {x: -446.3, y: 255.3}
m_SizeDelta: {x: 383.04, y: 50.5} m_SizeDelta: {x: 327.3, y: 50.5}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8334943640923905114 --- !u!222 &8334943640923905114
CanvasRenderer: CanvasRenderer:
@@ -5569,7 +5818,7 @@ MonoBehaviour:
m_VertexBufferAutoSizeReduction: 0 m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1 m_useMaxVisibleDescender: 1
m_pageToDisplay: 1 m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0} m_margin: {x: 0, y: 0, z: 0.9477234, w: 0}
m_isUsingLegacyAnimationComponent: 0 m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0 m_isVolumetricText: 0
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
@@ -5625,7 +5874,6 @@ GameObject:
- component: {fileID: 7392776148620295955} - component: {fileID: 7392776148620295955}
- component: {fileID: 623723497249906612} - component: {fileID: 623723497249906612}
- component: {fileID: 8524569723447833986} - component: {fileID: 8524569723447833986}
- component: {fileID: 2518031444015721236}
m_Layer: 5 m_Layer: 5
m_Name: Button m_Name: Button
m_TagString: Untagged m_TagString: Untagged
@@ -5752,19 +6000,6 @@ MonoBehaviour:
minValue: 0 minValue: 0
maxValue: 1 maxValue: 1
slideareaOffsetMultiplier: 0.9 slideareaOffsetMultiplier: 0.9
--- !u!114 &2518031444015721236
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7116268483853744053}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 3
--- !u!1 &7137625347935658456 --- !u!1 &7137625347935658456
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -6850,7 +7085,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -2404.8, y: 30} m_AnchoredPosition: {x: -2424, y: 30}
m_SizeDelta: {x: 186.1, y: 50.5} m_SizeDelta: {x: 186.1, y: 50.5}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6159749963066026057 --- !u!222 &6159749963066026057
@@ -6916,7 +7151,7 @@ MonoBehaviour:
m_fontSizeMin: 18 m_fontSizeMin: 18
m_fontSizeMax: 72 m_fontSizeMax: 72
m_fontStyle: 0 m_fontStyle: 0
m_HorizontalAlignment: 1 m_HorizontalAlignment: 4
m_VerticalAlignment: 512 m_VerticalAlignment: 512
m_textAlignment: 65535 m_textAlignment: 65535
m_characterSpacing: 0 m_characterSpacing: 0
@@ -6966,7 +7201,6 @@ GameObject:
- component: {fileID: 4806540607707404536} - component: {fileID: 4806540607707404536}
- component: {fileID: 1263225200033619485} - component: {fileID: 1263225200033619485}
- component: {fileID: 512852062931003448} - component: {fileID: 512852062931003448}
- component: {fileID: 5185990981600041478}
m_Layer: 5 m_Layer: 5
m_Name: Button m_Name: Button
m_TagString: Untagged m_TagString: Untagged
@@ -7093,19 +7327,6 @@ MonoBehaviour:
minValue: 0 minValue: 0
maxValue: 1 maxValue: 1
slideareaOffsetMultiplier: 0.9 slideareaOffsetMultiplier: 0.9
--- !u!114 &5185990981600041478
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7795711801980221647}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebe1ab889a9bed940995d4f47bc743ef, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 1
--- !u!1 &7941339244779152679 --- !u!1 &7941339244779152679
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -7851,7 +8072,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -3755, y: 30} m_AnchoredPosition: {x: -3897, y: 30}
m_SizeDelta: {x: 131.9, y: 50.5} m_SizeDelta: {x: 131.9, y: 50.5}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7891019527381773321 --- !u!222 &7891019527381773321

View File

@@ -0,0 +1,112 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
abstract public class AbstractSlider : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
{
public RectTransform sliderBackground; // Assign in Inspector
public float minValue = 0f;
public float maxValue = 1f;
public float slideareaOffsetMultiplier = 0.9f;
public float CurrentValue { get; private set; }
public float CurrentNormalizedValue { get; private set; }
private RectTransform handleRect;
private Vector2 backgroundStart;
private float backgroundWidth;
public System.Action<float, bool> OnValueChanged;
private void OnEnable()
{
if (null == handleRect)
{
handleRect = GetComponent<RectTransform>();
}
if (sliderBackground != null)
{
backgroundStart = sliderBackground.position;
backgroundWidth = sliderBackground.rect.width;
}
UpdateHandlePosition();
}
virtual public void OnBeginDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
virtual public void OnDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
virtual public void OnEndDrag(PointerEventData eventData)
{
UpdateSlider(eventData, true);
EventSystem.current.SetSelectedGameObject(null);
}
virtual public void SetHandleValue(float unnormalizedValue)
{
SetValuesFromValue(unnormalizedValue);
UpdateHandlePosition();
}
virtual public void SetHandleNormalizedValue(float normalizedValue)
{
SetValuesFromNormalizedValue(normalizedValue);
UpdateHandlePosition();
}
virtual protected void UpdateHandlePosition()
{
if (null == handleRect) return; // The options menu might not be opened yet
float halfWidth = sliderBackground.rect.width * 0.5f;
float limit = halfWidth * slideareaOffsetMultiplier;
float x = Mathf.Lerp(-limit, limit, CurrentNormalizedValue);
handleRect.localPosition = new Vector3(x, handleRect.localPosition.y, 0);
}
virtual protected void UpdateSlider(PointerEventData eventData, bool draggingEnded = false)
{
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(sliderBackground, eventData.position, eventData.pressEventCamera, out localPoint);
float halfWidth = sliderBackground.rect.width * 0.5f;
// Only allow dragging within 90% of the slider width, centered
float limit = halfWidth * slideareaOffsetMultiplier;
float clampedX = Mathf.Clamp(localPoint.x, -limit, limit);
Vector3 newPosition = new Vector3(clampedX, handleRect.localPosition.y, handleRect.localPosition.z);
handleRect.localPosition = newPosition;
// Normalize within the limited 90% range
float normalized = (clampedX + limit) / (limit * 2f);
SetValuesFromValue(Mathf.Lerp(minValue, maxValue, normalized));
OnValueChanged?.Invoke(CurrentValue, draggingEnded);
}
protected void SetValuesFromNormalizedValue(float normalizedValue)
{
CurrentNormalizedValue = normalizedValue;
CurrentValue = CurrentNormalizedValue * (maxValue - minValue) + minValue;
}
protected void SetValuesFromValue(float unnormalizedValue)
{
CurrentValue = unnormalizedValue;
CurrentNormalizedValue = (CurrentValue - minValue) / (maxValue - minValue);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8fe704cafb6cf2441a62a6497d58f229
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
abstract public class AbstractValueController : MonoBehaviour
{
abstract public void RestoreFromConfig();
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dfd6e172b2a79944788029ce9d4220dd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -4,87 +4,8 @@ using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
public class AudioSliderDragHandler : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler public class AudioSliderDragHandler : AbstractSlider, IBeginDragHandler, IDragHandler, IEndDragHandler
{ {
public RectTransform sliderBackground; // Assign in Inspector
public float minValue = 0f;
public float maxValue = 1f;
public float slideareaOffsetMultiplier = 0.9f;
public float CurrentValue { get; private set; }
private RectTransform handleRect;
private Vector2 backgroundStart;
private float backgroundWidth;
public System.Action<float> OnValueChanged;
void Awake()
{
handleRect = GetComponent<RectTransform>();
if (sliderBackground != null)
{
backgroundStart = sliderBackground.position;
backgroundWidth = sliderBackground.rect.width;
}
}
public void OnBeginDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
public void SetHandlePosition(float normalizedValue)
{
float halfWidth = sliderBackground.rect.width * 0.5f;
float limit = halfWidth * slideareaOffsetMultiplier;
float x = Mathf.Lerp(-limit, limit, normalizedValue);
handleRect.localPosition = new Vector3(x, handleRect.localPosition.y, 0);
CurrentValue = normalizedValue;
}
public void OnDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
public void OnEndDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
//notify FMOD
}
private void UpdateSlider(PointerEventData eventData)
{
//Debug.Log("UpDating Slider");
Vector2 localPoint;
RectTransformUtility.ScreenPointToLocalPointInRectangle(sliderBackground, eventData.position, eventData.pressEventCamera, out localPoint);
float halfWidth = sliderBackground.rect.width * 0.5f;
// Only allow dragging within 90% of the slider width, centered
float limit = halfWidth * slideareaOffsetMultiplier;
float clampedX = Mathf.Clamp(localPoint.x, -limit, limit);
Vector3 newPosition = new Vector3(clampedX, handleRect.localPosition.y, handleRect.localPosition.z);
handleRect.localPosition = newPosition;
// Normalize within the limited 90% range
float normalized = (clampedX + limit) / (limit * 2f);
//Debug.Log(normalized);
CurrentValue = Mathf.Lerp(minValue, maxValue, normalized);
//Debug.Log(warningThreshholdValue);
OnValueChanged?.Invoke(CurrentValue);
}
} }

View File

@@ -3,12 +3,14 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
//using UnityEngine.UIElements;
using UnityEngine.XR.Interaction.Toolkit; using UnityEngine.XR.Interaction.Toolkit;
public class ContinuoslocomotionConfigurator : MonoBehaviour public class ContinuoslocomotionConfigurator : AbstractValueController
{ {
public Button turnOffButton; public Button turnOffButton;
public Button turnOnButton; public Button turnOnButton;
public MoveSliderDragHandler moveSpeedSlider;
public ContinuousMoveProviderBase locomotion; public ContinuousMoveProviderBase locomotion;
// Events for listeners // Events for listeners
@@ -19,13 +21,28 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
{ {
turnOnButton.onClick.AddListener(enableLocomotion); turnOnButton.onClick.AddListener(enableLocomotion);
turnOffButton.onClick.AddListener(disableLocomotion); turnOffButton.onClick.AddListener(disableLocomotion);
turnOffButton.gameObject.SetActive(false);
RestoreFromConfig();
}
override public void RestoreFromConfig()
{
bool isContinuousLocomotion = ConfigManager.instance.GetIsContinuousLocomotion();
turnOffButton.gameObject.SetActive(isContinuousLocomotion);
turnOnButton.gameObject.SetActive(!isContinuousLocomotion);
locomotion.enabled = isContinuousLocomotion;
OnLocomotionToggled?.Invoke(isContinuousLocomotion);
float continuousLocomotionSpeed = ConfigManager.instance.GetContinuousLocomotionSpeed();
moveSpeedSlider.SetHandleValue(continuousLocomotionSpeed);
locomotion.moveSpeed = continuousLocomotionSpeed;
} }
public void UpdateSpeed(float speed) public void UpdateSpeed(float speed)
{ {
locomotion.moveSpeed = speed; locomotion.moveSpeed = speed;
OnSpeedChanged?.Invoke(speed); OnSpeedChanged?.Invoke(speed);
WriteToConfig();
} }
private void enableLocomotion() private void enableLocomotion()
@@ -35,6 +52,7 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
turnOnButton.gameObject.SetActive(false); turnOnButton.gameObject.SetActive(false);
turnOffButton.gameObject.SetActive(true); turnOffButton.gameObject.SetActive(true);
OnLocomotionToggled?.Invoke(true); OnLocomotionToggled?.Invoke(true);
WriteToConfig();
} }
private void disableLocomotion() private void disableLocomotion()
@@ -44,5 +62,12 @@ public class ContinuoslocomotionConfigurator : MonoBehaviour
turnOnButton.gameObject.SetActive(true); turnOnButton.gameObject.SetActive(true);
turnOffButton.gameObject.SetActive(false); turnOffButton.gameObject.SetActive(false);
OnLocomotionToggled?.Invoke(false); OnLocomotionToggled?.Invoke(false);
WriteToConfig();
}
protected void WriteToConfig()
{
ConfigManager.instance.SetIsContinuousLocomotion(locomotion.enabled);
ConfigManager.instance.SetContinuousLocomotionSpeed(locomotion.moveSpeed);
} }
} }

View File

@@ -3,82 +3,35 @@ using UnityEngine.UI;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using TMPro; using TMPro;
public class MoveSliderDragHandler : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler public class MoveSliderDragHandler : AbstractSlider, IDragHandler, IBeginDragHandler, IEndDragHandler
{ {
public RectTransform sliderBackground; // Assign in Inspector
public float minValue = 2f;
public float maxValue = 5f;
public float slideareaOffsetMultiplier = 0.9f;
public TMP_Text warningText; public TMP_Text warningText;
public float warningThreshholdValue = 0.65f; public float warningThreshholdValue = 0.65f;
public float CurrentValue { get; private set; }
public ContinuoslocomotionConfigurator configurator; public ContinuoslocomotionConfigurator configurator;
private RectTransform handleRect; override public void OnEndDrag(PointerEventData eventData)
private Vector2 backgroundStart;
private float backgroundWidth;
void Awake()
{ {
handleRect = GetComponent<RectTransform>(); base.OnEndDrag(eventData);
if (sliderBackground != null)
{
backgroundStart = sliderBackground.position;
backgroundWidth = sliderBackground.rect.width;
}
}
public void OnBeginDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
public void OnDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
}
public void OnEndDrag(PointerEventData eventData)
{
UpdateSlider(eventData);
configurator.UpdateSpeed(CurrentValue); configurator.UpdateSpeed(CurrentValue);
EventSystem.current.SetSelectedGameObject(null);
} }
private void UpdateSlider(PointerEventData eventData)
override protected void UpdateSlider(PointerEventData eventData, bool draggingEnded = false)
{ {
Debug.Log("UpDating Slider"); base.UpdateSlider(eventData, draggingEnded);
Vector2 localPoint; DisplayWarningTextIfNecessary();
RectTransformUtility.ScreenPointToLocalPointInRectangle(sliderBackground, eventData.position, eventData.pressEventCamera, out localPoint); }
float halfWidth = sliderBackground.rect.width * 0.5f; override protected void UpdateHandlePosition()
{
base.UpdateHandlePosition();
DisplayWarningTextIfNecessary();
// Only allow dragging within 90% of the slider width, centered }
float limit = halfWidth * slideareaOffsetMultiplier;
float clampedX = Mathf.Clamp(localPoint.x, -limit, limit);
Vector3 newPosition = new Vector3(clampedX, handleRect.localPosition.y, handleRect.localPosition.z);
handleRect.localPosition = newPosition;
// Normalize within the limited 90% range
float normalized = (clampedX + limit) / (limit * 2f);
//Debug.Log(normalized);
CurrentValue = Mathf.Lerp(minValue, maxValue, normalized);
// Displaying the warning.
protected void DisplayWarningTextIfNecessary()
{
if (CurrentValue > (warningThreshholdValue * (maxValue - minValue) + minValue)) warningText.gameObject.SetActive(true); if (CurrentValue > (warningThreshholdValue * (maxValue - minValue) + minValue)) warningText.gameObject.SetActive(true);
else warningText.gameObject.SetActive(false); else warningText.gameObject.SetActive(false);
//Debug.Log(warningThreshholdValue);
} }
} }

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class RegularButtonView : MonoBehaviour, IPointerEnterHandler, IPointerClickHandler
{
public void OnPointerEnter(PointerEventData eventData)
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Hover, this.gameObject);
}
public void OnPointerClick(PointerEventData eventData)
{
AudioManager.Instance.PlayAttachedInstance(FMODEvents.Instance.Click, this.gameObject);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c648a319c5c6aa47b3ef152a10657bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Burst;
using UnityEngine;
public class RestoreDefaultsController : MonoBehaviour
{
[SerializeField]
public List<AbstractValueController> valueControllers = new List<AbstractValueController>();
public void OnRestoreDefaults()
{
ConfigManager.instance.RestoreDefaultConfig();
foreach (AbstractValueController avc in valueControllers)
{
avc.RestoreFromConfig();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ebe1a3f8ef35a041a8ef39da672dd49
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
public class SliderToVCA : MonoBehaviour public class SliderToVCA : AbstractValueController
{ {
public enum VCATarget public enum VCATarget
{ {
@@ -13,36 +13,39 @@ public class SliderToVCA : MonoBehaviour
} }
public VCATarget target; public VCATarget target;
private AudioSliderDragHandler slider; public AudioSliderDragHandler slider;
private void Awake() private void Awake()
{ {
slider = GetComponent<AudioSliderDragHandler>();
slider.OnValueChanged += ApplyVolume; slider.OnValueChanged += ApplyVolume;
} }
private void Start() private void Start()
{ {
float initialValue = GetInitialValueFromAudioManager(); RestoreFromConfig();
slider.SetHandlePosition(initialValue); // we will add this function
} }
override public void RestoreFromConfig()
{
float initialValue = GetInitialValue();
slider.SetHandleValue(initialValue);
}
private float GetInitialValueFromAudioManager() private float GetInitialValue()
{ {
switch (target) switch (target)
{ {
case VCATarget.Master: case VCATarget.Master:
return AudioManager.Instance.MasterVolume; return ConfigManager.instance.GetVolumeMaster();
case VCATarget.Ambiences: case VCATarget.Ambiences:
return AudioManager.Instance.AmbienceVolume; return ConfigManager.instance.GetVolumeAmbient();
case VCATarget.Music: case VCATarget.Music:
return AudioManager.Instance.MusicVolume; return ConfigManager.instance.GetVolumeMusic();
case VCATarget.SFX: case VCATarget.SFX:
return AudioManager.Instance.SFXVolume; return ConfigManager.instance.GetVolumeSFX();
case VCATarget.UI: case VCATarget.UI:
return AudioManager.Instance.UIVolume; return ConfigManager.instance.GetVolumeUI();
case VCATarget.Voiceovers: case VCATarget.Voiceovers:
return AudioManager.Instance.VoiceoverVolume; return ConfigManager.instance.GetVolumeVO();
default: default:
return 0.5f; return 0.5f;
} }
@@ -51,38 +54,44 @@ private float GetInitialValueFromAudioManager()
private void Update() private void Update()
{ {
// Constantly push slider value to the VCA // Constantly push slider value to the VCA
ApplyVolume(slider.CurrentValue); ApplyVolume(slider.CurrentValue, false);
//Debug.Log("CurrentValue: " + slider.CurrentValue); //Debug.Log("CurrentValue: " + slider.CurrentValue);
} }
private void ApplyVolume(float value) private void ApplyVolume(float value, bool isLastChange)
{ {
switch (target) switch (target)
{ {
case VCATarget.Master: case VCATarget.Master:
AudioManager.Instance.SetMasterVCA(value); AudioManager.Instance.SetMasterVCA(value);
//Debug.LogError(value); if (isLastChange) ConfigManager.instance.SetVolumeMaster(value);
break; break;
case VCATarget.Ambiences: case VCATarget.Ambiences:
AudioManager.Instance.SetAmbientVCA(value); AudioManager.Instance.SetAmbientVCA(value);
if (isLastChange) ConfigManager.instance.SetVolumeAmbient(value);
break; break;
case VCATarget.Music: case VCATarget.Music:
AudioManager.Instance.SetMusicVCA(value); AudioManager.Instance.SetMusicVCA(value);
if (isLastChange) ConfigManager.instance.SetVolumeMusic(value);
break; break;
case VCATarget.SFX: case VCATarget.SFX:
AudioManager.Instance.SetSFXVCA(value); AudioManager.Instance.SetSFXVCA(value);
if (isLastChange) ConfigManager.instance.SetVolumeSFX(value);
break; break;
case VCATarget.UI: case VCATarget.UI:
AudioManager.Instance.SetUIVCA(value); AudioManager.Instance.SetUIVCA(value);
if (isLastChange) ConfigManager.instance.SetVolumeUI(value);
break; break;
case VCATarget.Voiceovers: case VCATarget.Voiceovers:
AudioManager.Instance.SetVoiceoverVCA(value); AudioManager.Instance.SetVoiceoverVCA(value);
if (isLastChange) ConfigManager.instance.SetVolumeVO(value);
break; break;
} }
} }
} }

View File

@@ -2,8 +2,6 @@ using FishNet.Component.Spawning;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using Valve.Newtonsoft.Json.Converters;
using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
public class CustomNetworkManager : MonoBehaviour public class CustomNetworkManager : MonoBehaviour
{ {

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 963bbf549b806584b8b059c31e469ac5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,46 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &8320216767994874586
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7021351325020055800}
- component: {fileID: 4493448285314379156}
m_Layer: 0
m_Name: ConfigManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7021351325020055800
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8320216767994874586}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -74.23521, y: 4.9800367, z: -13.716739}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 38
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4493448285314379156
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8320216767994874586}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c7622588c230b4b448152a6dfd6c0588, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5d19b02089b931a469209b09142786a0
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7db8366967e9da242adbfd3af7e17fcd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,179 @@
using System.IO;
using UnityEngine;
public class ConfigManager : MonoBehaviour
{
public static ConfigManager instance = null;
[System.Serializable]
public class Config
{
public bool isContinuousLocomotion = false;
public float continuousLocomotionSpeed = 3.0f;
public float volumeMaster = 0.5f;
public float volumeAmbient = 0.5f;
public float volumeMusic = 0.5f;
public float volumeSFX = 0.5f;
public float volumeUI = 0.5f;
public float volumeVO = 0.5f;
}
protected Config currentConfig = new Config();
protected string configFileName = "config.json";
protected string configFilePath;
void Awake()
{
if (!instance) { instance = this; }
else if (instance != this) { Destroy(gameObject); }
DontDestroyOnLoad(gameObject);
}
private void Start()
{
configFilePath = Directory.GetCurrentDirectory() + "\\" + configFileName;
Debug.Log(configFilePath);
currentConfig = LoadConfigFromFile();
}
public Config GetConfig()
{
return currentConfig;
}
protected void SaveConfigToFile()
{
FileStream fileStream;
if (!File.Exists(configFilePath))
{
fileStream = File.Create(configFilePath);
fileStream.Close();
}
string json = JsonUtility.ToJson(currentConfig, true);
File.WriteAllText(configFilePath, json);
}
protected Config LoadConfigFromFile()
{
if (!File.Exists(configFilePath))
{
CreateDefaultConfigFile(); // File did not exist, try to create an empty file
if (!File.Exists(configFilePath))
{
Debug.LogError("Config file was not found and could not be created: " + configFilePath);
return currentConfig;
}
}
Config config = JsonUtility.FromJson<Config>(File.ReadAllText(configFilePath));
return config;
}
protected void CreateDefaultConfigFile()
{
currentConfig = new Config();
SaveConfigToFile();
}
public void RestoreDefaultConfig()
{
currentConfig = new Config();
SaveConfigToFile();
}
// Getters and Setters
public bool GetIsContinuousLocomotion()
{
return currentConfig.isContinuousLocomotion;
}
public void SetIsContinuousLocomotion(bool isContinuousLocomotion)
{
currentConfig.isContinuousLocomotion = isContinuousLocomotion;
SaveConfigToFile();
}
public float GetContinuousLocomotionSpeed()
{
return currentConfig.continuousLocomotionSpeed;
}
public void SetContinuousLocomotionSpeed(float continuousLocomotionSpeed)
{
currentConfig.continuousLocomotionSpeed = continuousLocomotionSpeed;
SaveConfigToFile();
}
public float GetVolumeMaster()
{
return currentConfig.volumeMaster;
}
public void SetVolumeMaster(float masterVolume)
{
currentConfig.volumeMaster = masterVolume;
SaveConfigToFile();
}
public float GetVolumeAmbient()
{
return currentConfig.volumeAmbient;
}
public void SetVolumeAmbient(float ambientVolume)
{
currentConfig.volumeAmbient = ambientVolume;
SaveConfigToFile();
}
public float GetVolumeMusic()
{
return currentConfig.volumeMusic;
}
public void SetVolumeMusic(float musicVolume)
{
currentConfig.volumeMusic = musicVolume;
SaveConfigToFile();
}
public float GetVolumeSFX()
{
return currentConfig.volumeSFX;
}
public void SetVolumeSFX(float sfxVolume)
{
currentConfig.volumeSFX = sfxVolume;
SaveConfigToFile();
}
public float GetVolumeUI()
{
return currentConfig.volumeUI;
}
public void SetVolumeUI(float uiVolume)
{
currentConfig.volumeUI = uiVolume;
SaveConfigToFile();
}
public float GetVolumeVO()
{
return currentConfig.volumeVO;
}
public void SetVolumeVO(float voVolume)
{
currentConfig.volumeVO = voVolume;
SaveConfigToFile();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7622588c230b4b448152a6dfd6c0588
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@@ -66,7 +66,7 @@ Technical sound design.
**Raimond Tunnel**<br/> **Raimond Tunnel**<br/>
Project management, visual design. Project management, visual design.
Developed in the [Computer Graphcis and Virtual Reality Study Lab](https://cgvr.cs.ut.ee/) of the [Institute of Computer Science, University of Tartu](https://cs.ut.ee). Developed in the [Computer Graphics and Virtual Reality Study Lab](https://cgvr.cs.ut.ee/) of the [Institute of Computer Science, University of Tartu](https://cs.ut.ee).
### Used Attributions ### Used Attributions