From f7659b6a5780e67fdeefcca4fbf2431705273c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Matkowski?= Date: Sat, 24 Dec 2022 16:24:10 +0100 Subject: [PATCH 1/4] Create Debugging package --- .github/workflows/ci-dev.yml | 19 + .../Editor.meta => Examples/Prefabs.meta} | 2 +- Assets/Examples/Prefabs/Debugging.prefab | 152 +++++++ Assets/Examples/Prefabs/Debugging.prefab.meta | 7 + Assets/Examples/Scenes.meta | 8 + Assets/Examples/Scenes/SampleScene.unity | 370 ++++++++++++++++++ Assets/Examples/Scenes/SampleScene.unity.meta | 7 + Assets/Examples/Scriptables.meta | 8 + .../Scriptables/Commands Repository.asset | 18 + .../Commands Repository.asset.meta | 8 + Assets/Examples/Scriptables/Commands.meta | 8 + .../Scriptables/Commands/Clear Command.asset | 14 + .../Commands/Clear Command.asset.meta | 8 + .../Scriptables/Commands/Help Command.asset | 14 + .../Commands/Help Command.asset.meta | 8 + .../Scriptables/Commands/Test Command.asset | 14 + .../Commands/Test Command.asset.meta | 8 + Assets/Package/CHANGELOG.md.meta | 2 +- Assets/Package/LICENSE.md.meta | 2 +- Assets/Package/README.md | 9 +- Assets/Package/README.md.meta | 2 +- Assets/Package/Runtime.meta | 2 +- Assets/Package/Runtime/AssemblyInfo.cs | 3 + Assets/Package/Runtime/AssemblyInfo.cs.meta | 11 + .../Package/Runtime/BroWar.Debugging.asmdef | 18 + .../Runtime/BroWar.Debugging.asmdef.meta | 7 + Assets/Package/Runtime/Console.meta | 8 + .../Console/ArgumentExtractionException.cs | 13 + .../ArgumentExtractionException.cs.meta | 11 + .../Package/Runtime/Console/CommandResult.cs | 16 + .../Runtime/Console/CommandResult.cs.meta | 11 + Assets/Package/Runtime/Console/Commands.meta | 8 + .../Runtime/Console/Commands/ClearCommand.cs | 31 ++ .../Console/Commands/ClearCommand.cs.meta | 11 + .../Runtime/Console/Commands/HelpCommand.cs | 29 ++ .../Console/Commands/HelpCommand.cs.meta | 11 + .../Runtime/Console/Commands/TestCommand.cs | 28 ++ .../Console/Commands/TestCommand.cs.meta | 11 + .../Runtime/Console/CommandsRepository.cs | 36 ++ .../Console/CommandsRepository.cs.meta | 11 + .../Package/Runtime/Console/ConsoleCommand.cs | 11 + .../Runtime/Console/ConsoleCommand.cs.meta | 11 + Assets/Package/Runtime/Console/ConsoleGui.cs | 309 +++++++++++++++ .../Runtime/Console/ConsoleGui.cs.meta | 11 + .../Package/Runtime/Console/ConsoleHistory.cs | 102 +++++ .../Runtime/Console/ConsoleHistory.cs.meta | 11 + .../Runtime/Console/ConsoleInputSettings.cs | 24 ++ .../Console/ConsoleInputSettings.cs.meta | 11 + .../Package/Runtime/Console/ConsoleManager.cs | 273 +++++++++++++ .../Runtime/Console/ConsoleManager.cs.meta | 11 + .../Runtime/Console/ConsoleManagerSettings.cs | 16 + .../Console/ConsoleManagerSettings.cs.meta | 11 + .../Runtime/Console/ConsoleStyleSettings.cs | 20 + .../Console/ConsoleStyleSettings.cs.meta | 11 + .../Package/Runtime/Console/ConsoleUtility.cs | 73 ++++ .../Runtime/Console/ConsoleUtility.cs.meta | 11 + .../Console/IConsoleHistoryDisposer.cs | 12 + .../Console/IConsoleHistoryDisposer.cs.meta | 11 + .../Runtime/Console/IConsoleManager.cs | 9 + .../Runtime/Console/IConsoleManager.cs.meta | 11 + Assets/Package/Runtime/Console/MessageType.cs | 9 + .../Runtime/Console/MessageType.cs.meta | 11 + Assets/Package/Runtime/FpsCounter.cs | 19 + Assets/Package/Runtime/FpsCounter.cs.meta | 11 + Assets/Package/Runtime/GameKiller.cs | 32 ++ Assets/Package/Runtime/GameKiller.cs.meta | 11 + Assets/Package/Runtime/ScenesLoader.cs | 67 ++++ Assets/Package/Runtime/ScenesLoader.cs.meta | 11 + Assets/Package/Runtime/VersionDisplayer.cs | 14 + .../Package/Runtime/VersionDisplayer.cs.meta | 11 + Assets/Package/Tests.meta | 2 +- Assets/Package/Tests/Runtime.meta | 8 + .../Tests/Runtime/ArgumentExtractionTest.cs | 33 ++ .../Runtime/ArgumentExtractionTest.cs.meta | 11 + .../Runtime/BroWar.Debugging.Tests.asmdef | 22 ++ .../BroWar.Debugging.Tests.asmdef.meta | 7 + Assets/Package/package.json | 18 +- Assets/Package/package.json.meta | 2 +- Packages/manifest.json | 14 +- Packages/packages-lock.json | 25 ++ ProjectSettings/EditorBuildSettings.asset | 5 +- ProjectSettings/PackageManagerSettings.asset | 24 +- ProjectSettings/ProjectSettings.asset | 2 +- README.md | 9 +- 84 files changed, 2272 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/ci-dev.yml rename Assets/{Package/Editor.meta => Examples/Prefabs.meta} (77%) create mode 100644 Assets/Examples/Prefabs/Debugging.prefab create mode 100644 Assets/Examples/Prefabs/Debugging.prefab.meta create mode 100644 Assets/Examples/Scenes.meta create mode 100644 Assets/Examples/Scenes/SampleScene.unity create mode 100644 Assets/Examples/Scenes/SampleScene.unity.meta create mode 100644 Assets/Examples/Scriptables.meta create mode 100644 Assets/Examples/Scriptables/Commands Repository.asset create mode 100644 Assets/Examples/Scriptables/Commands Repository.asset.meta create mode 100644 Assets/Examples/Scriptables/Commands.meta create mode 100644 Assets/Examples/Scriptables/Commands/Clear Command.asset create mode 100644 Assets/Examples/Scriptables/Commands/Clear Command.asset.meta create mode 100644 Assets/Examples/Scriptables/Commands/Help Command.asset create mode 100644 Assets/Examples/Scriptables/Commands/Help Command.asset.meta create mode 100644 Assets/Examples/Scriptables/Commands/Test Command.asset create mode 100644 Assets/Examples/Scriptables/Commands/Test Command.asset.meta create mode 100644 Assets/Package/Runtime/AssemblyInfo.cs create mode 100644 Assets/Package/Runtime/AssemblyInfo.cs.meta create mode 100644 Assets/Package/Runtime/BroWar.Debugging.asmdef create mode 100644 Assets/Package/Runtime/BroWar.Debugging.asmdef.meta create mode 100644 Assets/Package/Runtime/Console.meta create mode 100644 Assets/Package/Runtime/Console/ArgumentExtractionException.cs create mode 100644 Assets/Package/Runtime/Console/ArgumentExtractionException.cs.meta create mode 100644 Assets/Package/Runtime/Console/CommandResult.cs create mode 100644 Assets/Package/Runtime/Console/CommandResult.cs.meta create mode 100644 Assets/Package/Runtime/Console/Commands.meta create mode 100644 Assets/Package/Runtime/Console/Commands/ClearCommand.cs create mode 100644 Assets/Package/Runtime/Console/Commands/ClearCommand.cs.meta create mode 100644 Assets/Package/Runtime/Console/Commands/HelpCommand.cs create mode 100644 Assets/Package/Runtime/Console/Commands/HelpCommand.cs.meta create mode 100644 Assets/Package/Runtime/Console/Commands/TestCommand.cs create mode 100644 Assets/Package/Runtime/Console/Commands/TestCommand.cs.meta create mode 100644 Assets/Package/Runtime/Console/CommandsRepository.cs create mode 100644 Assets/Package/Runtime/Console/CommandsRepository.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleCommand.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleCommand.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleGui.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleGui.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleHistory.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleHistory.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleInputSettings.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleInputSettings.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleManager.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleManager.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleManagerSettings.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleManagerSettings.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleStyleSettings.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleStyleSettings.cs.meta create mode 100644 Assets/Package/Runtime/Console/ConsoleUtility.cs create mode 100644 Assets/Package/Runtime/Console/ConsoleUtility.cs.meta create mode 100644 Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs create mode 100644 Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs.meta create mode 100644 Assets/Package/Runtime/Console/IConsoleManager.cs create mode 100644 Assets/Package/Runtime/Console/IConsoleManager.cs.meta create mode 100644 Assets/Package/Runtime/Console/MessageType.cs create mode 100644 Assets/Package/Runtime/Console/MessageType.cs.meta create mode 100644 Assets/Package/Runtime/FpsCounter.cs create mode 100644 Assets/Package/Runtime/FpsCounter.cs.meta create mode 100644 Assets/Package/Runtime/GameKiller.cs create mode 100644 Assets/Package/Runtime/GameKiller.cs.meta create mode 100644 Assets/Package/Runtime/ScenesLoader.cs create mode 100644 Assets/Package/Runtime/ScenesLoader.cs.meta create mode 100644 Assets/Package/Runtime/VersionDisplayer.cs create mode 100644 Assets/Package/Runtime/VersionDisplayer.cs.meta create mode 100644 Assets/Package/Tests/Runtime.meta create mode 100644 Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs create mode 100644 Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs.meta create mode 100644 Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef create mode 100644 Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef.meta diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml new file mode 100644 index 0000000..d75c0bb --- /dev/null +++ b/.github/workflows/ci-dev.yml @@ -0,0 +1,19 @@ +name: CI +on: + push: + branches: + - develop +jobs: + split-upm: + name: split upm branch + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: split upm branch + run: | + git subtree split -P "$PKG_ROOT" -b upm-dev + git push -u origin upm-dev + env: + PKG_ROOT: 'Assets/Package' diff --git a/Assets/Package/Editor.meta b/Assets/Examples/Prefabs.meta similarity index 77% rename from Assets/Package/Editor.meta rename to Assets/Examples/Prefabs.meta index f4f534b..f3e4e31 100644 --- a/Assets/Package/Editor.meta +++ b/Assets/Examples/Prefabs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7bc77ed6985b1df409c86244fd859e75 +guid: c8033d98298963949b1d3adf92193410 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Examples/Prefabs/Debugging.prefab b/Assets/Examples/Prefabs/Debugging.prefab new file mode 100644 index 0000000..bfbd8af --- /dev/null +++ b/Assets/Examples/Prefabs/Debugging.prefab @@ -0,0 +1,152 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1213356938199733026 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 477482139075367511} + - component: {fileID: 145488333231022481} + - component: {fileID: 5675982600121752539} + m_Layer: 0 + m_Name: Console + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &477482139075367511 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1213356938199733026} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5680067472162913344} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &145488333231022481 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1213356938199733026} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3fe6cce1ddcc26f489ce1db899063d5f, type: 3} + m_Name: + m_EditorClassIdentifier: + settings: + k__BackingField: {fileID: 11400000, guid: e64ee987e14df8147b00f98e56999768, + type: 2} + k__BackingField: 64 + k__BackingField: '"' +--- !u!114 &5675982600121752539 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1213356938199733026} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 068a827a1e189e3439fed8c25d02265d, type: 3} + m_Name: + m_EditorClassIdentifier: + consoleManager: {fileID: 145488333231022481} + forceInputFocus: 1 + inputSettings: + triggerKey: 4 + confirmationKey: 2 + prevCommandKey: 63 + nextCommandKey: 64 + styleSettings: + initialRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 800 + height: 500 + textColor: {r: 0.7843138, g: 0.7843138, b: 0.7843138, a: 1} + mainColor: {r: 0, g: 0, b: 0, a: 0.78431374} + minDistanceFromEdge: 100 +--- !u!1 &5680067472162913345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5680067472162913344} + - component: {fileID: 6316979283037583983} + - component: {fileID: 3903173460022865518} + - component: {fileID: 8724080618557178838} + m_Layer: 0 + m_Name: Debugging + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5680067472162913344 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5680067472162913345} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 477482139075367511} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6316979283037583983 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5680067472162913345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4c5c84fa2624528449441fa243793507, type: 3} + m_Name: + m_EditorClassIdentifier: + value: 0 +--- !u!114 &3903173460022865518 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5680067472162913345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4c35b7f4026ca2344b54d5316f845a7c, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &8724080618557178838 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5680067472162913345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0a500a6547f840f46bfbbf613600ba02, type: 3} + m_Name: + m_EditorClassIdentifier: + exitKey: 60 diff --git a/Assets/Examples/Prefabs/Debugging.prefab.meta b/Assets/Examples/Prefabs/Debugging.prefab.meta new file mode 100644 index 0000000..def2d6f --- /dev/null +++ b/Assets/Examples/Prefabs/Debugging.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 95607884d118b2d4f90c774cfa064ac8 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scenes.meta b/Assets/Examples/Scenes.meta new file mode 100644 index 0000000..b48cd28 --- /dev/null +++ b/Assets/Examples/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db0c115be66490a4191eab32a816350d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scenes/SampleScene.unity b/Assets/Examples/Scenes/SampleScene.unity new file mode 100644 index 0000000..b1a86a3 --- /dev/null +++ b/Assets/Examples/Scenes/SampleScene.unity @@ -0,0 +1,370 @@ +%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: 9 + 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: 10304, guid: 0000000000000000f000000000000000, type: 0} + 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: 0} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + 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_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + 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: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + 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 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &1303637885 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1303637887} + - component: {fileID: 1303637886} + 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 &1303637886 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1303637885} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + 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_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1303637887 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1303637885} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1858461317 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1858461320} + - component: {fileID: 1858461319} + - component: {fileID: 1858461318} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1858461318 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858461317} + m_Enabled: 1 +--- !u!20 &1858461319 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858461317} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1858461320 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1858461317} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &5680067473741380827 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913344, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5680067472162913345, guid: 95607884d118b2d4f90c774cfa064ac8, + type: 3} + propertyPath: m_Name + value: Debugging + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 95607884d118b2d4f90c774cfa064ac8, type: 3} diff --git a/Assets/Examples/Scenes/SampleScene.unity.meta b/Assets/Examples/Scenes/SampleScene.unity.meta new file mode 100644 index 0000000..530963f --- /dev/null +++ b/Assets/Examples/Scenes/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a31b418cdc6701f41ae5d52930e36f13 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables.meta b/Assets/Examples/Scriptables.meta new file mode 100644 index 0000000..16bfc59 --- /dev/null +++ b/Assets/Examples/Scriptables.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f9df32d273d66745b1f05fdf0a40c7b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables/Commands Repository.asset b/Assets/Examples/Scriptables/Commands Repository.asset new file mode 100644 index 0000000..96501c9 --- /dev/null +++ b/Assets/Examples/Scriptables/Commands Repository.asset @@ -0,0 +1,18 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d7ad9b8f9eb533429bb2b49b7950676, type: 3} + m_Name: Commands Repository + m_EditorClassIdentifier: + commands: + - {fileID: 11400000, guid: 5fb50d2c52cb39146aae5361ef608c1e, type: 2} + - {fileID: 11400000, guid: f3548dc1b603c1a40907cf987711c149, type: 2} + - {fileID: 11400000, guid: eb4bb9d9179980a4e8f3514df0548380, type: 2} diff --git a/Assets/Examples/Scriptables/Commands Repository.asset.meta b/Assets/Examples/Scriptables/Commands Repository.asset.meta new file mode 100644 index 0000000..d5e195b --- /dev/null +++ b/Assets/Examples/Scriptables/Commands Repository.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e64ee987e14df8147b00f98e56999768 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables/Commands.meta b/Assets/Examples/Scriptables/Commands.meta new file mode 100644 index 0000000..9da755a --- /dev/null +++ b/Assets/Examples/Scriptables/Commands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 42a1c9431561b1f449750451cde3c893 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables/Commands/Clear Command.asset b/Assets/Examples/Scriptables/Commands/Clear Command.asset new file mode 100644 index 0000000..cf611e0 --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Clear Command.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7bd7c1d0826b390439845a3a359345d0, type: 3} + m_Name: Clear Command + m_EditorClassIdentifier: diff --git a/Assets/Examples/Scriptables/Commands/Clear Command.asset.meta b/Assets/Examples/Scriptables/Commands/Clear Command.asset.meta new file mode 100644 index 0000000..bf8902c --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Clear Command.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5fb50d2c52cb39146aae5361ef608c1e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables/Commands/Help Command.asset b/Assets/Examples/Scriptables/Commands/Help Command.asset new file mode 100644 index 0000000..520a814 --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Help Command.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9ae2d327e0e70a348bc7085595f471db, type: 3} + m_Name: Help Command + m_EditorClassIdentifier: diff --git a/Assets/Examples/Scriptables/Commands/Help Command.asset.meta b/Assets/Examples/Scriptables/Commands/Help Command.asset.meta new file mode 100644 index 0000000..d417eeb --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Help Command.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f3548dc1b603c1a40907cf987711c149 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Examples/Scriptables/Commands/Test Command.asset b/Assets/Examples/Scriptables/Commands/Test Command.asset new file mode 100644 index 0000000..d918b15 --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Test Command.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0b643962d42a4f245a815f162bc8cf38, type: 3} + m_Name: Test Command + m_EditorClassIdentifier: diff --git a/Assets/Examples/Scriptables/Commands/Test Command.asset.meta b/Assets/Examples/Scriptables/Commands/Test Command.asset.meta new file mode 100644 index 0000000..f82e2ec --- /dev/null +++ b/Assets/Examples/Scriptables/Commands/Test Command.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eb4bb9d9179980a4e8f3514df0548380 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/CHANGELOG.md.meta b/Assets/Package/CHANGELOG.md.meta index e3e5042..df7ba64 100644 --- a/Assets/Package/CHANGELOG.md.meta +++ b/Assets/Package/CHANGELOG.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e9c23a67c52bdfa49a19fd18cb0efc51 +guid: 770c49b99e3c4b44cb4e89b0eb5edca0 TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/Package/LICENSE.md.meta b/Assets/Package/LICENSE.md.meta index 909fab9..268a718 100644 --- a/Assets/Package/LICENSE.md.meta +++ b/Assets/Package/LICENSE.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2a2bfcb3ebd4a964fa82b9dfb2276205 +guid: 944dd1ae6b3561f49b5b6d0f715d2e35 TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/Package/README.md b/Assets/Package/README.md index 4283fb6..ccd4032 100644 --- a/Assets/Package/README.md +++ b/Assets/Package/README.md @@ -1 +1,8 @@ -# \ No newline at end of file +# UI + +### Structure +``` +├── Editor +├── Runtime +├── Tests +``` \ No newline at end of file diff --git a/Assets/Package/README.md.meta b/Assets/Package/README.md.meta index 53c91d8..5579d89 100644 --- a/Assets/Package/README.md.meta +++ b/Assets/Package/README.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b4b8d0f996006eb458e1d5302602e1fd +guid: c19a012d37364a9488007bbd65d11ff7 TextScriptImporter: externalObjects: {} userData: diff --git a/Assets/Package/Runtime.meta b/Assets/Package/Runtime.meta index 6767c20..512505d 100644 --- a/Assets/Package/Runtime.meta +++ b/Assets/Package/Runtime.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 94efd6707d533dd4283eafdeef7b0213 +guid: 2c56a8faecbd9644e9070561bd363ecd folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Package/Runtime/AssemblyInfo.cs b/Assets/Package/Runtime/AssemblyInfo.cs new file mode 100644 index 0000000..be13a9b --- /dev/null +++ b/Assets/Package/Runtime/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("BroWar.Debugging.Tests")] \ No newline at end of file diff --git a/Assets/Package/Runtime/AssemblyInfo.cs.meta b/Assets/Package/Runtime/AssemblyInfo.cs.meta new file mode 100644 index 0000000..2704649 --- /dev/null +++ b/Assets/Package/Runtime/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 676290982a0c01346b5ec80c14ee1201 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/BroWar.Debugging.asmdef b/Assets/Package/Runtime/BroWar.Debugging.asmdef new file mode 100644 index 0000000..3e07c05 --- /dev/null +++ b/Assets/Package/Runtime/BroWar.Debugging.asmdef @@ -0,0 +1,18 @@ +{ + "name": "BroWar.Debugging", + "rootNamespace": "", + "references": [ + "GUID:696a0953692949b40bec8730e64e1fdd", + "GUID:75469ad4d38634e559750d17036d5f7c", + "GUID:173c5b3ae199f7948aa8473aac4ba00d" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Package/Runtime/BroWar.Debugging.asmdef.meta b/Assets/Package/Runtime/BroWar.Debugging.asmdef.meta new file mode 100644 index 0000000..9479d7c --- /dev/null +++ b/Assets/Package/Runtime/BroWar.Debugging.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: eb242716b29208542a7500020c91b908 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console.meta b/Assets/Package/Runtime/Console.meta new file mode 100644 index 0000000..e2b9040 --- /dev/null +++ b/Assets/Package/Runtime/Console.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c9f381f25b590e14e98d71094439c3cd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ArgumentExtractionException.cs b/Assets/Package/Runtime/Console/ArgumentExtractionException.cs new file mode 100644 index 0000000..16587f9 --- /dev/null +++ b/Assets/Package/Runtime/Console/ArgumentExtractionException.cs @@ -0,0 +1,13 @@ +using System; + +namespace BroWar.Debugging.Console +{ + internal class ArgumentExtractionException : Exception + { + public ArgumentExtractionException() + { } + + public ArgumentExtractionException(string message) : base(message) + { } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ArgumentExtractionException.cs.meta b/Assets/Package/Runtime/Console/ArgumentExtractionException.cs.meta new file mode 100644 index 0000000..3ef2825 --- /dev/null +++ b/Assets/Package/Runtime/Console/ArgumentExtractionException.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 990a0634a4e79664dadc4005d0cdaeda +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/CommandResult.cs b/Assets/Package/Runtime/Console/CommandResult.cs new file mode 100644 index 0000000..2be2613 --- /dev/null +++ b/Assets/Package/Runtime/Console/CommandResult.cs @@ -0,0 +1,16 @@ +namespace BroWar.Debugging.Console +{ + public class CommandResult + { + public CommandResult(string message, MessageType messageType) + { + Message = message; + MessageType = messageType; + } + + public static CommandResult Empty => new CommandResult(string.Empty, MessageType.Log); + + public string Message { get; private set; } + public MessageType MessageType { get; private set; } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/CommandResult.cs.meta b/Assets/Package/Runtime/Console/CommandResult.cs.meta new file mode 100644 index 0000000..b1a74d0 --- /dev/null +++ b/Assets/Package/Runtime/Console/CommandResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fbdbd94610bc0054ab061cd27aa45ec9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/Commands.meta b/Assets/Package/Runtime/Console/Commands.meta new file mode 100644 index 0000000..65875d2 --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cdae4e8af15a5b84ca383dd7ccefc038 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/Commands/ClearCommand.cs b/Assets/Package/Runtime/Console/Commands/ClearCommand.cs new file mode 100644 index 0000000..6b1bf90 --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/ClearCommand.cs @@ -0,0 +1,31 @@ +using UnityEngine; + +namespace BroWar.Debugging.Console.Commands +{ + [CreateAssetMenu(fileName = "Clear Command", menuName = "BroWar/Debugging/Commands/Clear")] + public class ClearCommand : ConsoleCommand + { + private const string wrongArgumentsMessage = "Couldn't parse arguments.\nAvailable options:\n-h,--history - clearing history"; + + public void Clear() + { + var consoleGui = FindObjectOfType(); + consoleGui.Clear(); + } + + public CommandResult Clear(string arg) + { + if (arg.Equals("-h") || arg.Equals("--history")) + { + Clear(); + var consoleManager = FindObjectOfType(); + consoleManager.ClearHistory(); + return CommandResult.Empty; + } + else + { + return new CommandResult(wrongArgumentsMessage, MessageType.Error); + } + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/Commands/ClearCommand.cs.meta b/Assets/Package/Runtime/Console/Commands/ClearCommand.cs.meta new file mode 100644 index 0000000..11d4b55 --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/ClearCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7bd7c1d0826b390439845a3a359345d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/Commands/HelpCommand.cs b/Assets/Package/Runtime/Console/Commands/HelpCommand.cs new file mode 100644 index 0000000..41e897e --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/HelpCommand.cs @@ -0,0 +1,29 @@ +using System.Text; +using UnityEngine; + +namespace BroWar.Debugging.Console.Commands +{ + [CreateAssetMenu(fileName = "Help Command", menuName = "BroWar/Debugging/Commands/Help")] + public class HelpCommand : ConsoleCommand + { + public CommandResult Help() + { + var consoleManager = FindObjectOfType(); + var registeredMethods = consoleManager.RegisteredMethods; + var stringBuilder = new StringBuilder(); + stringBuilder.AppendLine("Available commands:"); + foreach (var methodItem in registeredMethods) + { + var methods = methodItem.Value; + foreach (var method in methods) + { + var methodDisplay = ConsoleUtility.GetMethodDefinitionString(method); + stringBuilder.AppendLine(methodDisplay); + } + } + + var message = stringBuilder.ToString(); + return new CommandResult(message, MessageType.Warning); + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/Commands/HelpCommand.cs.meta b/Assets/Package/Runtime/Console/Commands/HelpCommand.cs.meta new file mode 100644 index 0000000..8508ebe --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/HelpCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ae2d327e0e70a348bc7085595f471db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/Commands/TestCommand.cs b/Assets/Package/Runtime/Console/Commands/TestCommand.cs new file mode 100644 index 0000000..82ebf46 --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/TestCommand.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace BroWar.Debugging.Console.Commands +{ + [CreateAssetMenu(fileName = "Test Command", menuName = "BroWar/Debugging/Commands/Test")] + public class TestCommand : ConsoleCommand + { + public float Add(float i, int j) + { + return (i + j); + } + + public float Add(float i, int j, int k) + { + return (i + j + k); + } + + public double Add(double i, bool flag) + { + return (flag ? i : -i); + } + + public string Print(string text) + { + return text; + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/Commands/TestCommand.cs.meta b/Assets/Package/Runtime/Console/Commands/TestCommand.cs.meta new file mode 100644 index 0000000..cf42c11 --- /dev/null +++ b/Assets/Package/Runtime/Console/Commands/TestCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0b643962d42a4f245a815f162bc8cf38 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/CommandsRepository.cs b/Assets/Package/Runtime/Console/CommandsRepository.cs new file mode 100644 index 0000000..bbfa19c --- /dev/null +++ b/Assets/Package/Runtime/Console/CommandsRepository.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace BroWar.Debugging.Console +{ + using BroWar.Common.Utilities; + + /// + /// Scriptable container for . + /// + [CreateAssetMenu(fileName = "Commands Repository", menuName = "BroWar/Debugging/Commands Repository")] + public class CommandsRepository : ScriptableObject + { + [EditorButton(nameof(CollectAll), "Collect All")] + public List commands; + + private void CollectAll() + { + commands = AssetUtility.CollectAllAssets(); + ForceDirty(); + } + + private void ForceDirty() + { +#if UNITY_EDITOR + if (Application.isPlaying) + { + return; + } + + EditorUtility.SetDirty(this); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/CommandsRepository.cs.meta b/Assets/Package/Runtime/Console/CommandsRepository.cs.meta new file mode 100644 index 0000000..48a7057 --- /dev/null +++ b/Assets/Package/Runtime/Console/CommandsRepository.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3d7ad9b8f9eb533429bb2b49b7950676 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleCommand.cs b/Assets/Package/Runtime/Console/ConsoleCommand.cs new file mode 100644 index 0000000..b2f446a --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleCommand.cs @@ -0,0 +1,11 @@ +using UnityEngine; + +namespace BroWar.Debugging.Console +{ + /// + /// Base class for console commands. + /// Every public functions defined in inherting classes will be accessible through console. + /// + public abstract class ConsoleCommand : ScriptableObject + { } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleCommand.cs.meta b/Assets/Package/Runtime/Console/ConsoleCommand.cs.meta new file mode 100644 index 0000000..55861d1 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleCommand.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d2b8ae6b5fcacf647a316c9e46f840da +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleGui.cs b/Assets/Package/Runtime/Console/ConsoleGui.cs new file mode 100644 index 0000000..654fd39 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleGui.cs @@ -0,0 +1,309 @@ +using System; +using System.Collections.Generic; +using System.Text; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace BroWar.Debugging.Console +{ + [AddComponentMenu("BroWar/Debugging/Console/Console GUI")] + [RequireComponent(typeof(ConsoleManager))] + public class ConsoleGui : MonoBehaviour + { + private static class Style + { + internal static readonly GUIStyle consoleWindowStyle = new GUIStyle(GUI.skin.window) + { + fontSize = 16, + fontStyle = FontStyle.Bold + }; + internal static readonly GUIStyle consoleButtonStyle = new GUIStyle(GUI.skin.button); + internal static readonly GUIStyle consoleTextStyle = new GUIStyle(GUI.skin.textField); + internal static readonly GUIStyle consoleBodyStyle = new GUIStyle(GUI.skin.textArea) + { + richText = true + }; + } + + private const string inputFieldControlName = "ConsoleGUI_InputField"; + + [SerializeField] + private ConsoleManager consoleManager; + [Title("Settings")] + [SerializeField] + private bool forceInputFocus; + [SerializeField] + private ConsoleInputSettings inputSettings; + [SerializeField] + private ConsoleStyleSettings styleSettings; + [SerializeField] + private float minDistanceFromEdge; + + private Rect windowRect; + private Vector2 scrollPosition; + + private string printedText; + private string currentInput; + private StringBuilder printedTextBuilder; + + private bool updateCursorPosition; + private bool isInitialized; + + private Dictionary inputKeysToActions; + + private void Update() + { + if (IsKeyPressed(inputSettings.TriggerKey)) + { + Toggle(); + } + + if (!IsShown) + { + return; + } + + foreach (var item in inputKeysToActions) + { + var inputKey = item.Key; + if (IsKeyPressed(inputKey)) + { + var action = item.Value; + action.Invoke(); + } + } + } + + private void OnGUI() + { + if (!IsShown) + { + return; + } + + var prevColor = GUI.backgroundColor; + GUI.backgroundColor = styleSettings.MainColor; + + var requiredWindowSize = GetRequiredWindowSize(); + var validWindowPosition = GetValidWindowPosition(); + + windowRect = new Rect(validWindowPosition, requiredWindowSize); + windowRect = GUI.Window(0, windowRect, DrawWindow, "Console Window", Style.consoleWindowStyle); + GUI.backgroundColor = prevColor; + } + + private void DrawWindow(int windowId) + { + Style.consoleTextStyle.normal.textColor = styleSettings.TextColor; + Style.consoleBodyStyle.normal.textColor = styleSettings.TextColor; + using (var scrollView = new GUILayout.ScrollViewScope(scrollPosition)) + { + scrollPosition = scrollView.scrollPosition; + GUILayout.Label(printedText, Style.consoleBodyStyle, GUILayout.ExpandHeight(true)); + } + + using (new GUILayout.HorizontalScope()) + { + GUI.SetNextControlName(inputFieldControlName); + currentInput = GUILayout.TextField(currentInput, Style.consoleTextStyle); + if (forceInputFocus) + { + GUI.FocusControl(inputFieldControlName); + } + + if (updateCursorPosition) + { + GUI.FocusControl(inputFieldControlName); + var editor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl); + editor.OnFocus(); + editor.cursorIndex = currentInput.Length; + updateCursorPosition = false; + } + + var buttonContent = new GUIContent("Apply"); + var size = Style.consoleButtonStyle.CalcSize(buttonContent); + if (GUILayout.Button(buttonContent, GUILayout.Width(size.x))) + { + InvokeInputString(); + } + } + + GUI.DragWindow(new Rect(0, 0, Screen.width, Screen.height)); + } + + private void EnsureInitialized() + { + if (isInitialized) + { + return; + } + + currentInput = string.Empty; + printedTextBuilder = new StringBuilder(); + inputKeysToActions = new Dictionary() + { + { inputSettings.ConfirmationKey, InvokeInputString }, + { inputSettings.NextCommandKey, FetchNextCommand }, + { inputSettings.PrevCommandKey, FetchPrevCommand } + }; + + windowRect = styleSettings.InitialRect; + scrollPosition = Vector2.zero; + isInitialized = true; + } + + private void InvokeInputString() + { + if (string.IsNullOrEmpty(currentInput)) + { + return; + } + + printedTextBuilder.AppendLine(currentInput); + var resultObject = consoleManager.InvokeCommand(currentInput); + var stringResult = ParseResultToString(resultObject); + if (!string.IsNullOrEmpty(stringResult)) + { + printedTextBuilder.AppendLine(stringResult); + } + + printedText = printedTextBuilder.ToString(); + printedText = printedText.TrimEnd(); + currentInput = string.Empty; + } + + private string ParseResultToString(object resultObject) + { + if (resultObject is CommandResult commandResult) + { + return ParseResultToString(commandResult); + } + + return resultObject != null + ? resultObject.ToString() + : string.Empty; + } + + private string ParseResultToString(CommandResult commandResult) + { + var messageType = commandResult.MessageType; + switch (messageType) + { + case MessageType.Error: + return $"{commandResult.Message}"; + case MessageType.Warning: + return $"{commandResult.Message}"; + case MessageType.Log: + default: + return commandResult.Message; + } + } + + private void FetchNextCommand() + { + if (consoleManager.TryGetNextEntryFromHistory(out var entry)) + { + currentInput = entry; + updateCursorPosition = true; + } + } + + private void FetchPrevCommand() + { + if (consoleManager.TryGetPrevEntryFromHistory(out var entry)) + { + currentInput = entry; + updateCursorPosition = true; + } + } + + private bool IsKeyPressed(Key key) + { + return Keyboard.current[key].wasPressedThisFrame; + } + + private void RemoveTriggerKeyTextFromInput() + { + var triggerKey = inputSettings.TriggerKey; + if (!triggerKey.IsTextInputKey()) + { + return; + } + + var inputString = Keyboard.current[triggerKey].displayName; + var inputStringLength = inputString.Length; + var currentInputLength = currentInput.Length; + currentInput = currentInput.Substring(0, currentInputLength - inputStringLength); + } + + private Vector2 GetRequiredWindowSize() + { + var initialRectSize = styleSettings.InitialRect.size; + var requiredWindowSize = new Vector2 + (Screen.width < initialRectSize.x ? Screen.width : initialRectSize.x, + Screen.height < initialRectSize.y ? Screen.height : initialRectSize.y); + + return requiredWindowSize; + } + + private Vector2 GetValidWindowPosition() + { + var windowPosition = windowRect.position; + var windowSize = windowRect.size; + + if (windowPosition.x > Screen.width - minDistanceFromEdge) + { + windowPosition.x = Screen.width - minDistanceFromEdge; + } + else if (windowPosition.x < minDistanceFromEdge - windowSize.x) + { + windowPosition.x = minDistanceFromEdge - windowSize.x; + } + + if (windowPosition.y > Screen.height - minDistanceFromEdge) + { + windowPosition.y = Screen.height - minDistanceFromEdge; + } + else if (windowPosition.y < minDistanceFromEdge - windowSize.y) + { + windowPosition.y = minDistanceFromEdge - windowSize.y; + } + + return windowPosition; + } + + public void Toggle() + { + if (IsShown) + { + Hide(); + } + else + { + Show(); + } + } + + public void Show() + { + EnsureInitialized(); + IsShown = true; + } + + public void Hide() + { + EnsureInitialized(); + RemoveTriggerKeyTextFromInput(); + consoleManager.SaveHistory(); + IsShown = false; + } + + public void Clear() + { + printedTextBuilder?.Clear(); + printedText = string.Empty; + } + + public bool IsShown { get; private set; } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleGui.cs.meta b/Assets/Package/Runtime/Console/ConsoleGui.cs.meta new file mode 100644 index 0000000..bde0f49 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleGui.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 068a827a1e189e3439fed8c25d02265d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleHistory.cs b/Assets/Package/Runtime/Console/ConsoleHistory.cs new file mode 100644 index 0000000..a51dd52 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleHistory.cs @@ -0,0 +1,102 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace BroWar.Debugging.Console +{ + public class ConsoleHistory : IConsoleHistoryDisposer + { + private const string playerPrefsConsoleHistoryCount = "consoleHistoryList_count"; + private const string playerPrefsConsoleHistoryElementFormat = "consoleHistoryList_{0}"; + + private readonly int historyBufferSize; + + private readonly string[] inputHistoryBuffer; + private readonly Queue inputHistoryQueue; + + public ConsoleHistory(int historyBufferSize) + { + this.historyBufferSize = historyBufferSize; + inputHistoryQueue = new Queue(historyBufferSize); + inputHistoryBuffer = new string[historyBufferSize]; + } + + public void ClearHistory() + { + inputHistoryQueue.Clear(); + for (var i = 0; i < inputHistoryBuffer.Length; i++) + { + inputHistoryBuffer[i] = null; + } + + CurrentEntryIndex = 0; + } + + public void SaveHistory() + { + var historyCount = inputHistoryQueue.Count; + PlayerPrefs.SetInt(playerPrefsConsoleHistoryCount, historyCount); + for (var i = 0; i < historyCount; i++) + { + var inputLine = inputHistoryBuffer[i]; + PlayerPrefs.SetString(string.Format(playerPrefsConsoleHistoryElementFormat, i), inputLine); + } + } + + public void LoadHistory() + { + inputHistoryQueue.Clear(); + var historyCount = PlayerPrefs.GetInt(playerPrefsConsoleHistoryCount, 0); + historyCount = Mathf.Min(historyCount, historyBufferSize); + for (var i = 0; i < historyCount; i++) + { + var inputLine = PlayerPrefs.GetString(string.Format(playerPrefsConsoleHistoryElementFormat, i), string.Empty); + inputHistoryBuffer[i] = inputLine; + inputHistoryQueue.Enqueue(inputLine); + } + + CurrentEntryIndex = historyCount; + } + + public void AddEntry(string entry) + { + inputHistoryQueue.Enqueue(entry); + if (inputHistoryQueue.Count > historyBufferSize) + { + inputHistoryQueue.Dequeue(); + } + + inputHistoryQueue.CopyTo(inputHistoryBuffer, 0); + CurrentEntryIndex = inputHistoryQueue.Count; + } + + public bool TryGetNextEntryFromHistory(out string entry) + { + if (inputHistoryQueue.Count == 0 || CurrentEntryIndex >= inputHistoryQueue.Count - 1) + { + CurrentEntryIndex = inputHistoryQueue.Count; + entry = string.Empty; + return false; + } + + CurrentEntryIndex++; + entry = inputHistoryBuffer[CurrentEntryIndex]; + return true; + } + + public bool TryGetPrevEntryFromHistory(out string entry) + { + if (CurrentEntryIndex == 0) + { + entry = inputHistoryBuffer[CurrentEntryIndex]; + return false; + } + + CurrentEntryIndex--; + entry = inputHistoryBuffer[CurrentEntryIndex]; + return true; + } + + public int CurrentEntryIndex { get; private set; } + public int CurrentHistorySize => inputHistoryQueue.Count; + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleHistory.cs.meta b/Assets/Package/Runtime/Console/ConsoleHistory.cs.meta new file mode 100644 index 0000000..70f4e83 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleHistory.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54bf5996f860ff7498fc62695d273c9b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleInputSettings.cs b/Assets/Package/Runtime/Console/ConsoleInputSettings.cs new file mode 100644 index 0000000..981f3ec --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleInputSettings.cs @@ -0,0 +1,24 @@ +using System; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace BroWar.Debugging.Console +{ + [Serializable] + public class ConsoleInputSettings + { + [SerializeField] + private Key triggerKey = Key.Backquote; + [SerializeField] + private Key confirmationKey = Key.Enter; + [SerializeField] + private Key prevCommandKey = Key.UpArrow; + [SerializeField] + private Key nextCommandKey = Key.DownArrow; + + public Key TriggerKey { get => triggerKey; set => triggerKey = value; } + public Key ConfirmationKey { get => confirmationKey; set => confirmationKey = value; } + public Key PrevCommandKey { get => prevCommandKey; set => prevCommandKey = value; } + public Key NextCommandKey { get => nextCommandKey; set => nextCommandKey = value; } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleInputSettings.cs.meta b/Assets/Package/Runtime/Console/ConsoleInputSettings.cs.meta new file mode 100644 index 0000000..845057a --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleInputSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3debeb523277f904db51b3d7f71be098 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleManager.cs b/Assets/Package/Runtime/Console/ConsoleManager.cs new file mode 100644 index 0000000..adf6023 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleManager.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Reflection; +using System.Text; +using UnityEngine; +using UnityEngine.Assertions; +using UnityEngine.Serialization; + +namespace BroWar.Debugging.Console +{ + /// + /// Manager for registering/unregistering and invoking console commands and storing input history. + /// Uses commands stored in as an initial commands set. + /// + [AddComponentMenu("LowPolis/Debugging/Console/Console Manager")] + public class ConsoleManager : MonoBehaviour, IConsoleManager + { + [Title("Settings")] + [SerializeField, FormerlySerializedAs("consoleManagerSettings"), IgnoreParent] + private ConsoleManagerSettings settings; + + private Dictionary> namesToMethods; + private Dictionary namesToInstances; + + private ConsoleHistory inputHistory; + + private bool isInitialized; + + private void EnsureInitialized() + { + if (isInitialized) + { + return; + } + + isInitialized = true; + InitializeCache(); + ValidateSettings(); + InitializeHistory(); + InitializeCommands(); + } + + private void ValidateSettings() + { + Assert.IsNotNull(settings.CommandsRepository, "[Console] Commands repository not set."); + Assert.AreNotEqual(settings.MultiargumentEncapsulationCharacter, string.Empty, "[Console] Missing multiArgumentEncapsulationCharacter."); + } + + private void InitializeCache() + { + namesToMethods = new Dictionary>(); + namesToInstances = new Dictionary(); + } + + private void InitializeHistory() + { + var bufferSize = settings.HistoryBufferSize; + inputHistory = new ConsoleHistory(bufferSize); + inputHistory.LoadHistory(); + } + + private void InitializeCommands() + { + var commandsRepository = settings.CommandsRepository; + var commandsList = commandsRepository.commands; + for (int i = 0; i < commandsList.Count; i++) + { + var command = commandsList[i]; + AppendCommand(command); + } + } + + private string ExtractCommandName(string input) + { + var clearedInput = input.Trim(); + var splittedInput = clearedInput.Split(' '); + return splittedInput.Length == 0 + ? input.ToLower() + : splittedInput[0].ToLower(); + } + + private bool TryParseParameters(string[] arguments, ParameterInfo[] methodParameters, out object[] parsedArguments) + { + parsedArguments = new object[arguments.Length]; + try + { + for (var i = 0; i < arguments.Length; i++) + { + var converter = TypeDescriptor.GetConverter(methodParameters[i].ParameterType); + parsedArguments[i] = converter.ConvertFromInvariantString(arguments[i]); + } + } + catch (Exception) + { + return false; + } + + return true; + } + + private string GetAvailableCommandsText(string commandName) + { + var sb = new StringBuilder(); + var commandMethods = namesToMethods[commandName]; + foreach (var method in commandMethods) + { + var methodDisplayName = ConsoleUtility.GetMethodDefinitionString(method); + sb.AppendLine(methodDisplayName); + } + + return sb.ToString(); + } + + private bool TryMatchMethod(string commandNameLowerCased, string[] arguments, HashSet commandMethods, out MethodInfo matchedMethod, out object[] parsedArguments) + { + foreach (var method in commandMethods) + { + var methodName = method.Name; + var methodNameLowerCased = methodName.ToLower(); + if (!methodNameLowerCased.Equals(commandNameLowerCased)) + { + continue; + } + + var methodParameters = method.GetParameters(); + if (arguments.Length != methodParameters.Length) + { + continue; + } + + var areArgumentsMatched = TryParseParameters(arguments, methodParameters, out parsedArguments); + if (!areArgumentsMatched) + { + continue; + } + + matchedMethod = method; + return true; + } + + parsedArguments = null; + matchedMethod = null; + return false; + } + + private void RegistorMethodFromCommand(ConsoleCommand command, MethodInfo method) + { + var commandName = method.Name.ToLower(); + if (namesToMethods.TryGetValue(commandName, out var methodsGroup)) + { + if (methodsGroup.Contains(method)) + { + Debug.LogWarning($"[Console] There is a command {command.name} registered with the same method definition {method}"); + } + else + { + methodsGroup.Add(method); + } + } + else + { + namesToMethods.Add(commandName, new HashSet() + { + method + }); + namesToInstances.Add(commandName, command); + } + } + + public void AppendCommand(ConsoleCommand command) + { + EnsureInitialized(); + + var commandType = command.GetType(); + var commandInfo = commandType.GetTypeInfo(); + foreach (var method in commandInfo.DeclaredMethods.Where(method => method.IsPublic)) + { + RegistorMethodFromCommand(command, method); + } + } + + public void RemoveCommand(ConsoleCommand command) + { + EnsureInitialized(); + + var commandType = command.GetType(); + foreach (var method in commandType.GetMethods()) + { + if (namesToMethods.TryGetValue(method.Name, out var methodsSet)) + { + methodsSet.Remove(method); + } + } + } + + public object InvokeCommand(string input) + { + if (string.IsNullOrEmpty(input)) + { + Debug.LogWarning($"[Console] Cannot process invalid input - '{input}'"); + return null; + } + + EnsureInitialized(); + + inputHistory.AddEntry(input); + try + { + var commandName = ExtractCommandName(input); + if (namesToMethods.TryGetValue(commandName, out var commandMethods)) + { + var arguments = ConsoleUtility.ExtractArguments(input, settings.MultiargumentEncapsulationCharacter); + if (TryMatchMethod(commandName, arguments, commandMethods, out var method, out var parsedArguments)) + { + var command = namesToInstances[commandName]; + return method.Invoke(command, parsedArguments); + } + + return new CommandResult($"Couldn't find a matching method. Available {commandName} methods:\n{GetAvailableCommandsText(commandName)}", MessageType.Error); + } + + return new CommandResult($"Command {commandName} isn't registered in the console.", MessageType.Error); + } + catch (Exception e) + { + return new CommandResult(e.ToString(), MessageType.Error); + } + } + + public void ClearHistory() + { + InputHistory.ClearHistory(); + } + + public bool TryGetNextEntryFromHistory(out string entry) + { + return InputHistory.TryGetNextEntryFromHistory(out entry); + } + + public bool TryGetPrevEntryFromHistory(out string entry) + { + return InputHistory.TryGetPrevEntryFromHistory(out entry); + } + + public void AddEntry(string entry) + { + InputHistory.AddEntry(entry); + } + + public void SaveHistory() + { + InputHistory.SaveHistory(); + } + + public void LoadHistory() + { + InputHistory.LoadHistory(); + } + + private ConsoleHistory InputHistory + { + get + { + EnsureInitialized(); + return inputHistory; + } + } + + public IReadOnlyDictionary> RegisteredMethods => namesToMethods; + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleManager.cs.meta b/Assets/Package/Runtime/Console/ConsoleManager.cs.meta new file mode 100644 index 0000000..81c6d72 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3fe6cce1ddcc26f489ce1db899063d5f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs b/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs new file mode 100644 index 0000000..9977451 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs @@ -0,0 +1,16 @@ +using System; +using UnityEngine; + +namespace BroWar.Debugging.Console +{ + [Serializable] + public class ConsoleManagerSettings + { + [field: SerializeField, InLineEditor] + public CommandsRepository CommandsRepository { get; set; } + [field: SerializeField] + public int HistoryBufferSize { get; set; } = 64; + [field: SerializeField] + public string MultiargumentEncapsulationCharacter { get; set; } = "\""; + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs.meta b/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs.meta new file mode 100644 index 0000000..62e937b --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleManagerSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c54495b9d92f924bb6834e92bf4facf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs b/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs new file mode 100644 index 0000000..89cf706 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs @@ -0,0 +1,20 @@ +using System; +using UnityEngine; + +namespace BroWar.Debugging.Console +{ + [Serializable] + public class ConsoleStyleSettings + { + [SerializeField] + private Rect initialRect; + [SerializeField] + private Color textColor = Color.white; + [SerializeField] + private Color mainColor = Color.black; + + public Rect InitialRect { get => initialRect; set => initialRect = value; } + public Color TextColor { get => textColor; set => textColor = value; } + public Color MainColor { get => mainColor; set => mainColor = value; } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs.meta b/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs.meta new file mode 100644 index 0000000..66e9364 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleStyleSettings.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c54644df281ac294b92a9156a9e7f956 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/ConsoleUtility.cs b/Assets/Package/Runtime/Console/ConsoleUtility.cs new file mode 100644 index 0000000..d806d87 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleUtility.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Text; +using System.Text.RegularExpressions; + +namespace BroWar.Debugging.Console +{ + internal static class ConsoleUtility + { + private static string TypeToSimpleTypeString(Type type) + { + switch (type.Name) + { + case "Int32": + return "int"; + case "Single": + return "float"; + case "Double": + return "double"; + case "Boolean": + return "bool"; + case "String": + return "string"; + default: + return type.Name; + } + } + + public static string[] ExtractArguments(string input, string encapsulationCharacter) + { + var encapsulatingCharactersCount = Regex.Matches(input, encapsulationCharacter).Count; + if (encapsulatingCharactersCount % 2 != 0) + { + throw new ArgumentExtractionException("Missing closing encapsulation character in input"); + } + + var argumentsList = new List(); + var clearedInput = input.Trim(); + var matches = Regex.Matches(clearedInput, $"\"([^{encapsulationCharacter}]*)\"|([^\\s]+)"); + for (var i = 1; i < matches.Count; i++) + { + var match = matches[i]; + var groups = match.Groups; + for (var j = 1; j < groups.Count; j++) + { + var group = match.Groups[j]; + if (group.Success) + { + argumentsList.Add(group.Value); + } + } + } + + return argumentsList.ToArray(); + } + + public static string GetMethodDefinitionString(MethodInfo method) + { + var sb = new StringBuilder(); + sb.Append(method.Name); + var parameters = method.GetParameters(); + foreach (var param in parameters) + { + var paramName = param.Name; + var paramType = param.ParameterType; + sb.Append($" {paramName}({TypeToSimpleTypeString(paramType)})"); + } + + return sb.ToString(); + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/ConsoleUtility.cs.meta b/Assets/Package/Runtime/Console/ConsoleUtility.cs.meta new file mode 100644 index 0000000..a5fdfd3 --- /dev/null +++ b/Assets/Package/Runtime/Console/ConsoleUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 01dc17b30b6f232458f7285902ccb1a5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs b/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs new file mode 100644 index 0000000..e6ba4b5 --- /dev/null +++ b/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs @@ -0,0 +1,12 @@ +namespace BroWar.Debugging.Console +{ + public interface IConsoleHistoryDisposer + { + void SaveHistory(); + void LoadHistory(); + void ClearHistory(); + void AddEntry(string entry); + bool TryGetNextEntryFromHistory(out string entry); + bool TryGetPrevEntryFromHistory(out string entry); + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs.meta b/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs.meta new file mode 100644 index 0000000..0665041 --- /dev/null +++ b/Assets/Package/Runtime/Console/IConsoleHistoryDisposer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf7671c6e9544814f9528a51cd3cce84 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/IConsoleManager.cs b/Assets/Package/Runtime/Console/IConsoleManager.cs new file mode 100644 index 0000000..761467e --- /dev/null +++ b/Assets/Package/Runtime/Console/IConsoleManager.cs @@ -0,0 +1,9 @@ +namespace BroWar.Debugging.Console +{ + public interface IConsoleManager : IConsoleHistoryDisposer + { + object InvokeCommand(string input); + void AppendCommand(ConsoleCommand command); + void RemoveCommand(ConsoleCommand command); + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/IConsoleManager.cs.meta b/Assets/Package/Runtime/Console/IConsoleManager.cs.meta new file mode 100644 index 0000000..61ce56e --- /dev/null +++ b/Assets/Package/Runtime/Console/IConsoleManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ee7e4b4d2abdd664185a625bf3271ad8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/Console/MessageType.cs b/Assets/Package/Runtime/Console/MessageType.cs new file mode 100644 index 0000000..3b117df --- /dev/null +++ b/Assets/Package/Runtime/Console/MessageType.cs @@ -0,0 +1,9 @@ +namespace BroWar.Debugging.Console +{ + public enum MessageType + { + Log, + Warning, + Error + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/Console/MessageType.cs.meta b/Assets/Package/Runtime/Console/MessageType.cs.meta new file mode 100644 index 0000000..1007c5f --- /dev/null +++ b/Assets/Package/Runtime/Console/MessageType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81b702cb29d79c042afba27613e7ebaa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/FpsCounter.cs b/Assets/Package/Runtime/FpsCounter.cs new file mode 100644 index 0000000..e0247bb --- /dev/null +++ b/Assets/Package/Runtime/FpsCounter.cs @@ -0,0 +1,19 @@ +using UnityEngine; + +namespace BroWar.Debugging +{ + [AddComponentMenu("BroWar/Debugging/FPS Counter")] + public class FpsCounter : MonoBehaviour + { + private readonly Rect labelPosition = new Rect(10, 10, 100, 100); + + [SerializeField, Disable] + private int value; + + private void OnGUI() + { + value = (int)(1.0f / Time.unscaledDeltaTime); + GUI.Label(labelPosition, $"{value} FPS"); + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/FpsCounter.cs.meta b/Assets/Package/Runtime/FpsCounter.cs.meta new file mode 100644 index 0000000..dc4fa6e --- /dev/null +++ b/Assets/Package/Runtime/FpsCounter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c5c84fa2624528449441fa243793507 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/GameKiller.cs b/Assets/Package/Runtime/GameKiller.cs new file mode 100644 index 0000000..0fba08d --- /dev/null +++ b/Assets/Package/Runtime/GameKiller.cs @@ -0,0 +1,32 @@ +#if UNITY_EDITOR +using UnityEditor; +#endif +using UnityEngine; +using UnityEngine.InputSystem; + +namespace BroWar.Debugging +{ + [AddComponentMenu("BroWar/Debugging/Game Killer")] + public class GameKiller : MonoBehaviour + { + [SerializeField, SearchableEnum] + private Key exitKey = Key.Escape; + + private void Update() + { + if (Keyboard.current[exitKey].wasPressedThisFrame) + { + KillGame(); + } + } + + private void KillGame() + { +#if UNITY_EDITOR + EditorApplication.isPlaying = false; +#else + Application.Quit(); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/GameKiller.cs.meta b/Assets/Package/Runtime/GameKiller.cs.meta new file mode 100644 index 0000000..2e3a205 --- /dev/null +++ b/Assets/Package/Runtime/GameKiller.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a500a6547f840f46bfbbf613600ba02 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/ScenesLoader.cs b/Assets/Package/Runtime/ScenesLoader.cs new file mode 100644 index 0000000..720079c --- /dev/null +++ b/Assets/Package/Runtime/ScenesLoader.cs @@ -0,0 +1,67 @@ +using System.Collections; +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace BroWar.Debugging +{ + [AddComponentMenu("BroWar/Debugging/Scenes Loader")] + public class ScenesLoader : MonoBehaviour + { + [SerializeField, ReorderableList] + private SerializedScene[] scenes; + + private void OnEnable() + { + SceneManager.sceneLoaded += OnSceneLoaded; + } + + private void OnDisable() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + } + + private IEnumerator Start() + { + foreach (var scene in scenes) + { + var operation = SceneManager.LoadSceneAsync(scene.BuildIndex, LoadSceneMode.Additive); + if (operation == null) + { + continue; + } + + while (!operation.isDone) + { + yield return null; + } + + Debug.Log($"[Debugging] Scene loaded: {scene.SceneName}"); + } + } + + private void HandleFirst(SerializedScene scene) + { + var targetScene = SceneManager.GetSceneByBuildIndex(scene.BuildIndex); + SceneManager.SetActiveScene(targetScene); + } + + private void HandleFirst(Scene scene) + { + SceneManager.SetActiveScene(scene); + } + + private void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + if (scenes.Length == 0) + { + return; + } + + var targetScene = scenes[0]; + if (targetScene.BuildIndex == scene.buildIndex) + { + HandleFirst(scene); + } + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/ScenesLoader.cs.meta b/Assets/Package/Runtime/ScenesLoader.cs.meta new file mode 100644 index 0000000..623f825 --- /dev/null +++ b/Assets/Package/Runtime/ScenesLoader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71c656db8b089df4fa961010ae9525b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Runtime/VersionDisplayer.cs b/Assets/Package/Runtime/VersionDisplayer.cs new file mode 100644 index 0000000..2d5235e --- /dev/null +++ b/Assets/Package/Runtime/VersionDisplayer.cs @@ -0,0 +1,14 @@ +using UnityEngine; + +namespace BroWar.Debugging +{ + [AddComponentMenu("BroWar/Debugging/Version Displayer")] + public class VersionDisplayer : MonoBehaviour + { + private void OnGUI() + { + var labelPosition = new Rect(10, Screen.height - 20, 100, 40); + GUI.Label(labelPosition, $"v{Application.version}"); + } + } +} \ No newline at end of file diff --git a/Assets/Package/Runtime/VersionDisplayer.cs.meta b/Assets/Package/Runtime/VersionDisplayer.cs.meta new file mode 100644 index 0000000..eec4c28 --- /dev/null +++ b/Assets/Package/Runtime/VersionDisplayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4c35b7f4026ca2344b54d5316f845a7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Tests.meta b/Assets/Package/Tests.meta index 704a85f..b627e11 100644 --- a/Assets/Package/Tests.meta +++ b/Assets/Package/Tests.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2275c38156f0ee14fa809c3ea4758c42 +guid: 5c715394c32c669429db3e1c95424155 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Package/Tests/Runtime.meta b/Assets/Package/Tests/Runtime.meta new file mode 100644 index 0000000..cc1e0d1 --- /dev/null +++ b/Assets/Package/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8a6a92c03c5fdfe40a4e05c13363a2fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs new file mode 100644 index 0000000..1060283 --- /dev/null +++ b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; + +namespace BroWar.Tests.Debugging +{ + using BroWar.Debugging.Console; + + public class ArgumentExtractionTest + { + [TestCase("CommandName", new string[] { })] + [TestCase("CommandName \"arg1\"", new string[] { "arg1" })] + [TestCase("CommandName \"arg1.1 arg1.2\"", new string[] { "arg1.1 arg1.2" })] + [TestCase("CommandName arg1 \"arg2.1 arg2.2\"", new string[] { "arg1", "arg2.1 arg2.2" })] + [TestCase("CommandName \"arg1.1 arg1.2\" arg2", new string[] { "arg1.1 arg1.2", "arg2" })] + [TestCase("CommandName arg1 \"arg2.1 arg2.2\" arg3", new string[] { "arg1", "arg2.1 arg2.2", "arg3" })] + [TestCase("CommandName arg1 \"arg2.1 arg2.2\" arg3 arg4", new string[] { "arg1", "arg2.1 arg2.2", "arg3", "arg4" })] + [TestCase("CommandName arg1 \"arg2.1 arg2.2\" \" arg3.1 arg3.2\"", new string[] { "arg1", "arg2.1 arg2.2", " arg3.1 arg3.2" })] + public void TestMultiArgumentExtraction(string input, string[] expectedOutput) + { + Assert.AreEqual(ConsoleUtility.ExtractArguments(input, "\""), expectedOutput); + } + + [TestCase("CommandName \"invalid input")] + [TestCase("CommandName invalid input\"")] + [TestCase("CommandName \"invalid input\"\"")] + [TestCase("CommandName invalid input\"\"\"")] + [TestCase("CommandName \"arg1.1 arg 1.2\" \"arg2.1 arg2.2")] + [TestCase("CommandName \"arg1.1 arg 1.2\" arg2.1 arg2.2\"")] + public void TestMultiArgumentExtractionExceptions(string input) + { + Assert.Throws(() => ConsoleUtility.ExtractArguments(input, "\"")); + } + } +} \ No newline at end of file diff --git a/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs.meta b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs.meta new file mode 100644 index 0000000..459aa03 --- /dev/null +++ b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3fb0646c99c87748a277f5655a1c724 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef b/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef new file mode 100644 index 0000000..e074e98 --- /dev/null +++ b/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef @@ -0,0 +1,22 @@ +{ + "name": "BroWar.Debugging.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "BroWar.Debugging" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef.meta b/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef.meta new file mode 100644 index 0000000..a7c0e75 --- /dev/null +++ b/Assets/Package/Tests/Runtime/BroWar.Debugging.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 28f30ed6c0b1f604b8e970cc133fb69e +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Package/package.json b/Assets/Package/package.json index be423a5..2f9346e 100644 --- a/Assets/Package/package.json +++ b/Assets/Package/package.json @@ -1,13 +1,19 @@ { - "name": "com.browar.TODO", - "displayName": "TODO", - "version": "0.0.0", + "name": "com.browar.debugging", + "displayName": "Debugging", + "version": "1.0.0", "unity": "2018.1", - "description": "TODO.", + "description": "Collection of debug scripts and systems.", "keywords": [ - "TODO", + "debugging", + "debug" ], - "category": "TODO", + "category": "Debug", + "dependencies": { + "com.browar.common": "1.0.0", + "com.browar.editor-toolbox": "0.12.0", + "com.unity.inputsystem": "1.3.0" + }, "author": { "name": "BroWar Collective", "email": "browar.collective@gmail.com", diff --git a/Assets/Package/package.json.meta b/Assets/Package/package.json.meta index 9e15780..2f54a16 100644 --- a/Assets/Package/package.json.meta +++ b/Assets/Package/package.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2907910f201ee5241b2173505d3f4865 +guid: 550400c0b354ee940b5000642a7859b8 TextScriptImporter: externalObjects: {} userData: diff --git a/Packages/manifest.json b/Packages/manifest.json index a1ac03a..88a15b9 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,7 @@ { "dependencies": { + "com.browar.common": "1.0.0", + "com.browar.editor-toolbox": "0.12.0", "com.unity.2d.sprite": "1.0.0", "com.unity.2d.tilemap": "1.0.0", "com.unity.analytics": "3.6.12", @@ -8,6 +10,7 @@ "com.unity.ide.rider": "2.0.7", "com.unity.ide.visualstudio": "2.0.14", "com.unity.ide.vscode": "1.2.5", + "com.unity.inputsystem": "1.3.0", "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.4.8", @@ -45,5 +48,14 @@ "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0" - } + }, + "scopedRegistries": [ + { + "name": "BroWar Collective", + "url": "https://npm.cloudsmith.io/browar-collective/browar", + "scopes": [ + "com.browar" + ] + } + ] } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index dfda880..2a5a287 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,21 @@ { "dependencies": { + "com.browar.common": { + "version": "1.0.0", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://npm.cloudsmith.io/browar-collective/browar" + }, + "com.browar.editor-toolbox": { + "version": "0.12.0", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.editorcoroutines": "1.0.0" + }, + "url": "https://npm.cloudsmith.io/browar-collective/browar" + }, "com.unity.2d.sprite": { "version": "1.0.0", "depth": 0, @@ -69,6 +85,15 @@ "dependencies": {}, "url": "https://packages.unity.com" }, + "com.unity.inputsystem": { + "version": "1.3.0", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.uielements": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.services.core": { "version": "1.0.1", "depth": 1, diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 9bd6d10..0147887 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -4,8 +4,5 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 - m_Scenes: - - enabled: 0 - path: - guid: 00000000000000000000000000000000 + m_Scenes: [] m_configObjects: {} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index be4a797..c019c57 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -24,20 +24,28 @@ MonoBehaviour: m_Scopes: [] m_IsDefault: 1 m_Capabilities: 7 - m_UserSelectedRegistryName: + - m_Id: scoped:BroWar Collective + m_Name: BroWar Collective + m_Url: https://npm.cloudsmith.io/browar-collective/browar + m_Scopes: + - com.browar + m_IsDefault: 0 + m_Capabilities: 0 + m_UserSelectedRegistryName: BroWar Collective m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: m_ErrorMessage: m_Original: - m_Id: - m_Name: - m_Url: - m_Scopes: [] + m_Id: scoped:BroWar Collective + m_Name: BroWar Collective + m_Url: https://npm.cloudsmith.io/browar-collective/browar + m_Scopes: + - com.browar m_IsDefault: 0 m_Capabilities: 0 m_Modified: 0 - m_Name: - m_Url: + m_Name: BroWar Collective + m_Url: https://npm.cloudsmith.io/browar-collective/browar m_Scopes: - - + - com.browar m_SelectedScopeIndex: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 7e0728c..3faa0b7 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -690,7 +690,7 @@ PlayerSettings: m_VersionCode: 1 m_VersionName: apiCompatibilityLevel: 6 - activeInputHandler: 0 + activeInputHandler: 1 cloudProjectId: 7c3cffca-cc4e-4f8f-93f7-97568a17fdbb framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] diff --git a/README.md b/README.md index 4283fb6..ccd4032 100644 --- a/README.md +++ b/README.md @@ -1 +1,8 @@ -# \ No newline at end of file +# UI + +### Structure +``` +├── Editor +├── Runtime +├── Tests +``` \ No newline at end of file From 956b42ed992f7c485302d3108cff0f90dc3a7db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Matkowski?= Date: Sat, 24 Dec 2022 16:25:57 +0100 Subject: [PATCH 2/4] Update README.md --- Assets/Package/README.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Package/README.md b/Assets/Package/README.md index ccd4032..9c87d71 100644 --- a/Assets/Package/README.md +++ b/Assets/Package/README.md @@ -1,4 +1,4 @@ -# UI +# Debugging ### Structure ``` diff --git a/README.md b/README.md index ccd4032..9c87d71 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# UI +# Debugging ### Structure ``` From 59938592c2620a08592a8beb053c534ba79ebb41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Matkowski?= Date: Sat, 24 Dec 2022 16:28:25 +0100 Subject: [PATCH 3/4] Update package.json --- Assets/Package/package.json | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Assets/Package/package.json b/Assets/Package/package.json index 2f9346e..b1f4b9b 100644 --- a/Assets/Package/package.json +++ b/Assets/Package/package.json @@ -1,22 +1,22 @@ { - "name": "com.browar.debugging", - "displayName": "Debugging", - "version": "1.0.0", - "unity": "2018.1", - "description": "Collection of debug scripts and systems.", - "keywords": [ - "debugging", - "debug" - ], - "category": "Debug", - "dependencies": { - "com.browar.common": "1.0.0", - "com.browar.editor-toolbox": "0.12.0", - "com.unity.inputsystem": "1.3.0" - }, - "author": { - "name": "BroWar Collective", - "email": "browar.collective@gmail.com", - "url": "https://github.com/BroWar-Collective" - } + "name": "com.browar.debugging", + "displayName": "Debugging", + "version": "1.0.0", + "unity": "2018.1", + "description": "Collection of debug scripts and systems.", + "keywords": [ + "debugging", + "debug" + ], + "category": "Debug", + "dependencies": { + "com.browar.common": "1.0.0", + "com.browar.editor-toolbox": "0.12.0", + "com.unity.inputsystem": "1.3.0" + }, + "author": { + "name": "BroWar Collective", + "email": "browar.collective@gmail.com", + "url": "https://github.com/BroWar-Collective" + } } From 73ebf0ab793dc38a4a59a8116f550361dd047d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Matkowski?= Date: Sat, 24 Dec 2022 16:33:12 +0100 Subject: [PATCH 4/4] Minor refactor changes --- Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs index 1060283..5ac0585 100644 --- a/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs +++ b/Assets/Package/Tests/Runtime/ArgumentExtractionTest.cs @@ -1,6 +1,6 @@ using NUnit.Framework; -namespace BroWar.Tests.Debugging +namespace BroWar.Debugging.Tests { using BroWar.Debugging.Console;