├── screenshot01.png ├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── NetworkManager.asset ├── EditorBuildSettings.asset ├── XRSettings.asset ├── VersionControlSettings.asset ├── TimeManager.asset ├── VFXManager.asset ├── AudioManager.asset ├── RiderScriptEditorPersistedState.asset ├── TagManager.asset ├── DynamicsManager.asset ├── UnityConnectSettings.asset ├── PackageManagerSettings.asset ├── EditorSettings.asset ├── MemorySettings.asset ├── Physics2DSettings.asset ├── NavMeshAreas.asset ├── GraphicsSettings.asset ├── QualitySettings.asset └── InputManager.asset ├── Assets ├── Sample01.unity.meta ├── Sample02.unity.meta ├── Sample03.unity.meta ├── Sample04.unity.meta ├── Packages │ ├── XGUI │ │ ├── LICENSE.meta │ │ ├── package.json.meta │ │ ├── XGUI.asmdef.meta │ │ ├── Components.meta │ │ ├── Components │ │ │ ├── Panels.meta │ │ │ ├── Elements.meta │ │ │ ├── Elements │ │ │ │ ├── Texts.meta │ │ │ │ ├── Reflections.meta │ │ │ │ ├── Texts │ │ │ │ │ ├── Values.meta │ │ │ │ │ ├── Values │ │ │ │ │ │ ├── Numerics.meta │ │ │ │ │ │ ├── Vectors.meta │ │ │ │ │ │ ├── Matrix4x4GUI.cs.meta │ │ │ │ │ │ ├── Vectors │ │ │ │ │ │ │ ├── ColorGUI.cs.meta │ │ │ │ │ │ │ ├── Vector2IntGUI.cs.meta │ │ │ │ │ │ │ ├── VectorFloatGUI.cs.meta │ │ │ │ │ │ │ ├── Vector2GUI.cs.meta │ │ │ │ │ │ │ ├── Vector3GUI.cs.meta │ │ │ │ │ │ │ ├── Vector4GUI.cs.meta │ │ │ │ │ │ │ ├── VectorGUI.cs.meta │ │ │ │ │ │ │ ├── Vector3IntGUI.cs.meta │ │ │ │ │ │ │ ├── VectorFloatGUI.cs │ │ │ │ │ │ │ ├── VectorGUI.cs │ │ │ │ │ │ │ ├── Vector2IntGUI.cs │ │ │ │ │ │ │ ├── Vector2GUI.cs │ │ │ │ │ │ │ ├── Vector3IntGUI.cs │ │ │ │ │ │ │ ├── Vector3GUI.cs │ │ │ │ │ │ │ ├── Vector4GUI.cs │ │ │ │ │ │ │ └── ColorGUI.cs │ │ │ │ │ │ ├── ValueGUI.cs.meta │ │ │ │ │ │ ├── Numerics │ │ │ │ │ │ │ ├── IntGUI.cs.meta │ │ │ │ │ │ │ ├── FloatGUI.cs.meta │ │ │ │ │ │ │ ├── NumericGUI.cs.meta │ │ │ │ │ │ │ ├── IntGUI.cs │ │ │ │ │ │ │ ├── FloatGUI.cs │ │ │ │ │ │ │ └── NumericGUI.cs │ │ │ │ │ │ ├── ValueGUI.cs │ │ │ │ │ │ └── Matrix4x4GUI.cs │ │ │ │ │ ├── TextFieldGUI.cs.meta │ │ │ │ │ ├── StringGUI.cs.meta │ │ │ │ │ ├── StringGUI.cs │ │ │ │ │ └── TextFieldGUI.cs │ │ │ │ ├── ListGUI.cs.meta │ │ │ │ ├── ListBaseGUI.cs.meta │ │ │ │ ├── UnsupportedGUI.cs.meta │ │ │ │ ├── Reflections │ │ │ │ │ ├── FlexGUI.cs.meta │ │ │ │ │ ├── FlexListGUI.cs.meta │ │ │ │ │ ├── ReflectionHelper.cs.meta │ │ │ │ │ ├── FlexGUI.cs │ │ │ │ │ ├── FlexListGUI.cs │ │ │ │ │ └── ReflectionHelper.cs │ │ │ │ ├── BoolGUI.cs.meta │ │ │ │ ├── EnumGUI.cs.meta │ │ │ │ ├── ElementGUI.cs.meta │ │ │ │ ├── ElementGUI.cs │ │ │ │ ├── UnsupportedGUI.cs │ │ │ │ ├── BoolGUI.cs │ │ │ │ ├── ListGUI.cs │ │ │ │ ├── EnumGUI.cs │ │ │ │ └── ListBaseGUI.cs │ │ │ ├── Panels │ │ │ │ ├── ScrollPanel.cs.meta │ │ │ │ ├── Panel.cs.meta │ │ │ │ ├── TabPanel.cs.meta │ │ │ │ ├── FoldoutPanel.cs.meta │ │ │ │ ├── Panel.cs │ │ │ │ ├── TabPanel.cs │ │ │ │ ├── ScrollPanel.cs │ │ │ │ └── FoldoutPanel.cs │ │ │ ├── ComponentGUI.cs.meta │ │ │ └── ComponentGUI.cs │ │ ├── BaseGUI.cs.meta │ │ ├── FlexWindow.cs.meta │ │ ├── XGUILayout.cs.meta │ │ ├── XGUI.asmdef │ │ ├── package.json │ │ ├── BaseGUI.cs │ │ ├── LICENSE │ │ ├── FlexWindow.cs │ │ └── XGUILayout.cs │ └── XGUI.meta ├── Packages.meta ├── Sample01.cs.meta ├── Sample02.cs.meta ├── Sample03.cs.meta ├── Sample04.cs.meta ├── Sample03.cs ├── Sample02.cs ├── Sample01.cs ├── Sample04.cs ├── Sample02.unity ├── Sample03.unity ├── Sample01.unity └── Sample04.unity ├── LICENSE ├── .gitignore ├── README.md ├── Packages ├── manifest.json └── packages-lock.json └── Logs └── Packages-Update.log /screenshot01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XJINE/Unity_XGUI/HEAD/screenshot01.png -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.2.19f1 2 | m_EditorVersionWithRevision: 2022.2.19f1 (765657fe9343) 3 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /Assets/Sample01.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e238e36ca1040594493678735470764b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Sample02.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f460511478e344d448e6ca68e0d9aeae 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Sample03.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21d98134ff3ae0247afb533623ec850d 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Sample04.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33353a6e4f7525f4495153b0745c580a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/LICENSE.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8007af3239e3da64a9dc8a0692f97536 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4c40eef117c8d9c40bde6c6739822cac 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/XGUI.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3afd393eaeaad1342837e3076d8fb51f 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2c84d7c7b0129764090c7af81ef27824 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 592a33a2801cb634f948ce6ec8e5942f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cac6e18e97a826946a7c09b94e55f5e9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2fb824353c26516448048e339788c2d7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 02ab081c3bd7827429cfb701352bd94a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f4a20d1d498faf44bd50cfe3bd8cef7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b8947db82a772044b8780724ec96232 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a68b02b78c506a543845760f99b08e94 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Packages.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c87f5bf1c47e301478dff86f0f4a744f 3 | folderAsset: yes 4 | timeCreated: 1512616093 5 | licenseType: Pro 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c76aa2c897e24e34eb66b5c4416af499 3 | folderAsset: yes 4 | timeCreated: 1512161585 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Sample01.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 63eb82ceba8ae3c499dd2bdd04c66c6c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample02.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2ce9b9b2e15bd0449c71802e945c796 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample03.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c84b5310022e55448837c3fb2b5f3222 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Sample04.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa8ed5852d331fd439d6fd12644f890a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ListGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98c7376c94bb24a4aa506e22dc81b014 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/ScrollPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a915bd7e727cf6d4cb48ae2188700bed 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 6.72 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ListBaseGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82f5cd34f6758fe44b1646ac90db5e59 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/UnsupportedGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d3b383e13de03f44b716d4b28695e73 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/FlexGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b40f5be519143074995d3dc2491ed5ba 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/TextFieldGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7d0ea34fe941da4e9355824cf1c9422 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/FlexListGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74e43fc0f1005ce41907a76549b6d2da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Matrix4x4GUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e156a7e45860a7c4fa8343dd4dca1ae1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/ReflectionHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0e429f95dc77e24fa954a7b04224039 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/ColorGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8182ee8d0887cca42b12e0e59cc60679 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector2IntGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 977c6b44f91d82f4ab5fe40782214ce0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/VectorFloatGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b2e29a5a8c6ded4da5abb24a32f8ecc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/BaseGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c16fe1a4165f8c4faa2388a4b4eb561 3 | timeCreated: 1512167226 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/FlexWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a19d1e2289019546a65f9accdb47ac9 3 | timeCreated: 1512167760 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/XGUILayout.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 21097f43e58e731478bdfbba2404ca11 3 | timeCreated: 1512163489 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/ComponentGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dfeb8ba6b6177345b261c77474e0df2 3 | timeCreated: 1512161628 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/Panel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5fc10566b86c6c49b6741b9de67939f 3 | timeCreated: 1512167081 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/BoolGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f9c451021cd77784d828c8e676facce3 3 | timeCreated: 1512161625 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/EnumGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1b2ccfd56191614b8b182d295d4269d 3 | timeCreated: 1512311670 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/TabPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 932465f9da2a7694d8ed7e4713347ff1 3 | timeCreated: 1512161610 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ElementGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b1c866b3b768b94408ad151993702611 3 | timeCreated: 1512521782 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/FoldoutPanel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bbb9c953145498949a2db3f796319ed3 3 | timeCreated: 1512167763 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/StringGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 32f1eab166a1dc34283208d2c10b0893 3 | timeCreated: 1512161599 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/ValueGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b4cc6e99d800c74e8e6cabdd23c6d29 3 | timeCreated: 1512242260 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/IntGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9208f8673aa4d544fb454d4c2c078ab8 3 | timeCreated: 1512161599 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/FloatGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6f4ee97c898e494c869ac3fe125c31d 3 | timeCreated: 1512226842 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/NumericGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0d7d06320ef47234088013b3dfc1faaf 3 | timeCreated: 1512533718 4 | licenseType: Pro 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector2GUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af4b5ad9f9d8a214eb23085b6351b62e 3 | timeCreated: 1512227550 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector3GUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e0c9b0d94bf289d45bc573ef8df2bf48 3 | timeCreated: 1512227550 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector4GUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e949f449a541de045be24a1d95c573d1 3 | timeCreated: 1512227550 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/VectorGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49f3005d85553364f8b30fcefc5c6b24 3 | timeCreated: 1512308362 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector3IntGUI.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d612223be2e9a6149aaa2342cc96afe4 3 | timeCreated: 1512227550 4 | licenseType: Free 5 | MonoImporter: 6 | externalObjects: {} 7 | serializedVersion: 2 8 | defaultReferences: [] 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ElementGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public abstract class ElementGUI : ComponentGUI 4 | { 5 | #region Constructor 6 | 7 | protected ElementGUI() { } 8 | 9 | protected ElementGUI(string title) : base(title) { } 10 | 11 | #endregion Constructor 12 | 13 | #region Method 14 | 15 | public abstract T Show(T value); 16 | 17 | #endregion Method 18 | } 19 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/Panel.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public abstract class Panel : ComponentGUI 4 | { 5 | #region Field 6 | 7 | public T Value; 8 | public bool BoxSkin = true; 9 | 10 | #endregion Field 11 | 12 | #region Constructor 13 | 14 | protected Panel() { } 15 | 16 | protected Panel(string title) : base(title) { } 17 | 18 | #endregion Constructor 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/XGUI.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "XGUI", 3 | "rootNamespace": "", 4 | "references": [ 5 | "GUID:db2963f7e9f762d4b9e27e490c2b66f4" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": false, 11 | "precompiledReferences": [], 12 | "autoReferenced": true, 13 | "defineConstraints": [], 14 | "versionDefines": [], 15 | "noEngineReferences": false 16 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "com.xjine.xgui", 3 | "displayName": "XGUI", 4 | "version" : "2.3.1", 5 | "unity" : "2022.2", 6 | "description": "Utilities to make a lot of IMGUI(OnGUI). It is easy & fast.", 7 | "author" : 8 | { 9 | "name": "XJINE", 10 | "url" : "https://github.com/XJINE" 11 | }, 12 | "keywords": 13 | [ 14 | "GUI" 15 | ], 16 | "dependencies": 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ProjectSettings/RiderScriptEditorPersistedState.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState 15 | lastWriteTicks: -8585484322494032650 16 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/UnsupportedGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public class UnSupportedGUI : ElementGUI 4 | { 5 | #region Constructor 6 | 7 | public UnSupportedGUI() { } 8 | 9 | public UnSupportedGUI(string title) : base(title) { } 10 | 11 | #endregion Constructor 12 | 13 | #region Method 14 | 15 | public override int Show(int value) 16 | { 17 | XGUILayout.Label("UnSupported : " + base.Title); 18 | return -1; 19 | } 20 | 21 | #endregion Method 22 | } 23 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/VectorFloatGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public abstract class VectorFloatGUI : VectorGUI where T : struct 4 | { 5 | #region Property 6 | 7 | public virtual int Digits { get; set; } 8 | 9 | #endregion Property 10 | 11 | #region Constructor 12 | 13 | protected VectorFloatGUI() { } 14 | 15 | protected VectorFloatGUI(string title) : base(title) { } 16 | 17 | protected VectorFloatGUI(string title, T min, T max) : base(title, min, max) { } 18 | 19 | #endregion Constructor 20 | } 21 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/BaseGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public abstract class BaseGUI 4 | { 5 | #region Property 6 | 7 | public virtual string Title { get; set; } 8 | 9 | #endregion Property 10 | 11 | #region Constructor 12 | 13 | protected BaseGUI() : this (XGUILayout.DefaultTitle) { } 14 | 15 | protected BaseGUI(string title) 16 | { 17 | // CAUTION: 18 | // Initialize first, because some inheritance initialize the GUI in Initialize. 19 | 20 | Initialize(); 21 | Title = title; 22 | } 23 | 24 | #endregion Constructor 25 | 26 | #region Method 27 | 28 | protected virtual void Initialize() { } 29 | 30 | #endregion Method 31 | } 32 | } -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | m_AutoSimulation: 1 20 | m_AutoSyncTransforms: 1 21 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/BoolGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class BoolGUI : ElementGUI 6 | { 7 | #region Constructor 8 | 9 | public BoolGUI() { } 10 | 11 | public BoolGUI(string title) : base(title) { } 12 | 13 | #endregion Constructor 14 | 15 | #region Method 16 | 17 | public override bool Show(bool value) 18 | { 19 | var previousValue = value; 20 | 21 | const string emptyText = ""; 22 | 23 | XGUILayout.HorizontalLayout(()=> 24 | { 25 | base.ShowTitle(base.Title == null); 26 | 27 | GUILayout.FlexibleSpace(); 28 | 29 | value = GUILayout.Toggle(value, emptyText); 30 | }); 31 | 32 | Updated = previousValue != value; 33 | 34 | return value; 35 | } 36 | 37 | #endregion Method 38 | } 39 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/StringGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public class StringGUI : TextFieldGUI 4 | { 5 | #region Constructor 6 | 7 | public StringGUI() { } 8 | 9 | public StringGUI(string title) : base(title) { } 10 | 11 | #endregion Constructor 12 | 13 | #region Method 14 | 15 | protected override void Initialize() 16 | { 17 | base.Initialize(); 18 | Width = XGUILayout.DefaultWidth; 19 | } 20 | 21 | public override string Show(string value) 22 | { 23 | var previousValue = value; 24 | 25 | XGUILayout.HorizontalLayout(() => 26 | { 27 | base.ShowTitle(); 28 | value = ShowTextField(value); 29 | }); 30 | 31 | Updated = previousValue != value; 32 | 33 | return value; 34 | } 35 | 36 | #endregion Method 37 | } 38 | } -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ListGUI.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace XGUI 4 | { 5 | // NOTE: 6 | // Custom TGUI should be override Updated and Title property. 7 | 8 | public class ListGUI : ListBaseGUI 9 | where TList : IList 10 | where TGUI : ElementGUI, new() 11 | { 12 | #region Constructor 13 | 14 | public ListGUI() { } 15 | 16 | public ListGUI(string title) : base(title) { } 17 | 18 | #endregion Constructor 19 | 20 | #region Method 21 | 22 | protected override ElementGUI GenerateGUI() 23 | { 24 | return new TGUI(); 25 | } 26 | 27 | protected override string GetElementTitle(TElement value, ElementGUI gui) 28 | { 29 | return string.IsNullOrEmpty(gui.Title) ? "Element" : gui.Title; 30 | } 31 | 32 | #endregion Method 33 | } 34 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/VectorGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public abstract class VectorGUI : ValueGUI where T : struct 4 | { 5 | #region Constructor 6 | 7 | protected VectorGUI() { } 8 | 9 | protected VectorGUI(string title) : base(title) { } 10 | 11 | protected VectorGUI(string title, T min, T max) : base(title, min, max) { } 12 | 13 | #endregion Constructor 14 | 15 | #region Method 16 | 17 | public override T Show(T value) 18 | { 19 | var previousValue = value; 20 | 21 | XGUILayout.VerticalLayout(() => 22 | { 23 | base.ShowTitle(); 24 | 25 | XGUILayout.HorizontalLayout(() => 26 | { 27 | value = ShowComponents(value); 28 | }); 29 | }); 30 | 31 | Updated = !previousValue.Equals(value); 32 | 33 | return value; 34 | } 35 | 36 | protected abstract T ShowComponents(T value); 37 | 38 | #endregion Method 39 | } 40 | } -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -830 34 | m_OriginalInstanceId: -832 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/IntGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public class IntGUI : NumericGUI 4 | { 5 | #region Property 6 | 7 | protected override bool TextIsCorrect 8 | { 9 | get 10 | { 11 | int value; 12 | 13 | if (!int.TryParse(Text, out value)) 14 | { 15 | return false; 16 | } 17 | 18 | return base.MinValue <= value && value <= base.MaxValue; 19 | } 20 | } 21 | 22 | #endregion Property 23 | 24 | #region Constructor 25 | 26 | public IntGUI() { } 27 | 28 | public IntGUI(string title) : base(title) { } 29 | 30 | public IntGUI(string title, int min, int max) : base(title, min, max) { } 31 | 32 | #endregion Constructor 33 | 34 | #region Method 35 | 36 | protected override void Initialize() 37 | { 38 | base.Initialize(); 39 | 40 | MinValue = XGUILayout.DefaultMinValueInt; 41 | MaxValue = XGUILayout.DefaultMaxValueInt; 42 | } 43 | 44 | #endregion Method 45 | } 46 | } -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 1 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/ValueGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public abstract class ValueGUI : TextFieldGUI where T : struct 6 | { 7 | #region Property 8 | 9 | public virtual T MinValue { get; set; } 10 | public virtual T MaxValue { get; set; } 11 | public virtual bool Slider { get; set; } 12 | 13 | protected override GUIStyle FieldStyle 14 | { 15 | get 16 | { 17 | var style = base.FieldStyle; 18 | style.alignment = TextAnchor.MiddleRight; 19 | return style; 20 | } 21 | } 22 | 23 | #endregion Property 24 | 25 | #region Constructor 26 | 27 | protected ValueGUI() { } 28 | 29 | protected ValueGUI(string title) : base(title) { } 30 | 31 | protected ValueGUI(string title, T min, T max) : base(title) 32 | { 33 | MinValue = min; 34 | MaxValue = max; 35 | } 36 | 37 | #endregion Constructor 38 | 39 | #region Method 40 | 41 | protected override void Initialize() 42 | { 43 | base.Initialize(); 44 | 45 | Width = XGUILayout.DefaultWidth; 46 | Slider = XGUILayout.DefaultSlider; 47 | } 48 | 49 | #endregion Method 50 | } 51 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/TextFieldGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public abstract class TextFieldGUI : ElementGUI 6 | { 7 | #region Property 8 | 9 | public virtual float Width { get; set; } 10 | 11 | private static GUIStyle _fieldStyle; 12 | protected virtual GUIStyle FieldStyle 13 | { 14 | get 15 | { 16 | _fieldStyle ??= new GUIStyle(GUI.skin.textField); 17 | return _fieldStyle; 18 | } 19 | } 20 | 21 | protected GUILayoutOption FieldLayout => 22 | Width <= 0 ? GUILayout.ExpandWidth(true) 23 | : GUILayout.Width(Width); 24 | 25 | #endregion Property 26 | 27 | #region Constructor 28 | 29 | protected TextFieldGUI() { } 30 | 31 | protected TextFieldGUI(string title) : base(title) { } 32 | 33 | #endregion Constructor 34 | 35 | #region Method 36 | 37 | protected override void ShowTitle(bool blank = false) 38 | { 39 | base.ShowTitle(blank || (0 < Width && string.IsNullOrEmpty(base.Title))); 40 | } 41 | 42 | protected virtual string ShowTextField(string text) 43 | { 44 | return GUILayout.TextField(text, FieldStyle, FieldLayout); 45 | } 46 | 47 | #endregion Method 48 | } 49 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/ComponentGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public abstract class ComponentGUI : BaseGUI 6 | { 7 | #region Property 8 | 9 | // NOTE: 10 | // GUIStyle and GUI.skin are accessible in OnGUI(). 11 | 12 | private static GUIStyle _titleStyle; 13 | protected static GUIStyle TitleStyle 14 | { 15 | get 16 | { 17 | _titleStyle ??= new GUIStyle(GUI.skin.label); 18 | return _titleStyle; 19 | } 20 | } 21 | 22 | public virtual bool Updated { get; protected set; } 23 | 24 | #endregion Property 25 | 26 | #region Constructor 27 | 28 | protected ComponentGUI() { } 29 | 30 | protected ComponentGUI(string title) : base(title) { } 31 | 32 | #endregion Constructor 33 | 34 | #region Method 35 | 36 | protected virtual void ShowTitle(bool blank = false) 37 | { 38 | // NOTE: 39 | // Sometimes need to set empty(dummy) title to align another component to right. 40 | 41 | const string emptyTitle = ""; 42 | 43 | if (!blank && string.IsNullOrEmpty(base.Title)) 44 | { 45 | return; 46 | } 47 | 48 | GUILayout.Label(blank ? emptyTitle : base.Title, TitleStyle); 49 | } 50 | 51 | #endregion Method 52 | } 53 | } -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_AutoSyncTransforms: 1 28 | m_AlwaysShowColliders: 0 29 | m_ShowColliderSleep: 1 30 | m_ShowColliderContacts: 0 31 | m_ShowColliderAABB: 0 32 | m_ContactArrowScale: 0.2 33 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 34 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 35 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 36 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 37 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017, XJINE 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2017, XJINE 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Asset meta data should only be ignored when the corresponding asset is also ignored 18 | !/[Aa]ssets/**/*.meta 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | .idea/ 26 | 27 | # Visual Studio cache directory 28 | .vs/ 29 | 30 | # Gradle cache directory 31 | .gradle/ 32 | 33 | # Autogenerated VS/MD/Consulo solution and project files 34 | ExportedObj/ 35 | .consulo/ 36 | *.csproj 37 | *.unityproj 38 | *.sln 39 | *.suo 40 | *.tmp 41 | *.user 42 | *.userprefs 43 | *.pidb 44 | *.booproj 45 | *.svd 46 | *.pdb 47 | *.mdb 48 | *.opendb 49 | *.VC.db 50 | 51 | # Unity3D generated meta files 52 | *.pidb.meta 53 | *.pdb.meta 54 | *.mdb.meta 55 | 56 | # Unity3D generated file on crash reports 57 | sysinfo.txt 58 | 59 | # Builds 60 | *.apk 61 | *.aab 62 | *.unitypackage 63 | 64 | # Crashlytics generated file 65 | crashlytics-build.properties 66 | 67 | # Packed Addressables 68 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 69 | 70 | # Temporary auto-generated Android Assets 71 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 72 | /[Aa]ssets/[Ss]treamingAssets/aa/* -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/TabPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace XGUI 5 | { 6 | public class TabPanel : Panel 7 | { 8 | #region Property 9 | 10 | private static GUIStyle _tabStyle; 11 | private static GUIStyle TabStyle 12 | { 13 | // NOTE: 14 | // GUIStyle is able to access only in OnGUI. 15 | get 16 | { 17 | if (_tabStyle != null) 18 | { 19 | _tabStyle = new GUIStyle(GUI.skin.button); 20 | _tabStyle.onNormal.background = Texture2D.blackTexture; 21 | } 22 | 23 | return _tabStyle; 24 | } 25 | } 26 | 27 | #endregion Property 28 | 29 | #region Constructor 30 | 31 | public TabPanel() { } 32 | 33 | public TabPanel(string title) { } 34 | 35 | #endregion Constructor 36 | 37 | #region Method 38 | 39 | public int Show(params (string label, Action show)[] tabActions) 40 | { 41 | var previousValue = Value; 42 | 43 | var labels = new string[tabActions.Length]; 44 | 45 | for (var i = 0; i < labels.Length; i++) 46 | { 47 | labels[i] = tabActions[i].label; 48 | } 49 | 50 | ShowTitle(); 51 | XGUILayout.VerticalLayout(() => 52 | { 53 | Value = GUILayout.Toolbar(Value, labels, TabStyle); 54 | tabActions[Value].show(); 55 | 56 | }, BoxSkin ? GUI.skin.box : null); 57 | 58 | Updated = previousValue != Value; 59 | 60 | return Value; 61 | } 62 | 63 | #endregion Method 64 | } 65 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity_XGUI 2 | 3 | Utilities to make a lot of IMGUI(OnGUI). It is easy & fast. 4 | 5 | ## Importing 6 | 7 | You can use Package Manager or import it directly. 8 | 9 | ``` 10 | https://github.com/XJINE/Unity_XGUI.git?path=Assets/Packages/XGUI 11 | ``` 12 | 13 | ### Dependencies 14 | 15 | This project use following resources. 16 | 17 | - https://github.com/XJINE/Unity_ExpressionParser 18 | 19 | ## Various GUI 20 | 21 | 22 | 23 | XGUI includes following type GUI. 24 | 25 | 26 | 27 | 28 | 29 |
int float string bool Enum
Vector2 Vector3 Vector4 Vector2Int Vector3Int
Color Matrix4x4 IList<T> (List<T>, T[])
30 | 31 | ## Various Panel 32 | 33 | ``FlexWindow`` automatically scale its width and height when needed. 34 | 35 | ``ScrollPanel`` shows scroll handle when needed. 36 | 37 | ``FoldoutPanel`` & ``TabPanel`` hide or group some GUIs. 38 | 39 | 40 | ## FlexGUI 41 | 42 | FlexGUI provides common feels to make GUI. 43 | 44 | Usually, it is needed to define corresponding GUI. 45 | 46 | ```csharp 47 | BoolGUI _boolGUI = new ("Bool" ); 48 | StringGUI _stringGUI = new ("String") { Width = 250 }; 49 | IntGUI _intGUI = new ("Int" ) { MinValue = 0, MaxValue = 100 }; 50 | ``` 51 | 52 | FlexGUI needs only a Type of the value. 53 | 54 | ```csharp 55 | FlexGUI _boolGUI = new ("Bool" ); 56 | FlexGUI _stringGUI = new ("String") { Width = 250 }; 57 | FlexGUI _intGUI = new ("Int" ) { MinValue = 0, MaxValue = 100 }; 58 | ``` 59 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ai.navigation": "1.1.3", 4 | "com.unity.ide.rider": "3.0.21", 5 | "com.unity.ide.visualstudio": "2.0.18", 6 | "com.xjine.expression_parser": "https://github.com/XJINE/Unity_ExpressionParser.git?path=Assets/Packages/ExpressionParser", 7 | "com.unity.modules.ai": "1.0.0", 8 | "com.unity.modules.androidjni": "1.0.0", 9 | "com.unity.modules.animation": "1.0.0", 10 | "com.unity.modules.assetbundle": "1.0.0", 11 | "com.unity.modules.audio": "1.0.0", 12 | "com.unity.modules.cloth": "1.0.0", 13 | "com.unity.modules.director": "1.0.0", 14 | "com.unity.modules.imageconversion": "1.0.0", 15 | "com.unity.modules.imgui": "1.0.0", 16 | "com.unity.modules.jsonserialize": "1.0.0", 17 | "com.unity.modules.particlesystem": "1.0.0", 18 | "com.unity.modules.physics": "1.0.0", 19 | "com.unity.modules.physics2d": "1.0.0", 20 | "com.unity.modules.screencapture": "1.0.0", 21 | "com.unity.modules.terrain": "1.0.0", 22 | "com.unity.modules.terrainphysics": "1.0.0", 23 | "com.unity.modules.tilemap": "1.0.0", 24 | "com.unity.modules.ui": "1.0.0", 25 | "com.unity.modules.uielements": "1.0.0", 26 | "com.unity.modules.umbra": "1.0.0", 27 | "com.unity.modules.unityanalytics": "1.0.0", 28 | "com.unity.modules.unitywebrequest": "1.0.0", 29 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 30 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 31 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 32 | "com.unity.modules.unitywebrequestwww": "1.0.0", 33 | "com.unity.modules.vehicles": "1.0.0", 34 | "com.unity.modules.video": "1.0.0", 35 | "com.unity.modules.vr": "1.0.0", 36 | "com.unity.modules.wind": "1.0.0", 37 | "com.unity.modules.xr": "1.0.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/FloatGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public class FloatGUI : NumericGUI 4 | { 5 | #region Property 6 | 7 | public virtual int Digits { get; set; } 8 | 9 | protected override bool TextIsCorrect 10 | { 11 | get 12 | { 13 | float value; 14 | 15 | if (!float.TryParse(Text, out value)) 16 | { 17 | return false; 18 | } 19 | 20 | if (value < MinValue || MaxValue < value) 21 | { 22 | return false; 23 | } 24 | 25 | var splits = Text.Split('.'); 26 | 27 | if (splits.Length == 1) 28 | { 29 | return true; 30 | } 31 | 32 | return splits[1].Length <= Digits; 33 | } 34 | } 35 | 36 | #endregion Property 37 | 38 | #region Constructor 39 | 40 | public FloatGUI() { } 41 | 42 | public FloatGUI(string title) : base(title) { } 43 | 44 | public FloatGUI(string title, float min, float max) : base(title, min , max) { } 45 | 46 | #endregion Constructor 47 | 48 | #region Method 49 | 50 | protected override void Initialize() 51 | { 52 | base.Initialize(); 53 | 54 | Digits = XGUILayout.DefaultDigits; 55 | MinValue = XGUILayout.DefaultMinValueFloat; 56 | MaxValue = XGUILayout.DefaultMaxValueFloat; 57 | } 58 | 59 | protected override float ValidateValue(float value) 60 | { 61 | return (float)System.Math.Round(base.ValidateValue(value), Digits); 62 | } 63 | 64 | #endregion Method 65 | } 66 | } -------------------------------------------------------------------------------- /Assets/Sample03.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using XGUI; 4 | 5 | public class Sample03 : MonoBehaviour 6 | { 7 | #region Field 8 | 9 | public CameraType enumSelect; 10 | public float floatListSelect; 11 | public List floatListValue = new () { 0, 1.414f, 2.236f, 3.141f }; 12 | public string stringArraySelect; 13 | public string[] stringArrayValue = { "Alpha", "Bravo", "Charlie", 14 | "Delta", "Echo", "Foxtrot", 15 | "Golf", "Hotel", "India", 16 | "Juliet" }; 17 | 18 | private readonly FlexWindow _window = new ("Sample03"); 19 | 20 | #endregion Field 21 | 22 | #region Method 23 | 24 | private void Update() 25 | { 26 | if (Input.GetKeyDown(KeyCode.Return)) 27 | { 28 | _window.IsVisible = !_window.IsVisible; 29 | } 30 | } 31 | 32 | private void OnGUI() 33 | { 34 | GUILayout.Label("Press [Return] to show/hide window."); 35 | 36 | _window.Show(() => 37 | { 38 | XGUILayout.HorizontalLayout(() => 39 | { 40 | XGUILayout.Label("LabelText(Bold)", XGUILayout.LabelOption.Bold); 41 | XGUILayout.Label("LabelText"); 42 | }); 43 | 44 | XGUILayout.Label("SelectionGrid : Enum"); 45 | enumSelect = XGUILayout.SelectionGrid(enumSelect); 46 | XGUILayout.Label("SelectionGrid : List"); 47 | floatListSelect = XGUILayout.SelectionGrid(floatListSelect, floatListValue, 3); 48 | XGUILayout.Label("SelectionGrid : string[]"); 49 | stringArraySelect = XGUILayout.SelectionGrid(stringArraySelect, stringArrayValue, 5); 50 | }); 51 | } 52 | 53 | #endregion Method 54 | } -------------------------------------------------------------------------------- /Assets/Sample02.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | using XGUI; 5 | 6 | public class Sample02 : MonoBehaviour 7 | { 8 | #region Field 9 | 10 | public int[] intArrayValue; 11 | public Vector2[] vectorArrayValue; 12 | public List enumListValue; 13 | public List intArrayListValue = new () {new []{ 1, 2, 3 }, new []{ 4, 5, 6 }}; 14 | 15 | private readonly FlexWindow _window = new("Sample02"); 16 | 17 | private readonly FlexListGUI _intArrayGUI = new ("IntArrayGUI") 18 | { 19 | MinHeight = 300, 20 | }; 21 | 22 | private readonly FlexListGUI _vectorArrayGUI = new ("VectorArrayGUI") 23 | { 24 | MinValue = Vector2.zero, 25 | MaxValue = Vector2.one * 10, 26 | Digits = 3, 27 | Height = 300 28 | }; 29 | 30 | private readonly FlexListGUI> _enumListGUI = new ("EnumListGUI") 31 | { 32 | MinHeight = 200 33 | }; 34 | 35 | private readonly FlexListGUI> _intArrayListGUI = new ("IntArrayListGUI") 36 | { 37 | MinValue = -1, 38 | MaxValue = 999, 39 | MinHeight = 300, 40 | }; 41 | 42 | private readonly FoldoutPanel _foldoutIntArrayListGUI = new("IntArrayListValue"); 43 | 44 | #endregion Field 45 | 46 | #region Method 47 | 48 | private void Update() 49 | { 50 | if (Input.GetKeyDown(KeyCode.Return)) 51 | { 52 | _window.IsVisible = !_window.IsVisible; 53 | } 54 | } 55 | 56 | private void OnGUI() 57 | { 58 | GUILayout.Label("Press [Return] to show/hide window."); 59 | 60 | _window.Show(() => 61 | { 62 | _intArrayGUI .Show(intArrayValue); 63 | _vectorArrayGUI .Show(vectorArrayValue); 64 | _enumListGUI .Show(enumListValue); 65 | _intArrayListGUI.Show(intArrayListValue); 66 | 67 | _foldoutIntArrayListGUI.Show(() => 68 | { 69 | foreach (var intArray in intArrayListValue) 70 | { 71 | foreach (var intValue in intArray) 72 | { 73 | XGUILayout.Label(intValue.ToString()); 74 | } 75 | } 76 | }); 77 | }); 78 | } 79 | 80 | #endregion Method 81 | } -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 40 | m_PreloadedShaders: [] 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 42 | type: 0} 43 | m_CustomRenderPipeline: {fileID: 0} 44 | m_TransparencySortMode: 0 45 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 46 | m_DefaultRenderingPath: 1 47 | m_DefaultMobileRenderingPath: 1 48 | m_TierSettings: [] 49 | m_LightmapStripping: 0 50 | m_FogStripping: 0 51 | m_InstancingStripping: 0 52 | m_LightmapKeepPlain: 1 53 | m_LightmapKeepDirCombined: 1 54 | m_LightmapKeepDynamicPlain: 1 55 | m_LightmapKeepDynamicDirCombined: 1 56 | m_LightmapKeepShadowMask: 1 57 | m_LightmapKeepSubtractive: 1 58 | m_FogKeepLinear: 1 59 | m_FogKeepExp: 1 60 | m_FogKeepExp2: 1 61 | m_AlbedoSwatchInfos: [] 62 | m_LightsUseLinearIntensity: 0 63 | m_LightsUseColorTemperature: 0 64 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/ScrollPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace XGUI 5 | { 6 | public class ScrollPanel : Panel 7 | { 8 | #region Property 9 | 10 | public float Width { get; set; } 11 | public float Height { get; set; } 12 | public float MinWidth { get; set; } 13 | public float MinHeight { get; set; } 14 | public float MaxWidth { get; set; } = float.MaxValue; 15 | public float MaxHeight { get; set; } = float.MaxValue; 16 | 17 | public bool AlwaysShowHorizontal { get; set; } 18 | public bool AlwaysShowVertical { get; set; } 19 | 20 | #endregion Property 21 | 22 | #region Constructor 23 | 24 | public ScrollPanel() { } 25 | 26 | public ScrollPanel(string title) : base(title) { } 27 | 28 | #endregion Constructor 29 | 30 | #region Method 31 | 32 | public Vector2 Show(params Action[] actions) 33 | { 34 | var previousValue = Value; 35 | var height = Mathf.Min(MaxHeight, Mathf.Max(MinHeight, Height)); 36 | var width = Mathf.Min(MaxWidth, Mathf.Max(MinWidth, Width)); 37 | 38 | XGUILayout.VerticalLayout(() => 39 | { 40 | base.ShowTitle(); 41 | XGUILayout.VerticalLayout(() => 42 | { 43 | Value = GUILayout.BeginScrollView(Value, AlwaysShowHorizontal, 44 | AlwaysShowVertical, 45 | GUILayout.Width (width), 46 | GUILayout.MinWidth(width), 47 | GUILayout.MaxWidth(width), 48 | GUILayout.Height (height)); 49 | foreach (var action in actions) 50 | { 51 | action(); 52 | } 53 | 54 | GUILayout.EndScrollView(); 55 | }, 56 | BoxSkin? GUI.skin.box : null, GUILayout.Height (height), 57 | GUILayout.MinHeight(height), 58 | GUILayout.MaxHeight(height)); 59 | }); 60 | 61 | Updated = previousValue != Value; 62 | 63 | return Value; 64 | } 65 | 66 | #endregion Method 67 | } 68 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector2IntGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Vector2IntGUI : VectorGUI 6 | { 7 | #region Field 8 | 9 | private readonly IntGUI _guiX = new () { Title = "X" }; 10 | private readonly IntGUI _guiY = new () { Title = "Y" }; 11 | 12 | #endregion Field 13 | 14 | #region Property 15 | 16 | public override Vector2Int MinValue 17 | { 18 | get => new () 19 | { 20 | x = _guiX.MinValue, 21 | y = _guiY.MinValue 22 | }; 23 | set 24 | { 25 | _guiX.MinValue = value.x; 26 | _guiY.MinValue = value.y; 27 | } 28 | } 29 | 30 | public override Vector2Int MaxValue 31 | { 32 | get => new () 33 | { 34 | x = _guiX.MaxValue, 35 | y = _guiY.MaxValue 36 | }; 37 | set 38 | { 39 | _guiX.MaxValue = value.x; 40 | _guiY.MaxValue = value.y; 41 | } 42 | } 43 | 44 | public override float Width 45 | { 46 | get => _guiX.Width; 47 | set 48 | { 49 | _guiX.Width = value; 50 | _guiY.Width = value; 51 | } 52 | } 53 | 54 | public override bool Slider 55 | { 56 | get => _guiX.Slider; 57 | set 58 | { 59 | _guiX.Slider = value; 60 | _guiY.Slider = value; 61 | } 62 | } 63 | 64 | #endregion Property 65 | 66 | #region Constructor 67 | 68 | public Vector2IntGUI(){ } 69 | 70 | public Vector2IntGUI(string title) : base(title) { } 71 | 72 | public Vector2IntGUI(string title, Vector2Int min, Vector2Int max) : base(title, min, max) { } 73 | 74 | #endregion Constructor 75 | 76 | #region Method 77 | 78 | protected override void Initialize() 79 | { 80 | base.Initialize(); 81 | 82 | MinValue = XGUILayout.DefaultMinValueVector2Int; 83 | MaxValue = XGUILayout.DefaultMaxValueVector2Int; 84 | } 85 | 86 | protected override Vector2Int ShowComponents(Vector2Int value) 87 | { 88 | return new Vector2Int() 89 | { 90 | x = _guiX.Show(value.x), 91 | y = _guiY.Show(value.y) 92 | }; 93 | } 94 | 95 | #endregion Method 96 | } 97 | } -------------------------------------------------------------------------------- /Logs/Packages-Update.log: -------------------------------------------------------------------------------- 1 | 2 | === Mon Feb 18 18:04:45 2019 3 | 4 | Packages were changed. 5 | Update Mode: updateDependencies 6 | 7 | The following packages were added: 8 | com.unity.collab-proxy@1.2.15 9 | The following packages were updated: 10 | com.unity.package-manager-ui from version 1.9.11 to 2.0.3 11 | 12 | === Tue Feb 19 07:37:01 2019 13 | 14 | Packages were changed. 15 | Update Mode: updateDependencies 16 | 17 | The following packages were added: 18 | com.unity.collab-proxy@1.2.15 19 | 20 | === Fri Apr 12 15:40:35 2019 21 | 22 | Packages were changed. 23 | Update Mode: updateDependencies 24 | 25 | The following packages were updated: 26 | com.unity.package-manager-ui from version 2.0.3 to 2.0.7 27 | 28 | === Mon Jul 22 19:30:16 2019 29 | 30 | Packages were changed. 31 | Update Mode: updateDependencies 32 | 33 | The following packages were added: 34 | com.unity.timeline@1.0.0 35 | com.unity.multiplayer-hlapi@1.0.2 36 | com.unity.xr.legacyinputhelpers@2.0.2 37 | The following packages were updated: 38 | com.unity.package-manager-ui from version 2.0.7 to 2.1.2 39 | 40 | === Tue Dec 10 03:29:15 2019 41 | 42 | Packages were changed. 43 | Update Mode: updateDependencies 44 | 45 | The following packages were added: 46 | com.unity.2d.tilemap@1.0.0 47 | com.unity.ext.nunit@1.0.0 48 | com.unity.test-framework@1.0.13 49 | com.unity.2d.sprite@1.0.0 50 | com.unity.ide.vscode@1.1.2 51 | com.unity.ide.rider@1.1.0 52 | com.unity.ugui@1.0.0 53 | com.unity.modules.androidjni@1.0.0 54 | The following packages were updated: 55 | com.unity.package-manager-ui from version 2.1.2 to 2.2.0 56 | 57 | === Fri Jun 19 16:01:46 2020 58 | 59 | Packages were changed. 60 | Update Mode: updateDependencies 61 | 62 | The following packages were removed: 63 | com.unity.package-manager-ui@2.2.0 64 | 65 | === Mon Feb 28 17:37:32 2022 66 | 67 | Packages were changed. 68 | Update Mode: updateDependencies 69 | 70 | The following packages were updated: 71 | com.unity.ide.rider from version 3.0.7 to 3.0.9 72 | com.unity.ide.visualstudio from version 2.0.11 to 2.0.12 73 | 74 | === Sun May 22 08:10:28 2022 75 | 76 | Packages were changed. 77 | Update Mode: updateDependencies 78 | 79 | The following packages were updated: 80 | com.unity.ide.rider from version 3.0.9 to 3.0.13 81 | com.unity.ide.visualstudio from version 2.0.12 to 2.0.14 82 | 83 | === Tue Jul 11 03:57:23 2023 84 | 85 | Packages were changed. 86 | Update Mode: updateDependencies 87 | 88 | The following packages were added: 89 | com.unity.ai.navigation@1.1.3 90 | The following packages were updated: 91 | com.unity.ide.rider from version 3.0.14 to 3.0.21 92 | com.unity.ide.visualstudio from version 2.0.15 to 2.0.18 93 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Panels/FoldoutPanel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace XGUI 5 | { 6 | public class FoldoutPanel : Panel 7 | { 8 | #region Field 9 | 10 | public Action ButtonFieldAction; 11 | 12 | private static GUIStyle _foldoutButtonStyle; 13 | protected static GUIStyle FoldoutButtonStyle 14 | { 15 | get 16 | { 17 | _foldoutButtonStyle ??= new GUIStyle(GUI.skin.label) 18 | { 19 | margin = GUI.skin.button.margin, 20 | padding = GUI.skin.button.padding 21 | }; 22 | 23 | return _foldoutButtonStyle; 24 | } 25 | } 26 | 27 | private static GUIStyle _foldoutBoxStyle; 28 | protected static GUIStyle FoldoutBoxStyle 29 | { 30 | get 31 | { 32 | _foldoutBoxStyle ??= new GUIStyle(GUI.skin.label) 33 | { 34 | padding = new RectOffset(GUI.skin.font.fontSize, 35 | GUI.skin.box.padding.right, 36 | GUI.skin.box.padding.top, 37 | GUI.skin.box.padding.bottom) 38 | }; 39 | 40 | return _foldoutBoxStyle; 41 | } 42 | } 43 | 44 | #endregion Field 45 | 46 | #region Constructor 47 | 48 | public FoldoutPanel() { } 49 | 50 | public FoldoutPanel(string title) : base(title) { } 51 | 52 | #endregion Constructor 53 | 54 | #region Method 55 | 56 | public bool Show(params Action[] actions) 57 | { 58 | var previousValue = Value; 59 | 60 | XGUILayout.VerticalLayout(() => 61 | { 62 | var buttonContent = (Value ? "\u25BC " : "\u25BA ") + Title; 63 | 64 | XGUILayout.HorizontalLayout(() => 65 | { 66 | var expand = !string.IsNullOrEmpty(Title); 67 | Value = Value != GUILayout.Button(buttonContent, FoldoutButtonStyle, GUILayout.ExpandWidth(expand)); 68 | ButtonFieldAction?.Invoke(); 69 | }); 70 | 71 | if (Value) 72 | { 73 | XGUILayout.VerticalLayout(()=> 74 | { 75 | foreach (var action in actions) 76 | { 77 | action(); 78 | } 79 | }, FoldoutBoxStyle); 80 | } 81 | }, Value && BoxSkin ? GUI.skin.box : null); 82 | 83 | Updated = previousValue != Value; 84 | 85 | return Value; 86 | } 87 | 88 | #endregion Method 89 | } 90 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector2GUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Vector2GUI : VectorFloatGUI 6 | { 7 | #region Field 8 | 9 | private readonly FloatGUI _guiX = new () { Title = "X" }; 10 | private readonly FloatGUI _guiY = new () { Title = "Y" }; 11 | 12 | #endregion Field 13 | 14 | #region Property 15 | 16 | public override Vector2 MinValue 17 | { 18 | get => new () 19 | { 20 | x = _guiX.MinValue, 21 | y = _guiY.MinValue 22 | }; 23 | set 24 | { 25 | _guiX.MinValue = value.x; 26 | _guiY.MinValue = value.y; 27 | } 28 | } 29 | 30 | public override Vector2 MaxValue 31 | { 32 | get => new () 33 | { 34 | x = _guiX.MaxValue, 35 | y = _guiY.MaxValue 36 | }; 37 | set 38 | { 39 | _guiX.MaxValue = value.x; 40 | _guiY.MaxValue = value.y; 41 | } 42 | } 43 | 44 | public override int Digits 45 | { 46 | get => _guiX.Digits; 47 | set 48 | { 49 | _guiX.Digits = value; 50 | _guiY.Digits = value; 51 | } 52 | } 53 | 54 | public override float Width 55 | { 56 | get => _guiX.Width; 57 | set 58 | { 59 | _guiX.Width = value; 60 | _guiY.Width = value; 61 | } 62 | } 63 | 64 | public override bool Slider 65 | { 66 | get => _guiX.Slider; 67 | set 68 | { 69 | _guiX.Slider = value; 70 | _guiY.Slider = value; 71 | } 72 | } 73 | 74 | #endregion Property 75 | 76 | #region Constructor 77 | 78 | public Vector2GUI() { } 79 | 80 | public Vector2GUI(string title) : base(title) { } 81 | 82 | public Vector2GUI(string title, Vector2 min, Vector2 max) : base(title, min, max) { } 83 | 84 | #endregion Constructor 85 | 86 | #region Method 87 | 88 | protected override void Initialize() 89 | { 90 | base.Initialize(); 91 | 92 | MinValue = XGUILayout.DefaultMinValueVector2; 93 | MaxValue = XGUILayout.DefaultMaxValueVector2; 94 | } 95 | 96 | protected override Vector2 ShowComponents(Vector2 value) 97 | { 98 | return new Vector2() 99 | { 100 | x = _guiX.Show(value.x), 101 | y = _guiY.Show(value.y) 102 | }; 103 | } 104 | 105 | #endregion Method 106 | } 107 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector3IntGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Vector3IntGUI : VectorGUI 6 | { 7 | #region Field 8 | 9 | private readonly IntGUI _guiX = new () { Title = "X" }; 10 | private readonly IntGUI _guiY = new () { Title = "Y" }; 11 | private readonly IntGUI _guiZ = new () { Title = "Z" }; 12 | 13 | #endregion Field 14 | 15 | #region Property 16 | 17 | public override Vector3Int MinValue 18 | { 19 | get => new () 20 | { 21 | x = _guiX.MinValue, 22 | y = _guiY.MinValue, 23 | z = _guiZ.MinValue 24 | }; 25 | set 26 | { 27 | _guiX.MinValue = value.x; 28 | _guiY.MinValue = value.y; 29 | _guiZ.MinValue = value.z; 30 | } 31 | } 32 | 33 | public override Vector3Int MaxValue 34 | { 35 | get => new () 36 | { 37 | x = _guiX.MaxValue, 38 | y = _guiY.MaxValue, 39 | z = _guiZ.MaxValue 40 | }; 41 | set 42 | { 43 | _guiX.MaxValue = value.x; 44 | _guiY.MaxValue = value.y; 45 | _guiZ.MaxValue = value.z; 46 | } 47 | } 48 | 49 | public override float Width 50 | { 51 | get => _guiX.Width; 52 | set 53 | { 54 | _guiX.Width = value; 55 | _guiY.Width = value; 56 | _guiZ.Width = value; 57 | } 58 | } 59 | 60 | public override bool Slider 61 | { 62 | get => _guiX.Slider; 63 | set 64 | { 65 | _guiX.Slider = value; 66 | _guiY.Slider = value; 67 | _guiZ.Slider = value; 68 | } 69 | } 70 | 71 | #endregion Property 72 | 73 | #region Constructor 74 | 75 | public Vector3IntGUI() { } 76 | 77 | public Vector3IntGUI(string title) : base(title) { } 78 | 79 | public Vector3IntGUI(string title, Vector3Int min, Vector3Int max) : base(title, min, max) { } 80 | 81 | #endregion Constructor 82 | 83 | #region Method 84 | 85 | protected override void Initialize() 86 | { 87 | base.Initialize(); 88 | 89 | MinValue = XGUILayout.DefaultMinValueVector3Int; 90 | MaxValue = XGUILayout.DefaultMaxValueVector3Int; 91 | } 92 | 93 | protected override Vector3Int ShowComponents(Vector3Int value) 94 | { 95 | return new Vector3Int() 96 | { 97 | x = _guiX.Show(value.x), 98 | y = _guiY.Show(value.y), 99 | z = _guiZ.Show(value.z) 100 | }; 101 | } 102 | 103 | #endregion Method 104 | } 105 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector3GUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Vector3GUI : VectorFloatGUI 6 | { 7 | #region Field 8 | 9 | private readonly FloatGUI _guiX = new () { Title = "X" }; 10 | private readonly FloatGUI _guiY = new () { Title = "Y" }; 11 | private readonly FloatGUI _guiZ = new () { Title = "Z" }; 12 | 13 | #endregion Field 14 | 15 | #region Property 16 | 17 | public override Vector3 MinValue 18 | { 19 | get => new () 20 | { 21 | x = _guiX.MinValue, 22 | y = _guiY.MinValue, 23 | z = _guiZ.MinValue 24 | }; 25 | set 26 | { 27 | _guiX.MinValue = value.x; 28 | _guiY.MinValue = value.y; 29 | _guiZ.MinValue = value.z; 30 | } 31 | } 32 | 33 | public override Vector3 MaxValue 34 | { 35 | get => new () 36 | { 37 | x = _guiX.MaxValue, 38 | y = _guiY.MaxValue, 39 | z = _guiZ.MaxValue 40 | }; 41 | set 42 | { 43 | _guiX.MaxValue = value.x; 44 | _guiY.MaxValue = value.y; 45 | _guiZ.MaxValue = value.z; 46 | } 47 | } 48 | 49 | public override int Digits 50 | { 51 | get => _guiX.Digits; 52 | set 53 | { 54 | _guiX.Digits = value; 55 | _guiY.Digits = value; 56 | _guiZ.Digits = value; 57 | } 58 | } 59 | 60 | public override float Width 61 | { 62 | get => _guiX.Width; 63 | set 64 | { 65 | _guiX.Width = value; 66 | _guiY.Width = value; 67 | _guiZ.Width = value; 68 | } 69 | } 70 | 71 | public override bool Slider 72 | { 73 | get => _guiX.Slider; 74 | set 75 | { 76 | _guiX.Slider = value; 77 | _guiY.Slider = value; 78 | _guiZ.Slider = value; 79 | } 80 | } 81 | 82 | #endregion Property 83 | 84 | #region Constructor 85 | 86 | public Vector3GUI() { } 87 | 88 | public Vector3GUI(string title) : base(title) { } 89 | 90 | public Vector3GUI(string title, Vector3 min, Vector3 max) : base(title, min, max) { } 91 | 92 | #endregion Constructor 93 | 94 | #region Method 95 | 96 | protected override void Initialize() 97 | { 98 | base.Initialize(); 99 | 100 | MinValue = XGUILayout.DefaultMinValueVector3; 101 | MaxValue = XGUILayout.DefaultMaxValueVector3; 102 | } 103 | 104 | protected override Vector3 ShowComponents(Vector3 value) 105 | { 106 | return new Vector3() 107 | { 108 | x = _guiX.Show(value.x), 109 | y = _guiY.Show(value.y), 110 | z = _guiZ.Show(value.z) 111 | }; 112 | } 113 | 114 | #endregion Method 115 | } 116 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/Vector4GUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Vector4GUI : VectorFloatGUI 6 | { 7 | #region Field 8 | 9 | private readonly FloatGUI _guiX = new () { Title = "X" }; 10 | private readonly FloatGUI _guiY = new () { Title = "Y" }; 11 | private readonly FloatGUI _guiZ = new () { Title = "Z" }; 12 | private readonly FloatGUI _guiW = new () { Title = "W" }; 13 | 14 | #endregion Field 15 | 16 | #region Property 17 | 18 | public override Vector4 MinValue 19 | { 20 | get => new () 21 | { 22 | x = _guiX.MinValue, 23 | y = _guiY.MinValue, 24 | z = _guiZ.MinValue, 25 | w = _guiW.MinValue 26 | }; 27 | set 28 | { 29 | _guiX.MinValue = value.x; 30 | _guiY.MinValue = value.y; 31 | _guiZ.MinValue = value.z; 32 | _guiW.MinValue = value.w; 33 | } 34 | } 35 | 36 | public override Vector4 MaxValue 37 | { 38 | get => new () 39 | { 40 | x = _guiX.MaxValue, 41 | y = _guiY.MaxValue, 42 | z = _guiZ.MaxValue, 43 | w = _guiW.MaxValue 44 | }; 45 | set 46 | { 47 | _guiX.MaxValue = value.x; 48 | _guiY.MaxValue = value.y; 49 | _guiZ.MaxValue = value.z; 50 | _guiW.MaxValue = value.w; 51 | } 52 | } 53 | 54 | public override int Digits 55 | { 56 | get => _guiX.Digits; 57 | set 58 | { 59 | _guiX.Digits = value; 60 | _guiY.Digits = value; 61 | _guiZ.Digits = value; 62 | _guiW.Digits = value; 63 | } 64 | } 65 | 66 | public override float Width 67 | { 68 | get => _guiX.Width; 69 | set 70 | { 71 | _guiX.Width = value; 72 | _guiY.Width = value; 73 | _guiZ.Width = value; 74 | _guiW.Width = value; 75 | } 76 | } 77 | 78 | public override bool Slider 79 | { 80 | get => _guiX.Slider; 81 | set 82 | { 83 | _guiX.Slider = value; 84 | _guiY.Slider = value; 85 | _guiZ.Slider = value; 86 | _guiW.Slider = value; 87 | } 88 | } 89 | 90 | #endregion Property 91 | 92 | #region Constructor 93 | 94 | public Vector4GUI() { } 95 | 96 | public Vector4GUI(string title) : base(title) { } 97 | 98 | public Vector4GUI(string title, Vector4 min, Vector4 max) : base(title, min, max) { } 99 | 100 | #endregion Constructor 101 | 102 | #region Method 103 | 104 | protected override void Initialize() 105 | { 106 | base.Initialize(); 107 | 108 | MinValue = XGUILayout.DefaultMinValueVector4; 109 | MaxValue = XGUILayout.DefaultMaxValueVector4; 110 | } 111 | 112 | protected override Vector4 ShowComponents(Vector4 value) 113 | { 114 | return new Vector4() 115 | { 116 | x = _guiX.Show(value.x), 117 | y = _guiY.Show(value.y), 118 | z = _guiZ.Show(value.z), 119 | w = _guiW.Show(value.w) 120 | }; 121 | } 122 | 123 | #endregion Method 124 | } 125 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Vectors/ColorGUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.PlayerLoop; 3 | 4 | namespace XGUI 5 | { 6 | public class ColorGUI : VectorFloatGUI 7 | { 8 | #region Field 9 | 10 | private readonly FloatGUI _guiR = new () { Title = "R" }; 11 | private readonly FloatGUI _guiG = new () { Title = "G" }; 12 | private readonly FloatGUI _guiB = new () { Title = "B" }; 13 | private readonly FloatGUI _guiA = new () { Title = "A" }; 14 | 15 | #endregion Field 16 | 17 | #region Property 18 | 19 | public override Color MinValue 20 | { 21 | get => new () 22 | { 23 | r = _guiR.MinValue, 24 | g = _guiG.MinValue, 25 | b = _guiB.MinValue, 26 | a = _guiA.MinValue 27 | }; 28 | 29 | set 30 | { 31 | _guiR.MinValue = value.r; 32 | _guiG.MinValue = value.g; 33 | _guiB.MinValue = value.b; 34 | _guiA.MinValue = value.a; 35 | } 36 | } 37 | 38 | public override Color MaxValue 39 | { 40 | get => new () 41 | { 42 | r = _guiR.MaxValue, 43 | g = _guiG.MaxValue, 44 | b = _guiB.MaxValue, 45 | a = _guiA.MaxValue 46 | }; 47 | 48 | set 49 | { 50 | _guiR.MaxValue = value.r; 51 | _guiG.MaxValue = value.g; 52 | _guiB.MaxValue = value.b; 53 | _guiA.MaxValue = value.a; 54 | } 55 | } 56 | 57 | public override int Digits 58 | { 59 | get => _guiR.Digits; 60 | set 61 | { 62 | _guiR.Digits = value; 63 | _guiG.Digits = value; 64 | _guiB.Digits = value; 65 | _guiA.Digits = value; 66 | } 67 | } 68 | 69 | public override float Width 70 | { 71 | get => _guiR.Width; 72 | set 73 | { 74 | _guiR.Width = value; 75 | _guiG.Width = value; 76 | _guiB.Width = value; 77 | _guiA.Width = value; 78 | } 79 | } 80 | 81 | public override bool Slider 82 | { 83 | get => _guiR.Slider; 84 | set 85 | { 86 | _guiR.Slider = value; 87 | _guiG.Slider = value; 88 | _guiB.Slider = value; 89 | _guiA.Slider = value; 90 | } 91 | } 92 | 93 | #endregion Property 94 | 95 | #region Constructor 96 | 97 | public ColorGUI() { } 98 | 99 | public ColorGUI(string title) : base(title) { } 100 | 101 | public ColorGUI(string title, Color min, Color max) : base(title, min, max) { } 102 | 103 | #endregion Constructor 104 | 105 | #region Method 106 | 107 | protected override void Initialize() 108 | { 109 | base.Initialize(); 110 | 111 | MinValue = XGUILayout.DefaultMinValueColor; 112 | MaxValue = XGUILayout.DefaultMaxValueColor; 113 | } 114 | 115 | protected override Color ShowComponents(Color value) 116 | { 117 | var previousValue = value; 118 | 119 | value = new Color() 120 | { 121 | r = _guiR.Show(value.r), 122 | g = _guiG.Show(value.g), 123 | b = _guiB.Show(value.b), 124 | a = _guiA.Show(value.a) 125 | }; 126 | 127 | Updated = previousValue != value; 128 | 129 | return value; 130 | } 131 | 132 | #endregion Method 133 | } 134 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/FlexWindow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.UIElements; 4 | 5 | namespace XGUI 6 | { 7 | // NOTE: 8 | // FlexWindow is not an inheritance of Component class 9 | // because it doesn't need ShowTitle(). 10 | 11 | public class FlexWindow : BaseGUI 12 | { 13 | #region Field 14 | 15 | private Rect _value; 16 | private float _previousShowTime; 17 | 18 | #endregion Field 19 | 20 | #region Property 21 | 22 | public Vector2 Position 23 | { 24 | get => new (_value.x, _value.y); 25 | set { _value.x = value.x; _value.y = value.y; } 26 | } 27 | 28 | public int ID { get; private set; } 29 | public float MinWidth { get; set; } 30 | public float MinHeight { get; set; } 31 | public float MaxWidth { get; set; } 32 | public float MaxHeight { get; set; } 33 | public bool IsDraggable { get; set; } 34 | public bool IsVisible { get; set; } 35 | 36 | #endregion Property 37 | 38 | #region Constructor 39 | 40 | public FlexWindow() { } 41 | 42 | public FlexWindow(string title) : base(title) { } 43 | 44 | #endregion Constructor 45 | 46 | #region Method 47 | 48 | protected override void Initialize() 49 | { 50 | base.Initialize(); 51 | 52 | // NOTE: 53 | // Guid.NewGuid().GetHashCode get collision at sometimes but its very rare case. 54 | // It is enough to use it as WindowID. 55 | // https://blogs.msdn.microsoft.com/ericlippert/2010/03/22/socks-birthdays-and-hash-collisions/ 56 | 57 | ID = Guid.NewGuid().GetHashCode(); 58 | MinWidth = XGUILayout.DefaultWindowMinWidth; 59 | MinHeight = XGUILayout.DefaultWindowMinHeight; 60 | MaxWidth = XGUILayout.DefaultWindowMaxWidth; 61 | MaxHeight = XGUILayout.DefaultWindowMaxHeight; 62 | IsDraggable = XGUILayout.DefaultWindowIsDraggable; 63 | IsVisible = XGUILayout.DefaultWindowIsVisible; 64 | } 65 | 66 | public Rect Show(params Action[] guiAction) 67 | { 68 | if (!IsVisible) 69 | { 70 | return new Rect(_value.position.x, _value.position.y, 0, 0); 71 | } 72 | 73 | // NOTE: 74 | // GUILayout.Window will render stretched window when width or height = 0. 75 | // However, there is a problem to render window with 0 width (or height). 76 | // When the window is dragged, it will blink. 77 | // This problem is not always occur, but when application gets more heavy, it will more occur. 78 | // 79 | // Maybe this is because of the OnGUI method is called twice in a game-loop. 80 | // To resolve this problem, this method render the window with 0 width (or height) in 1st call. 81 | // And in 2nd call, render the window with 1st call result size. 82 | 83 | if (_previousShowTime != Time.timeSinceLevelLoad) 84 | { 85 | _value = new Rect(_value.x, _value.y, 0, 0); 86 | _previousShowTime = Time.timeSinceLevelLoad; 87 | } 88 | 89 | _value = GUILayout.Window(ID, 90 | _value, 91 | WindowFunction, 92 | base.Title, 93 | GUILayout.MinWidth (MinWidth), 94 | GUILayout.MinHeight(MinHeight), 95 | GUILayout.MaxWidth (MaxWidth), 96 | GUILayout.MaxHeight(MaxHeight)); 97 | 98 | return _value; 99 | 100 | void WindowFunction(int windowID) 101 | { 102 | foreach (var action in guiAction) 103 | { 104 | action(); 105 | } 106 | 107 | if (IsDraggable) 108 | { 109 | GUI.DragWindow(); 110 | } 111 | } 112 | } 113 | 114 | #endregion Method 115 | } 116 | } -------------------------------------------------------------------------------- /Assets/Sample01.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using XGUI; 3 | 4 | public class Sample01 : MonoBehaviour 5 | { 6 | // NOTE: 7 | // Various GUI and Panels. 8 | 9 | #region Field 10 | 11 | public bool boolValue; 12 | public string stringValue; 13 | public int intValue; 14 | public float floatValue; 15 | public Vector2 vector2Value; 16 | public Vector3 vector3Value; 17 | public Vector4 vector4Value; 18 | public Vector2Int vector2IntValue; 19 | public Vector3Int vector3IntValue; 20 | public Color colorValue; 21 | public Matrix4x4 matrixValue; 22 | public CameraType enumValue; 23 | 24 | private readonly BoolGUI _boolGUI = new ("Bool" ); 25 | private readonly StringGUI _stringGUI = new ("String" ) { Width = 250 }; 26 | private readonly IntGUI _intGUI = new ("Int" ) { MinValue = 0, MaxValue = 100 }; 27 | private readonly FloatGUI _floatGUI = new ("Float", -1, 1); 28 | private readonly Vector2GUI _vector2GUI = new ("Vector2", Vector2.one, Vector2.one *3) { Digits = 1 }; 29 | private readonly Vector3GUI _vector3GUI = new ("Vector3" ) { MinValue = Vector3.zero }; 30 | private readonly Vector4GUI _vector4GUI = new ("Vector4" ) { Slider = false }; 31 | private readonly Vector2IntGUI _vector2IntGUI = new ("Vector2Int" ); 32 | private readonly Vector3IntGUI _vector3IntGUI = new ("Vector3Int", Vector3Int.zero, Vector3Int.one); 33 | private readonly ColorGUI _colorGUI = new ("Color" ); 34 | private readonly Matrix4x4GUI _matrixGUI = new ("Matrix4x4" ); 35 | private readonly EnumGUI _enumGUI = new ("Enum" ); 36 | 37 | private readonly FlexWindow _window = new("Sample01"); 38 | private readonly TabPanel _tabPanel = new (); 39 | private readonly FoldoutPanel _foldoutPanel = new ("Click to Open/Close"); 40 | private readonly ScrollPanel _scrollPanel = new (); 41 | 42 | #endregion Field 43 | 44 | #region Method 45 | 46 | private void Update() 47 | { 48 | if (Input.GetKeyDown(KeyCode.Return)) 49 | { 50 | _window.IsVisible = !_window.IsVisible; 51 | } 52 | } 53 | 54 | private void OnGUI() 55 | { 56 | GUILayout.Label("Press [Return] to show/hide window."); 57 | 58 | _window.Show(() => 59 | { 60 | _tabPanel.Show 61 | (("Basic", () => 62 | { 63 | boolValue = _boolGUI .Show(boolValue); 64 | stringValue = _stringGUI.Show(stringValue); 65 | intValue = _intGUI .Show(intValue); 66 | floatValue = _floatGUI .Show(floatValue); 67 | }), 68 | ("Vector & Matrix", () => 69 | { 70 | _foldoutPanel.Show(() => 71 | { 72 | vector2Value = _vector2GUI.Show(vector2Value); 73 | vector3Value = _vector3GUI.Show(vector3Value); 74 | vector4Value = _vector4GUI.Show(vector4Value); 75 | }); 76 | 77 | vector2IntValue = _vector2IntGUI.Show(vector2IntValue); 78 | vector3IntValue = _vector3IntGUI.Show(vector3IntValue); 79 | 80 | matrixValue = _matrixGUI.Show(matrixValue); 81 | }), 82 | ("Others", () => 83 | { 84 | colorValue = _colorGUI.Show(colorValue); 85 | enumValue = _enumGUI.Show(enumValue); 86 | 87 | _scrollPanel.Show(() => 88 | { 89 | GUILayout.Box("BOX", GUILayout.Width(300), GUILayout.Height(300)); 90 | 91 | XGUILayout.Label("Long Text, Long Text, Long Text, Long Text, Long Text, Long Text" 92 | + "Long Text, Long Text, Long Text, Long Text, Long Text, Long Text" 93 | + "Long Text, Long Text, Long Text, Long Text, Long Text, Long Text", 94 | XGUILayout.LabelOption.NoWrap 95 | | XGUILayout.LabelOption.Bold); 96 | }); 97 | })); 98 | }); 99 | } 100 | 101 | #endregion Method 102 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/FlexGUI.cs: -------------------------------------------------------------------------------- 1 | namespace XGUI 2 | { 3 | public class FlexGUI : ElementGUI 4 | { 5 | #region Field 6 | 7 | private ElementGUI _gui; 8 | 9 | #endregion Field 10 | 11 | #region Property 12 | 13 | public override string Title 14 | { 15 | get => _gui.Title; 16 | set => _gui.Title = value; 17 | } 18 | 19 | public override bool Updated => _gui.Updated; 20 | 21 | // CAUTION: 22 | // T gets IList or unsupported value in sometimes. 23 | // So it cant define MinValue/MaxValue type. 24 | 25 | public object MinValue 26 | { 27 | get => ReflectionHelper.GetProperty(_gui, "MinValue"); 28 | set => ReflectionHelper.SetProperty(_gui, "MinValue", value); 29 | } 30 | 31 | public object MaxValue 32 | { 33 | get => ReflectionHelper.GetProperty(_gui, "MaxValue"); 34 | set => ReflectionHelper.SetProperty(_gui, "MaxValue", value); 35 | } 36 | 37 | public int Digits 38 | { 39 | get => (int)ReflectionHelper.GetProperty(_gui, "Digits"); 40 | set => ReflectionHelper.SetProperty(_gui, "Digits", value); 41 | } 42 | 43 | public bool Slider 44 | { 45 | get => (bool)ReflectionHelper.GetProperty(_gui, "Slider"); 46 | set => ReflectionHelper.SetProperty(_gui, "Slider", value); 47 | } 48 | 49 | public float Width 50 | { 51 | get => (float)ReflectionHelper.GetProperty(_gui, "Width"); 52 | set => ReflectionHelper.SetProperty(_gui, "Width", value); 53 | } 54 | 55 | public float Height 56 | { 57 | get => (float)ReflectionHelper.GetProperty(_gui, "Height"); 58 | set => ReflectionHelper.SetProperty(_gui, "Height", value); 59 | } 60 | 61 | public float MinWidth 62 | { 63 | get => (float)ReflectionHelper.GetProperty(_gui, "MinWidth"); 64 | set => ReflectionHelper.SetProperty(_gui, "MinWidth", value); 65 | } 66 | 67 | public float MinHeight 68 | { 69 | get => (float)ReflectionHelper.GetProperty(_gui, "MinHeight"); 70 | set => ReflectionHelper.SetProperty(_gui, "MinHeight", value); 71 | } 72 | 73 | public float MaxWidth 74 | { 75 | get => (float)ReflectionHelper.GetProperty(_gui, "MaxWidth"); 76 | set => ReflectionHelper.SetProperty(_gui, "MaxWidth", value); 77 | } 78 | 79 | public float MaxHeight 80 | { 81 | get => (float)ReflectionHelper.GetProperty(_gui, "MaxHeight"); 82 | set => ReflectionHelper.SetProperty(_gui, "MaxHeight", value); 83 | } 84 | 85 | #endregion Proerty 86 | 87 | #region Constructor 88 | 89 | public FlexGUI() { } 90 | 91 | public FlexGUI(string title) : base(title) { } 92 | 93 | public FlexGUI(string title, object minValue, object maxValue) : base(title) 94 | { 95 | MinValue = minValue; 96 | MaxValue = maxValue; 97 | } 98 | 99 | public FlexGUI(string title, object minValue, object maxValue, int digits) : this(title, minValue, maxValue) 100 | { 101 | Digits = digits; 102 | } 103 | 104 | public FlexGUI(string title, float minValue, float maxValue) : base(title) 105 | { 106 | // NOTE: 107 | // Setup Min/Max with float value is only available in Constructor. 108 | 109 | var type = typeof(T); 110 | MinValue = ReflectionHelper.GetMinValue(type, minValue); 111 | MaxValue = ReflectionHelper.GetMaxValue(type, maxValue); 112 | } 113 | 114 | public FlexGUI(string title, float minValue, float maxValue, int digits) : this(title, minValue, maxValue) 115 | { 116 | Digits = digits; 117 | } 118 | 119 | #endregion Constructor 120 | 121 | #region Method 122 | 123 | protected override void Initialize() 124 | { 125 | base.Initialize(); 126 | _gui = (ElementGUI)ReflectionHelper.GenerateGUI(typeof(T)); 127 | } 128 | 129 | public override T Show(T value) 130 | { 131 | return _gui.Show(value); 132 | } 133 | 134 | #endregion Method 135 | } 136 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/EnumGUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.PlayerLoop; 4 | 5 | namespace XGUI 6 | { 7 | // CAUTION: 8 | // Enum.GetValues return wrong pattern in sometimes. 9 | // If some of the Enum components has a same value, the values has same Enum components. 10 | // Ex. When Enum is defined like this {EnumA = 0, EnumB = 0}, 11 | // Enum.GetValues will return 2 EnumB, and the EnumA is not included there. 12 | // 13 | // So we should Name based implement. However, still have another problem. 14 | // When try to Enum.Parse in same case, it returns EnumB only. 15 | // Even if the string value shows "EnumA", Enum.Parse returns EnumB. 16 | // I try to use Reflection, but the result was not good. 17 | 18 | public class EnumGUI : ElementGUI where T : Enum 19 | { 20 | #region Field 21 | 22 | private bool _isEditing; 23 | 24 | #endregion Field 25 | 26 | #region Property 27 | 28 | public float Width { get; set; } 29 | 30 | private static GUIStyle _buttonStyle; 31 | private GUIStyle ButtonStyle 32 | { 33 | get 34 | { 35 | _buttonStyle ??= new GUIStyle(GUI.skin.button); 36 | _buttonStyle.normal = _isEditing ? GUI.skin.button.active 37 | : GUI.skin.button.normal; 38 | return _buttonStyle; 39 | } 40 | } 41 | 42 | private GUILayoutOption ButtonLayout 43 | { 44 | get => Width <= 0 ? null : GUILayout.Width(Width); 45 | } 46 | 47 | #endregion Property 48 | 49 | #region Constructor 50 | 51 | public EnumGUI() { } 52 | 53 | public EnumGUI(string title) : base(title) { } 54 | 55 | #endregion Constructor 56 | 57 | #region Method 58 | 59 | protected override void Initialize() 60 | { 61 | base.Initialize(); 62 | Width = XGUILayout.DefaultWidth; 63 | } 64 | 65 | public override T Show(T value) 66 | { 67 | var enumType = value.GetType(); 68 | var enumNames = Enum.GetNames(enumType); 69 | var selectedIndex = GetSelectedIndex(value, enumNames); 70 | 71 | XGUILayout.HorizontalLayout(() => 72 | { 73 | base.ShowTitle(); 74 | 75 | if (Width > 0) 76 | { 77 | GUILayout.FlexibleSpace(); 78 | } 79 | 80 | if (GUILayout.Button(enumNames[selectedIndex], ButtonStyle, ButtonLayout)) 81 | { 82 | _isEditing = !_isEditing; 83 | } 84 | }); 85 | 86 | if (!_isEditing) 87 | { 88 | Updated = false; 89 | return value; 90 | } 91 | 92 | var previousValue = value; 93 | 94 | XGUILayout.HorizontalLayout(() => 95 | { 96 | if(Width > 0) 97 | { 98 | GUILayout.FlexibleSpace(); 99 | } 100 | 101 | XGUILayout.VerticalLayout(() => 102 | { 103 | for (var i = 0; i < enumNames.Length; i++) 104 | { 105 | if (i == selectedIndex) 106 | { 107 | continue; 108 | } 109 | 110 | if (GUILayout.Button(enumNames[i], ButtonLayout)) 111 | { 112 | _isEditing = false; 113 | value = (T)Enum.Parse(enumType, enumNames[i]); 114 | } 115 | } 116 | 117 | }, GUI.skin.box); 118 | }); 119 | 120 | Updated = !previousValue.Equals(value); 121 | 122 | return value; 123 | } 124 | 125 | private static int GetSelectedIndex(Enum value, string[] enumNames) 126 | { 127 | var enumName = value.ToString(); 128 | 129 | for (var i = 0; i < enumNames.Length; i++) 130 | { 131 | if (enumNames[i] == enumName) 132 | { 133 | return i; 134 | } 135 | } 136 | 137 | return 0; 138 | } 139 | 140 | #endregion Method 141 | } 142 | } -------------------------------------------------------------------------------- /Assets/Sample04.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using XGUI; 4 | 5 | public class Sample04 : MonoBehaviour 6 | { 7 | #region Field 8 | 9 | public bool boolValue; 10 | public string stringValue; 11 | public int intValue; 12 | public float floatValue; 13 | public Vector2 vector2Value; 14 | public Vector3 vector3Value; 15 | public Vector4 vector4Value; 16 | public Vector2Int vector2IntValue; 17 | public Vector3Int vector3IntValue; 18 | public Matrix4x4 matrixValue; 19 | public Color colorValue; 20 | public CameraType enumValue; 21 | 22 | public int[] intArrayValue; 23 | public List vectorListValue; 24 | public List floatArrayListValue = new () 25 | { 26 | new []{ -1f, -2f, -3.141592f }, 27 | new []{ 1f, 2f, 3.141592f } 28 | }; 29 | 30 | private readonly FlexGUI _boolGUI = new ("Bool" ); 31 | private readonly FlexGUI _stringGUI = new ("String" ) { Width = 250 }; 32 | private readonly FlexGUI _intGUI = new ("Int" ) { MinValue = 0, MaxValue = 100 }; 33 | private readonly FlexGUI _floatGUI = new ("Float", -1, 1); 34 | private readonly FlexGUI _vector2GUI = new ("Vector2", Vector2.one, Vector2.one *3) { Digits = 1 }; 35 | private readonly FlexGUI _vector3GUI = new ("Vector3" ) { MinValue = Vector3.zero }; 36 | private readonly FlexGUI _vector4GUI = new ("Vector4" ) { Slider = false }; 37 | private readonly FlexGUI _vector2IntGUI = new ("Vector2Int" ); 38 | private readonly FlexGUI _vector3IntGUI = new ("Vector3Int", Vector3Int.zero, Vector3Int.one); 39 | private readonly FlexGUI _matrixGUI = new ("Matrix4x4" ); 40 | private readonly FlexGUI _colorGUI = new ("Color" ); 41 | private readonly FlexGUI _enumGUI = new ("Enum" ); 42 | 43 | private readonly FlexGUI _intArrayGUI = new ("IntArray") 44 | { 45 | MinValue = -1, 46 | MaxValue = 10 47 | }; 48 | private readonly FlexGUI> _vectorListGUI = new ("VectorList") 49 | { 50 | MinValue = 0, Digits = 1 51 | }; 52 | private readonly FlexGUI> _floatArrayListGUI = new("FloatArrayList") 53 | { 54 | MinValue = -10, 55 | MaxValue = 10, 56 | Digits = 2, 57 | Height = 300 58 | }; 59 | 60 | private readonly FlexWindow _window = new ("Sample04"); 61 | private readonly TabPanel _tabPanel = new (); 62 | 63 | #endregion Field 64 | 65 | #region Method 66 | 67 | private void Update() 68 | { 69 | if (Input.GetKeyDown(KeyCode.Return)) 70 | { 71 | _window.IsVisible = !_window.IsVisible; 72 | } 73 | } 74 | 75 | private void OnGUI() 76 | { 77 | GUILayout.Label("Press [Return] to show/hide window."); 78 | 79 | _window.Show(() => 80 | { 81 | _tabPanel.Show 82 | (("Basic", () => 83 | { 84 | boolValue = _boolGUI .Show(boolValue); 85 | stringValue = _stringGUI.Show(stringValue); 86 | intValue = _intGUI .Show(intValue); 87 | floatValue = _floatGUI .Show(floatValue); 88 | }), 89 | ("Vector & Matrix", () => 90 | { 91 | vector2Value = _vector2GUI.Show(vector2Value); 92 | vector3Value = _vector3GUI.Show(vector3Value); 93 | vector4Value = _vector4GUI.Show(vector4Value); 94 | 95 | vector2IntValue = _vector2IntGUI.Show(vector2IntValue); 96 | vector3IntValue = _vector3IntGUI.Show(vector3IntValue); 97 | 98 | matrixValue = _matrixGUI.Show(matrixValue); 99 | }), 100 | ("Others", () => 101 | { 102 | colorValue = _colorGUI.Show(colorValue); 103 | enumValue = _enumGUI.Show(enumValue); 104 | }), 105 | ("Array", () => 106 | { 107 | _intArrayGUI.Show(intArrayValue); 108 | _vectorListGUI.Show(vectorListValue); 109 | _floatArrayListGUI.Show(floatArrayListValue); 110 | })); 111 | }); 112 | } 113 | 114 | #endregion Method 115 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Numerics/NumericGUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace XGUI 5 | { 6 | // NOTE: 7 | // T must be 'int' or 'float'. 8 | 9 | public abstract class NumericGUI : ValueGUI where T : struct, IComparable 10 | { 11 | #region Field 12 | 13 | protected T PreviousValue; 14 | 15 | protected string Text; 16 | 17 | #endregion Field 18 | 19 | #region Property 20 | 21 | protected override GUIStyle FieldStyle 22 | { 23 | get 24 | { 25 | var style = base.FieldStyle; 26 | var textColor = TextIsCorrect ? GUI.skin.textField.normal.textColor 27 | : XGUILayout.DefaultInvalidValueColor; 28 | style.normal.textColor = textColor; 29 | style.active.textColor = textColor; 30 | style.focused.textColor = textColor; 31 | 32 | return style; 33 | } 34 | } 35 | 36 | protected abstract bool TextIsCorrect { get; } 37 | 38 | #endregion Property 39 | 40 | #region Constructor 41 | 42 | protected NumericGUI() { } 43 | 44 | protected NumericGUI(string title) : base(title) { } 45 | 46 | protected NumericGUI(string title, T min, T max) : base(title, min, max) { } 47 | 48 | #endregion Constructor 49 | 50 | #region Method 51 | 52 | public override T Show(T value) 53 | { 54 | var previousValue = value; 55 | 56 | Text ??= value.ToString(); 57 | Text = PreviousValue.Equals(value) ? Text : value.ToString(); 58 | 59 | XGUILayout.VerticalLayout(() => 60 | { 61 | XGUILayout.HorizontalLayout(() => 62 | { 63 | base.ShowTitle(); 64 | 65 | Text = ShowTextField(Text); 66 | 67 | // NOTE: 68 | // float.TryParse("0.") return true. 69 | // But need to keep user input text, because the user may input "0.x~". 70 | 71 | if (float.TryParse(Text, out float textValue)) 72 | { 73 | value = (T)Convert.ChangeType(textValue, typeof(T)); 74 | } 75 | }); 76 | 77 | if (!Slider) 78 | { 79 | Updated = !previousValue.Equals(value); 80 | return; 81 | } 82 | 83 | // NOTE: 84 | // Need to update text when the value is updated with Slider. 85 | 86 | var floatValue = (float)Convert.ChangeType(value, typeof(float)); 87 | var minValue = (float)Convert.ChangeType(MinValue, typeof(float)); 88 | var maxValue = (float)Convert.ChangeType(MaxValue, typeof(float)); 89 | 90 | var sliderValue = GUILayout.HorizontalSlider(floatValue, minValue, maxValue); 91 | var sliderValueT = ValidateValue((T)Convert.ChangeType(sliderValue, typeof(T))); 92 | 93 | if (!sliderValueT.Equals(value)) 94 | { 95 | value = sliderValueT; 96 | Text = value.ToString(); 97 | } 98 | }); 99 | 100 | PreviousValue = value; 101 | Updated = !previousValue.Equals(value); 102 | 103 | return value; 104 | } 105 | 106 | protected virtual T ValidateValue(T value) 107 | { 108 | if (0 < value.CompareTo(MaxValue)) 109 | { 110 | value = MaxValue; 111 | } 112 | 113 | if (value.CompareTo(MinValue) < 0) 114 | { 115 | value = MinValue; 116 | } 117 | 118 | return value; 119 | } 120 | 121 | protected override string ShowTextField(string text) 122 | { 123 | var name = GetHashCode().ToString(); 124 | GUI.SetNextControlName(name); 125 | 126 | var newText = base.ShowTextField(text); 127 | var focused = GUI.GetNameOfFocusedControl() == name; 128 | 129 | if ((Event.current.isKey && Event.current.keyCode == KeyCode.Return) || !focused) 130 | { 131 | var (success, value) = ExpressionParser.Parse(newText); 132 | 133 | if (success) 134 | { 135 | newText = value.ToString(); 136 | } 137 | } 138 | 139 | return newText; 140 | } 141 | 142 | #endregion Method 143 | } 144 | } -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSM: 5 183 | PSP2: 2 184 | Samsung TV: 2 185 | Standalone: 5 186 | Tizen: 2 187 | WebGL: 3 188 | WiiU: 5 189 | Windows Store Apps: 5 190 | XboxOne: 5 191 | iPhone: 2 192 | tvOS: 2 193 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/FlexListGUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace XGUI 6 | { 7 | public class FlexListGUI : ListBaseGUI 8 | where TList : IList 9 | { 10 | #region Field 11 | 12 | private Type _guiType; 13 | 14 | #endregion Field 15 | 16 | #region Property 17 | 18 | // CAUTION: 19 | // TElement gets IList or unsupported value in sometimes. 20 | // So it can't define MinValue/MaxValue type. 21 | 22 | private object _minValue; 23 | public object MinValue 24 | { 25 | get => _minValue; 26 | set 27 | { 28 | _minValue = value; 29 | foreach (var gui in _guiList) { ReflectionHelper.SetProperty(gui, "MinValue", value); } 30 | } 31 | } 32 | 33 | private object _maxValue; 34 | public object MaxValue 35 | { 36 | get => _maxValue; 37 | set 38 | { 39 | _maxValue = value; 40 | foreach (var gui in _guiList) { ReflectionHelper.SetProperty(gui, "MaxValue", value); } 41 | } 42 | } 43 | 44 | private int _digits = XGUILayout.DefaultDigits; 45 | public int Digits 46 | { 47 | get => _digits; 48 | set 49 | { 50 | _digits = value; 51 | foreach (var gui in _guiList) { ReflectionHelper.SetProperty(gui, "Digits", value); } 52 | } 53 | } 54 | 55 | private bool _slider = XGUILayout.DefaultSlider; 56 | public bool Slider 57 | { 58 | get => _slider; 59 | set 60 | { 61 | _slider = value; 62 | foreach (var gui in _guiList) { ReflectionHelper.SetProperty(gui, "Slider", value); } 63 | } 64 | } 65 | 66 | #endregion Property 67 | 68 | #region Constructor 69 | 70 | public FlexListGUI() { } 71 | 72 | public FlexListGUI(string title) : base(title) { } 73 | 74 | public FlexListGUI(string title, object minValue, object maxValue) : base(title) 75 | { 76 | MinValue = minValue; 77 | MaxValue = maxValue; 78 | } 79 | 80 | public FlexListGUI(string title, object minValue, object maxValue, int digits) : this(title, minValue, maxValue) 81 | { 82 | Digits = digits; 83 | } 84 | 85 | public FlexListGUI(string title, float minValue, float maxValue) : base(title) 86 | { 87 | // NOTE: 88 | // Setup Min/Max with float value is only available in Constructor. 89 | 90 | var type = typeof(TElement); 91 | MinValue = ReflectionHelper.GetMinValue(type, minValue); 92 | MaxValue = ReflectionHelper.GetMaxValue(type, maxValue); 93 | } 94 | 95 | public FlexListGUI(string title, float minValue, float maxValue, int digits) : this(title, minValue, maxValue) 96 | { 97 | Digits = digits; 98 | } 99 | 100 | #endregion Constructor 101 | 102 | #region Method 103 | 104 | protected override void Initialize() 105 | { 106 | base.Initialize(); 107 | _guiType = ReflectionHelper.GetGUIType(typeof(TElement)); 108 | } 109 | 110 | protected override ElementGUI GenerateGUI() 111 | { 112 | // CAUTION: 113 | // _minValue and _maxValue are defined as object. 114 | // If do not check null, they will get 0. 115 | // And if do not so, they get default GUI values. 116 | 117 | var gui = (ElementGUI)(_guiType == null ? new UnSupportedGUI() 118 | : Activator.CreateInstance(_guiType)); 119 | 120 | if (_minValue != null) { ReflectionHelper.SetProperty(gui, "MinValue", _minValue); } 121 | if (_maxValue != null) { ReflectionHelper.SetProperty(gui, "MaxValue", _maxValue); } 122 | ReflectionHelper.SetProperty(gui, "Digits", _digits); 123 | ReflectionHelper.SetProperty(gui, "Slider", _slider); 124 | return gui; 125 | } 126 | 127 | protected override string GetElementTitle(TElement value, ElementGUI gui) 128 | { 129 | if (value.GetType().IsEnum) 130 | { 131 | return value.ToString(); 132 | } 133 | 134 | var digitsObject = ReflectionHelper.GetProperty(gui, "Digits"); 135 | var digitsFormat = "F" + (digitsObject == null ? 4 : (int)digitsObject); 136 | 137 | return value switch 138 | { 139 | string v => v, 140 | int v => v.ToString(), 141 | float v => v.ToString(digitsFormat), 142 | Vector2 v => v.ToString(digitsFormat), 143 | Vector3 v => v.ToString(digitsFormat), 144 | Vector4 v => v.ToString(digitsFormat), 145 | Color v => v.ToString(digitsFormat), 146 | Vector2Int v => v.ToString(), 147 | Vector3Int v => v.ToString(), 148 | Matrix4x4 v => "(" + v.m00.ToString(digitsFormat) 149 | + "," + v.m10.ToString(digitsFormat) 150 | + "," + v.m20.ToString(digitsFormat) 151 | + "," + v.m30.ToString(digitsFormat) 152 | + ")…", 153 | _ => "Element" 154 | }; 155 | } 156 | 157 | #endregion Method 158 | } 159 | } -------------------------------------------------------------------------------- /Assets/Sample02.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 4890085278179872738, guid: 46b0c3843408f6249b80d31e7eca1b26, 102 | type: 2} 103 | --- !u!196 &4 104 | NavMeshSettings: 105 | serializedVersion: 2 106 | m_ObjectHideFlags: 0 107 | m_BuildSettings: 108 | serializedVersion: 2 109 | agentTypeID: 0 110 | agentRadius: 0.5 111 | agentHeight: 2 112 | agentSlope: 45 113 | agentClimb: 0.4 114 | ledgeDropHeight: 0 115 | maxJumpAcrossDistance: 0 116 | minRegionArea: 2 117 | manualCellSize: 0 118 | cellSize: 0.16666667 119 | manualTileSize: 0 120 | tileSize: 256 121 | accuratePlacement: 0 122 | maxJobWorkers: 0 123 | preserveTilesOutsideBounds: 0 124 | debug: 125 | m_Flags: 0 126 | m_NavMeshData: {fileID: 0} 127 | --- !u!1 &1390282236 128 | GameObject: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | serializedVersion: 6 134 | m_Component: 135 | - component: {fileID: 1390282239} 136 | - component: {fileID: 1390282238} 137 | - component: {fileID: 1390282240} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!20 &1390282238 146 | Camera: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 1390282236} 152 | m_Enabled: 1 153 | serializedVersion: 2 154 | m_ClearFlags: 2 155 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 156 | m_projectionMatrixMode: 1 157 | m_GateFitMode: 2 158 | m_FOVAxisMode: 0 159 | m_SensorSize: {x: 36, y: 24} 160 | m_LensShift: {x: 0, y: 0} 161 | m_FocalLength: 50 162 | m_NormalizedViewPortRect: 163 | serializedVersion: 2 164 | x: 0 165 | y: 0 166 | width: 1 167 | height: 1 168 | near clip plane: 0.3 169 | far clip plane: 1000 170 | field of view: 60 171 | orthographic: 0 172 | orthographic size: 5 173 | m_Depth: -1 174 | m_CullingMask: 175 | serializedVersion: 2 176 | m_Bits: 4294967295 177 | m_RenderingPath: -1 178 | m_TargetTexture: {fileID: 0} 179 | m_TargetDisplay: 0 180 | m_TargetEye: 3 181 | m_HDR: 1 182 | m_AllowMSAA: 1 183 | m_AllowDynamicResolution: 0 184 | m_ForceIntoRT: 0 185 | m_OcclusionCulling: 1 186 | m_StereoConvergence: 10 187 | m_StereoSeparation: 0.022 188 | --- !u!4 &1390282239 189 | Transform: 190 | m_ObjectHideFlags: 0 191 | m_CorrespondingSourceObject: {fileID: 0} 192 | m_PrefabInstance: {fileID: 0} 193 | m_PrefabAsset: {fileID: 0} 194 | m_GameObject: {fileID: 1390282236} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 1, z: -10} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_ConstrainProportionsScale: 0 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_RootOrder: 0 202 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 203 | --- !u!114 &1390282240 204 | MonoBehaviour: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | m_GameObject: {fileID: 1390282236} 210 | m_Enabled: 1 211 | m_EditorHideFlags: 0 212 | m_Script: {fileID: 11500000, guid: e2ce9b9b2e15bd0449c71802e945c796, type: 3} 213 | m_Name: 214 | m_EditorClassIdentifier: 215 | intArrayValue: 0000000003000000 216 | vectorArrayValue: 217 | - {x: -3, y: 2} 218 | - {x: 2, y: 2} 219 | - {x: 2, y: 5} 220 | - {x: 1, y: 3} 221 | - {x: 0, y: -2} 222 | enumListValue: 00000000ffffffff010000000200000010000000 223 | -------------------------------------------------------------------------------- /Assets/Sample03.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 4890085278179872738, guid: 46b0c3843408f6249b80d31e7eca1b26, 102 | type: 2} 103 | --- !u!196 &4 104 | NavMeshSettings: 105 | serializedVersion: 2 106 | m_ObjectHideFlags: 0 107 | m_BuildSettings: 108 | serializedVersion: 2 109 | agentTypeID: 0 110 | agentRadius: 0.5 111 | agentHeight: 2 112 | agentSlope: 45 113 | agentClimb: 0.4 114 | ledgeDropHeight: 0 115 | maxJumpAcrossDistance: 0 116 | minRegionArea: 2 117 | manualCellSize: 0 118 | cellSize: 0.16666667 119 | manualTileSize: 0 120 | tileSize: 256 121 | accuratePlacement: 0 122 | maxJobWorkers: 0 123 | preserveTilesOutsideBounds: 0 124 | debug: 125 | m_Flags: 0 126 | m_NavMeshData: {fileID: 0} 127 | --- !u!1 &1390282236 128 | GameObject: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | serializedVersion: 6 134 | m_Component: 135 | - component: {fileID: 1390282239} 136 | - component: {fileID: 1390282238} 137 | - component: {fileID: 1390282240} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!20 &1390282238 146 | Camera: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 1390282236} 152 | m_Enabled: 1 153 | serializedVersion: 2 154 | m_ClearFlags: 2 155 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 156 | m_projectionMatrixMode: 1 157 | m_GateFitMode: 2 158 | m_FOVAxisMode: 0 159 | m_SensorSize: {x: 36, y: 24} 160 | m_LensShift: {x: 0, y: 0} 161 | m_FocalLength: 50 162 | m_NormalizedViewPortRect: 163 | serializedVersion: 2 164 | x: 0 165 | y: 0 166 | width: 1 167 | height: 1 168 | near clip plane: 0.3 169 | far clip plane: 1000 170 | field of view: 60 171 | orthographic: 0 172 | orthographic size: 5 173 | m_Depth: -1 174 | m_CullingMask: 175 | serializedVersion: 2 176 | m_Bits: 4294967295 177 | m_RenderingPath: -1 178 | m_TargetTexture: {fileID: 0} 179 | m_TargetDisplay: 0 180 | m_TargetEye: 3 181 | m_HDR: 1 182 | m_AllowMSAA: 1 183 | m_AllowDynamicResolution: 0 184 | m_ForceIntoRT: 0 185 | m_OcclusionCulling: 1 186 | m_StereoConvergence: 10 187 | m_StereoSeparation: 0.022 188 | --- !u!4 &1390282239 189 | Transform: 190 | m_ObjectHideFlags: 0 191 | m_CorrespondingSourceObject: {fileID: 0} 192 | m_PrefabInstance: {fileID: 0} 193 | m_PrefabAsset: {fileID: 0} 194 | m_GameObject: {fileID: 1390282236} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 1, z: -10} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_ConstrainProportionsScale: 0 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_RootOrder: 0 202 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 203 | --- !u!114 &1390282240 204 | MonoBehaviour: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | m_GameObject: {fileID: 1390282236} 210 | m_Enabled: 1 211 | m_EditorHideFlags: 0 212 | m_Script: {fileID: 11500000, guid: c84b5310022e55448837c3fb2b5f3222, type: 3} 213 | m_Name: 214 | m_EditorClassIdentifier: 215 | enumSelect: 0 216 | floatListSelect: 0 217 | floatListValue: 218 | - 0 219 | - 1.414 220 | - 2.236 221 | - 3.141 222 | stringArraySelect: 223 | stringArrayValue: 224 | - Alpha 225 | - Bravo 226 | - Charlie 227 | - Delta 228 | - Echo 229 | - Foxtrot 230 | - Golf 231 | - Hotel 232 | - India 233 | - Juliet 234 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/XGUILayout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using UnityEngine; 5 | 6 | public static class XGUILayout 7 | { 8 | #region Field 9 | 10 | #region FlexWindow Settings 11 | 12 | public static float DefaultWindowMinWidth = 500; 13 | public static float DefaultWindowMinHeight = 300; 14 | public static float DefaultWindowMaxWidth = 1000; 15 | public static float DefaultWindowMaxHeight = 800; 16 | public static bool DefaultWindowIsDraggable = true; 17 | public static bool DefaultWindowIsVisible = true; 18 | 19 | #endregion FlexWindow Settings 20 | 21 | #region Default GUI Settings 22 | 23 | public static string DefaultTitle = null; 24 | public static float DefaultWidth = 100; 25 | public static int DefaultDigits = 4; 26 | public static bool DefaultSlider = true; 27 | public static Color DefaultInvalidValueColor = new (1, 0, 0, 1); 28 | 29 | #endregion Default GUI Settings 30 | 31 | #region Default Settings 32 | 33 | public static int DefaultMinValueInt = -9999999; 34 | public static int DefaultMaxValueInt = 9999999; 35 | 36 | public static float DefaultMinValueFloat = -9999999; 37 | public static float DefaultMaxValueFloat = 9999999; 38 | 39 | public static Vector2 DefaultMinValueVector2 = new (-9999999, -9999999); 40 | public static Vector2 DefaultMaxValueVector2 = new ( 9999999, 9999999); 41 | 42 | public static Vector3 DefaultMinValueVector3 = new (-9999999, -9999999, -9999999); 43 | public static Vector3 DefaultMaxValueVector3 = new ( 9999999, 9999999, 9999999); 44 | 45 | public static Vector4 DefaultMinValueVector4 = new (-9999999, -9999999, -9999999, -9999999); 46 | public static Vector4 DefaultMaxValueVector4 = new ( 9999999, 9999999, 9999999, 9999999); 47 | 48 | public static Vector2Int DefaultMinValueVector2Int = new (-9999999, -9999999); 49 | public static Vector2Int DefaultMaxValueVector2Int = new ( 9999999, 9999999); 50 | 51 | public static Vector3Int DefaultMinValueVector3Int = new (-50, -50, -50); 52 | public static Vector3Int DefaultMaxValueVector3Int = new (50, 50, 50); 53 | 54 | public static Color DefaultMinValueColor = new (0, 0, 0, 0); 55 | public static Color DefaultMaxValueColor = new (1, 1, 1, 1); 56 | 57 | public static Matrix4x4 DefaultMinValueMatrix4x4 = new (new Vector4(-9999999, -9999999, -9999999, -9999999), 58 | new Vector4(-9999999, -9999999, -9999999, -9999999), 59 | new Vector4(-9999999, -9999999, -9999999, -9999999), 60 | new Vector4(-9999999, -9999999, -9999999, -9999999)); 61 | public static Matrix4x4 DefaultMaxValueMatrix4x4 = new (new Vector4( 9999999, 9999999, 9999999, 9999999), 62 | new Vector4( 9999999, 9999999, 9999999, 9999999), 63 | new Vector4( 9999999, 9999999, 9999999, 9999999), 64 | new Vector4( 9999999, 9999999, 9999999, 9999999)); 65 | 66 | #endregion Default Settings 67 | 68 | #region Label 69 | 70 | private static GUIStyle _labelStyle; 71 | private static GUIStyle LabelStyle 72 | { 73 | get 74 | { 75 | _labelStyle ??= new GUIStyle(GUI.skin.label); 76 | return _labelStyle; 77 | } 78 | } 79 | 80 | [Flags] 81 | public enum LabelOption 82 | { 83 | Default = 0x0, 84 | Bold = 0x1, 85 | NoWrap = 0x2, 86 | } 87 | 88 | #endregion Label 89 | 90 | #endregion Field 91 | 92 | #region Method 93 | 94 | public static void Label(string text, LabelOption option = LabelOption.Default) 95 | { 96 | LabelStyle.wordWrap = !option.HasFlag(LabelOption.NoWrap); 97 | LabelStyle.fontStyle = option.HasFlag(LabelOption.Bold) ? FontStyle.Bold : FontStyle.Normal; 98 | 99 | GUILayout.Label(text, LabelStyle); 100 | } 101 | 102 | public static void HorizontalLayout(Action guiAction, GUIStyle style = null, params GUILayoutOption[] options) 103 | { 104 | if (style == null) 105 | { 106 | GUILayout.BeginHorizontal(options); 107 | } 108 | else 109 | { 110 | GUILayout.BeginHorizontal(style, options); 111 | } 112 | 113 | guiAction(); 114 | 115 | GUILayout.EndHorizontal(); 116 | } 117 | 118 | public static void VerticalLayout(Action guiAction, GUIStyle style = null, params GUILayoutOption[] options) 119 | { 120 | if (style == null) 121 | { 122 | GUILayout.BeginVertical(options); 123 | } 124 | else 125 | { 126 | GUILayout.BeginVertical(style, options); 127 | } 128 | 129 | guiAction(); 130 | 131 | GUILayout.EndVertical(); 132 | } 133 | 134 | public static T SelectionGrid(T value) where T : Enum 135 | { 136 | var type = typeof(T); 137 | 138 | if (type.IsEnum) 139 | { 140 | return SelectionGrid(value, Enum.GetValues(type).Cast().ToArray()); 141 | } 142 | 143 | return value; 144 | } 145 | 146 | public static T SelectionGrid(T value, IList values, int xCount = 0) 147 | { 148 | var index = Mathf.Max(0, values.IndexOf(value)); 149 | var type = typeof(T); 150 | 151 | xCount = 0 < xCount ? xCount : values.Count; 152 | 153 | if (type == typeof(string)) 154 | { 155 | index = GUILayout.SelectionGrid(index, values.Cast().ToArray(), xCount); 156 | } 157 | else if (type == typeof(GUIContent)) 158 | { 159 | index = GUILayout.SelectionGrid(index, values.Cast().ToArray(), xCount); 160 | } 161 | else if (type == typeof(Texture)) 162 | { 163 | index = GUILayout.SelectionGrid(index, values.Cast().ToArray(), xCount); 164 | } 165 | else 166 | { 167 | index = GUILayout.SelectionGrid(index, values.Select(x => x.ToString()).ToArray(), xCount); 168 | } 169 | 170 | return values[index]; 171 | } 172 | 173 | public static string GetTitleCase(string title) 174 | { 175 | // NOTE: 176 | // Following case is not good. Only the first character becomes uppercase. 177 | // return System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text); 178 | 179 | if (string.IsNullOrEmpty(title)) 180 | { 181 | return title; 182 | } 183 | 184 | switch (title.Length) 185 | { 186 | case 0: 187 | return title; 188 | case 1: 189 | return new string(new[]{char.ToUpper(title[0])}); 190 | } 191 | 192 | for (var i = 0; i < title.Length - 1; i++) 193 | { 194 | if ((char.IsLower(title[i]) && (char.IsUpper(title[i + 1]) || char.IsDigit(title[i + 1]))) 195 | || (char.IsDigit(title[i]) && char.IsUpper(title[i + 1]))) 196 | { 197 | title = title.Insert(i + 1, " "); 198 | } 199 | } 200 | 201 | return char.ToUpper(title[0]) + title.Substring(1); 202 | } 203 | 204 | #endregion Method 205 | } -------------------------------------------------------------------------------- /Assets/Sample01.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 4890085278179872738, guid: 339e8da480af9f746b60c110f6f1c60a, 102 | type: 2} 103 | --- !u!196 &4 104 | NavMeshSettings: 105 | serializedVersion: 2 106 | m_ObjectHideFlags: 0 107 | m_BuildSettings: 108 | serializedVersion: 2 109 | agentTypeID: 0 110 | agentRadius: 0.5 111 | agentHeight: 2 112 | agentSlope: 45 113 | agentClimb: 0.4 114 | ledgeDropHeight: 0 115 | maxJumpAcrossDistance: 0 116 | minRegionArea: 2 117 | manualCellSize: 0 118 | cellSize: 0.16666667 119 | manualTileSize: 0 120 | tileSize: 256 121 | accuratePlacement: 0 122 | maxJobWorkers: 0 123 | preserveTilesOutsideBounds: 0 124 | debug: 125 | m_Flags: 0 126 | m_NavMeshData: {fileID: 0} 127 | --- !u!1 &1390282236 128 | GameObject: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | serializedVersion: 6 134 | m_Component: 135 | - component: {fileID: 1390282239} 136 | - component: {fileID: 1390282238} 137 | - component: {fileID: 1390282240} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!20 &1390282238 146 | Camera: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 1390282236} 152 | m_Enabled: 1 153 | serializedVersion: 2 154 | m_ClearFlags: 2 155 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 156 | m_projectionMatrixMode: 1 157 | m_GateFitMode: 2 158 | m_FOVAxisMode: 0 159 | m_SensorSize: {x: 36, y: 24} 160 | m_LensShift: {x: 0, y: 0} 161 | m_FocalLength: 50 162 | m_NormalizedViewPortRect: 163 | serializedVersion: 2 164 | x: 0 165 | y: 0 166 | width: 1 167 | height: 1 168 | near clip plane: 0.3 169 | far clip plane: 1000 170 | field of view: 60 171 | orthographic: 0 172 | orthographic size: 5 173 | m_Depth: -1 174 | m_CullingMask: 175 | serializedVersion: 2 176 | m_Bits: 4294967295 177 | m_RenderingPath: -1 178 | m_TargetTexture: {fileID: 0} 179 | m_TargetDisplay: 0 180 | m_TargetEye: 3 181 | m_HDR: 1 182 | m_AllowMSAA: 1 183 | m_AllowDynamicResolution: 0 184 | m_ForceIntoRT: 0 185 | m_OcclusionCulling: 1 186 | m_StereoConvergence: 10 187 | m_StereoSeparation: 0.022 188 | --- !u!4 &1390282239 189 | Transform: 190 | m_ObjectHideFlags: 0 191 | m_CorrespondingSourceObject: {fileID: 0} 192 | m_PrefabInstance: {fileID: 0} 193 | m_PrefabAsset: {fileID: 0} 194 | m_GameObject: {fileID: 1390282236} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 1, z: -10} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_ConstrainProportionsScale: 0 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_RootOrder: 0 202 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 203 | --- !u!114 &1390282240 204 | MonoBehaviour: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | m_GameObject: {fileID: 1390282236} 210 | m_Enabled: 1 211 | m_EditorHideFlags: 0 212 | m_Script: {fileID: 11500000, guid: 63eb82ceba8ae3c499dd2bdd04c66c6c, type: 3} 213 | m_Name: 214 | m_EditorClassIdentifier: 215 | boolValue: 1 216 | stringValue: aiueo 217 | intValue: 777 218 | floatValue: 0.7346 219 | vector2Value: {x: -1753475, y: 1031462} 220 | vector3Value: {x: 7428581, y: 3285470, z: 2002010} 221 | vector4Value: {x: 1, y: 2, z: 3, w: 4} 222 | vector2IntValue: {x: 143, y: 229} 223 | vector3IntValue: {x: 1, y: 1, z: 1} 224 | colorValue: {r: 0.5438, g: 0.4729, b: 0.6769, a: 1} 225 | matrixValue: 226 | e00: 4400364 227 | e01: 0 228 | e02: 0 229 | e03: 0 230 | e10: 0 231 | e11: 4187544 232 | e12: 4586578 233 | e13: 0 234 | e20: 0 235 | e21: 0 236 | e22: 0 237 | e23: -7569423 238 | e30: 5950708 239 | e31: 4848737 240 | e32: 3746745 241 | e33: 0 242 | enumValue: 8 243 | -------------------------------------------------------------------------------- /Assets/Sample04.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 12 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_LightingSettings: {fileID: 4890085278179872738, guid: 339e8da480af9f746b60c110f6f1c60a, 102 | type: 2} 103 | --- !u!196 &4 104 | NavMeshSettings: 105 | serializedVersion: 2 106 | m_ObjectHideFlags: 0 107 | m_BuildSettings: 108 | serializedVersion: 2 109 | agentTypeID: 0 110 | agentRadius: 0.5 111 | agentHeight: 2 112 | agentSlope: 45 113 | agentClimb: 0.4 114 | ledgeDropHeight: 0 115 | maxJumpAcrossDistance: 0 116 | minRegionArea: 2 117 | manualCellSize: 0 118 | cellSize: 0.16666667 119 | manualTileSize: 0 120 | tileSize: 256 121 | accuratePlacement: 0 122 | maxJobWorkers: 0 123 | preserveTilesOutsideBounds: 0 124 | debug: 125 | m_Flags: 0 126 | m_NavMeshData: {fileID: 0} 127 | --- !u!1 &1390282236 128 | GameObject: 129 | m_ObjectHideFlags: 0 130 | m_CorrespondingSourceObject: {fileID: 0} 131 | m_PrefabInstance: {fileID: 0} 132 | m_PrefabAsset: {fileID: 0} 133 | serializedVersion: 6 134 | m_Component: 135 | - component: {fileID: 1390282239} 136 | - component: {fileID: 1390282238} 137 | - component: {fileID: 1390282241} 138 | m_Layer: 0 139 | m_Name: Main Camera 140 | m_TagString: MainCamera 141 | m_Icon: {fileID: 0} 142 | m_NavMeshLayer: 0 143 | m_StaticEditorFlags: 0 144 | m_IsActive: 1 145 | --- !u!20 &1390282238 146 | Camera: 147 | m_ObjectHideFlags: 0 148 | m_CorrespondingSourceObject: {fileID: 0} 149 | m_PrefabInstance: {fileID: 0} 150 | m_PrefabAsset: {fileID: 0} 151 | m_GameObject: {fileID: 1390282236} 152 | m_Enabled: 1 153 | serializedVersion: 2 154 | m_ClearFlags: 2 155 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 156 | m_projectionMatrixMode: 1 157 | m_GateFitMode: 2 158 | m_FOVAxisMode: 0 159 | m_SensorSize: {x: 36, y: 24} 160 | m_LensShift: {x: 0, y: 0} 161 | m_FocalLength: 50 162 | m_NormalizedViewPortRect: 163 | serializedVersion: 2 164 | x: 0 165 | y: 0 166 | width: 1 167 | height: 1 168 | near clip plane: 0.3 169 | far clip plane: 1000 170 | field of view: 60 171 | orthographic: 0 172 | orthographic size: 5 173 | m_Depth: -1 174 | m_CullingMask: 175 | serializedVersion: 2 176 | m_Bits: 4294967295 177 | m_RenderingPath: -1 178 | m_TargetTexture: {fileID: 0} 179 | m_TargetDisplay: 0 180 | m_TargetEye: 3 181 | m_HDR: 1 182 | m_AllowMSAA: 1 183 | m_AllowDynamicResolution: 0 184 | m_ForceIntoRT: 0 185 | m_OcclusionCulling: 1 186 | m_StereoConvergence: 10 187 | m_StereoSeparation: 0.022 188 | --- !u!4 &1390282239 189 | Transform: 190 | m_ObjectHideFlags: 0 191 | m_CorrespondingSourceObject: {fileID: 0} 192 | m_PrefabInstance: {fileID: 0} 193 | m_PrefabAsset: {fileID: 0} 194 | m_GameObject: {fileID: 1390282236} 195 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 196 | m_LocalPosition: {x: 0, y: 1, z: -10} 197 | m_LocalScale: {x: 1, y: 1, z: 1} 198 | m_ConstrainProportionsScale: 0 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_RootOrder: 0 202 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 203 | --- !u!114 &1390282241 204 | MonoBehaviour: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | m_GameObject: {fileID: 1390282236} 210 | m_Enabled: 1 211 | m_EditorHideFlags: 0 212 | m_Script: {fileID: 11500000, guid: aa8ed5852d331fd439d6fd12644f890a, type: 3} 213 | m_Name: 214 | m_EditorClassIdentifier: 215 | boolValue: 1 216 | stringValue: aiueo 217 | intValue: 777 218 | floatValue: 0.7346 219 | vector2Value: {x: -1753475, y: 1031462} 220 | vector3Value: {x: 7428581, y: 3285470, z: 2002010} 221 | vector4Value: {x: 1, y: 2, z: 3, w: 4} 222 | vector2IntValue: {x: 143, y: 229} 223 | vector3IntValue: {x: 1, y: 1, z: 1} 224 | matrixValue: 225 | e00: 4400364 226 | e01: 0 227 | e02: 0 228 | e03: 0 229 | e10: 0 230 | e11: 4187544 231 | e12: 4586578 232 | e13: 0 233 | e20: 0 234 | e21: 0 235 | e22: 0 236 | e23: -7569423 237 | e30: 5950708 238 | e31: 4848737 239 | e32: 3746745 240 | e33: 0 241 | colorValue: {r: 0.54509807, g: 0.4745098, b: 0.6784314, a: 1} 242 | enumValue: 8 243 | intArrayValue: 000000000100000002000000 244 | vectorListValue: 245 | - {x: 0, y: 1} 246 | - {x: 2, y: 3} 247 | - {x: -1, y: 1} 248 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Reflections/ReflectionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using UnityEngine; 5 | using static XGUILayout; 6 | 7 | namespace XGUI 8 | { 9 | internal static class ReflectionHelper 10 | { 11 | #region Field 12 | 13 | private static readonly Type FlexListGUIType = typeof(FlexListGUI<,>); 14 | private static readonly Type EnumGUIType = typeof(EnumGUI<>); 15 | 16 | internal static readonly Dictionary GUIType = new () 17 | { 18 | { typeof(bool), typeof(BoolGUI) }, 19 | { typeof(string), typeof(StringGUI) }, 20 | { typeof(int), typeof(IntGUI) }, 21 | { typeof(float) , typeof(FloatGUI) }, 22 | { typeof(Vector2), typeof(Vector2GUI) }, 23 | { typeof(Vector3), typeof(Vector3GUI) }, 24 | { typeof(Vector4), typeof(Vector4GUI) }, 25 | { typeof(Vector2Int), typeof(Vector2IntGUI) }, 26 | { typeof(Vector3Int), typeof(Vector3IntGUI) }, 27 | { typeof(Color), typeof(ColorGUI) }, 28 | { typeof(Matrix4x4), typeof(Matrix4x4GUI) }, 29 | }; 30 | 31 | internal static readonly Dictionary> MinValue = new () 32 | { 33 | { typeof(int), (min) => float.IsNaN(min) ? DefaultMinValueInt : (int)min}, 34 | { typeof(float), (min) => float.IsNaN(min) ? DefaultMinValueFloat : min}, 35 | { typeof(Vector2), (min) => float.IsNaN(min) ? DefaultMinValueVector2 : new Vector2(min, min)}, 36 | { typeof(Vector3), (min) => float.IsNaN(min) ? DefaultMinValueVector3 : new Vector3(min, min, min)}, 37 | { typeof(Vector4), (min) => float.IsNaN(min) ? DefaultMinValueVector4 : new Vector4(min, min, min, min)}, 38 | { typeof(Vector2Int), (min) => float.IsNaN(min) ? DefaultMinValueVector2Int : new Vector2Int((int)min, (int)min)}, 39 | { typeof(Vector3Int), (min) => float.IsNaN(min) ? DefaultMinValueVector3Int : new Vector3Int((int)min, (int)min, (int)min)}, 40 | { typeof(Color), (min) => float.IsNaN(min) ? DefaultMinValueColor : new Color(min, min, min, min)}, 41 | { typeof(Matrix4x4), (min) => float.IsNaN(min) ? DefaultMinValueMatrix4x4 : new Matrix4x4(new Vector4(min, min, min, min), 42 | new Vector4(min, min, min, min), 43 | new Vector4(min, min, min, min), 44 | new Vector4(min, min, min, min))} 45 | }; 46 | 47 | internal static readonly Dictionary> MaxValue = new () 48 | { 49 | { typeof(int), (max) => float.IsNaN(max) ? DefaultMaxValueInt : (int)max}, 50 | { typeof(float), (max) => float.IsNaN(max) ? DefaultMaxValueFloat : max}, 51 | { typeof(Vector2), (max) => float.IsNaN(max) ? DefaultMaxValueVector2 : new Vector2(max, max)}, 52 | { typeof(Vector3), (max) => float.IsNaN(max) ? DefaultMaxValueVector3 : new Vector3(max, max, max)}, 53 | { typeof(Vector4), (max) => float.IsNaN(max) ? DefaultMaxValueVector4 : new Vector4(max, max, max, max)}, 54 | { typeof(Vector2Int), (max) => float.IsNaN(max) ? DefaultMaxValueVector2Int : new Vector2Int((int)max, (int)max)}, 55 | { typeof(Vector3Int), (max) => float.IsNaN(max) ? DefaultMaxValueVector3Int : new Vector3Int((int)max, (int)max, (int)max)}, 56 | { typeof(Color), (max) => float.IsNaN(max) ? DefaultMaxValueColor : new Color(max, max, max, max)}, 57 | { typeof(Matrix4x4), (max) => float.IsNaN(max) ? DefaultMaxValueMatrix4x4 : new Matrix4x4(new Vector4(max, max, max, max), 58 | new Vector4(max, max, max, max), 59 | new Vector4(max, max, max, max), 60 | new Vector4(max, max, max, max))}, 61 | }; 62 | 63 | #endregion Field 64 | 65 | #region Method 66 | 67 | internal static Type GetGUIType(Type type) 68 | { 69 | Type guiType = null; 70 | 71 | if (type.IsArray) 72 | { 73 | var elementType = type.GetElementType(); 74 | guiType = FlexListGUIType.MakeGenericType(elementType, elementType.MakeArrayType()); 75 | } 76 | else if (type.IsGenericType) 77 | { 78 | if (type.GetGenericTypeDefinition() == typeof(List<>)) 79 | { 80 | var elementType = type.GetGenericArguments()[0]; 81 | guiType = FlexListGUIType.MakeGenericType(elementType, type); 82 | } 83 | } 84 | else if (type.IsEnum) 85 | { 86 | guiType = EnumGUIType.MakeGenericType(type); ; 87 | } 88 | else if (GUIType.ContainsKey(type)) 89 | { 90 | guiType = GUIType[type]; 91 | } 92 | 93 | return guiType; 94 | } 95 | 96 | internal static object GenerateGUI(Type type) 97 | { 98 | var guiType = GetGUIType(type); 99 | 100 | return guiType == null ? new UnSupportedGUI() 101 | : Activator.CreateInstance(guiType); 102 | } 103 | 104 | internal static void SetProperty(object gui, string propertyName, object value) 105 | { 106 | var property = gui.GetType().GetProperty(propertyName); 107 | 108 | if (property == null) 109 | { 110 | return; 111 | } 112 | 113 | try 114 | { 115 | property.SetValue(gui, value); 116 | } 117 | catch 118 | { 119 | // ignored 120 | } 121 | } 122 | 123 | internal static object GetProperty(object gui, string propertyName) 124 | { 125 | var property = gui.GetType().GetProperty(propertyName); 126 | 127 | if (property == null) 128 | { 129 | return null; 130 | } 131 | 132 | try 133 | { 134 | return property.GetValue(gui); 135 | } 136 | catch 137 | { 138 | return null; 139 | } 140 | } 141 | 142 | internal static Type GetRootElementType(Type type) 143 | { 144 | if (type == null) 145 | { 146 | return null; 147 | } 148 | 149 | var tempType = type; 150 | 151 | while (true) 152 | { 153 | if (tempType.IsArray) 154 | { 155 | tempType = tempType.GetElementType(); 156 | } 157 | else if (tempType.IsGenericType) 158 | { 159 | if (tempType.GetGenericTypeDefinition() == typeof(List<>)) 160 | { 161 | var genericTypes = tempType.GetGenericArguments(); 162 | 163 | if (genericTypes.Length == 0) 164 | { 165 | return null; 166 | } 167 | 168 | tempType = tempType.GetGenericArguments()[0]; 169 | } 170 | } 171 | else 172 | { 173 | break; 174 | } 175 | } 176 | 177 | return tempType; 178 | } 179 | 180 | [return : MaybeNull] 181 | internal static object GetMinValue(Type type, float minValue) 182 | { 183 | var rootType = GetRootElementType(type); 184 | return MinValue.ContainsKey(rootType) ? MinValue[rootType].Invoke(minValue) : null; 185 | } 186 | 187 | [return : MaybeNull] 188 | internal static object GetMaxValue(Type type, float maxValue) 189 | { 190 | var rootType = GetRootElementType(type); 191 | return MaxValue.ContainsKey(rootType) ? MaxValue[rootType].Invoke(maxValue) : null; 192 | } 193 | 194 | #endregion Method 195 | } 196 | } -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/ListBaseGUI.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace XGUI 6 | { 7 | public abstract class ListBaseGUI : ElementGUI 8 | where TList : IList 9 | { 10 | #region Field 11 | 12 | protected const float ButtonWidth = 30; 13 | 14 | protected readonly FoldoutPanel _foldoutPanel = new (); 15 | protected readonly ScrollPanel _scrollPanel = new (); 16 | protected readonly List<(ElementGUI gui, FoldoutPanel foldOutPanel)> _guiList = new (); 17 | 18 | public bool FoldoutList = true; 19 | public bool Reorderable = true; 20 | public bool Resizable = true; 21 | public bool BoxSkin = true; 22 | 23 | #endregion Field 24 | 25 | #region Property 26 | 27 | public float Width 28 | { 29 | get => _scrollPanel.Width; 30 | set => _scrollPanel.Width = value; 31 | } 32 | 33 | public float Height 34 | { 35 | get => _scrollPanel.Height; 36 | set => _scrollPanel.Height = value; 37 | } 38 | 39 | public float MinWidth 40 | { 41 | get => _scrollPanel.MinWidth; 42 | set => _scrollPanel.MinWidth = value; 43 | } 44 | 45 | public float MinHeight 46 | { 47 | get => _scrollPanel.MinHeight; 48 | set => _scrollPanel.MinHeight = value; 49 | } 50 | 51 | public float MaxWidth 52 | { 53 | get => _scrollPanel.MaxWidth; 54 | set => _scrollPanel.MaxWidth = value; 55 | } 56 | 57 | public float MaxHeight 58 | { 59 | get => _scrollPanel.MaxHeight; 60 | set => _scrollPanel.MaxHeight = value; 61 | } 62 | 63 | #endregion Property 64 | 65 | #region Constructor 66 | 67 | protected ListBaseGUI() { } 68 | 69 | protected ListBaseGUI(string title) : base(title) { } 70 | 71 | #endregion Constructor 72 | 73 | #region Method 74 | 75 | public override TList Show(TList value) 76 | { 77 | var valueCount = value == null ? 0 : value.Count; 78 | var guiCount = _guiList.Count; 79 | 80 | while (valueCount < guiCount) 81 | { 82 | guiCount -= 1; 83 | _guiList.RemoveAt(guiCount); 84 | } 85 | 86 | while (valueCount > guiCount) 87 | { 88 | guiCount += 1; 89 | _guiList.Add((GenerateGUI(), new FoldoutPanel())); 90 | } 91 | 92 | var addList = new List(); 93 | var removeList = new List(); 94 | 95 | var panelAction = new Action(() => 96 | { 97 | if (valueCount == 0) 98 | { 99 | // NOTE: 100 | // Show dummy buttons to keep UI layout. 101 | 102 | XGUILayout.HorizontalLayout(() => 103 | { 104 | GUILayout.Label("No Element"); 105 | GUILayout.FlexibleSpace(); // To Align Right 106 | 107 | GUI.enabled = false; 108 | GUILayout.Button("∧", GUILayout.Width(ButtonWidth)); 109 | GUILayout.Button("∨", GUILayout.Width(ButtonWidth)); 110 | if (!typeof(TList).IsArray) 111 | { 112 | GUI.enabled = Resizable; 113 | if (GUILayout.Button("+", GUILayout.Width(ButtonWidth))) 114 | { 115 | addList.Add(0); 116 | } 117 | GUI.enabled = false; 118 | GUILayout.Button("-", GUILayout.Width(ButtonWidth)); 119 | } 120 | GUI.enabled = true; 121 | }); 122 | } 123 | else 124 | { 125 | for (var i = 0; i < valueCount; i++) 126 | { 127 | var (gui, foldoutPanel) = _guiList[i]; 128 | 129 | foldoutPanel.Title = i + " : " + GetElementTitle(value[i], gui); 130 | foldoutPanel.ButtonFieldAction = () => 131 | { 132 | XGUILayout.HorizontalLayout(() => 133 | { 134 | GUILayout.FlexibleSpace(); // To Align Right 135 | 136 | GUI.enabled = i > 0 && Reorderable; 137 | if (GUILayout.Button("∧", GUILayout.Width(ButtonWidth))) 138 | { 139 | (value[i], value[i - 1]) = (value[i - 1], value[i]); 140 | } 141 | 142 | GUI.enabled = i < valueCount - 1 && Reorderable; 143 | if (GUILayout.Button("∨", GUILayout.Width(ButtonWidth))) 144 | { 145 | (value[i], value[i + 1]) = (value[i + 1], value[i]); 146 | } 147 | 148 | if (!typeof(TList).IsArray) 149 | { 150 | GUI.enabled = Resizable; 151 | if (GUILayout.Button("+", GUILayout.Width(ButtonWidth))) { addList .Add(i); } 152 | if (GUILayout.Button("-", GUILayout.Width(ButtonWidth))) { removeList.Add(i); } 153 | } 154 | 155 | GUI.enabled = true; 156 | }); 157 | }; 158 | 159 | foldoutPanel.Show(() => 160 | { 161 | value[i] = gui.Show(value[i]); 162 | Updated = Updated || gui.Updated; 163 | }); 164 | } 165 | } 166 | }); 167 | 168 | // CAUTION: 169 | // string.IsNullOrEmpty needs to consider nested list/array. 170 | 171 | if (FoldoutList && !string.IsNullOrEmpty(Title)) 172 | { 173 | _foldoutPanel.Title = Title; 174 | _scrollPanel .Title = null; 175 | 176 | _foldoutPanel.BoxSkin = BoxSkin; 177 | _scrollPanel.BoxSkin = false; 178 | 179 | _foldoutPanel.Show(() => 180 | { 181 | _scrollPanel.Show(panelAction); 182 | }); 183 | } 184 | else 185 | { 186 | _scrollPanel.BoxSkin = BoxSkin; 187 | _scrollPanel.Title = Title; 188 | 189 | _scrollPanel.Show(panelAction); 190 | } 191 | 192 | // NOTE: 193 | // Array type can't add or remove value now. 194 | // Because it makes code more complicated. 195 | // The reference of the instance will be changed. 196 | // If the length of the value must be changed, it should be defined as list. 197 | 198 | foreach (var i in addList) 199 | { 200 | // NOTE: 201 | // It is hard to implement to copy instance. 202 | // 1) Using BinaryFormatter and De/serialize is now deprecated. 203 | // And it requires serializable(System.Serializable) to the instance. 204 | // That's nonsense. 205 | // 2) It can't guarantee that generating the deep-copy instance is safe. 206 | 207 | // NOTE: 208 | // Remove limitation of TElement now. Because Array-type might be set. 209 | // ex. where TElement : new() 210 | 211 | var elementType = typeof(TElement); 212 | var newInstance = (TElement)(elementType.IsArray ? Array.CreateInstance(elementType.GetElementType(), 0) 213 | : Activator.CreateInstance(elementType)); 214 | 215 | value.Insert(i == 0 ? i : i + 1, newInstance); 216 | } 217 | 218 | foreach (var i in removeList) 219 | { 220 | value.RemoveAt(i); 221 | } 222 | 223 | Updated = Updated || addList.Count != 0 || removeList.Count != 0; 224 | 225 | return value; 226 | } 227 | 228 | protected abstract ElementGUI GenerateGUI(); 229 | protected abstract string GetElementTitle(TElement value, ElementGUI gui); 230 | 231 | #endregion Method 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ai.navigation": { 4 | "version": "1.1.3", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": { 8 | "com.unity.modules.ai": "1.0.0" 9 | }, 10 | "url": "https://packages.unity.com" 11 | }, 12 | "com.unity.ext.nunit": { 13 | "version": "1.0.6", 14 | "depth": 1, 15 | "source": "registry", 16 | "dependencies": {}, 17 | "url": "https://packages.unity.com" 18 | }, 19 | "com.unity.ide.rider": { 20 | "version": "3.0.21", 21 | "depth": 0, 22 | "source": "registry", 23 | "dependencies": { 24 | "com.unity.ext.nunit": "1.0.6" 25 | }, 26 | "url": "https://packages.unity.com" 27 | }, 28 | "com.unity.ide.visualstudio": { 29 | "version": "2.0.18", 30 | "depth": 0, 31 | "source": "registry", 32 | "dependencies": { 33 | "com.unity.test-framework": "1.1.9" 34 | }, 35 | "url": "https://packages.unity.com" 36 | }, 37 | "com.unity.test-framework": { 38 | "version": "1.1.33", 39 | "depth": 1, 40 | "source": "registry", 41 | "dependencies": { 42 | "com.unity.ext.nunit": "1.0.6", 43 | "com.unity.modules.imgui": "1.0.0", 44 | "com.unity.modules.jsonserialize": "1.0.0" 45 | }, 46 | "url": "https://packages.unity.com" 47 | }, 48 | "com.xjine.expression_parser": { 49 | "version": "https://github.com/XJINE/Unity_ExpressionParser.git?path=Assets/Packages/ExpressionParser", 50 | "depth": 0, 51 | "source": "git", 52 | "dependencies": {}, 53 | "hash": "d8aa42ad7b6b785bc8f4a17c7e1122d56f12893c" 54 | }, 55 | "com.unity.modules.ai": { 56 | "version": "1.0.0", 57 | "depth": 0, 58 | "source": "builtin", 59 | "dependencies": {} 60 | }, 61 | "com.unity.modules.androidjni": { 62 | "version": "1.0.0", 63 | "depth": 0, 64 | "source": "builtin", 65 | "dependencies": {} 66 | }, 67 | "com.unity.modules.animation": { 68 | "version": "1.0.0", 69 | "depth": 0, 70 | "source": "builtin", 71 | "dependencies": {} 72 | }, 73 | "com.unity.modules.assetbundle": { 74 | "version": "1.0.0", 75 | "depth": 0, 76 | "source": "builtin", 77 | "dependencies": {} 78 | }, 79 | "com.unity.modules.audio": { 80 | "version": "1.0.0", 81 | "depth": 0, 82 | "source": "builtin", 83 | "dependencies": {} 84 | }, 85 | "com.unity.modules.cloth": { 86 | "version": "1.0.0", 87 | "depth": 0, 88 | "source": "builtin", 89 | "dependencies": { 90 | "com.unity.modules.physics": "1.0.0" 91 | } 92 | }, 93 | "com.unity.modules.director": { 94 | "version": "1.0.0", 95 | "depth": 0, 96 | "source": "builtin", 97 | "dependencies": { 98 | "com.unity.modules.audio": "1.0.0", 99 | "com.unity.modules.animation": "1.0.0" 100 | } 101 | }, 102 | "com.unity.modules.imageconversion": { 103 | "version": "1.0.0", 104 | "depth": 0, 105 | "source": "builtin", 106 | "dependencies": {} 107 | }, 108 | "com.unity.modules.imgui": { 109 | "version": "1.0.0", 110 | "depth": 0, 111 | "source": "builtin", 112 | "dependencies": {} 113 | }, 114 | "com.unity.modules.jsonserialize": { 115 | "version": "1.0.0", 116 | "depth": 0, 117 | "source": "builtin", 118 | "dependencies": {} 119 | }, 120 | "com.unity.modules.particlesystem": { 121 | "version": "1.0.0", 122 | "depth": 0, 123 | "source": "builtin", 124 | "dependencies": {} 125 | }, 126 | "com.unity.modules.physics": { 127 | "version": "1.0.0", 128 | "depth": 0, 129 | "source": "builtin", 130 | "dependencies": {} 131 | }, 132 | "com.unity.modules.physics2d": { 133 | "version": "1.0.0", 134 | "depth": 0, 135 | "source": "builtin", 136 | "dependencies": {} 137 | }, 138 | "com.unity.modules.screencapture": { 139 | "version": "1.0.0", 140 | "depth": 0, 141 | "source": "builtin", 142 | "dependencies": { 143 | "com.unity.modules.imageconversion": "1.0.0" 144 | } 145 | }, 146 | "com.unity.modules.subsystems": { 147 | "version": "1.0.0", 148 | "depth": 1, 149 | "source": "builtin", 150 | "dependencies": { 151 | "com.unity.modules.jsonserialize": "1.0.0" 152 | } 153 | }, 154 | "com.unity.modules.terrain": { 155 | "version": "1.0.0", 156 | "depth": 0, 157 | "source": "builtin", 158 | "dependencies": {} 159 | }, 160 | "com.unity.modules.terrainphysics": { 161 | "version": "1.0.0", 162 | "depth": 0, 163 | "source": "builtin", 164 | "dependencies": { 165 | "com.unity.modules.physics": "1.0.0", 166 | "com.unity.modules.terrain": "1.0.0" 167 | } 168 | }, 169 | "com.unity.modules.tilemap": { 170 | "version": "1.0.0", 171 | "depth": 0, 172 | "source": "builtin", 173 | "dependencies": { 174 | "com.unity.modules.physics2d": "1.0.0" 175 | } 176 | }, 177 | "com.unity.modules.ui": { 178 | "version": "1.0.0", 179 | "depth": 0, 180 | "source": "builtin", 181 | "dependencies": {} 182 | }, 183 | "com.unity.modules.uielements": { 184 | "version": "1.0.0", 185 | "depth": 0, 186 | "source": "builtin", 187 | "dependencies": { 188 | "com.unity.modules.ui": "1.0.0", 189 | "com.unity.modules.imgui": "1.0.0", 190 | "com.unity.modules.jsonserialize": "1.0.0" 191 | } 192 | }, 193 | "com.unity.modules.umbra": { 194 | "version": "1.0.0", 195 | "depth": 0, 196 | "source": "builtin", 197 | "dependencies": {} 198 | }, 199 | "com.unity.modules.unityanalytics": { 200 | "version": "1.0.0", 201 | "depth": 0, 202 | "source": "builtin", 203 | "dependencies": { 204 | "com.unity.modules.unitywebrequest": "1.0.0", 205 | "com.unity.modules.jsonserialize": "1.0.0" 206 | } 207 | }, 208 | "com.unity.modules.unitywebrequest": { 209 | "version": "1.0.0", 210 | "depth": 0, 211 | "source": "builtin", 212 | "dependencies": {} 213 | }, 214 | "com.unity.modules.unitywebrequestassetbundle": { 215 | "version": "1.0.0", 216 | "depth": 0, 217 | "source": "builtin", 218 | "dependencies": { 219 | "com.unity.modules.assetbundle": "1.0.0", 220 | "com.unity.modules.unitywebrequest": "1.0.0" 221 | } 222 | }, 223 | "com.unity.modules.unitywebrequestaudio": { 224 | "version": "1.0.0", 225 | "depth": 0, 226 | "source": "builtin", 227 | "dependencies": { 228 | "com.unity.modules.unitywebrequest": "1.0.0", 229 | "com.unity.modules.audio": "1.0.0" 230 | } 231 | }, 232 | "com.unity.modules.unitywebrequesttexture": { 233 | "version": "1.0.0", 234 | "depth": 0, 235 | "source": "builtin", 236 | "dependencies": { 237 | "com.unity.modules.unitywebrequest": "1.0.0", 238 | "com.unity.modules.imageconversion": "1.0.0" 239 | } 240 | }, 241 | "com.unity.modules.unitywebrequestwww": { 242 | "version": "1.0.0", 243 | "depth": 0, 244 | "source": "builtin", 245 | "dependencies": { 246 | "com.unity.modules.unitywebrequest": "1.0.0", 247 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 248 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 249 | "com.unity.modules.audio": "1.0.0", 250 | "com.unity.modules.assetbundle": "1.0.0", 251 | "com.unity.modules.imageconversion": "1.0.0" 252 | } 253 | }, 254 | "com.unity.modules.vehicles": { 255 | "version": "1.0.0", 256 | "depth": 0, 257 | "source": "builtin", 258 | "dependencies": { 259 | "com.unity.modules.physics": "1.0.0" 260 | } 261 | }, 262 | "com.unity.modules.video": { 263 | "version": "1.0.0", 264 | "depth": 0, 265 | "source": "builtin", 266 | "dependencies": { 267 | "com.unity.modules.audio": "1.0.0", 268 | "com.unity.modules.ui": "1.0.0", 269 | "com.unity.modules.unitywebrequest": "1.0.0" 270 | } 271 | }, 272 | "com.unity.modules.vr": { 273 | "version": "1.0.0", 274 | "depth": 0, 275 | "source": "builtin", 276 | "dependencies": { 277 | "com.unity.modules.jsonserialize": "1.0.0", 278 | "com.unity.modules.physics": "1.0.0", 279 | "com.unity.modules.xr": "1.0.0" 280 | } 281 | }, 282 | "com.unity.modules.wind": { 283 | "version": "1.0.0", 284 | "depth": 0, 285 | "source": "builtin", 286 | "dependencies": {} 287 | }, 288 | "com.unity.modules.xr": { 289 | "version": "1.0.0", 290 | "depth": 0, 291 | "source": "builtin", 292 | "dependencies": { 293 | "com.unity.modules.physics": "1.0.0", 294 | "com.unity.modules.jsonserialize": "1.0.0", 295 | "com.unity.modules.subsystems": "1.0.0" 296 | } 297 | } 298 | } 299 | } 300 | -------------------------------------------------------------------------------- /Assets/Packages/XGUI/Components/Elements/Texts/Values/Matrix4x4GUI.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace XGUI 4 | { 5 | public class Matrix4x4GUI : ValueGUI 6 | { 7 | #region Field 8 | 9 | private readonly FoldoutPanel _foldoutPanel = new (); 10 | 11 | private readonly FloatGUI _guiM00 = new () { Title = "M00" }; 12 | private readonly FloatGUI _guiM10 = new () { Title = "M10" }; 13 | private readonly FloatGUI _guiM20 = new () { Title = "M20" }; 14 | private readonly FloatGUI _guiM30 = new () { Title = "M30" }; 15 | 16 | private readonly FloatGUI _guiM01 = new () { Title = "M01" }; 17 | private readonly FloatGUI _guiM11 = new () { Title = "M11" }; 18 | private readonly FloatGUI _guiM21 = new () { Title = "M21" }; 19 | private readonly FloatGUI _guiM31 = new () { Title = "M31" }; 20 | 21 | private readonly FloatGUI _guiM02 = new () { Title = "M02" }; 22 | private readonly FloatGUI _guiM12 = new () { Title = "M12" }; 23 | private readonly FloatGUI _guiM22 = new () { Title = "M22" }; 24 | private readonly FloatGUI _guiM32 = new () { Title = "M32" }; 25 | 26 | private readonly FloatGUI _guiM03 = new () { Title = "M03" }; 27 | private readonly FloatGUI _guiM13 = new () { Title = "M13" }; 28 | private readonly FloatGUI _guiM23 = new () { Title = "M23" }; 29 | private readonly FloatGUI _guiM33 = new () { Title = "M33" }; 30 | 31 | #endregion Field 32 | 33 | #region Property 34 | 35 | public override string Title 36 | { 37 | get => _foldoutPanel.Title; 38 | set => _foldoutPanel.Title = value; 39 | } 40 | 41 | public override Matrix4x4 MinValue 42 | { 43 | get => new () 44 | { 45 | m00 = _guiM00.MinValue, 46 | m10 = _guiM10.MinValue, 47 | m20 = _guiM20.MinValue, 48 | m30 = _guiM30.MinValue, 49 | 50 | m01 = _guiM01.MinValue, 51 | m11 = _guiM11.MinValue, 52 | m21 = _guiM21.MinValue, 53 | m31 = _guiM31.MinValue, 54 | 55 | m02 = _guiM02.MinValue, 56 | m12 = _guiM12.MinValue, 57 | m22 = _guiM22.MinValue, 58 | m32 = _guiM32.MinValue, 59 | 60 | m03 = _guiM03.MinValue, 61 | m13 = _guiM13.MinValue, 62 | m23 = _guiM23.MinValue, 63 | m33 = _guiM33.MinValue, 64 | }; 65 | set 66 | { 67 | _guiM00.MinValue = value.m00; 68 | _guiM10.MinValue = value.m10; 69 | _guiM20.MinValue = value.m20; 70 | _guiM30.MinValue = value.m30; 71 | 72 | _guiM01.MinValue = value.m01; 73 | _guiM11.MinValue = value.m11; 74 | _guiM21.MinValue = value.m21; 75 | _guiM31.MinValue = value.m31; 76 | 77 | _guiM02.MinValue = value.m02; 78 | _guiM12.MinValue = value.m12; 79 | _guiM22.MinValue = value.m22; 80 | _guiM32.MinValue = value.m32; 81 | 82 | _guiM03.MinValue = value.m03; 83 | _guiM13.MinValue = value.m13; 84 | _guiM23.MinValue = value.m23; 85 | _guiM33.MinValue = value.m33; 86 | } 87 | } 88 | 89 | public override Matrix4x4 MaxValue 90 | { 91 | get => new () 92 | { 93 | m00 = _guiM00.MaxValue, 94 | m10 = _guiM10.MaxValue, 95 | m20 = _guiM20.MaxValue, 96 | m30 = _guiM30.MaxValue, 97 | 98 | m01 = _guiM01.MaxValue, 99 | m11 = _guiM11.MaxValue, 100 | m21 = _guiM21.MaxValue, 101 | m31 = _guiM31.MaxValue, 102 | 103 | m02 = _guiM02.MaxValue, 104 | m12 = _guiM12.MaxValue, 105 | m22 = _guiM22.MaxValue, 106 | m32 = _guiM32.MaxValue, 107 | 108 | m03 = _guiM03.MaxValue, 109 | m13 = _guiM13.MaxValue, 110 | m23 = _guiM23.MaxValue, 111 | m33 = _guiM33.MaxValue, 112 | }; 113 | set 114 | { 115 | _guiM00.MaxValue = value.m00; 116 | _guiM10.MaxValue = value.m10; 117 | _guiM20.MaxValue = value.m20; 118 | _guiM30.MaxValue = value.m30; 119 | 120 | _guiM01.MaxValue = value.m01; 121 | _guiM11.MaxValue = value.m11; 122 | _guiM21.MaxValue = value.m21; 123 | _guiM31.MaxValue = value.m31; 124 | 125 | _guiM02.MaxValue = value.m02; 126 | _guiM12.MaxValue = value.m12; 127 | _guiM22.MaxValue = value.m22; 128 | _guiM32.MaxValue = value.m32; 129 | 130 | _guiM03.MaxValue = value.m03; 131 | _guiM13.MaxValue = value.m13; 132 | _guiM23.MaxValue = value.m23; 133 | _guiM33.MaxValue = value.m33; 134 | } 135 | } 136 | 137 | public virtual int Decimals 138 | { 139 | get => _guiM00.Digits; 140 | set 141 | { 142 | _guiM00.Digits = value; 143 | _guiM10.Digits = value; 144 | _guiM20.Digits = value; 145 | _guiM30.Digits = value; 146 | 147 | _guiM01.Digits = value; 148 | _guiM11.Digits = value; 149 | _guiM21.Digits = value; 150 | _guiM31.Digits = value; 151 | 152 | _guiM02.Digits = value; 153 | _guiM12.Digits = value; 154 | _guiM22.Digits = value; 155 | _guiM32.Digits = value; 156 | 157 | _guiM03.Digits = value; 158 | _guiM13.Digits = value; 159 | _guiM23.Digits = value; 160 | _guiM33.Digits = value; 161 | } 162 | } 163 | 164 | public override float Width 165 | { 166 | get => _guiM00.Width; 167 | set 168 | { 169 | _guiM00.Width = value; 170 | _guiM10.Width = value; 171 | _guiM20.Width = value; 172 | _guiM30.Width = value; 173 | 174 | _guiM01.Width = value; 175 | _guiM11.Width = value; 176 | _guiM21.Width = value; 177 | _guiM31.Width = value; 178 | 179 | _guiM02.Width = value; 180 | _guiM12.Width = value; 181 | _guiM22.Width = value; 182 | _guiM32.Width = value; 183 | 184 | _guiM03.Width = value; 185 | _guiM13.Width = value; 186 | _guiM23.Width = value; 187 | _guiM33.Width = value; 188 | } 189 | } 190 | 191 | public override bool Slider 192 | { 193 | get => _guiM00.Slider; 194 | set 195 | { 196 | _guiM00.Slider = value; 197 | _guiM10.Slider = value; 198 | _guiM20.Slider = value; 199 | _guiM30.Slider = value; 200 | 201 | _guiM01.Slider = value; 202 | _guiM11.Slider = value; 203 | _guiM21.Slider = value; 204 | _guiM31.Slider = value; 205 | 206 | _guiM02.Slider = value; 207 | _guiM12.Slider = value; 208 | _guiM22.Slider = value; 209 | _guiM32.Slider = value; 210 | 211 | _guiM03.Slider = value; 212 | _guiM13.Slider = value; 213 | _guiM23.Slider = value; 214 | _guiM33.Slider = value; 215 | } 216 | } 217 | 218 | #endregion Property 219 | 220 | #region Constructor 221 | 222 | public Matrix4x4GUI() { } 223 | 224 | public Matrix4x4GUI(string title) : base(title) { } 225 | 226 | public Matrix4x4GUI(string title, Matrix4x4 min, Matrix4x4 max) : base(title, min, max) { } 227 | 228 | #endregion Constructor 229 | 230 | #region Method 231 | 232 | protected override void Initialize() 233 | { 234 | base.Initialize(); 235 | 236 | MinValue = XGUILayout.DefaultMinValueMatrix4x4; 237 | MaxValue = XGUILayout.DefaultMaxValueMatrix4x4; 238 | } 239 | 240 | public override Matrix4x4 Show(Matrix4x4 value) 241 | { 242 | var previousValue = value; 243 | 244 | _foldoutPanel.Show(() => 245 | { 246 | XGUILayout.HorizontalLayout(() => 247 | { 248 | value.m00 = _guiM00.Show(value.m00); 249 | value.m10 = _guiM10.Show(value.m10); 250 | value.m20 = _guiM20.Show(value.m20); 251 | value.m30 = _guiM30.Show(value.m30); 252 | }); 253 | 254 | XGUILayout.HorizontalLayout(() => 255 | { 256 | value.m01 = _guiM01.Show(value.m01); 257 | value.m11 = _guiM11.Show(value.m11); 258 | value.m21 = _guiM21.Show(value.m21); 259 | value.m31 = _guiM31.Show(value.m31); 260 | }); 261 | 262 | XGUILayout.HorizontalLayout(() => 263 | { 264 | value.m02 = _guiM02.Show(value.m02); 265 | value.m12 = _guiM12.Show(value.m12); 266 | value.m22 = _guiM22.Show(value.m22); 267 | value.m32 = _guiM32.Show(value.m32); 268 | }); 269 | 270 | XGUILayout.HorizontalLayout(() => 271 | { 272 | value.m03 = _guiM03.Show(value.m03); 273 | value.m13 = _guiM13.Show(value.m13); 274 | value.m23 = _guiM23.Show(value.m23); 275 | value.m33 = _guiM33.Show(value.m33); 276 | }); 277 | }); 278 | 279 | Updated = previousValue != value; 280 | 281 | return value; 282 | } 283 | 284 | #endregion Method 285 | } 286 | } --------------------------------------------------------------------------------