diff --git a/Assets/GameMain/Configs/ResourceBuilder.xml b/Assets/GameMain/Configs/ResourceBuilder.xml index ad28384..4ae4959 100644 --- a/Assets/GameMain/Configs/ResourceBuilder.xml +++ b/Assets/GameMain/Configs/ResourceBuilder.xml @@ -2,14 +2,14 @@ - 1 - 33 + 3 + 32 1 UnityGameFramework.Runtime.DefaultCompressionHelper False False SepCore.Editor.DefaultBuildEventHandler - D:/Learn/GameLearn/UnityProjects/VampireLike/bin/AssetBundles + D:/UnityProjects/VampireLike/bin/AssetBundles True True True diff --git a/Assets/GameMain/Configs/ResourceCollection.xml b/Assets/GameMain/Configs/ResourceCollection.xml index f3c895d..84a39c1 100644 --- a/Assets/GameMain/Configs/ResourceCollection.xml +++ b/Assets/GameMain/Configs/ResourceCollection.xml @@ -11,7 +11,6 @@ - @@ -35,6 +34,7 @@ + @@ -72,7 +72,6 @@ - @@ -102,7 +101,6 @@ - @@ -147,6 +145,7 @@ + @@ -162,11 +161,9 @@ - - @@ -197,7 +194,6 @@ - @@ -223,8 +219,9 @@ - + + diff --git a/Assets/GameMain/DataTables/Level.txt b/Assets/GameMain/DataTables/Level.txt index d2f8582..32a9bcc 100644 --- a/Assets/GameMain/DataTables/Level.txt +++ b/Assets/GameMain/DataTables/Level.txt @@ -1,7 +1,7 @@ # Id 列1 EnemyTypes EntityCounts Interval Duration # int int[] int[] float[] int # 关卡号 策划备注 敌人类型 每次出怪数量 每次出怪间隔 关卡时间 - 1 第一关-新手引导 [1,2] [5,2] [4,5] 60 + 1 第一关-新手引导 [1,2] [10,8] [1,2] 600 2 第二关-纯近战试炼 [1] [8] [3.5] 60 3 第三关-蝙蝠来袭 [1,3] [6,4] [3.5,3] 60 4 第四关-骷髅军团 [4,2] [6,4] [3,4] 60 diff --git a/Assets/GameMain/DebugPanel/RuntimeDebugPanelComponent.cs b/Assets/GameMain/DebugPanel/RuntimeDebugPanelComponent.cs index 9242805..ba69441 100644 --- a/Assets/GameMain/DebugPanel/RuntimeDebugPanelComponent.cs +++ b/Assets/GameMain/DebugPanel/RuntimeDebugPanelComponent.cs @@ -1,4 +1,3 @@ -#if UNITY_EDITOR || DEVELOPMENT_BUILD using System; using System.Linq; using SepCore.Event; @@ -36,7 +35,9 @@ public class RuntimeDebugPanelComponent : MonoBehaviour [SerializeField] private bool _showPlayerHealthControls = true; [SerializeField] private bool _showTips = true; - private Rect _windowRect = new Rect(20f, 60f, 460f, 800f); + private Rect _windowRect; + private Vector2 _panelScroll; + private GUISkin _panelSkin; private bool _isPanelVisible; private int _windowId; @@ -77,17 +78,58 @@ public class RuntimeDebugPanelComponent : MonoBehaviour private void OnGUI() { - DrawToggleButton(); - if (!_isPanelVisible) return; + GUISkin previousSkin = GUI.skin; + Matrix4x4 previousMatrix = GUI.matrix; + if (_panelSkin == null) + { + _panelSkin = Instantiate(previousSkin); + _panelSkin.label.fontSize = 18; + _panelSkin.label.wordWrap = true; + _panelSkin.button.fontSize = 18; + _panelSkin.button.padding = new RectOffset(12, 12, 10, 10); + _panelSkin.button.fixedHeight = 44f; + _panelSkin.textField.fontSize = 20; + _panelSkin.textField.fixedHeight = 44f; + _panelSkin.textField.padding = new RectOffset(10, 10, 10, 10); + _panelSkin.window.padding = new RectOffset(16, 16, 12, 16); + _panelSkin.verticalScrollbar.fixedWidth = 28f; + _panelSkin.verticalScrollbarThumb.fixedWidth = 28f; + } - _windowRect = GUI.Window(_windowId, _windowRect, DrawWindow, "Runtime Debug Panel"); + Rect safeArea = Screen.safeArea; + float scale = Mathf.Max(0.1f, Mathf.Min(safeArea.width, safeArea.height) / 480f); + Rect bounds = new Rect(0f, 0f, safeArea.width / scale, safeArea.height / scale); + try + { + GUI.skin = _panelSkin; + GUI.matrix = Matrix4x4.TRS( + new Vector3(safeArea.x, Screen.height - safeArea.yMax, 0f), + Quaternion.identity, new Vector3(scale, scale, 1f)); + DrawToggleButton(bounds); + if (!_isPanelVisible) return; + + float width = Mathf.Min(460f, bounds.width - 24f); + _windowRect = new Rect(bounds.width - width - 12f, 72f, width, + Mathf.Min(760f, bounds.height - 84f)); + GUI.Window(_windowId, _windowRect, DrawWindow, string.Empty); + } + finally + { + GUI.matrix = previousMatrix; + GUI.skin = previousSkin; + } } - private void DrawToggleButton() + private void OnDestroy() { - const float width = 64f; - const float height = 30f; - Rect buttonRect = new Rect(Screen.width - width - 12f, 10f, width, height); + if (_panelSkin != null) Destroy(_panelSkin); + } + + private void DrawToggleButton(Rect bounds) + { + const float width = 120f; + const float height = 48f; + Rect buttonRect = new Rect(bounds.width - width - 12f, 12f, width, height); if (GUI.Button(buttonRect, "DEBUG")) { _isPanelVisible = !_isPanelVisible; @@ -102,6 +144,12 @@ public class RuntimeDebugPanelComponent : MonoBehaviour } GUILayout.BeginVertical(); + GUILayout.BeginHorizontal(); + GUILayout.Label("Runtime Debug", GUILayout.ExpandWidth(true)); + if (GUILayout.Button("Close", GUILayout.Width(90f))) _isPanelVisible = false; + GUILayout.EndHorizontal(); + GUILayout.Space(8f); + _panelScroll = GUILayout.BeginScrollView(_panelScroll, false, true); bool hasPreviousSection = false; if (_showBuffSection) @@ -130,20 +178,20 @@ public class RuntimeDebugPanelComponent : MonoBehaviour GUILayout.Space(8f); } - GUILayout.Label("Tips: press `F8` or tap top-left corner 3 times to toggle.", GUILayout.Height(20f)); + GUILayout.Label("Tips: press F8 or tap top-left corner 3 times to toggle."); } + GUILayout.EndScrollView(); GUILayout.EndVertical(); - GUI.DragWindow(new Rect(0, 0, 10000, 22)); } private void DrawBuffSection() { GUILayout.Label("Buff Debug"); GUILayout.BeginHorizontal(); - GUILayout.Label("Search", GUILayout.Width(52f)); + GUILayout.Label("Search", GUILayout.Width(78f)); _searchText = GUILayout.TextField(_searchText); - if (GUILayout.Button("Refresh", GUILayout.Width(80f))) + if (GUILayout.Button("Refresh", GUILayout.Width(100f))) { EnsurePropList(true); } @@ -169,12 +217,12 @@ public class RuntimeDebugPanelComponent : MonoBehaviour GUILayout.Label(ItemDescUtility.CreatePropDescription(selectedProp.Modifiers), GUILayout.Height(40f)); GUILayout.BeginHorizontal(); - GUILayout.Label("Count", GUILayout.Width(52f)); - string addCountText = GUILayout.TextField(_addCount.ToString(), GUILayout.Width(60f)); + GUILayout.Label("Count", GUILayout.Width(78f)); + string addCountText = GUILayout.TextField(_addCount.ToString(), GUILayout.Width(88f)); if (!int.TryParse(addCountText, out _addCount)) _addCount = 1; _addCount = Mathf.Clamp(_addCount, 1, 99); - if (GUILayout.Button("Add Buff To Player", GUILayout.Height(24f))) + if (GUILayout.Button("Add Buff To Player", GUILayout.Height(44f))) { AddSelectedBuffToPlayer(selectedProp, _addCount); } @@ -235,26 +283,31 @@ public class RuntimeDebugPanelComponent : MonoBehaviour if (_showSpawnControls) { + GUILayout.Space(12f); + GUILayout.Label("Enemy Spawn Rate"); GUILayout.BeginHorizontal(); - GUILayout.Label("Rate", GUILayout.Width(52f)); - string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(60f)); + GUILayout.Label("Rate", GUILayout.Width(78f)); + string rateText = GUILayout.TextField(_spawnRateScaleInput.ToString("F2"), GUILayout.Width(88f)); if (float.TryParse(rateText, out float parsedRate)) { _spawnRateScaleInput = Mathf.Clamp(parsedRate, MinSpawnRate, 50f); } - if (GUILayout.Button("Apply", GUILayout.Width(70f))) + if (GUILayout.Button("Apply", GUILayout.Width(100f))) { enemyManager.SetSpawnRateScale(_spawnRateScaleInput); } - if (GUILayout.Button("x0.5", GUILayout.Width(60f))) + GUILayout.EndHorizontal(); + GUILayout.BeginHorizontal(); + + if (GUILayout.Button("x0.5")) { _spawnRateScaleInput = Mathf.Max(MinSpawnRate, enemyManager.SpawnRateScale * 0.5f); enemyManager.SetSpawnRateScale(_spawnRateScaleInput); } - if (GUILayout.Button("x2", GUILayout.Width(60f))) + if (GUILayout.Button("x2")) { _spawnRateScaleInput = enemyManager.SpawnRateScale * 2f; enemyManager.SetSpawnRateScale(_spawnRateScaleInput); @@ -265,15 +318,17 @@ public class RuntimeDebugPanelComponent : MonoBehaviour if (_showBattleDurationControls) { + GUILayout.Space(12f); + GUILayout.Label("Battle Duration"); GUILayout.BeginHorizontal(); - GUILayout.Label("Add Sec", GUILayout.Width(52f)); - string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(60f)); + GUILayout.Label("Add Sec", GUILayout.Width(78f)); + string durationText = GUILayout.TextField(_extendDurationSeconds.ToString("F0"), GUILayout.Width(88f)); if (float.TryParse(durationText, out float parsedDuration)) { _extendDurationSeconds = Mathf.Clamp(parsedDuration, 1f, 3600f); } - if (GUILayout.Button("Extend Battle", GUILayout.Height(24f))) + if (GUILayout.Button("Extend Battle", GUILayout.Height(44f))) { if (procedure.CurrentGameState is GameStateBattle gameState) { @@ -286,16 +341,17 @@ public class RuntimeDebugPanelComponent : MonoBehaviour if (_showPlayerWeaponControls) { + GUILayout.Space(12f); GUILayout.Label( $"Player Weapon: {(player == null ? "Player not found" : (player.WeaponEnabled ? "Enabled" : "Disabled"))}"); GUILayout.BeginHorizontal(); GUI.enabled = player != null; - if (GUILayout.Button("Disable Weapons", GUILayout.Height(24f))) + if (GUILayout.Button("Disable Weapons", GUILayout.Height(44f))) { player.SetWeaponEnabled(false); } - if (GUILayout.Button("Enable Weapons", GUILayout.Height(24f))) + if (GUILayout.Button("Enable Weapons", GUILayout.Height(44f))) { player.SetWeaponEnabled(true); } @@ -311,12 +367,12 @@ public class RuntimeDebugPanelComponent : MonoBehaviour $"Player HP: {(playerHealth == null ? "Unavailable" : $"{playerHealth.CurrentHealth}/{playerHealth.MaxHealth}")}"); GUILayout.BeginHorizontal(); GUI.enabled = playerHealth != null; - if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(24f))) + if (GUILayout.Button($"+{DebugHealAmount} HP", GUILayout.Height(44f))) { AddPlayerHealth(playerHealth, DebugHealAmount); } - if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(24f))) + if (GUILayout.Button(_lockPlayerHealthToMax ? "GodMode: ON" : "GodMode: OFF", GUILayout.Height(44f))) { _lockPlayerHealthToMax = !_lockPlayerHealthToMax; if (_lockPlayerHealthToMax) @@ -525,5 +581,3 @@ public class RuntimeDebugPanelComponent : MonoBehaviour #endif } } - -#endif diff --git a/Assets/GameMain/Meshes.meta b/Assets/GameMain/Meshes.meta deleted file mode 100644 index 25c9766..0000000 --- a/Assets/GameMain/Meshes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8d68657bbcaf3164a9868d3041485557 -folderAsset: yes -timeCreated: 1528026132 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/prop_asteroid_01.FBX b/Assets/GameMain/Meshes/prop_asteroid_01.FBX deleted file mode 100644 index f93522f..0000000 Binary files a/Assets/GameMain/Meshes/prop_asteroid_01.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/prop_asteroid_01.FBX.meta b/Assets/GameMain/Meshes/prop_asteroid_01.FBX.meta deleted file mode 100644 index 24f852f..0000000 --- a/Assets/GameMain/Meshes/prop_asteroid_01.FBX.meta +++ /dev/null @@ -1,78 +0,0 @@ -fileFormatVersion: 2 -guid: baedbbad82997f445a8cb4da210404e0 -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: Group1 - 4300002: prop_asteroid_01 - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/prop_asteroid_02.FBX b/Assets/GameMain/Meshes/prop_asteroid_02.FBX deleted file mode 100644 index 36aa293..0000000 Binary files a/Assets/GameMain/Meshes/prop_asteroid_02.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/prop_asteroid_02.FBX.meta b/Assets/GameMain/Meshes/prop_asteroid_02.FBX.meta deleted file mode 100644 index c54beb9..0000000 --- a/Assets/GameMain/Meshes/prop_asteroid_02.FBX.meta +++ /dev/null @@ -1,78 +0,0 @@ -fileFormatVersion: 2 -guid: 9afa958d6d8235941b9badb42aae4370 -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: Asteroid_02 - 4300002: prop_asteroid_02 - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/prop_asteroid_03.FBX b/Assets/GameMain/Meshes/prop_asteroid_03.FBX deleted file mode 100644 index 7db39c1..0000000 Binary files a/Assets/GameMain/Meshes/prop_asteroid_03.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/prop_asteroid_03.FBX.meta b/Assets/GameMain/Meshes/prop_asteroid_03.FBX.meta deleted file mode 100644 index 8687d3b..0000000 --- a/Assets/GameMain/Meshes/prop_asteroid_03.FBX.meta +++ /dev/null @@ -1,78 +0,0 @@ -fileFormatVersion: 2 -guid: 2768a9a4c8d289840918dcb879705893 -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: Asteroid_03 - 4300002: prop_asteroid_03 - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/vehicle_enemyShip.FBX b/Assets/GameMain/Meshes/vehicle_enemyShip.FBX deleted file mode 100644 index 7393215..0000000 Binary files a/Assets/GameMain/Meshes/vehicle_enemyShip.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/vehicle_enemyShip.FBX.meta b/Assets/GameMain/Meshes/vehicle_enemyShip.FBX.meta deleted file mode 100644 index 9a7c94f..0000000 --- a/Assets/GameMain/Meshes/vehicle_enemyShip.FBX.meta +++ /dev/null @@ -1,79 +0,0 @@ -fileFormatVersion: 2 -guid: 9ddab293e2a8af3499dac05f5fd6169c -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: Ship_low - 4300002: enemy_ship - 4300004: vehicle_enemyShip - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/vehicle_playerShip.FBX b/Assets/GameMain/Meshes/vehicle_playerShip.FBX deleted file mode 100644 index 0356e52..0000000 Binary files a/Assets/GameMain/Meshes/vehicle_playerShip.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/vehicle_playerShip.FBX.meta b/Assets/GameMain/Meshes/vehicle_playerShip.FBX.meta deleted file mode 100644 index a68f725..0000000 --- a/Assets/GameMain/Meshes/vehicle_playerShip.FBX.meta +++ /dev/null @@ -1,78 +0,0 @@ -fileFormatVersion: 2 -guid: d9808401c68af274a8edfbed3d1b53c7 -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: player_ship - 4300002: vehicle_playerShip - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX b/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX deleted file mode 100644 index 6db9baa..0000000 Binary files a/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX and /dev/null differ diff --git a/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX.meta b/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX.meta deleted file mode 100644 index b4884c3..0000000 --- a/Assets/GameMain/Meshes/vehicle_playerShip_collider.FBX.meta +++ /dev/null @@ -1,78 +0,0 @@ -fileFormatVersion: 2 -guid: 5282f20eba4d44213820e21af8481932 -timeCreated: 1528026132 -licenseType: Pro -ModelImporter: - serializedVersion: 19 - fileIDToRecycleName: - 100000: //RootNode - 400000: //RootNode - 2300000: //RootNode - 3300000: //RootNode - 4300000: player_ship - 4300002: player_ship_collider - 9500000: //RootNode - materials: - importMaterials: 0 - materialName: 1 - materialSearch: 1 - animations: - legacyGenerateAnimations: 4 - bakeSimulation: 0 - resampleRotations: 1 - optimizeGameObjects: 0 - motionNodeName: - animationImportErrors: - animationImportWarnings: - animationRetargetingWarnings: - animationDoRetargetingWarnings: 0 - animationCompression: 1 - animationRotationError: 0.5 - animationPositionError: 0.5 - animationScaleError: 0.5 - animationWrapMode: 0 - extraExposedTransformPaths: [] - clipAnimations: [] - isReadable: 1 - meshes: - lODScreenPercentages: [] - globalScale: 0.01 - meshCompression: 0 - addColliders: 0 - importBlendShapes: 1 - swapUVChannels: 0 - generateSecondaryUV: 0 - useFileUnits: 1 - optimizeMeshForGPU: 1 - keepQuads: 0 - weldVertices: 1 - secondaryUVAngleDistortion: 8 - secondaryUVAreaDistortion: 15.000001 - secondaryUVHardAngle: 88 - secondaryUVPackMargin: 4 - useFileScale: 0 - tangentSpace: - normalSmoothAngle: 60 - normalImportMode: 0 - tangentImportMode: 4 - importAnimation: 0 - copyAvatar: 0 - humanDescription: - human: [] - skeleton: [] - armTwist: 0.5 - foreArmTwist: 0.5 - upperLegTwist: 0.5 - legTwist: 0.5 - armStretch: 0.05 - legStretch: 0.05 - feetSpacing: 0 - rootMotionBoneName: - hasTranslationDoF: 0 - lastHumanDescriptionAvatarSource: {instanceID: 0} - animationType: 0 - humanoidOversampling: 1 - additionalBone: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/GameMain/Scripts/Presentation/Main/Hud/HudForm.cs b/Assets/GameMain/Scripts/Presentation/Main/Hud/HudForm.cs index 839a43f..df2fa65 100644 --- a/Assets/GameMain/Scripts/Presentation/Main/Hud/HudForm.cs +++ b/Assets/GameMain/Scripts/Presentation/Main/Hud/HudForm.cs @@ -1,8 +1,10 @@ +using System.Collections; using SepCore.Event; using GameFramework.Event; using SepCore.EnemyManager; using TMPro; using UnityEngine; +using Unity.Profiling; using UnityEngine.UI; namespace SepCore.UI @@ -39,6 +41,14 @@ namespace SepCore.UI [SerializeField] private GameObject _movePromptRoot; [SerializeField] private TMP_Text _movePromptText; + [SerializeField] private TMP_Text _cpuTimeCostText; + + [SerializeField] private float _performanceStatsRefreshInterval = 0.2f; + + private ProfilerRecorder _cpuTimeRecorder; + private float _performanceStatsRefreshTimer; + private Coroutine _performanceStatsCoroutine; + public void RefreshUI(HudContext hudContext) { RefreshMovePrompt(hudContext?.MovePrompt); @@ -73,6 +83,41 @@ namespace SepCore.UI _enemy = GameEntry.EnemyManager; } + protected override void OnOpen(object userData) + { + base.OnOpen(userData); + + StartPerformanceStatsCollection(); + } + + protected override void OnPause() + { + StopPerformanceStatsCoroutine(); + base.OnPause(); + } + + protected override void OnResume() + { + base.OnResume(); + + StartPerformanceStatsCoroutine(); + } + + private void StartPerformanceStatsCollection() + { + DisposePerformanceStatsRecorders(); + _cpuTimeRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15); + + StartPerformanceStatsCoroutine(); + } + + private void StartPerformanceStatsCoroutine() + { + StopPerformanceStatsCoroutine(); + _performanceStatsRefreshTimer = 0f; + _performanceStatsCoroutine = StartCoroutine(RefreshPerformanceStatsAtEndOfFrame()); + } + protected override void OnClose(bool isShutdown, object userData) { GameEntry.Event.Unsubscribe(PlayerLevelUpEventArgs.EventId, PlayerLevelUp); @@ -81,9 +126,29 @@ namespace SepCore.UI GameEntry.Event.Unsubscribe(PlayerCoinChangeEventArgs.EventId, PlayerCoinChange); GameEntry.Event.Unsubscribe(PlayerLevelUpEventArgs.EventId, PlayerLevelUp); + StopPerformanceStatsCoroutine(); + DisposePerformanceStatsRecorders(); + base.OnClose(isShutdown, userData); } - + + private void StopPerformanceStatsCoroutine() + { + if (_performanceStatsCoroutine != null) + { + StopCoroutine(_performanceStatsCoroutine); + _performanceStatsCoroutine = null; + } + } + + private void DisposePerformanceStatsRecorders() + { + if (_cpuTimeRecorder.Valid) + { + _cpuTimeRecorder.Dispose(); + } + } + protected override void OnUpdate(float elapseSeconds, float realElapseSeconds) { base.OnUpdate(elapseSeconds, realElapseSeconds); @@ -100,6 +165,51 @@ namespace SepCore.UI #endregion + private IEnumerator RefreshPerformanceStatsAtEndOfFrame() + { + WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame(); + while (true) + { + yield return waitForEndOfFrame; + + _performanceStatsRefreshTimer -= Time.unscaledDeltaTime; + if (_performanceStatsRefreshTimer > 0f) continue; + + _performanceStatsRefreshTimer = Mathf.Max(0.05f, _performanceStatsRefreshInterval); + RefreshPerformanceStats(); + } + } + + private void RefreshPerformanceStats() + { + if (_cpuTimeCostText == null) return; + + bool hasCpuFrame = TryGetLastValue(_cpuTimeRecorder, out long cpuFrameNanoseconds); + + if (!hasCpuFrame) + { + _cpuTimeCostText.text = + "CPU Frame: -- ms\nSimulation: -- ms\nJob Wait: -- ms"; + return; + } + + float cpuFrameMilliseconds = cpuFrameNanoseconds / 1_000_000f; + + _cpuTimeCostText.SetText("CPU Frame: {0:2} ms",cpuFrameMilliseconds); + } + + private static bool TryGetLastValue(ProfilerRecorder recorder, out long value) + { + if (recorder.Valid && recorder.Count > 0) + { + value = recorder.LastValue; + return true; + } + + value = 0; + return false; + } + #region Event Handlers private void PlayerHpChange(object sender, GameEventArgs e) diff --git a/Assets/GameMain/UI/UIForms/HudForm.prefab b/Assets/GameMain/UI/UIForms/HudForm.prefab index a32a357..5bba7d8 100644 --- a/Assets/GameMain/UI/UIForms/HudForm.prefab +++ b/Assets/GameMain/UI/UIForms/HudForm.prefab @@ -302,6 +302,42 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &1254538346940764031 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5180695496978991772} + m_Layer: 5 + m_Name: CPUTimeCost + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5180695496978991772 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1254538346940764031} + 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: 5394394129721257420} + m_Father: {fileID: 5845023051097607336} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 50, y: -470} + m_SizeDelta: {x: 600, y: 400} + m_Pivot: {x: 0, y: 1} --- !u!1 &1588863174275057922 GameObject: m_ObjectHideFlags: 0 @@ -933,6 +969,7 @@ RectTransform: - {fileID: 1455300086952074150} - {fileID: 2701155363628883645} - {fileID: 5367559285010484074} + - {fileID: 5180695496978991772} - {fileID: 716378031281921353} - {fileID: 844544797351374585} m_Father: {fileID: 0} @@ -964,6 +1001,8 @@ MonoBehaviour: _enemyCountText: {fileID: 1716982582738894949} _movePromptRoot: {fileID: 1181223948078793352} _movePromptText: {fileID: 4622934279017998176} + _cpuTimeCostText: {fileID: 3568634826224029446} + _performanceStatsRefreshInterval: 0.2 --- !u!1 &5990189277179061188 GameObject: m_ObjectHideFlags: 0 @@ -1651,3 +1690,138 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!1 &8883820757741353608 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5394394129721257420} + - component: {fileID: 7988281595709803232} + - component: {fileID: 3568634826224029446} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5394394129721257420 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8883820757741353608} + 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: 5180695496978991772} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7988281595709803232 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8883820757741353608} + m_CullTransparentMesh: 1 +--- !u!114 &3568634826224029446 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8883820757741353608} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "CPU Frame: -- ms\nSimulation: -- ms\nJob Wait: -- ms\nGC Alloc: -- B/frame" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 99d811b0183246646a2ce8df996f4bca, type: 2} + m_sharedMaterial: {fileID: -1106088975554028259, guid: 99d811b0183246646a2ce8df996f4bca, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 11400000, guid: bc065bcf1474d7d4387fafd202678c37, type: 2} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 50 + m_fontSizeBase: 50 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 1 + m_VerticalAlignment: 256 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} diff --git a/数据表/Level.xlsx b/数据表/Level.xlsx index a06b1e6..829634e 100644 Binary files a/数据表/Level.xlsx and b/数据表/Level.xlsx differ