diff --git a/Assets/1.TeamWorkspace/MainMenu.meta b/Assets/1.TeamWorkspace/MainMenu.meta new file mode 100644 index 00000000..8a0620b8 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0bf6c8007412d454389295304ba05ff1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Editor.meta b/Assets/1.TeamWorkspace/MainMenu/Editor.meta new file mode 100644 index 00000000..b9c65217 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 796b12aba449643d98f43214a7377ea8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs b/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs new file mode 100644 index 00000000..b20d20c5 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs @@ -0,0 +1,183 @@ +using System.Collections.Generic; +using System.IO; +using TMPro; +using UnityEditor; +using UnityEditor.SceneManagement; +using UnityEngine; +using UnityEngine.Rendering; + +/// +/// Generates the Module Select scene, and puts the module scenes into the build list. +/// +/// The scene is generated rather than hand-built because a serialized Unity scene is the worst +/// thing this repo can hold: Module 1's `Main Scene.unity` is ~100k lines and any two people editing +/// one conflict irreconcilably. This scene is small on purpose - a rig, a light, a floor and one +/// component - and everything visible is drawn from code by . If it +/// ever gets mangled by a merge, delete it and run this again. +/// +/// Unity picks fresh object ids every time, so re-running this rewrites the whole file even when +/// nothing changed. That is fine here (nobody hand-edits it) but do not re-run it casually on a +/// branch you are about to merge, or you will hand the reviewer 450 lines of noise. +/// +/// Menu: AEDES > Rebuild Module Select Scene. +/// Batchmode: -executeMethod ModuleSelectSceneBuilder.Run. +/// +public static class ModuleSelectSceneBuilder +{ + const string SceneDir = "Assets/1.TeamWorkspace/MainMenu/Scene"; + const string ScenePath = AppFlow.MenuScene; + const string GroundMatPath = SceneDir + "/M_MenuGround.mat"; + // One in-game shot per module, named after its card (Module1.png, Module2.png, Module3.png). + // Every texture in the folder is wired in; a card with no match is text only. + const string PictureDir = "Assets/1.TeamWorkspace/MainMenu/Pictures"; + + const string RigPath = "Assets/Resources/Prefabs/Player/FPSPlayer.prefab"; + const string LogoPath = "Assets/Images/SIMPLE_Logo.png"; + const string SkyboxPath = "Assets/Packages/Fantasy Skybox FREE/Cubemaps/Classic/FS000_Day_03.mat"; + // The project's shared Lao font: static atlas, the whole Lao block plus Basic Latin. + // Generated by LaoFontTool (AEDES > Regenerate Lao font asset); Module 2's HUD uses it too. + const string LaoFontPath = "Assets/Resources/Fonts/Lao_SomVang Full SDF.asset"; + + // Scenes the menu needs, in the order they get build indices. The menu goes first so the app + // starts on it. + static readonly string[] BuildScenes = + { + AppFlow.MenuScene, + AppFlow.Module1Scene, + AppFlow.Module1GameScene, + AppFlow.Module2Scene, + // Module 3 is not on main yet. UpdateBuildSettings skips paths that do not exist, so + // listing it is harmless now and correct the moment that branch lands. + AppFlow.Module3Scene, + AppFlow.Module2TutorialScene, + // The IP Menu's buttons go on to Module 1's start screen, which is already listed. + AppFlow.IpMenuScene, + }; + + [MenuItem("AEDES/Rebuild Module Select Scene")] + public static void Run() + { + Directory.CreateDirectory(SceneDir); + + var font = AssetDatabase.LoadAssetAtPath(LaoFontPath); + if (font == null) + Debug.LogWarning($"[ModuleSelectSceneBuilder] {LaoFontPath} not found; the menu falls back to the default TMP font (no Lao glyphs)."); + BuildScene(font); + UpdateBuildSettings(); + + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + Debug.Log($"[ModuleSelectSceneBuilder] Wrote {ScenePath} and updated the build list."); + } + + // ------------------------------------------------------------------ scene + + static void BuildScene(TMP_FontAsset font) + { + var scene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single); + + // Sun. Nothing here is lightmapped, so realtime is both correct and cheap. + var lightGo = new GameObject("Directional Light"); + lightGo.transform.rotation = Quaternion.Euler(48f, 150f, 0f); + var light = lightGo.AddComponent(); + light.type = LightType.Directional; + light.color = new Color(1f, 0.96f, 0.88f); + light.intensity = 1.1f; + light.shadows = LightShadows.None; + + var skybox = AssetDatabase.LoadAssetAtPath(SkyboxPath); + if (skybox != null) RenderSettings.skybox = skybox; + RenderSettings.ambientMode = AmbientMode.Skybox; + RenderSettings.sun = light; + RenderSettings.fog = false; + + // A floor. Standing in a void is genuinely unpleasant in a headset, and the XR rig needs + // something under it if anyone ever re-enables locomotion here. + var ground = GameObject.CreatePrimitive(PrimitiveType.Plane); + ground.name = "Ground"; + ground.transform.localScale = Vector3.one * 8f; + ground.isStatic = true; + ground.GetComponent().sharedMaterial = EnsureGroundMaterial(); + + // The rig the rest of the project uses, minus locomotion: a menu is not somewhere to walk + // off to, and without it nobody can fall through the world while choosing a module. + var rigPrefab = AssetDatabase.LoadAssetAtPath(RigPath); + if (rigPrefab == null) + { + Debug.LogError($"[ModuleSelectSceneBuilder] Player rig not found at {RigPath}."); + } + else + { + var rig = (GameObject)PrefabUtility.InstantiatePrefab(rigPrefab); + rig.name = "Player"; + rig.transform.position = Vector3.zero; + var locomotion = rig.transform.Find("Locomotion"); + if (locomotion != null) locomotion.gameObject.SetActive(false); + } + + var menuGo = new GameObject("Module Select Menu"); + var menu = menuGo.AddComponent(); + menu.font = font; + menu.logo = AssetDatabase.LoadAssetAtPath(LogoPath); + var pictures = new List(); + foreach (var guid in AssetDatabase.FindAssets("t:Texture2D", new[] { PictureDir })) + pictures.Add(AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid))); + menu.pictures = pictures.ToArray(); + + EditorSceneManager.SaveScene(scene, ScenePath); + } + + static Material EnsureGroundMaterial() + { + var existing = AssetDatabase.LoadAssetAtPath(GroundMatPath); + if (existing != null) return existing; + + var shader = Shader.Find("Universal Render Pipeline/Lit") ?? Shader.Find("Standard"); + var mat = new Material(shader) { name = "M_MenuGround" }; + mat.color = new Color(0.16f, 0.36f, 0.34f); + if (mat.HasProperty("_Smoothness")) mat.SetFloat("_Smoothness", 0.1f); + AssetDatabase.CreateAsset(mat, GroundMatPath); + return mat; + } + + // ------------------------------------------------------------------ build list + + /// + /// Puts the menu at index 0 and every module behind it, enabled. Entries already in the list + /// keep their place after those, so nothing anyone else added is dropped - except that an + /// enabled scene sharing a name with one of ours is disabled. Module 1's game code loads + /// "Main Scene" and "Startup Menu_New" by name, and SIMPLE ships two other scenes called + /// "Main Scene"; if one of those were enabled, a name lookup could land in it instead. + /// + static void UpdateBuildSettings() + { + var wanted = new List(); + var seen = new HashSet(); + var names = new HashSet(); + + foreach (var path in BuildScenes) + { + if (AssetDatabase.LoadAssetAtPath(path) == null) + { + Debug.LogWarning($"[ModuleSelectSceneBuilder] {path} does not exist; skipping it in the build list."); + continue; + } + wanted.Add(new EditorBuildSettingsScene(path, true)); + seen.Add(path); + names.Add(Path.GetFileNameWithoutExtension(path)); + } + + foreach (var s in EditorBuildSettings.scenes) + { + if (seen.Contains(s.path)) continue; + if (s.enabled && names.Contains(Path.GetFileNameWithoutExtension(s.path))) + { + Debug.LogWarning($"[ModuleSelectSceneBuilder] Disabling {s.path}: its name clashes with a module scene."); + s.enabled = false; + } + wanted.Add(s); + } + + EditorBuildSettings.scenes = wanted.ToArray(); + } +} diff --git a/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs.meta b/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs.meta new file mode 100644 index 00000000..5ff666ae --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Editor/ModuleSelectSceneBuilder.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 68dec9d17b2344410a6fd89625542f76 \ No newline at end of file diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures.meta b/Assets/1.TeamWorkspace/MainMenu/Pictures.meta new file mode 100644 index 00000000..616a305f --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Pictures.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 08c9e6e9f70ab4a209265204c78ea085 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png new file mode 100644 index 00000000..75b75200 Binary files /dev/null and b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png differ diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png.meta b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png.meta new file mode 100644 index 00000000..7133bc27 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module1.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 1b767a72cc3354f17b05e703f8656dc6 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png new file mode 100644 index 00000000..2fc7b5e8 Binary files /dev/null and b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png differ diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png.meta b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png.meta new file mode 100644 index 00000000..e54495ce --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module2.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 9d4aec44cae8848019e0e5b106b69e7b +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png new file mode 100644 index 00000000..914571ca Binary files /dev/null and b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png differ diff --git a/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png.meta b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png.meta new file mode 100644 index 00000000..77fdb935 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Pictures/Module3.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: 81b6c0fe0f8844675bc90a1d76cc00ad +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + 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: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + 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: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Scene.meta b/Assets/1.TeamWorkspace/MainMenu/Scene.meta new file mode 100644 index 00000000..9a2c2dd6 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scene.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39d058baa28dd464e9b4173fcb852a30 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat b/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat new file mode 100644 index 00000000..692e0185 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat @@ -0,0 +1,137 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8488255678476136024 +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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: M_MenuGround + 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: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + 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: 0} + 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: + - _AddPrecomputedVelocity: 0 + - _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.1 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0.16, g: 0.36, b: 0.34, a: 1} + - _Color: {r: 0.15999997, g: 0.35999998, b: 0.33999997, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat.meta b/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat.meta new file mode 100644 index 00000000..0e20e4fc --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scene/M_MenuGround.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f32e86dfec5c473fa0415bf86c8ae65 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity b/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity new file mode 100644 index 00000000..4604bc9c --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity @@ -0,0 +1,461 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 10 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 2100000, guid: 33ab377b49aa14f6fae6e5bac230a5d4, type: 2} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 193963687} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 2 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 1 + m_PVRFilteringGaussRadiusAO: 1 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &193963686 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 193963688} + - component: {fileID: 193963687} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &193963687 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 193963686} + m_Enabled: 1 + serializedVersion: 12 + m_Type: 1 + m_Color: {r: 1, g: 0.96, b: 0.88, a: 1} + m_Intensity: 1.1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize2D: {x: 0.5, y: 0.5} + m_Shadows: + m_Type: 0 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 +--- !u!4 &193963688 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 193963686} + serializedVersion: 2 + m_LocalRotation: {x: 0.105271205, y: 0.88241714, z: -0.39287746, w: 0.236443} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &273627934 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 273627938} + - component: {fileID: 273627937} + - component: {fileID: 273627936} + - component: {fileID: 273627935} + m_Layer: 0 + m_Name: Ground + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 2147483647 + m_IsActive: 1 +--- !u!23 &273627935 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 273627934} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 5f32e86dfec5c473fa0415bf86c8ae65, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_MaskInteraction: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!64 &273627936 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 273627934} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!33 &273627937 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 273627934} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &273627938 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 273627934} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 8, y: 8, z: 8} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1727197609 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1727197611} + - component: {fileID: 1727197610} + m_Layer: 0 + m_Name: Module Select Menu + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1727197610 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727197609} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 141c20b58ce8b4f35a549d4128930d10, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::ModuleSelectMenu + font: {fileID: 11400000, guid: 97d7e48a9564648719ef2cbd8a73bf8a, type: 2} + logo: {fileID: 2800000, guid: 24336e032b5d243a88bd4f081d842d92, type: 3} + pictures: + - {fileID: 2800000, guid: 1b767a72cc3354f17b05e703f8656dc6, type: 3} + - {fileID: 2800000, guid: 9d4aec44cae8848019e0e5b106b69e7b, type: 3} + - {fileID: 2800000, guid: 072659c261670478192bba1df123a40f, type: 3} + distance: 2 + canvasScale: 0.0015 + recentreAngle: 40 + recentreSpeed: 2.5 + inputGrace: 0.6 + launchFade: 0.35 + panelColor: {r: 0.5921569, g: 0.94509804, b: 1, a: 1} + headerColor: {r: 0.11764706, g: 0.60784316, b: 0.8784314, a: 1} + accentColor: {r: 0.24705882, g: 0.79607844, b: 0.29411766, a: 1} + inkColor: {r: 0.043137256, g: 0.22745098, b: 0.2901961, a: 1} + disabledColor: {r: 0.7254902, g: 0.7764706, b: 0.79607844, a: 1} +--- !u!4 &1727197611 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1727197609} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1970541003 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3482036030872247450, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4704493267458558271, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 5291858798952642335, guid: 2c59fa02513994303ad959d140b545eb, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 2c59fa02513994303ad959d140b545eb, type: 3} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 193963688} + - {fileID: 273627938} + - {fileID: 1970541003} + - {fileID: 1727197611} diff --git a/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity.meta b/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity.meta new file mode 100644 index 00000000..ad453730 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cbbe7617cbbf54a5599d5c78f1396480 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts.meta b/Assets/1.TeamWorkspace/MainMenu/Scripts.meta new file mode 100644 index 00000000..13603ca9 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 73daf4f82baff4ffbbd248d0c50c1c50 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs b/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs new file mode 100644 index 00000000..ab9d8267 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs @@ -0,0 +1,64 @@ +using UnityEngine; +using UnityEngine.SceneManagement; + +/// +/// The one place that knows which scenes exist and how to get between them. +/// +/// Everything here loads scenes by path, never by build index or bare name: +/// - build indices shift every time someone reorders the build list (SaveManager used to wipe +/// the save at index 0, and M2Manager restarts by index); +/// - names are not unique. Module 1's game scene is called "Main Scene", and so are two SIMPLE +/// template scenes, so LoadScene("Main Scene") means whichever of them comes first in +/// the build list. +/// +/// A scene still has to be in File > Build Profiles > Scene List to be loadable at runtime, so +/// checks that and says so in the log instead of +/// throwing deep inside SceneManager. +/// +public static class AppFlow +{ + public const string MenuScene = "Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity"; + + /// + /// Module 1 is entered through the team's own start screen, not straight into the game: it + /// holds the how-to-play slides and its SaveManager starts the run's clock. The game scene + /// ("Main Scene") returns there when time runs out. + /// + public const string Module1Scene = "Assets/1.TeamWorkspace/Module1/Scene/Startup Menu_New.unity"; + public const string Module1GameScene = "Assets/1.TeamWorkspace/Module1/Scene/Main Scene.unity"; + public const string Module2Scene = "Assets/1.TeamWorkspace/Module2/Scene/Module_2_MainScene.unity"; + /// + /// The team's Module 3 (branches Module-3-Demo / M3_Demo_BackUP): check villagers' symptoms and + /// send them to hospital or home. Not on main yet, so the menu hides its card until the scene is + /// in the build list. That branch also holds an unrelated scene with the same name, + /// Module3/Scenes/Module_3_Demo.unity, which is one more reason to load by path. + /// + public const string Module3Scene = "Assets/1.TeamWorkspace/Module3_System/Scene/Module_3_Demo.unity"; + public const string Module2TutorialScene = "Assets/1.TeamWorkspace/Module2/Scene/Tutorial_M2.unity"; + /// SIMPLE's GAMA connection screen. Only needed when the headset drives a simulation. + public const string IpMenuScene = "Assets/Scenes/Scenes by Simple/Menu/IP Menu.unity"; + + public static bool InMenu => SceneManager.GetActiveScene().path == MenuScene; + + public static bool IsAvailable(string scenePath) + { + return !string.IsNullOrEmpty(scenePath) && SceneUtility.GetBuildIndexByScenePath(scenePath) >= 0; + } + + public static void Load(string scenePath) + { + if (!IsAvailable(scenePath)) + { + Debug.LogError($"[AppFlow] Scene '{scenePath}' is not in the build list - add it under " + + "File > Build Profiles > Scene List. Staying put."); + return; + } + Time.timeScale = 1f; + SceneManager.LoadScene(scenePath); + } + + public static void ReturnToMenu() + { + Load(MenuScene); + } +} diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs.meta b/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs.meta new file mode 100644 index 00000000..4fe6b33e --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/AppFlow.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 450075e7d8da34da080a73b2fa71c396 \ No newline at end of file diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs b/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs new file mode 100644 index 00000000..851eb530 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs @@ -0,0 +1,670 @@ +using System.Collections.Generic; +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +/// +/// The startup menu: pick a module, press A, go. +/// +/// Built entirely from code at runtime - no prefab, no scene canvas - for the same reason +/// Module1HUD is: a layout change then touches one C# file instead of a serialized scene, which +/// is the difference between a reviewable diff and an unmergeable one in this repo. +/// ModuleSelectSceneBuilder regenerates the (tiny) scene that hosts it. +/// +/// Selection works two ways at once, because a classroom cannot rely on either alone: +/// - gaze: look at a card and it highlights. No aiming a controller ray, which most +/// eight-year-olds cannot do on their first day in a headset; +/// - thumbstick left/right, either hand, for anyone whose head is still. +/// Either way, A (or the trigger) launches. +/// +/// A module whose scene is missing from the build list is drawn greyed out with the reason on it, +/// rather than silently failing at the moment a child presses the button. +/// +public class ModuleSelectMenu : MonoBehaviour +{ + [Header("Assets (wired by ModuleSelectSceneBuilder)")] + public TMP_FontAsset font; + public Texture2D logo; + [Tooltip("A shot of each module, matched to its card by texture name (Module1, Module2, Module3). Optional.")] + public Texture2D[] pictures; + + [Header("Placement")] + [Tooltip("Metres in front of the player.")] + public float distance = 2.0f; + [Tooltip("World metres per canvas unit. The layout below is authored in millimetres.")] + public float canvasScale = 0.0015f; + [Tooltip("Degrees the player may turn away before the menu drifts back in front of them.")] + public float recentreAngle = 40f; + public float recentreSpeed = 2.5f; + + [Header("Timing")] + [Tooltip("Input is ignored for this long, so a button still held from the previous scene cannot pick a module.")] + public float inputGrace = 0.6f; + public float launchFade = 0.35f; + + [Header("Colours (sampled from the team's UI art)")] + public Color panelColor = new Color32(0x97, 0xF1, 0xFF, 0xFF); + public Color headerColor = new Color32(0x1E, 0x9B, 0xE0, 0xFF); + public Color accentColor = new Color32(0x3F, 0xCB, 0x4B, 0xFF); + public Color inkColor = new Color32(0x0B, 0x3A, 0x4A, 0xFF); + public Color disabledColor = new Color32(0xB9, 0xC6, 0xCB, 0xFF); + + // The canvas is authored in millimetres and then scaled by canvasScale. Card width and the + // canvas width depend on how many modules are showing, so a fourth module is a data change + // rather than a layout rewrite. + const float MinCanvasW = 1560f, BaseCanvasH = 1042f; + const float TextCardH = 400f, CardGap = 60f; + // With pictures: header, picture frame, then a body band just tall enough for three lines. + const float PictureTop = 88f, PictureFrameH = 230f, PictureBodyH = 180f, PictureCardH = PictureTop + PictureFrameH + PictureBodyH + 22f; + const float SmallW = 480f, SmallH = 92f, SmallGap = 40f; + + float canvasW = MinCanvasW, canvasH = BaseCanvasH, cardW = 700f, cardH = TextCardH; + float cardTitleSize = 46f, cardBodySize = 34f; + + class Entry + { + public string scene; + public string badge, title, body; + public bool small; + public Texture2D picture; + + public RectTransform rect; + public Image glow, panel; + public TextMeshProUGUI titleText, bodyText; + public bool available; + public bool visible; + public float hot; // 0..1 selection weight, smoothed + } + + readonly List entries = new List(); + readonly XRButtons input = new XRButtons(); + + Transform cam; + RectTransform root; + RectTransform faderRoot; + Image fader; + TextMeshProUGUI hintText; + Sprite rounded, pill; + int uiLayer; + int selected; + int gazed = -1; // the card the head is on, which may differ from a stick selection + float born; + bool launching, placed; + float fade; + Vector3 targetPos; + string pendingScene; + + // ------------------------------------------------------------------ lifecycle + + void Awake() + { + born = Time.unscaledTime; + uiLayer = LayerMask.NameToLayer("UI"); + if (uiLayer < 0) uiLayer = 5; + + rounded = RoundedSprite(96, 26); + pill = RoundedSprite(96, 46); + + BuildEntries(); + BuildCanvas(); + BuildFader(); + SelectFirstAvailable(); + } + + void Update() + { + if (!ResolveCamera()) return; + input.Update(); + Place(); + + if (launching) + { + fade = Mathf.MoveTowards(fade, 1f, Time.unscaledDeltaTime / Mathf.Max(0.01f, launchFade)); + fader.color = new Color(0f, 0f, 0f, fade); + if (fade >= 1f) { launching = false; AppFlow.Load(pendingScene); } + return; + } + + if (Time.unscaledTime - born > inputGrace) + { + GazeSelect(); + StickSelect(); + if ((input.PrimaryDown || input.TriggerDown) && entries[selected].available) + Launch(entries[selected]); + } + + Animate(); + hintText.text = input.HasControllers ? ModuleSelectText.Hint : ModuleSelectText.HintDesktop; + } + + // ------------------------------------------------------------------ selection + + bool ResolveCamera() + { + if (cam != null) return true; + if (Camera.main != null) cam = Camera.main.transform; + return cam != null; + } + + void SelectFirstAvailable() + { + for (int i = 0; i < entries.Count; i++) + if (entries[i].available) { selected = i; return; } + selected = 0; + } + + /// + /// The cards are all coplanar on the canvas, so "what am I looking at" is one ray-plane + /// intersection plus a rect test - exact, and cheaper than a physics raycast every frame. + /// + void GazeSelect() + { + var plane = new Plane(-root.forward, root.position); + var ray = new Ray(cam.position, cam.forward); + if (!plane.Raycast(ray, out float dist)) return; + Vector3 hit = ray.GetPoint(dist); + + // Nearest entry rather than first hit: the cards and the small buttons below them are + // close enough that a generous hit box round one overlaps the next, and "first in the + // list wins" then makes the button underneath unreachable. + int best = -1; + float bestDist = float.MaxValue; + float gazedDist = float.MaxValue; + for (int i = 0; i < entries.Count; i++) + { + // Skip anything that cannot be launched, so gaze never parks the selection on a card + // that is only on screen to tell a developer its scene is missing. + if (entries[i].rect == null || !entries[i].available) continue; + Vector3 local = entries[i].rect.InverseTransformPoint(hit); + Rect r = entries[i].rect.rect; + float dx = Mathf.Max(r.xMin - local.x, local.x - r.xMax, 0f); + float dy = Mathf.Max(r.yMin - local.y, local.y - r.yMax, 0f); + float d = Mathf.Sqrt(dx * dx + dy * dy); // 0 when the gaze is inside the rect + if (i == gazed) gazedDist = d; + if (d < bestDist) { bestDist = d; best = i; } + } + + // Forgiving by a fixed margin - a child's head is never quite still - but not so far that + // looking at the sky keeps a card lit up. + const float slack = 70f; + if (best < 0 || bestDist > slack) { gazed = -1; return; } + if (best == gazed) return; + + // Hysteresis, but only in the dead space between targets. Looking straight at something + // always counts; looking at the gap between two cards puts the gaze inside neither and + // nearly equidistant from both, and without this the highlight would flip back and forth + // on sub-degree head movement, buzzing the controller every time. + const float stickiness = 40f; + bool lookingRightAtIt = bestDist <= 0.001f; + if (!lookingRightAtIt && gazedDist <= bestDist + stickiness) return; + + // Gaze selects only when it moves onto a different card. Selecting whatever is looked at + // every frame would undo a thumbstick choice on the very next frame, since the head is + // usually still pointing at the card the stick moved away from. + gazed = best; + if (selected == best) return; + selected = best; + input.Rumble(); + } + + void StickSelect() + { + if (input.StepX == 0) return; + int i = selected; + for (int n = 0; n < entries.Count; n++) + { + i = (i + input.StepX + entries.Count) % entries.Count; + if (entries[i].available) break; + } + if (i != selected) { selected = i; input.Rumble(); } + } + + void Launch(Entry e) + { + launching = true; + pendingScene = e.scene; + input.Rumble(0.6f, 0.12f); + Debug.Log($"[ModuleSelectMenu] Launching '{e.scene}'."); + } + + // ------------------------------------------------------------------ presentation + + /// + /// World-locked, not head-locked: a panel welded to the eyes is unpleasant to read and would + /// make gaze selection impossible. It only drifts back once the player has turned well away. + /// + void Place() + { + Vector3 forward = Flatten(cam.forward); + Vector3 wanted = cam.position + forward * distance; + wanted.y = cam.position.y - 0.12f; + + if (!placed) + { + targetPos = wanted; + root.position = wanted; + root.rotation = Quaternion.LookRotation(Flatten(wanted - cam.position), Vector3.up); + placed = true; + } + else if (Vector3.Angle(forward, Flatten(targetPos - cam.position)) > recentreAngle) + { + targetPos = wanted; + } + + float t = 1f - Mathf.Exp(-recentreSpeed * Time.unscaledDeltaTime); + root.position = Vector3.Lerp(root.position, targetPos, t); + Vector3 away = Flatten(root.position - cam.position); + root.rotation = Quaternion.Slerp(root.rotation, Quaternion.LookRotation(away, Vector3.up), t); + + // The fade-out quad rides just in front of the eyes. + faderRoot.position = cam.position + cam.forward * 0.12f; + faderRoot.rotation = cam.rotation; + } + + static Vector3 Flatten(Vector3 v) + { + v.y = 0f; + return v.sqrMagnitude > 0.0001f ? v.normalized : Vector3.forward; + } + + void Animate() + { + for (int i = 0; i < entries.Count; i++) + { + var e = entries[i]; + if (e.rect == null) continue; + bool on = i == selected && e.available; + e.hot = Mathf.MoveTowards(e.hot, on ? 1f : 0f, Time.unscaledDeltaTime * 6f); + + float pulse = on ? 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 4f) : 0f; + e.rect.localScale = Vector3.one * (1f + 0.035f * e.hot); + e.glow.color = new Color(accentColor.r, accentColor.g, accentColor.b, e.hot * (0.55f + 0.45f * pulse)); + e.panel.color = e.available ? Color.Lerp(panelColor, Color.white, e.hot * 0.35f) : disabledColor; + } + } + + // ------------------------------------------------------------------ build + + void BuildEntries() + { + Add(new Entry { scene = AppFlow.Module1Scene, badge = "1", title = ModuleSelectText.Module1Title, body = ModuleSelectText.Module1Body, picture = Picture("Module1") }); + Add(new Entry { scene = AppFlow.Module2Scene, badge = "2", title = ModuleSelectText.Module2Title, body = ModuleSelectText.Module2Body, picture = Picture("Module2") }); + Add(new Entry { scene = AppFlow.Module3Scene, badge = "3", title = ModuleSelectText.Module3Title, body = ModuleSelectText.Module3Body, picture = Picture("Module3") }); + Add(new Entry { scene = AppFlow.Module2TutorialScene, title = ModuleSelectText.TutorialTitle, small = true }); + Add(new Entry { scene = AppFlow.IpMenuScene, title = ModuleSelectText.GamaTitle, small = true }); + } + + /// + /// A module that is not in the build list is hidden from a player build and drawn greyed out, + /// with the reason, in the editor and in development builds. + /// + /// Module 3 lives on its own branch: its entry is listed above so that the day that branch + /// merges it appears here on its own, but until then a class must not be shown a dead card + /// captioned with a Unity menu path. + /// + Texture2D Picture(string name) + { + if (pictures == null) return null; + foreach (var t in pictures) if (t != null && t.name == name) return t; + return null; + } + + static bool ShowDiagnostics => Application.isEditor || Debug.isDebugBuild; + + void Add(Entry e) + { + e.available = AppFlow.IsAvailable(e.scene); + e.visible = e.available || ShowDiagnostics; + entries.Add(e); + } + + void BuildCanvas() + { + var go = new GameObject("Module Select Canvas") { layer = uiLayer }; + go.transform.SetParent(transform, false); + var canvas = go.AddComponent(); + canvas.renderMode = RenderMode.WorldSpace; + var scaler = go.AddComponent(); + scaler.uiScaleMode = CanvasScaler.ScaleMode.ConstantPixelSize; + // Read from ~2 m away, so give TMP headroom to rasterise at. + scaler.dynamicPixelsPerUnit = 3f; + + // Three modules across need more room than two; four need smaller cards as well. + int bigCount = 0; + bool anyPicture = false; + foreach (var e in entries) + { + if (e.small || !e.visible) continue; + bigCount++; + anyPicture |= e.picture != null && e.available; + } + // Every card gets the picture band if any card has one, so the row stays level. + cardH = anyPicture ? PictureCardH : TextCardH; + canvasH = BaseCanvasH + (cardH - TextCardH); + cardW = bigCount >= 4 ? 480f : bigCount == 3 ? 580f : 700f; + cardTitleSize = bigCount >= 4 ? 38f : bigCount == 3 ? 42f : 46f; + cardBodySize = bigCount >= 4 ? 28f : bigCount == 3 ? 32f : 34f; + canvasW = Mathf.Max(MinCanvasW, bigCount * cardW + (bigCount - 1) * CardGap + 100f); + + root = (RectTransform)go.transform; + root.sizeDelta = new Vector2(canvasW, canvasH); + root.localScale = Vector3.one * canvasScale; + + var back = NewImage("Backdrop", root, rounded, new Color(0.02f, 0.10f, 0.14f, 0.55f)); + Stretch(back.rectTransform, 28f); + + float y = -34f; + + if (logo != null) + { + const float h = 120f; + var logoRect = NewRect("Logo", root, new Vector2(h * logo.width / logo.height, h), new Vector2(0f, y)); + var raw = logoRect.gameObject.AddComponent(); + raw.texture = logo; + raw.raycastTarget = false; + y -= h + 20f; + } + + var title = NewText("Title", root, ModuleSelectText.Title, 64, Color.white, new Vector2(canvasW, 76), new Vector2(0f, y)); + title.fontStyle = FontStyles.Bold; + y -= 84f; + + NewText("Welcome", root, ModuleSelectText.WelcomeLao, 38, new Color(0.78f, 0.93f, 1f), + new Vector2(canvasW - 160f, 58), new Vector2(0f, y)); + // Room for the Lao line's below-base vowels and for the title pills, which ride 26 above + // the top of each card. + y -= 112f; + + float cardY = y; + float rowW = bigCount * cardW + (bigCount - 1) * CardGap; + float cursor = -rowW * 0.5f + cardW * 0.5f; + foreach (var e in entries) + { + if (e.small || !e.visible) continue; + BuildCard(e, new Vector2(cursor, cardY)); + cursor += cardW + CardGap; + } + y = cardY - cardH - 46f; + + int smallIndex = 0; + foreach (var e in entries) + { + if (!e.small || !e.visible) continue; + float x = (smallIndex == 0 ? -1f : 1f) * (SmallW + SmallGap) * 0.5f; + BuildSmall(e, new Vector2(x, y)); + smallIndex++; + } + y -= SmallH + 52f; + + hintText = NewText("Hint", root, ModuleSelectText.Hint, 30, new Color(0.80f, 0.92f, 1f, 0.92f), + new Vector2(canvasW - 100f, 44), new Vector2(0f, y)); + } + + void BuildCard(Entry e, Vector2 pos) + { + e.rect = NewRect("Card " + e.title, root, new Vector2(cardW, cardH), pos); + + e.glow = NewImage("Glow", e.rect, rounded, Color.clear); + Stretch(e.glow.rectTransform, 14f); + + e.panel = NewImage("Panel", e.rect, rounded, panelColor); + Stretch(e.panel.rectTransform, 0f); + + // The blue title pill overlaps the top edge, as on the team's Welcome UI art. + var header = NewImage("Header", e.rect, pill, headerColor); + var hr = header.rectTransform; + hr.anchorMin = hr.anchorMax = new Vector2(0.5f, 1f); + hr.pivot = new Vector2(0.5f, 1f); + hr.sizeDelta = new Vector2(cardW - 120f, 92f); + hr.anchoredPosition = new Vector2(0f, 26f); + + e.titleText = Centred(NewText("Title", hr, e.title, cardTitleSize, Color.white, new Vector2(cardW - 150f, 92), Vector2.zero)); + // One line, shrunk to fit: with four cards across, a long title would otherwise wrap out of its pill. + e.titleText.textWrappingMode = TextWrappingModes.NoWrap; + FitText(e.titleText, cardTitleSize); + e.titleText.fontStyle = FontStyles.Bold; + + if (!string.IsNullOrEmpty(e.badge)) + { + var badge = NewImage("Badge", e.rect, rounded, accentColor); + var br = badge.rectTransform; + br.anchorMin = br.anchorMax = new Vector2(0f, 1f); + br.pivot = new Vector2(0f, 1f); + br.sizeDelta = new Vector2(86f, 86f); + br.anchoredPosition = new Vector2(-18f, 30f); + Centred(NewText("N", br, e.badge, 52, Color.white, new Vector2(86, 86), Vector2.zero)).fontStyle = FontStyles.Bold; + } + + float bodyTop = -120f, bodyH = TextCardH - 150f; + if (cardH == PictureCardH) + { + BuildPicture(e, new Vector2(0f, -PictureTop), new Vector2(cardW - 60f, PictureFrameH)); + bodyTop = -PictureTop - PictureFrameH - 10f; + bodyH = PictureBodyH; + } + + // Centred in the space under the header, so a two-line and a three-line card still balance. + e.bodyText = NewText("Body", e.rect, e.body, cardBodySize, inkColor, new Vector2(cardW - 110f, bodyH), new Vector2(0f, bodyTop)); + // The copy wraps to whatever width the card has and shrinks rather than overflowing it. + e.bodyText.verticalAlignment = VerticalAlignmentOptions.Middle; + FitText(e.bodyText, cardBodySize); + + if (!e.available) MarkUnavailable(e, new Vector2(0f, -cardH + 64f), cardW - 60f, 26); + } + + /// + /// The module's picture, cropped to fill a rounded frame. A card without one gets a plain + /// tinted frame, so the cards in a row still line up. + /// + void BuildPicture(Entry e, Vector2 pos, Vector2 size) + { + var frame = NewRect("Picture", e.rect, size, pos); + var mask = frame.gameObject.AddComponent(); + mask.sprite = rounded; + mask.type = Image.Type.Sliced; + mask.color = new Color(inkColor.r, inkColor.g, inkColor.b, 0.18f); + mask.raycastTarget = false; + if (e.picture == null || !e.available) return; + + frame.gameObject.AddComponent().showMaskGraphic = false; + var go = new GameObject("Shot") { layer = uiLayer }; + var rt = go.AddComponent(); + rt.SetParent(frame, false); + Stretch(rt, 0f); + var raw = go.AddComponent(); + raw.texture = e.picture; + raw.raycastTarget = false; + + // Centre-crop the shot to the frame's aspect rather than squashing it. + float frameAspect = size.x / size.y; + float texAspect = (float)e.picture.width / e.picture.height; + raw.uvRect = texAspect > frameAspect + ? new Rect((1f - frameAspect / texAspect) * 0.5f, 0f, frameAspect / texAspect, 1f) + : new Rect(0f, (1f - texAspect / frameAspect) * 0.5f, 1f, texAspect / frameAspect); + } + + void BuildSmall(Entry e, Vector2 pos) + { + e.rect = NewRect("Button " + e.title, root, new Vector2(SmallW, SmallH), pos); + + e.glow = NewImage("Glow", e.rect, pill, Color.clear); + Stretch(e.glow.rectTransform, 10f); + + e.panel = NewImage("Panel", e.rect, pill, panelColor); + Stretch(e.panel.rectTransform, 0f); + + e.titleText = Centred(NewText("Title", e.rect, e.title, 34, inkColor, new Vector2(SmallW - 40f, SmallH), Vector2.zero)); + + if (!e.available) MarkUnavailable(e, new Vector2(0f, -SmallH - 2f), SmallW + 120f, 21); + } + + /// + /// The most common way this menu breaks is a scene missing from the build list, so say so on + /// the card instead of letting the button press do nothing. + /// + void MarkUnavailable(Entry e, Vector2 pos, float width, float fontSize) + { + e.titleText.color = new Color(0.30f, 0.34f, 0.36f); + + if (e.bodyText != null) + { + // Reuse the body rather than stacking a label over it: the pitch and the reason + // together overflow a card, and a developer looking at a dead card wants the reason. + e.bodyText.text = ModuleSelectText.NotInBuild; + e.bodyText.color = new Color(0.86f, 0.52f, 0.20f); + e.bodyText.enableAutoSizing = false; + e.bodyText.fontSize = fontSize; + } + else + { + NewText("Unavailable", e.rect, ModuleSelectText.NotInBuild, fontSize, + new Color(1f, 0.72f, 0.36f), new Vector2(width, 40f), pos); + } + + Debug.LogWarning($"[ModuleSelectMenu] Scene '{e.scene}' is not in the build list; its card is disabled."); + } + + /// + /// A head-locked black quad for the launch fade. It is a world-space canvas, not a + /// ScreenSpaceOverlay one, because overlay canvases are not rendered to an XR display at all. + /// + void BuildFader() + { + var go = new GameObject("Fader") { layer = uiLayer }; + go.transform.SetParent(transform, false); + var canvas = go.AddComponent(); + canvas.renderMode = RenderMode.WorldSpace; + + faderRoot = (RectTransform)go.transform; + faderRoot.sizeDelta = new Vector2(2000f, 2000f); // 2 m square, 12 cm from the eyes + faderRoot.localScale = Vector3.one * 0.001f; // fader is sized in metres already + + fader = NewImage("Black", faderRoot, null, new Color(0f, 0f, 0f, 0f)); + Stretch(fader.rectTransform, 0f); + } + + // ------------------------------------------------------------------ ui helpers + + RectTransform NewRect(string name, Transform parent, Vector2 size, Vector2 pos) + { + var go = new GameObject(name) { layer = uiLayer }; + var rt = go.AddComponent(); + rt.SetParent(parent, false); + rt.anchorMin = rt.anchorMax = new Vector2(0.5f, 1f); + rt.pivot = new Vector2(0.5f, 1f); + rt.sizeDelta = size; + rt.anchoredPosition = pos; + return rt; + } + + Image NewImage(string name, Transform parent, Sprite sprite, Color color) + { + var go = new GameObject(name) { layer = uiLayer }; + var rt = go.AddComponent(); + rt.SetParent(parent, false); + var img = go.AddComponent(); + img.sprite = sprite; + if (sprite != null) img.type = Image.Type.Sliced; + img.color = color; + img.raycastTarget = false; + return img; + } + + TextMeshProUGUI NewText(string name, Transform parent, string text, float size, Color color, Vector2 rectSize, Vector2 pos) + { + var go = new GameObject(name) { layer = uiLayer }; + var rt = go.AddComponent(); + rt.SetParent(parent, false); + rt.anchorMin = rt.anchorMax = new Vector2(0.5f, 1f); + rt.pivot = new Vector2(0.5f, 1f); + rt.sizeDelta = rectSize; + rt.anchoredPosition = pos; + var t = go.AddComponent(); + if (font != null) t.font = font; + t.text = text; + t.fontSize = size; + t.color = color; + t.alignment = TextAlignmentOptions.Center; + t.textWrappingMode = TextWrappingModes.Normal; + t.raycastTarget = false; + return t; + } + + static void FitText(TextMeshProUGUI t, float size) + { + t.enableAutoSizing = true; + t.fontSizeMax = size; + t.fontSizeMin = Mathf.Round(size * 0.6f); + } + + static TextMeshProUGUI Centred(TextMeshProUGUI t) + { + var rt = t.rectTransform; + rt.anchorMin = rt.anchorMax = rt.pivot = new Vector2(0.5f, 0.5f); + rt.anchoredPosition = Vector2.zero; + t.alignment = TextAlignmentOptions.Center; + return t; + } + + static void Stretch(RectTransform rt, float outset) + { + rt.anchorMin = Vector2.zero; + rt.anchorMax = Vector2.one; + rt.pivot = new Vector2(0.5f, 0.5f); + rt.offsetMin = new Vector2(-outset, -outset); + rt.offsetMax = new Vector2(outset, outset); + } + + /// A white rounded rectangle, 9-sliced so one texture serves every panel size. + static Sprite RoundedSprite(int size, int radius) + { + var tex = new Texture2D(size, size, TextureFormat.RGBA32, false) { wrapMode = TextureWrapMode.Clamp }; + var px = new Color32[size * size]; + for (int y = 0; y < size; y++) + { + for (int x = 0; x < size; x++) + { + float dx = Mathf.Max(radius - x - 0.5f, x + 0.5f - (size - radius), 0f); + float dy = Mathf.Max(radius - y - 0.5f, y + 0.5f - (size - radius), 0f); + float d = Mathf.Sqrt(dx * dx + dy * dy); + float a = Mathf.Clamp01(radius - d + 0.5f); // 1 px of antialiasing along the curve + px[y * size + x] = new Color32(255, 255, 255, (byte)(a * 255)); + } + } + tex.SetPixels32(px); + tex.Apply(); + return Sprite.Create(tex, new Rect(0, 0, size, size), new Vector2(0.5f, 0.5f), 100f, 0, + SpriteMeshType.FullRect, new Vector4(radius, radius, radius, radius)); + } +} + +/// +/// Every player-facing string in the menu, in one place, so translating it later is one file. +/// The Lao line is the team's own welcome copy, lifted from +/// Team Assets/UI/Sprites/UI/Main UI.png; the rest is still English and wants a native +/// speaker before this goes in front of a class. +/// +public static class ModuleSelectText +{ + public const string Title = "Choose a module"; + public const string WelcomeLao = "ຍິນດີຕ້ອນຮັບເຂົ້າສູ່ເກມການຈຳລອງຊີວິດຂອງຍຸງລາຍ!"; + + public const string Module1Title = "Be a Mosquito"; + public const string Module1Body = + "Fly as an Aedes mosquito. Nectar, a mate, a blood meal - then lay your eggs in rainwater."; + + public const string Module2Title = "Protect the House"; + public const string Module2Body = + "Find where mosquitoes breed. Cover the jars, empty containers, add guppies, clear the rubbish."; + + public const string Module3Title = "Health Check"; + public const string Module3Body = + "Talk to the villagers and check their symptoms. Hospital, rest at home, or are they fine?"; + + public const string TutorialTitle = "Module 2 - Tutorial"; + public const string GamaTitle = "GAMA / IP setup"; + + public const string Hint = "Look at a module, then press A stick to move | hold B in game to come back here"; + public const string HintDesktop = "Arrows to move, Space to start desktop test mode - no headset detected"; + public const string NotInBuild = "Scene missing from the build list (File > Build Profiles)"; +} diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs.meta b/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs.meta new file mode 100644 index 00000000..7e3fca90 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/ModuleSelectMenu.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 141c20b58ce8b4f35a549d4128930d10 \ No newline at end of file diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs b/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs new file mode 100644 index 00000000..dc510dd6 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs @@ -0,0 +1,172 @@ +using TMPro; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.UI; + +/// +/// "Hold B to leave" - the way out of a module and back to . +/// +/// It installs itself into every scene through and +/// survives scene loads, so neither module scene nor any module script has to be touched to gain +/// it. That is deliberate: Module_1_MainScene.unity is ~38k lines of YAML and every edit to +/// it is a merge conflict waiting for whoever is working on the other branch. +/// +/// The hold is long enough () that nobody leaves a module by fumbling a +/// button, and a progress bar appears while holding so it is discoverable rather than a secret. +/// B / Y is used because the modules only ever tap it (Module 1's "press anything to fly again", +/// Module 3's "no"); none of them holds it. +/// +public class ReturnToMenu : MonoBehaviour +{ + public const float HoldSeconds = 1.5f; + const float ShowAfterSeconds = 0.3f; + + static ReturnToMenu instance; + + readonly XRButtons input = new XRButtons(); + Transform cam; + RectTransform root; + CanvasGroup group; + Image fill; + TextMeshProUGUI label; + bool leaving; + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] + static void Install() + { + if (instance != null) return; + var go = new GameObject("[Return To Menu]"); + DontDestroyOnLoad(go); + instance = go.AddComponent(); + } + + void Awake() + { + BuildIndicator(); + SceneManager.sceneLoaded += OnSceneLoaded; + } + + // This object outlives every scene, so the "already leaving" latch has to be cleared on each + // load; otherwise only the first trip back to the menu per app launch would work. + void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + leaving = false; + } + + void Update() + { + // Nothing to go back to from the menu itself. + if (AppFlow.InMenu || leaving) + { + group.alpha = 0f; + return; + } + + if (cam == null) + { + if (Camera.main == null) return; + cam = Camera.main.transform; + } + + input.Update(); + float held = Mathf.Clamp01(input.SecondaryHeld / HoldSeconds); + + // A quick tap of B is an answer in Module 3 ("no"), so the bar only shows once the press is + // clearly a hold, rather than flashing up on every tap. + bool show = input.SecondaryHeld > ShowAfterSeconds; + group.alpha = Mathf.MoveTowards(group.alpha, show ? 1f : 0f, Time.unscaledDeltaTime * 8f); + fill.fillAmount = held; + label.text = ReturnToMenuText.Holding; + + // Sits below the line of sight so it never covers what the player is doing. + root.position = cam.position + cam.rotation * new Vector3(0f, -0.26f, 0.9f); + root.rotation = cam.rotation; + + if (input.SecondaryHeld >= HoldSeconds) + { + leaving = true; + input.Rumble(0.6f, 0.15f); + AppFlow.ReturnToMenu(); + } + } + + void OnDestroy() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + if (instance == this) instance = null; + } + + void BuildIndicator() + { + int layer = LayerMask.NameToLayer("UI"); + if (layer < 0) layer = 5; + + var go = new GameObject("Hold Indicator") { layer = layer }; + go.transform.SetParent(transform, false); + var canvas = go.AddComponent(); + canvas.renderMode = RenderMode.WorldSpace; + + root = (RectTransform)go.transform; + root.sizeDelta = new Vector2(560f, 120f); + root.localScale = Vector3.one * 0.001f; + group = go.AddComponent(); + group.alpha = 0f; + + var bg = Add("Panel", root); + bg.color = new Color(0.02f, 0.06f, 0.09f, 0.78f); + Stretch(bg.rectTransform); + + label = Add("Label", root); + label.fontSize = 30; + label.color = Color.white; + label.alignment = TextAlignmentOptions.Center; + label.raycastTarget = false; + var lr = label.rectTransform; + lr.anchorMin = new Vector2(0f, 1f); lr.anchorMax = new Vector2(1f, 1f); lr.pivot = new Vector2(0.5f, 1f); + lr.offsetMin = new Vector2(16f, 0f); lr.offsetMax = new Vector2(-16f, -14f); + lr.sizeDelta = new Vector2(lr.sizeDelta.x, 46f); + + var track = Add("Track", root); + track.color = new Color(1f, 1f, 1f, 0.18f); + Bar(track.rectTransform); + + fill = Add("Fill", root); + fill.color = new Color32(0x3F, 0xCB, 0x4B, 0xFF); + fill.type = Image.Type.Filled; + fill.fillMethod = Image.FillMethod.Horizontal; + fill.fillAmount = 0f; + Bar(fill.rectTransform); + } + + static T Add(string name, Transform parent) where T : Component + { + var go = new GameObject(name) { layer = parent.gameObject.layer }; + var rt = go.AddComponent(); + rt.SetParent(parent, false); + var c = go.AddComponent(); + if (c is Graphic g) g.raycastTarget = false; + return c; + } + + static void Stretch(RectTransform rt) + { + rt.anchorMin = Vector2.zero; + rt.anchorMax = Vector2.one; + rt.offsetMin = rt.offsetMax = Vector2.zero; + } + + static void Bar(RectTransform rt) + { + rt.anchorMin = new Vector2(0f, 0f); + rt.anchorMax = new Vector2(1f, 0f); + rt.pivot = new Vector2(0.5f, 0f); + rt.offsetMin = new Vector2(24f, 22f); + rt.offsetMax = new Vector2(-24f, 0f); + rt.sizeDelta = new Vector2(rt.sizeDelta.x, 14f); + } +} + +public static class ReturnToMenuText +{ + public const string Holding = "Keep holding B to go back to the menu"; +} diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs.meta b/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs.meta new file mode 100644 index 00000000..0eca717c --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/ReturnToMenu.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 108fab0234150473a98dfdb47cb8c912 \ No newline at end of file diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs b/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs new file mode 100644 index 00000000..bb805548 --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs @@ -0,0 +1,135 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.XR; + +/// +/// Reads the controller buttons both hands share, with edge detection and hold timers. +/// +/// It uses the legacy API rather than Input System +/// actions because that is what the rest of the AEDES gameplay code uses (PlayerMain, InputVR), +/// and mixing the two on one rig is how you end up with a menu that works in the editor and does +/// nothing on the headset. +/// +/// Not a MonoBehaviour: the owner calls once per frame. +/// In the editor, when no XR controllers are present, the keyboard stands in so the menu can be +/// driven from Play Mode without a headset. +/// +public class XRButtons +{ + InputDevice left, right; + float nextScan; + + // Held this frame (either hand). + public bool Primary { get; private set; } // A / X + public bool Secondary { get; private set; } // B / Y + public bool Trigger { get; private set; } + public bool Grip { get; private set; } + public Vector2 Stick { get; private set; } + + // Went down this frame. + public bool PrimaryDown { get; private set; } + public bool TriggerDown { get; private set; } + public bool SecondaryDown { get; private set; } + + /// Seconds B/Y has been held, or 0 when it is up. + public float SecondaryHeld { get; private set; } + /// Any button or stick input at all - for "press anything to continue". + public bool AnyInput { get; private set; } + public bool HasControllers => left.isValid || right.isValid; + + bool primaryLast, secondaryLast, triggerLast; + + /// Stick flicks, debounced into discrete steps so a held stick does not race through a list. + public int StepX { get; private set; } + float stickCooldown; + const float StickDeadzone = 0.6f; + const float MaxHoldStep = 0.1f; + + public void Update() + { + if (Time.unscaledTime >= nextScan && (!left.isValid || !right.isValid)) + { + nextScan = Time.unscaledTime + 0.5f; + if (!left.isValid) left = FirstDevice(InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Left); + if (!right.isValid) right = FirstDevice(InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.Right); + } + + Primary = Button(CommonUsages.primaryButton); + Secondary = Button(CommonUsages.secondaryButton); + Trigger = Button(CommonUsages.triggerButton); + Grip = Button(CommonUsages.gripButton); + Stick = Axis(CommonUsages.primary2DAxis); + +#if UNITY_EDITOR + if (!HasControllers) KeyboardFallback(); +#endif + + PrimaryDown = Primary && !primaryLast; + SecondaryDown = Secondary && !secondaryLast; + TriggerDown = Trigger && !triggerLast; + primaryLast = Primary; secondaryLast = Secondary; triggerLast = Trigger; + + // Capped per frame: a hitch (a scene loading, a stutter) must not turn a tap into a long hold. + SecondaryHeld = Secondary ? SecondaryHeld + Mathf.Min(Time.unscaledDeltaTime, MaxHoldStep) : 0f; + AnyInput = Primary || Secondary || Trigger || Grip || Stick.sqrMagnitude > 0.25f; + + StepX = 0; + stickCooldown -= Time.unscaledDeltaTime; + if (Mathf.Abs(Stick.x) < StickDeadzone * 0.5f) stickCooldown = 0f; + else if (Mathf.Abs(Stick.x) > StickDeadzone && stickCooldown <= 0f) + { + StepX = (int)Mathf.Sign(Stick.x); + stickCooldown = 0.35f; + } + } + + /// A short buzz. Silently does nothing on devices without haptics. + public void Rumble(float amplitude = 0.3f, float duration = 0.06f) + { + Rumble(right, amplitude, duration); + Rumble(left, amplitude, duration); + } + + static void Rumble(InputDevice d, float amplitude, float duration) + { + if (d.isValid && d.TryGetHapticCapabilities(out var caps) && caps.supportsImpulse) + d.SendHapticImpulse(0, amplitude, duration); + } + + bool Button(InputFeatureUsage usage) + { + bool a = right.isValid && right.TryGetFeatureValue(usage, out bool rv) && rv; + bool b = left.isValid && left.TryGetFeatureValue(usage, out bool lv) && lv; + return a || b; + } + + Vector2 Axis(InputFeatureUsage usage) + { + Vector2 v = Vector2.zero; + if (left.isValid && left.TryGetFeatureValue(usage, out Vector2 lv)) v = lv; + if (right.isValid && right.TryGetFeatureValue(usage, out Vector2 rv) && rv.sqrMagnitude > v.sqrMagnitude) v = rv; + return v; + } + + static InputDevice FirstDevice(InputDeviceCharacteristics characteristics) + { + var devices = new List(); + InputDevices.GetDevicesWithCharacteristics(characteristics, devices); + return devices.Count > 0 ? devices[0] : default; + } + +#if UNITY_EDITOR + // Left/right arrow or A/D to move, Space/Enter to confirm, Escape as B/Y. + void KeyboardFallback() + { + var kb = UnityEngine.InputSystem.Keyboard.current; + if (kb == null) return; + Primary = kb.spaceKey.isPressed || kb.enterKey.isPressed; + Secondary = kb.escapeKey.isPressed; + Trigger = kb.leftCtrlKey.isPressed; + float x = (kb.rightArrowKey.isPressed || kb.dKey.isPressed ? 1f : 0f) + - (kb.leftArrowKey.isPressed || kb.aKey.isPressed ? 1f : 0f); + Stick = new Vector2(x, 0f); + } +#endif +} diff --git a/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs.meta b/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs.meta new file mode 100644 index 00000000..cdae797b --- /dev/null +++ b/Assets/1.TeamWorkspace/MainMenu/Scripts/XRButtons.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f67715a57f2584cad8bd348b32509a29 \ No newline at end of file diff --git a/Assets/1.TeamWorkspace/Module1/GameSystem/SendRecieveData.cs b/Assets/1.TeamWorkspace/Module1/GameSystem/SendRecieveData.cs index 9df9984b..7878803a 100644 --- a/Assets/1.TeamWorkspace/Module1/GameSystem/SendRecieveData.cs +++ b/Assets/1.TeamWorkspace/Module1/GameSystem/SendRecieveData.cs @@ -53,7 +53,7 @@ protected override void OtherUpdate() isConnected = false; if (img != null) img.color = Color.red; } - if (SceneManager.GetActiveScene().buildIndex!=0) + if (!SaveManager.InStartScene) { if (GameManager.instance == null) { @@ -68,7 +68,7 @@ protected override void OtherUpdate() SendScore(69); } } - else if(SceneManager.GetActiveScene().buildIndex==0) + else { SendScore(1); } diff --git a/Assets/1.TeamWorkspace/Module1/Module1_Main/SaveSystem/SaveManager.cs b/Assets/1.TeamWorkspace/Module1/Module1_Main/SaveSystem/SaveManager.cs index 01fffd5c..f817514a 100644 --- a/Assets/1.TeamWorkspace/Module1/Module1_Main/SaveSystem/SaveManager.cs +++ b/Assets/1.TeamWorkspace/Module1/Module1_Main/SaveSystem/SaveManager.cs @@ -7,16 +7,31 @@ public class SaveManager : MonoBehaviour public int time_M, time_S; public PlayerSavedData a; public static SaveManager instance; + + /// + /// Module 1's start screen. A run begins there, so that is where the save is reset. This used to + /// test for build index 0, which stopped meaning the start screen once the module select menu + /// took that slot. + /// + public const string StartScene = "Startup Menu_New"; + public static bool InStartScene => SceneManager.GetActiveScene().name == StartScene; + private void Awake() { if (instance != null && instance != this) { - Destroy(gameObject); - return; + if (!InStartScene) + { + Destroy(gameObject); + return; + } + // Back at the start screen with the last run's manager still alive: the player left + // that run through the module menu instead of playing it out. Start a fresh one. + Destroy(instance.gameObject); } instance = this; DontDestroyOnLoad(gameObject); - if (SceneManager.GetActiveScene().buildIndex == 0) + if (InStartScene) { a.time = (time_M) * 60 + time_S; deleteSave(); diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index b34f4ed0..e7e3586b 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,15 +5,27 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 0 - path: Assets/Scenes/Scenes by Simple/Unity VR Template/SampleScene.unity - guid: 55daccc09a3b69647bbab145b54a3ab3 + - enabled: 1 + path: Assets/1.TeamWorkspace/MainMenu/Scene/Module Select.unity + guid: cbbe7617cbbf54a5599d5c78f1396480 - enabled: 1 path: Assets/1.TeamWorkspace/Module1/Scene/Startup Menu_New.unity guid: 85c292e6454855f4d9b3982692cf76e3 + - enabled: 1 + path: Assets/1.TeamWorkspace/Module1/Scene/Main Scene.unity + guid: 69e69fcaf6fe326439ca73d9fc683741 + - enabled: 1 + path: Assets/1.TeamWorkspace/Module2/Scene/Module_2_MainScene.unity + guid: 35c87c2dd13eadf4ba7464dde81e7162 + - enabled: 1 + path: Assets/1.TeamWorkspace/Module2/Scene/Tutorial_M2.unity + guid: 09ca6f8027d54bc419ae98675c7c4d69 - enabled: 1 path: Assets/Scenes/Scenes by Simple/Menu/IP Menu.unity guid: a6898870ea3a74b8eaf4ae0815720f93 + - enabled: 0 + path: Assets/Scenes/Scenes by Simple/Unity VR Template/SampleScene.unity + guid: 55daccc09a3b69647bbab145b54a3ab3 - enabled: 0 path: Assets/Scenes/Scenes by Simple/Menu/End of Game Menu.unity guid: 931173f81a7164b55a0e2f094ac25ae8 @@ -50,18 +62,12 @@ EditorBuildSettings: - enabled: 0 path: Assets/1.TeamWorkspace/Module1/Scene/Module1.unity guid: ec50f16f89219eb4d91cc4d03cf18bde - - enabled: 1 - path: Assets/1.TeamWorkspace/Module1/Scene/Main Scene.unity - guid: 69e69fcaf6fe326439ca73d9fc683741 - enabled: 0 path: Assets/Scenes/Scenes by Simple/Code Examples/Receive Water Data.unity guid: e432add6f06a341039153cf5e865ad9d - enabled: 0 path: Assets/Scenes/Scenes by Simple/Menu/Startup Menu.unity guid: fba6476e9c9b14afe9a8c87e93375ad1 - - enabled: 0 - path: Assets/1.TeamWorkspace/Module2/Scene/Module_2_MainScene.unity - guid: 35c87c2dd13eadf4ba7464dde81e7162 m_configObjects: Unity.XR.Oculus.Settings: {fileID: 11400000, guid: bfa1182bd221b4ca89619141f66f1260, type: 2} Unity.XR.WindowsMR.Settings: {fileID: 11400000, guid: dc5a169419fa04987b057f65238cf3ba, type: 2} diff --git a/README.md b/README.md index 98d4f1e6..63f86364 100644 --- a/README.md +++ b/README.md @@ -77,24 +77,30 @@ Two committed scripts cover the whole loop. There is no separate "make an APK" s Unity's player build *is* the APK, written signed and ready to sideload. ```bash -Tools/build.sh 2 # build module 2 -> build/Android/AEDES-Module2.apk -Tools/deploy.sh 2 # install it on the attached headset and launch it +Tools/build.sh app # the whole app -> build/Android/AEDES.apk +Tools/deploy.sh app # install it on the attached headset and launch it -Tools/build-and-deploy.sh 2 # both in one command +Tools/build-and-deploy.sh app # both in one command ``` ### Modules -Each module is built and deployed separately for now. +`app` is what a class should get: it starts on the **Module Select** menu +(`Assets/1.TeamWorkspace/MainMenu/`) and contains every module in the build list. Inside a +module, holding **B** (or **Y**) for 1.5 s returns to the menu. If the build list gets +scrambled, **AEDES > Rebuild Module Select Scene** puts it back. -| Key | Module | Scene | +The other keys build a single module on its own, which is quicker while working on it: + +| Key | Contents | Scenes | |---|---|---| -| `1` | Play as the mosquito | `Module_1_MainScene` | +| `app` | Module select menu + all modules | the enabled scenes in Build Settings | +| `1` | Play as the mosquito | `Startup Menu_New`, `Main Scene` | | `2` | Household vector control | `Module_2_MainScene` | | `tut2` | Module 2 tutorial | `Tutorial_M2` | -Scenes are located by filename, so moving or renaming their folders will not break the -scripts. Build Settings are ignored: each build contains only that module's scene. +Single-module scenes are located by filename, so moving or renaming their folders will not +break the scripts, and Build Settings are ignored for them. > **Only one module can be installed at a time.** They all share the application id > `com.unity.template.vr`, so deploying module 2 replaces module 1 on the headset. diff --git a/Tools/aedes-common.sh b/Tools/aedes-common.sh index 2086ece4..705b5eeb 100755 --- a/Tools/aedes-common.sh +++ b/Tools/aedes-common.sh @@ -26,24 +26,17 @@ warn() { printf '\033[33mwarning:\033[0m %s\n' "$*" >&2; } usage_modules() { cat >&2 <<'USAGE' modules: - 1 Module 1 - play as the mosquito (Module_1_MainScene) + app The whole app: module select menu + every module in the build list + 1 Module 1 - play as the mosquito (Startup Menu_New + Main Scene) 2 Module 2 - household vector control (Module_2_MainScene) tut2 Module 2 tutorial (Tutorial_M2) USAGE } -# Map a module key to its scene file. Located by filename rather than a fixed path so -# that folder reorganisations (GameTesting -> Module1, Phettae -> Module2) do not break it. -module_scene() { - local key="$1" name - case "$key" in - 1) name="Module_1_MainScene" ;; - 2) name="Module_2_MainScene" ;; - tut2) name="Tutorial_M2" ;; - *) usage_modules; die "unknown module '$key'" ;; - esac - - local matches count +# Locate one scene by filename under the team workspace, so that folder reorganisations +# (GameTesting -> Module1, Phettae -> Module2) do not break the scripts. +find_scene() { + local name="$1" matches count matches="$(cd "$REPO_ROOT" && find Assets/1.TeamWorkspace -name "$name.unity" -not -path '*/_Recovery/*')" count="$(printf '%s' "$matches" | grep -c . || true)" @@ -55,8 +48,23 @@ module_scene() { printf '%s\n' "$matches" | head -1 } +# Map a module key to the scenes to build, ';'-separated. Empty means "the enabled scenes in +# the build list", which is what AedesBuild falls back to. +module_scene() { + case "$1" in + app) printf '\n' ;; + # Module 1 starts on the team's start screen and returns there when time runs out, so a + # Module 1 build needs both scenes. + 1) printf '%s;%s\n' "$(find_scene 'Startup Menu_New')" "$(find_scene 'Main Scene')" ;; + 2) find_scene Module_2_MainScene ;; + tut2) find_scene Tutorial_M2 ;; + *) usage_modules; die "unknown module '$1'" ;; + esac +} + module_apk() { case "$1" in + app) printf 'build/Android/AEDES.apk\n' ;; 1) printf 'build/Android/AEDES-Module1.apk\n' ;; 2) printf 'build/Android/AEDES-Module2.apk\n' ;; tut2) printf 'build/Android/AEDES-TutorialM2.apk\n' ;; diff --git a/Tools/build-and-deploy.sh b/Tools/build-and-deploy.sh index 9b31fc2a..1cf67739 100755 --- a/Tools/build-and-deploy.sh +++ b/Tools/build-and-deploy.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash # Build a module and put it on the attached headset in one command. # -# Tools/build-and-deploy.sh <1|2|tut2> [--clean] +# Tools/build-and-deploy.sh [--clean] HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" MODULE="${1:-}" -[ -z "$MODULE" ] && { echo "usage: Tools/build-and-deploy.sh <1|2|tut2> [--clean]" >&2; exit 1; } +[ -z "$MODULE" ] && { echo "usage: Tools/build-and-deploy.sh [--clean]" >&2; exit 1; } shift "$HERE/build.sh" "$MODULE" "$@" && "$HERE/deploy.sh" "$MODULE" diff --git a/Tools/build.sh b/Tools/build.sh index ea6d6bd9..da102ef3 100755 --- a/Tools/build.sh +++ b/Tools/build.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Build an AEDES module into a sideloadable APK. # -# Tools/build.sh <1|2|tut2> [--clean] +# Tools/build.sh [--clean] # # The player build IS the APK - Unity writes a signed .apk directly, so there is no # separate packaging step. @@ -10,7 +10,7 @@ source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/aedes-common.sh" MODULE="${1:-}" CLEAN="" -[ -z "$MODULE" ] && { echo "usage: Tools/build.sh <1|2|tut2> [--clean]" >&2; usage_modules; exit 1; } +[ -z "$MODULE" ] && { echo "usage: Tools/build.sh [--clean]" >&2; usage_modules; exit 1; } shift for arg in "$@"; do case "$arg" in @@ -59,7 +59,7 @@ check_result() { } info "Building module $MODULE" -info " scene: $SCENE" +info " scenes: ${SCENE:-(enabled scenes in the build list)}" info " output: $APK" [ -n "$CLEAN" ] && info " clean build (IL2CPP recompiles from scratch - several minutes)" diff --git a/Tools/deploy.sh b/Tools/deploy.sh index 60cb375a..97dcde68 100755 --- a/Tools/deploy.sh +++ b/Tools/deploy.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Install an already-built AEDES module onto an attached Quest and launch it. # -# Tools/deploy.sh <1|2|tut2> [--no-launch] [--wait ] +# Tools/deploy.sh [--no-launch] [--wait ] # # Every module installs under the same application id, so only one can be on the headset # at a time - deploying module 2 replaces module 1. @@ -14,7 +14,7 @@ ACTIVITY="$APP_ID/com.unity3d.player.UnityPlayerGameActivity" MODULE="${1:-}" LAUNCH=1 WAIT_SECS=180 -[ -z "$MODULE" ] && { echo "usage: Tools/deploy.sh <1|2|tut2> [--no-launch] [--wait ]" >&2; usage_modules; exit 1; } +[ -z "$MODULE" ] && { echo "usage: Tools/deploy.sh [--no-launch] [--wait ]" >&2; usage_modules; exit 1; } shift while [ $# -gt 0 ]; do case "$1" in