From 268608a4596c4dc2cfb752f155171b87b34d640d Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 25 Jul 2023 18:47:45 +1000 Subject: [PATCH] menu --- Assets/Materials/00007--263407052.mat | 133 ++ Assets/Materials/00007--263407052.mat.meta | 8 + Assets/Materials/00025-3390040379.mat | 133 ++ Assets/Materials/00025-3390040379.mat.meta | 8 + ...putactions => SpaceRaceInput.inputactions} | 43 +- ....meta => SpaceRaceInput.inputactions.meta} | 0 .../sr_silverstorage/SilverStorage.unity | 199 ++- Assets/Src/ShipControls.cs | 21 +- Assets/Src/ShipInput.cs | 180 +- Assets/Src/Timing.cs | 13 +- Assets/Src/UI.meta | 8 + Assets/Src/{ => UI}/DebugLogPanel.cs | 0 Assets/Src/{ => UI}/DebugLogPanel.cs.meta | 0 Assets/Src/{ => UI}/LapTimeEntry.uxml | 0 Assets/Src/{ => UI}/LapTimeEntry.uxml.meta | 0 Assets/Src/UI/MenuControls.cs | 61 + Assets/Src/UI/MenuControls.cs.meta | 11 + Assets/Src/UI/MenuInput.cs | 284 ++++ Assets/Src/UI/MenuInput.cs.meta | 11 + Assets/Src/{ => UI}/RadialProgress.uss | 0 Assets/Src/{ => UI}/RadialProgress.uss.meta | 0 Assets/Src/{ => UI}/ShipUi.cs | 0 Assets/Src/{ => UI}/ShipUi.cs.meta | 0 Assets/Src/{ => UI}/ShipUi.uss | 6 +- Assets/Src/{ => UI}/ShipUi.uss.meta | 0 Assets/UI Toolkit/Menu.uxml | 23 + Assets/UI Toolkit/Menu.uxml.meta | 10 + Assets/UI Toolkit/PanelSettings.asset | 2 +- ProjectSettings/EditorBuildSettings.asset | 0 TODO.md | 12 +- UIElementsSchema/GlobalNamespace.xsd | 48 + UIElementsSchema/SpaceRaceUi.xsd | 26 + UIElementsSchema/UIElements.xsd | 18 + UIElementsSchema/Unity.Profiling.Editor.xsd | 123 ++ UIElementsSchema/Unity.UI.Builder.xsd | 975 +++++++++++ .../UnityEditor.Experimental.GraphView.xsd | 66 + UIElementsSchema/UnityEditor.Overlays.xsd | 50 + ...UnityEditor.PackageManager.UI.Internal.xsd | 554 +++++++ .../UnityEditor.Rendering.LookDev.xsd | 48 + UIElementsSchema/UnityEditor.Search.xsd | 28 + .../UnityEditor.ShaderGraph.Drawing.xsd | 51 + .../UnityEditor.ShortcutManagement.xsd | 46 + .../UnityEditor.UIElements.Debugger.xsd | 25 + UIElementsSchema/UnityEditor.UIElements.xsd | 563 +++++++ UIElementsSchema/UnityEditor.VFX.UI.xsd | 130 ++ UIElementsSchema/UnityEngine.UIElements.xsd | 1455 +++++++++++++++++ 46 files changed, 5298 insertions(+), 74 deletions(-) create mode 100644 Assets/Materials/00007--263407052.mat create mode 100644 Assets/Materials/00007--263407052.mat.meta create mode 100644 Assets/Materials/00025-3390040379.mat create mode 100644 Assets/Materials/00025-3390040379.mat.meta rename Assets/Resources/{ShipInput.inputactions => SpaceRaceInput.inputactions} (89%) rename Assets/Resources/{ShipInput.inputactions.meta => SpaceRaceInput.inputactions.meta} (100%) create mode 100644 Assets/Src/UI.meta rename Assets/Src/{ => UI}/DebugLogPanel.cs (100%) rename Assets/Src/{ => UI}/DebugLogPanel.cs.meta (100%) rename Assets/Src/{ => UI}/LapTimeEntry.uxml (100%) rename Assets/Src/{ => UI}/LapTimeEntry.uxml.meta (100%) create mode 100644 Assets/Src/UI/MenuControls.cs create mode 100644 Assets/Src/UI/MenuControls.cs.meta create mode 100644 Assets/Src/UI/MenuInput.cs create mode 100644 Assets/Src/UI/MenuInput.cs.meta rename Assets/Src/{ => UI}/RadialProgress.uss (100%) rename Assets/Src/{ => UI}/RadialProgress.uss.meta (100%) rename Assets/Src/{ => UI}/ShipUi.cs (100%) rename Assets/Src/{ => UI}/ShipUi.cs.meta (100%) rename Assets/Src/{ => UI}/ShipUi.uss (92%) rename Assets/Src/{ => UI}/ShipUi.uss.meta (100%) create mode 100644 Assets/UI Toolkit/Menu.uxml create mode 100644 Assets/UI Toolkit/Menu.uxml.meta mode change 100755 => 100644 ProjectSettings/EditorBuildSettings.asset create mode 100644 UIElementsSchema/GlobalNamespace.xsd create mode 100644 UIElementsSchema/SpaceRaceUi.xsd create mode 100644 UIElementsSchema/UIElements.xsd create mode 100644 UIElementsSchema/Unity.Profiling.Editor.xsd create mode 100644 UIElementsSchema/Unity.UI.Builder.xsd create mode 100644 UIElementsSchema/UnityEditor.Experimental.GraphView.xsd create mode 100644 UIElementsSchema/UnityEditor.Overlays.xsd create mode 100644 UIElementsSchema/UnityEditor.PackageManager.UI.Internal.xsd create mode 100644 UIElementsSchema/UnityEditor.Rendering.LookDev.xsd create mode 100644 UIElementsSchema/UnityEditor.Search.xsd create mode 100644 UIElementsSchema/UnityEditor.ShaderGraph.Drawing.xsd create mode 100644 UIElementsSchema/UnityEditor.ShortcutManagement.xsd create mode 100644 UIElementsSchema/UnityEditor.UIElements.Debugger.xsd create mode 100644 UIElementsSchema/UnityEditor.UIElements.xsd create mode 100644 UIElementsSchema/UnityEditor.VFX.UI.xsd create mode 100644 UIElementsSchema/UnityEngine.UIElements.xsd diff --git a/Assets/Materials/00007--263407052.mat b/Assets/Materials/00007--263407052.mat new file mode 100644 index 0000000..0c42ec8 --- /dev/null +++ b/Assets/Materials/00007--263407052.mat @@ -0,0 +1,133 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-9054159900995077648 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: 00007--263407052 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: bea628a9753f0f04983c95e4a979d0ed, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: bea628a9753f0f04983c95e4a979d0ed, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/00007--263407052.mat.meta b/Assets/Materials/00007--263407052.mat.meta new file mode 100644 index 0000000..0da78a4 --- /dev/null +++ b/Assets/Materials/00007--263407052.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 552c9652fdec3a6d980bb03db4706ea5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/00025-3390040379.mat b/Assets/Materials/00025-3390040379.mat new file mode 100644 index 0000000..18eb406 --- /dev/null +++ b/Assets/Materials/00025-3390040379.mat @@ -0,0 +1,133 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1371991816016477643 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 7 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: 00025-3390040379 + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 2800000, guid: d0a0bee744a166c05b51060da308e61a, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 2800000, guid: d0a0bee744a166c05b51060da308e61a, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Materials/00025-3390040379.mat.meta b/Assets/Materials/00025-3390040379.mat.meta new file mode 100644 index 0000000..8f9a5f3 --- /dev/null +++ b/Assets/Materials/00025-3390040379.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5c6ae25f73498fb4db2e36a46d2c620f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/ShipInput.inputactions b/Assets/Resources/SpaceRaceInput.inputactions similarity index 89% rename from Assets/Resources/ShipInput.inputactions rename to Assets/Resources/SpaceRaceInput.inputactions index b5f0df1..30adbf9 100755 --- a/Assets/Resources/ShipInput.inputactions +++ b/Assets/Resources/SpaceRaceInput.inputactions @@ -1,8 +1,8 @@ { - "name": "ShipInput", + "name": "SpaceRaceInput", "maps": [ { - "name": "movement", + "name": "ship", "id": "f52df5ad-4b20-4a0e-a4c8-bbf76c26b2c5", "actions": [ { @@ -315,6 +315,45 @@ "isPartOfComposite": false } ] + }, + { + "name": "menu", + "id": "88ca6226-1e9b-4abe-b02e-7b1304ef28ae", + "actions": [ + { + "name": "ToggleMenu", + "type": "Button", + "id": "cee6d41d-d488-4548-b2d6-11e16bb6b116", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "264c9b3e-9257-4ea7-ad15-c2469ae762f2", + "path": "/start", + "interactions": "", + "processors": "", + "groups": "", + "action": "ToggleMenu", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "1a12ee48-3233-43b7-88a3-175016b24098", + "path": "/escape", + "interactions": "", + "processors": "", + "groups": "", + "action": "ToggleMenu", + "isComposite": false, + "isPartOfComposite": false + } + ] } ], "controlSchemes": [] diff --git a/Assets/Resources/ShipInput.inputactions.meta b/Assets/Resources/SpaceRaceInput.inputactions.meta similarity index 100% rename from Assets/Resources/ShipInput.inputactions.meta rename to Assets/Resources/SpaceRaceInput.inputactions.meta diff --git a/Assets/Scenes/sr_silverstorage/SilverStorage.unity b/Assets/Scenes/sr_silverstorage/SilverStorage.unity index 60238ef..1dffb0c 100644 --- a/Assets/Scenes/sr_silverstorage/SilverStorage.unity +++ b/Assets/Scenes/sr_silverstorage/SilverStorage.unity @@ -172,6 +172,54 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &114959033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 114959034} + - component: {fileID: 114959035} + m_Layer: 0 + m_Name: MenuDoc + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 2147483647 + m_IsActive: 1 +--- !u!4 &114959034 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114959033} + 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: 1914996160} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114959035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114959033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_PanelSettings: {fileID: 11400000, guid: dab173ab15446054bb709b9a7ab085b6, type: 2} + m_ParentUI: {fileID: 0} + sourceAsset: {fileID: 9197481963319205126, guid: 59e6af4d391d177a8910e7a8ab6e05e6, type: 3} + m_SortingOrder: 0 --- !u!1001 &339815783 PrefabInstance: m_ObjectHideFlags: 0 @@ -264,10 +312,18 @@ PrefabInstance: propertyPath: m_Name value: Sector N (5) objectReference: {fileID: 0} + - target: {fileID: 6055114146370815326, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -401,7 +457,7 @@ Camera: width: 1 height: 1 near clip plane: 0.3 - far clip plane: 1000 + far clip plane: 2000 field of view: 60 orthographic: 0 orthographic size: 5 @@ -550,6 +606,22 @@ PrefabInstance: propertyPath: m_Name value: Timing objectReference: {fileID: 0} + - target: {fileID: 2603084029878042569, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} + - target: {fileID: 2884870557220750692, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} + propertyPath: m_Name + value: TimingDoc + objectReference: {fileID: 0} + - target: {fileID: 2884870557220750692, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2884870557220750692, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 4743817676494260426, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} propertyPath: m_RootOrder value: -1 @@ -639,7 +711,7 @@ GameObject: m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 + m_StaticEditorFlags: 2147483647 m_IsActive: 1 --- !u!4 &965851724 Transform: @@ -677,6 +749,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 965851724} m_Modifications: + - target: {fileID: -8873558038744925118, guid: 474d908ae00ea2447883cf399db91645, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: -8708185297467244275, guid: 474d908ae00ea2447883cf399db91645, type: 3} propertyPath: m_IsActive value: 0 @@ -745,6 +821,10 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: -3756473180518285571, guid: 474d908ae00ea2447883cf399db91645, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: -1823322365421230674, guid: 474d908ae00ea2447883cf399db91645, type: 3} propertyPath: m_Materials.Array.data[0] value: @@ -753,10 +833,18 @@ PrefabInstance: propertyPath: m_Name value: silverstorage objectReference: {fileID: 0} + - target: {fileID: 919132149155446097, guid: 474d908ae00ea2447883cf399db91645, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 3592631056726975269, guid: 474d908ae00ea2447883cf399db91645, type: 3} propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 3592631056726975269, guid: 474d908ae00ea2447883cf399db91645, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 5558786085232576308, guid: 474d908ae00ea2447883cf399db91645, type: 3} propertyPath: m_Materials.Array.data[0] value: @@ -765,6 +853,10 @@ PrefabInstance: propertyPath: m_IsActive value: 0 objectReference: {fileID: 0} + - target: {fileID: 5610006482927226887, guid: 474d908ae00ea2447883cf399db91645, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -893,10 +985,18 @@ PrefabInstance: propertyPath: m_Name value: Sector N (6) objectReference: {fileID: 0} + - target: {fileID: 6055114146370815326, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -907,6 +1007,17 @@ Transform: m_CorrespondingSourceObject: {fileID: 273700024047119412, guid: 87a51212e10250274a8feda6be865b7c, type: 3} m_PrefabInstance: {fileID: 1650371476} m_PrefabAsset: {fileID: 0} +--- !u!114 &1705992920 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 957429026670911964, guid: dcb64e3a91f1fec7ab6098f4f407830b, type: 3} + m_PrefabInstance: {fileID: 766862834} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1906469784 GameObject: m_ObjectHideFlags: 0 @@ -939,6 +1050,54 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1914996159 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1914996160} + - component: {fileID: 1914996162} + m_Layer: 0 + m_Name: Menu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 2147483647 + m_IsActive: 1 +--- !u!4 &1914996160 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1914996159} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 114959034} + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1914996162 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1914996159} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b7da082ca2a8e6ee9a5b1151245f535f, type: 3} + m_Name: + m_EditorClassIdentifier: + menuDoc: {fileID: 114959035} + timingDoc: {fileID: 1705992920} + shipControls: {fileID: 1972710421} --- !u!1 &1972710416 GameObject: m_ObjectHideFlags: 0 @@ -955,6 +1114,7 @@ GameObject: - component: {fileID: 1972710421} - component: {fileID: 1972710424} - component: {fileID: 1972710425} + - component: {fileID: 1972710426} m_Layer: 10 m_Name: Ship m_TagString: Untagged @@ -1003,7 +1163,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: a1ae10f4d23cf6121935ac77eb61ab79, type: 2} + - {fileID: 2100000, guid: 5c6ae25f73498fb4db2e36a46d2c620f, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -1040,7 +1200,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1972710416} - m_LocalRotation: {x: 0, y: 0.88700384, z: 0, w: 0.46176213} + m_LocalRotation: {x: 0, y: 0.88294756, z: 0, w: 0.46947163} m_LocalPosition: {x: -838.9999, y: 0, z: 945.99976} m_LocalScale: {x: 2.45, y: 2.45, z: 2.45} m_ConstrainProportionsScale: 0 @@ -1049,7 +1209,7 @@ Transform: - {fileID: 666695209} m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 113.716, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 124, z: 0} --- !u!114 &1972710421 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1140,9 +1300,13 @@ MonoBehaviour: m_Calls: [] m_ActionId: cea65125-c42e-40e9-bc97-966522e16691 m_ActionName: movement/quit[/Keyboard/f10] + - m_PersistentCalls: + m_Calls: [] + m_ActionId: cee6d41d-d488-4548-b2d6-11e16bb6b116 + m_ActionName: menu/New action[/Gamepad/start,/Keyboard/escape] m_NeverAutoSwitchControlSchemes: 0 m_DefaultControlScheme: - m_DefaultActionMap: movement + m_DefaultActionMap: ship m_SplitScreenIndex: -1 m_Camera: {fileID: 0} --- !u!114 &1972710425 @@ -1157,6 +1321,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 0cee35157fdc2b133bf69416f2db2ac3, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!114 &1972710426 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1972710416} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 --- !u!1 &2129212232 GameObject: m_ObjectHideFlags: 0 @@ -1395,10 +1574,18 @@ PrefabInstance: propertyPath: m_Name value: Sector N (4) objectReference: {fileID: 0} + - target: {fileID: 6055114146370815326, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 7552537107678286293, guid: 87a51212e10250274a8feda6be865b7c, type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} - target: {fileID: 8222871353402791901, guid: 87a51212e10250274a8feda6be865b7c, type: 3} propertyPath: m_LocalPosition.z value: 0 diff --git a/Assets/Src/ShipControls.cs b/Assets/Src/ShipControls.cs index 2d5ae7c..7ba8e86 100755 --- a/Assets/Src/ShipControls.cs +++ b/Assets/Src/ShipControls.cs @@ -1,11 +1,11 @@ using UnityEngine; using UnityEngine.InputSystem; -public class ShipControls : MonoBehaviour, ShipInput.IMovementActions { +public class ShipControls : MonoBehaviour, SpaceRaceInput.IShipActions { public Camera aim; public Timing timing; - ShipInput shipInput; + SpaceRaceInput input; InputAction lookAction; InputAction accelerateAction; InputAction decelerateAction; @@ -39,7 +39,7 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions { rigidBody.freezeRotation = true; initialPosition = rigidBody.transform.position; - initialAim = aim.transform.rotation; + initialAim = rigidBody.transform.rotation; initialForce = Vector3.forward; thrust = Vector3.zero; @@ -54,15 +54,15 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions { camYaw = initialAim.eulerAngles.y; forceMode = ForceMode.Acceleration; - if (shipInput == null) { - shipInput = new ShipInput(); - shipInput.movement.SetCallbacks(this); + if (input == null) { + input = new SpaceRaceInput(); + input.ship.SetCallbacks(this); } - shipInput.movement.Enable(); + input.ship.Enable(); - lookAction = shipInput.FindAction("look"); - accelerateAction = shipInput.FindAction("accelerate"); - decelerateAction = shipInput.FindAction("decelerate"); + lookAction = input.FindAction("look"); + accelerateAction = input.FindAction("accelerate"); + decelerateAction = input.FindAction("decelerate"); } void Update() { @@ -158,6 +158,7 @@ public class ShipControls : MonoBehaviour, ShipInput.IMovementActions { rigidBody.transform.forward = initialForce; rigidBody.velocity = new Vector3(0f, 0f, 0f); rigidBody.angularVelocity = new Vector3(0f, 0f, 0f); + rigidBody.transform.rotation = initialAim; aim.transform.rotation = initialAim; camPitch = initialAim.eulerAngles.x; diff --git a/Assets/Src/ShipInput.cs b/Assets/Src/ShipInput.cs index c6c1131..20a9cb2 100755 --- a/Assets/Src/ShipInput.cs +++ b/Assets/Src/ShipInput.cs @@ -2,7 +2,7 @@ // // This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator // version 1.6.1 -// from Assets/Resources/ShipInput.inputactions +// from Assets/Resources/SpaceRaceInput.inputactions // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,16 +15,16 @@ using System.Collections.Generic; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Utilities; -public partial class @ShipInput: IInputActionCollection2, IDisposable +public partial class @SpaceRaceInput: IInputActionCollection2, IDisposable { public InputActionAsset asset { get; } - public @ShipInput() + public @SpaceRaceInput() { asset = InputActionAsset.FromJson(@"{ - ""name"": ""ShipInput"", + ""name"": ""SpaceRaceInput"", ""maps"": [ { - ""name"": ""movement"", + ""name"": ""ship"", ""id"": ""f52df5ad-4b20-4a0e-a4c8-bbf76c26b2c5"", ""actions"": [ { @@ -337,18 +337,60 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable ""isPartOfComposite"": false } ] + }, + { + ""name"": ""menu"", + ""id"": ""88ca6226-1e9b-4abe-b02e-7b1304ef28ae"", + ""actions"": [ + { + ""name"": ""ToggleMenu"", + ""type"": ""Button"", + ""id"": ""cee6d41d-d488-4548-b2d6-11e16bb6b116"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""264c9b3e-9257-4ea7-ad15-c2469ae762f2"", + ""path"": ""/start"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""ToggleMenu"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""1a12ee48-3233-43b7-88a3-175016b24098"", + ""path"": ""/escape"", + ""interactions"": """", + ""processors"": """", + ""groups"": """", + ""action"": ""ToggleMenu"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] } ], ""controlSchemes"": [] }"); - // movement - m_movement = asset.FindActionMap("movement", throwIfNotFound: true); - m_movement_accelerate = m_movement.FindAction("accelerate", throwIfNotFound: true); - m_movement_decelerate = m_movement.FindAction("decelerate", throwIfNotFound: true); - m_movement_strafe = m_movement.FindAction("strafe", throwIfNotFound: true); - m_movement_look = m_movement.FindAction("look", throwIfNotFound: true); - m_movement_respawn = m_movement.FindAction("respawn", throwIfNotFound: true); - m_movement_quit = m_movement.FindAction("quit", throwIfNotFound: true); + // ship + m_ship = asset.FindActionMap("ship", throwIfNotFound: true); + m_ship_accelerate = m_ship.FindAction("accelerate", throwIfNotFound: true); + m_ship_decelerate = m_ship.FindAction("decelerate", throwIfNotFound: true); + m_ship_strafe = m_ship.FindAction("strafe", throwIfNotFound: true); + m_ship_look = m_ship.FindAction("look", throwIfNotFound: true); + m_ship_respawn = m_ship.FindAction("respawn", throwIfNotFound: true); + m_ship_quit = m_ship.FindAction("quit", throwIfNotFound: true); + // menu + m_menu = asset.FindActionMap("menu", throwIfNotFound: true); + m_menu_ToggleMenu = m_menu.FindAction("ToggleMenu", throwIfNotFound: true); } public void Dispose() @@ -407,34 +449,34 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable return asset.FindBinding(bindingMask, out action); } - // movement - private readonly InputActionMap m_movement; - private List m_MovementActionsCallbackInterfaces = new List(); - private readonly InputAction m_movement_accelerate; - private readonly InputAction m_movement_decelerate; - private readonly InputAction m_movement_strafe; - private readonly InputAction m_movement_look; - private readonly InputAction m_movement_respawn; - private readonly InputAction m_movement_quit; - public struct MovementActions + // ship + private readonly InputActionMap m_ship; + private List m_ShipActionsCallbackInterfaces = new List(); + private readonly InputAction m_ship_accelerate; + private readonly InputAction m_ship_decelerate; + private readonly InputAction m_ship_strafe; + private readonly InputAction m_ship_look; + private readonly InputAction m_ship_respawn; + private readonly InputAction m_ship_quit; + public struct ShipActions { - private @ShipInput m_Wrapper; - public MovementActions(@ShipInput wrapper) { m_Wrapper = wrapper; } - public InputAction @accelerate => m_Wrapper.m_movement_accelerate; - public InputAction @decelerate => m_Wrapper.m_movement_decelerate; - public InputAction @strafe => m_Wrapper.m_movement_strafe; - public InputAction @look => m_Wrapper.m_movement_look; - public InputAction @respawn => m_Wrapper.m_movement_respawn; - public InputAction @quit => m_Wrapper.m_movement_quit; - public InputActionMap Get() { return m_Wrapper.m_movement; } + private @SpaceRaceInput m_Wrapper; + public ShipActions(@SpaceRaceInput wrapper) { m_Wrapper = wrapper; } + public InputAction @accelerate => m_Wrapper.m_ship_accelerate; + public InputAction @decelerate => m_Wrapper.m_ship_decelerate; + public InputAction @strafe => m_Wrapper.m_ship_strafe; + public InputAction @look => m_Wrapper.m_ship_look; + public InputAction @respawn => m_Wrapper.m_ship_respawn; + public InputAction @quit => m_Wrapper.m_ship_quit; + public InputActionMap Get() { return m_Wrapper.m_ship; } public void Enable() { Get().Enable(); } public void Disable() { Get().Disable(); } public bool enabled => Get().enabled; - public static implicit operator InputActionMap(MovementActions set) { return set.Get(); } - public void AddCallbacks(IMovementActions instance) + public static implicit operator InputActionMap(ShipActions set) { return set.Get(); } + public void AddCallbacks(IShipActions instance) { - if (instance == null || m_Wrapper.m_MovementActionsCallbackInterfaces.Contains(instance)) return; - m_Wrapper.m_MovementActionsCallbackInterfaces.Add(instance); + if (instance == null || m_Wrapper.m_ShipActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_ShipActionsCallbackInterfaces.Add(instance); @accelerate.started += instance.OnAccelerate; @accelerate.performed += instance.OnAccelerate; @accelerate.canceled += instance.OnAccelerate; @@ -455,7 +497,7 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable @quit.canceled += instance.OnQuit; } - private void UnregisterCallbacks(IMovementActions instance) + private void UnregisterCallbacks(IShipActions instance) { @accelerate.started -= instance.OnAccelerate; @accelerate.performed -= instance.OnAccelerate; @@ -477,22 +519,68 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable @quit.canceled -= instance.OnQuit; } - public void RemoveCallbacks(IMovementActions instance) + public void RemoveCallbacks(IShipActions instance) { - if (m_Wrapper.m_MovementActionsCallbackInterfaces.Remove(instance)) + if (m_Wrapper.m_ShipActionsCallbackInterfaces.Remove(instance)) UnregisterCallbacks(instance); } - public void SetCallbacks(IMovementActions instance) + public void SetCallbacks(IShipActions instance) { - foreach (var item in m_Wrapper.m_MovementActionsCallbackInterfaces) + foreach (var item in m_Wrapper.m_ShipActionsCallbackInterfaces) UnregisterCallbacks(item); - m_Wrapper.m_MovementActionsCallbackInterfaces.Clear(); + m_Wrapper.m_ShipActionsCallbackInterfaces.Clear(); AddCallbacks(instance); } } - public MovementActions @movement => new MovementActions(this); - public interface IMovementActions + public ShipActions @ship => new ShipActions(this); + + // menu + private readonly InputActionMap m_menu; + private List m_MenuActionsCallbackInterfaces = new List(); + private readonly InputAction m_menu_ToggleMenu; + public struct MenuActions + { + private @SpaceRaceInput m_Wrapper; + public MenuActions(@SpaceRaceInput wrapper) { m_Wrapper = wrapper; } + public InputAction @ToggleMenu => m_Wrapper.m_menu_ToggleMenu; + public InputActionMap Get() { return m_Wrapper.m_menu; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(MenuActions set) { return set.Get(); } + public void AddCallbacks(IMenuActions instance) + { + if (instance == null || m_Wrapper.m_MenuActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_MenuActionsCallbackInterfaces.Add(instance); + @ToggleMenu.started += instance.OnToggleMenu; + @ToggleMenu.performed += instance.OnToggleMenu; + @ToggleMenu.canceled += instance.OnToggleMenu; + } + + private void UnregisterCallbacks(IMenuActions instance) + { + @ToggleMenu.started -= instance.OnToggleMenu; + @ToggleMenu.performed -= instance.OnToggleMenu; + @ToggleMenu.canceled -= instance.OnToggleMenu; + } + + public void RemoveCallbacks(IMenuActions instance) + { + if (m_Wrapper.m_MenuActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IMenuActions instance) + { + foreach (var item in m_Wrapper.m_MenuActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_MenuActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public MenuActions @menu => new MenuActions(this); + public interface IShipActions { void OnAccelerate(InputAction.CallbackContext context); void OnDecelerate(InputAction.CallbackContext context); @@ -501,4 +589,8 @@ public partial class @ShipInput: IInputActionCollection2, IDisposable void OnRespawn(InputAction.CallbackContext context); void OnQuit(InputAction.CallbackContext context); } + public interface IMenuActions + { + void OnToggleMenu(InputAction.CallbackContext context); + } } diff --git a/Assets/Src/Timing.cs b/Assets/Src/Timing.cs index 96fe9ca..f570c5f 100644 --- a/Assets/Src/Timing.cs +++ b/Assets/Src/Timing.cs @@ -15,15 +15,15 @@ public enum SectorColour { public readonly struct SectorTime { public SectorTime(int i, double t) { Sector = i; - Value = t; + Seconds = t; Colour = SectorColour.White; } public int Sector { get; } - public double Value { get; } + public double Seconds { get; } public SectorColour Colour { get; } - public override string ToString() => $"{Value:0.000}"; + public override string ToString() => $"{Seconds:0.000}"; // public string ColourClass() => Colour switch { // SectorColour.Green => "green", @@ -38,12 +38,13 @@ public struct Lap { public int Number { get; set; } public List Sectors { get; set; } + // 0:1:39 public override string ToString() { - return $"Lap {Number} : {TimeSpan.FromSeconds(TotalTime()):g} {String.Join(" ", Sectors.ConvertAll(s => s.ToString()))}"; + return $"{TimeSpan.FromSeconds(TotalTime()):m\\:ss\\.fff}"; } public double TotalTime() { - return Sectors.Sum(s => s.Value); + return Sectors.Sum(s => s.Seconds); } } @@ -154,7 +155,7 @@ public class Timing: MonoBehaviour { var fastestLap = lapTimes.MinBy(l => l.TotalTime()); var fastestSector = fastestLap.Sectors.Single(fls => fls.Sector == s.Sector); - return (s.Value < fastestSector.Value) switch { + return (s.Seconds < fastestSector.Seconds) switch { true => SectorColour.Green, false => SectorColour.Yellow, }; diff --git a/Assets/Src/UI.meta b/Assets/Src/UI.meta new file mode 100644 index 0000000..25391cc --- /dev/null +++ b/Assets/Src/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6cb6aa050e90de06e84c577b183b9655 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Src/DebugLogPanel.cs b/Assets/Src/UI/DebugLogPanel.cs similarity index 100% rename from Assets/Src/DebugLogPanel.cs rename to Assets/Src/UI/DebugLogPanel.cs diff --git a/Assets/Src/DebugLogPanel.cs.meta b/Assets/Src/UI/DebugLogPanel.cs.meta similarity index 100% rename from Assets/Src/DebugLogPanel.cs.meta rename to Assets/Src/UI/DebugLogPanel.cs.meta diff --git a/Assets/Src/LapTimeEntry.uxml b/Assets/Src/UI/LapTimeEntry.uxml similarity index 100% rename from Assets/Src/LapTimeEntry.uxml rename to Assets/Src/UI/LapTimeEntry.uxml diff --git a/Assets/Src/LapTimeEntry.uxml.meta b/Assets/Src/UI/LapTimeEntry.uxml.meta similarity index 100% rename from Assets/Src/LapTimeEntry.uxml.meta rename to Assets/Src/UI/LapTimeEntry.uxml.meta diff --git a/Assets/Src/UI/MenuControls.cs b/Assets/Src/UI/MenuControls.cs new file mode 100644 index 0000000..bbcb16c --- /dev/null +++ b/Assets/Src/UI/MenuControls.cs @@ -0,0 +1,61 @@ +using UnityEngine; +using UnityEngine.UIElements; +using UnityEngine.InputSystem; + +public class MenuControls : MonoBehaviour, SpaceRaceInput.IMenuActions { + [SerializeField] + UIDocument menuDoc; + + [SerializeField] + UIDocument timingDoc; + + [SerializeField] + ShipControls shipControls; + + SpaceRaceInput input; + bool visible = false; + + void Start() { + if (input == null) { + input = new SpaceRaceInput(); + input.menu.SetCallbacks(this); + } + input.menu.Enable(); + Debug.Log($"Menu {visible}"); + Hide(); + } + + void Show() { + visible = true; + UnityEngine.Cursor.lockState = CursorLockMode.None; + menuDoc.enabled = true; + + // take control off the ship + timingDoc.enabled = false; + shipControls.enabled = false; + + } + + void Hide() { + visible = false; + UnityEngine.Cursor.lockState = CursorLockMode.Locked; + menuDoc.enabled = false; + + // resume control of the ship + timingDoc.enabled = true; + shipControls.enabled = true; + } + + public void OnToggleMenu(InputAction.CallbackContext ctx) { + visible = !visible; + Debug.Log($"Menu {visible}"); + + if (visible) { + Show(); + return; + } + + Hide(); + return; + } +} \ No newline at end of file diff --git a/Assets/Src/UI/MenuControls.cs.meta b/Assets/Src/UI/MenuControls.cs.meta new file mode 100644 index 0000000..5346793 --- /dev/null +++ b/Assets/Src/UI/MenuControls.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7da082ca2a8e6ee9a5b1151245f535f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Src/UI/MenuInput.cs b/Assets/Src/UI/MenuInput.cs new file mode 100644 index 0000000..183cfb4 --- /dev/null +++ b/Assets/Src/UI/MenuInput.cs @@ -0,0 +1,284 @@ +//------------------------------------------------------------------------------ +// +// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator +// version 1.6.1 +// from Assets/Src/UI/MenuInput.inputactions +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.Utilities; + +public partial class @MenuInput: IInputActionCollection2, IDisposable +{ + public InputActionAsset asset { get; } + public @MenuInput() + { + asset = InputActionAsset.FromJson(@"{ + ""name"": ""MenuInput"", + ""maps"": [ + { + ""name"": ""menu"", + ""id"": ""fddbd52a-f0f1-4589-8706-8a70d80fffc7"", + ""actions"": [ + { + ""name"": ""Toggle"", + ""type"": ""Button"", + ""id"": ""ad2f7940-95f2-4063-87a1-7d42f3791e9f"", + ""expectedControlType"": ""Button"", + ""processors"": """", + ""interactions"": """", + ""initialStateCheck"": false + } + ], + ""bindings"": [ + { + ""name"": """", + ""id"": ""e4962cb0-d885-416a-a080-db19f4a0a4c4"", + ""path"": ""/escape"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Keyboard&Mouse"", + ""action"": ""Toggle"", + ""isComposite"": false, + ""isPartOfComposite"": false + }, + { + ""name"": """", + ""id"": ""a9401517-73d8-4cc5-baaa-56db81951850"", + ""path"": ""/start"", + ""interactions"": """", + ""processors"": """", + ""groups"": ""Gamepad"", + ""action"": ""Toggle"", + ""isComposite"": false, + ""isPartOfComposite"": false + } + ] + } + ], + ""controlSchemes"": [ + { + ""name"": ""Keyboard&Mouse"", + ""bindingGroup"": ""Keyboard&Mouse"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + }, + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Gamepad"", + ""bindingGroup"": ""Gamepad"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Touch"", + ""bindingGroup"": ""Touch"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""Joystick"", + ""bindingGroup"": ""Joystick"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + }, + { + ""name"": ""XR"", + ""bindingGroup"": ""XR"", + ""devices"": [ + { + ""devicePath"": """", + ""isOptional"": false, + ""isOR"": false + } + ] + } + ] +}"); + // menu + m_menu = asset.FindActionMap("menu", throwIfNotFound: true); + m_menu_Toggle = m_menu.FindAction("Toggle", throwIfNotFound: true); + } + + public void Dispose() + { + UnityEngine.Object.Destroy(asset); + } + + public InputBinding? bindingMask + { + get => asset.bindingMask; + set => asset.bindingMask = value; + } + + public ReadOnlyArray? devices + { + get => asset.devices; + set => asset.devices = value; + } + + public ReadOnlyArray controlSchemes => asset.controlSchemes; + + public bool Contains(InputAction action) + { + return asset.Contains(action); + } + + public IEnumerator GetEnumerator() + { + return asset.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Enable() + { + asset.Enable(); + } + + public void Disable() + { + asset.Disable(); + } + + public IEnumerable bindings => asset.bindings; + + public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false) + { + return asset.FindAction(actionNameOrId, throwIfNotFound); + } + + public int FindBinding(InputBinding bindingMask, out InputAction action) + { + return asset.FindBinding(bindingMask, out action); + } + + // menu + private readonly InputActionMap m_menu; + private List m_MenuActionsCallbackInterfaces = new List(); + private readonly InputAction m_menu_Toggle; + public struct MenuActions + { + private @MenuInput m_Wrapper; + public MenuActions(@MenuInput wrapper) { m_Wrapper = wrapper; } + public InputAction @Toggle => m_Wrapper.m_menu_Toggle; + public InputActionMap Get() { return m_Wrapper.m_menu; } + public void Enable() { Get().Enable(); } + public void Disable() { Get().Disable(); } + public bool enabled => Get().enabled; + public static implicit operator InputActionMap(MenuActions set) { return set.Get(); } + public void AddCallbacks(IMenuActions instance) + { + if (instance == null || m_Wrapper.m_MenuActionsCallbackInterfaces.Contains(instance)) return; + m_Wrapper.m_MenuActionsCallbackInterfaces.Add(instance); + @Toggle.started += instance.OnToggle; + @Toggle.performed += instance.OnToggle; + @Toggle.canceled += instance.OnToggle; + } + + private void UnregisterCallbacks(IMenuActions instance) + { + @Toggle.started -= instance.OnToggle; + @Toggle.performed -= instance.OnToggle; + @Toggle.canceled -= instance.OnToggle; + } + + public void RemoveCallbacks(IMenuActions instance) + { + if (m_Wrapper.m_MenuActionsCallbackInterfaces.Remove(instance)) + UnregisterCallbacks(instance); + } + + public void SetCallbacks(IMenuActions instance) + { + foreach (var item in m_Wrapper.m_MenuActionsCallbackInterfaces) + UnregisterCallbacks(item); + m_Wrapper.m_MenuActionsCallbackInterfaces.Clear(); + AddCallbacks(instance); + } + } + public MenuActions @menu => new MenuActions(this); + private int m_KeyboardMouseSchemeIndex = -1; + public InputControlScheme KeyboardMouseScheme + { + get + { + if (m_KeyboardMouseSchemeIndex == -1) m_KeyboardMouseSchemeIndex = asset.FindControlSchemeIndex("Keyboard&Mouse"); + return asset.controlSchemes[m_KeyboardMouseSchemeIndex]; + } + } + private int m_GamepadSchemeIndex = -1; + public InputControlScheme GamepadScheme + { + get + { + if (m_GamepadSchemeIndex == -1) m_GamepadSchemeIndex = asset.FindControlSchemeIndex("Gamepad"); + return asset.controlSchemes[m_GamepadSchemeIndex]; + } + } + private int m_TouchSchemeIndex = -1; + public InputControlScheme TouchScheme + { + get + { + if (m_TouchSchemeIndex == -1) m_TouchSchemeIndex = asset.FindControlSchemeIndex("Touch"); + return asset.controlSchemes[m_TouchSchemeIndex]; + } + } + private int m_JoystickSchemeIndex = -1; + public InputControlScheme JoystickScheme + { + get + { + if (m_JoystickSchemeIndex == -1) m_JoystickSchemeIndex = asset.FindControlSchemeIndex("Joystick"); + return asset.controlSchemes[m_JoystickSchemeIndex]; + } + } + private int m_XRSchemeIndex = -1; + public InputControlScheme XRScheme + { + get + { + if (m_XRSchemeIndex == -1) m_XRSchemeIndex = asset.FindControlSchemeIndex("XR"); + return asset.controlSchemes[m_XRSchemeIndex]; + } + } + public interface IMenuActions + { + void OnToggle(InputAction.CallbackContext context); + } +} diff --git a/Assets/Src/UI/MenuInput.cs.meta b/Assets/Src/UI/MenuInput.cs.meta new file mode 100644 index 0000000..578413c --- /dev/null +++ b/Assets/Src/UI/MenuInput.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 337598c194bddae77922f951b35575d6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Src/RadialProgress.uss b/Assets/Src/UI/RadialProgress.uss similarity index 100% rename from Assets/Src/RadialProgress.uss rename to Assets/Src/UI/RadialProgress.uss diff --git a/Assets/Src/RadialProgress.uss.meta b/Assets/Src/UI/RadialProgress.uss.meta similarity index 100% rename from Assets/Src/RadialProgress.uss.meta rename to Assets/Src/UI/RadialProgress.uss.meta diff --git a/Assets/Src/ShipUi.cs b/Assets/Src/UI/ShipUi.cs similarity index 100% rename from Assets/Src/ShipUi.cs rename to Assets/Src/UI/ShipUi.cs diff --git a/Assets/Src/ShipUi.cs.meta b/Assets/Src/UI/ShipUi.cs.meta similarity index 100% rename from Assets/Src/ShipUi.cs.meta rename to Assets/Src/UI/ShipUi.cs.meta diff --git a/Assets/Src/ShipUi.uss b/Assets/Src/UI/ShipUi.uss similarity index 92% rename from Assets/Src/ShipUi.uss rename to Assets/Src/UI/ShipUi.uss index f574115..2b8ba96 100644 --- a/Assets/Src/ShipUi.uss +++ b/Assets/Src/UI/ShipUi.uss @@ -5,11 +5,10 @@ --purple: rgb(164, 35, 188); --yellow: rgb(255, 161, 0); --white: rgb(245, 245, 245); -} - -#shipUi { color: var(--white); font-size: 24px; + letter-spacing: 24px; + unity-font: "Jura Medium"; } #list-entry { @@ -31,7 +30,6 @@ .green { color: var(--green); - font-weight: bold; } .purple { diff --git a/Assets/Src/ShipUi.uss.meta b/Assets/Src/UI/ShipUi.uss.meta similarity index 100% rename from Assets/Src/ShipUi.uss.meta rename to Assets/Src/UI/ShipUi.uss.meta diff --git a/Assets/UI Toolkit/Menu.uxml b/Assets/UI Toolkit/Menu.uxml new file mode 100644 index 0000000..d8f9a8f --- /dev/null +++ b/Assets/UI Toolkit/Menu.uxml @@ -0,0 +1,23 @@ + +