├── .gitignore ├── Runtime ├── Actions │ ├── EcsUguiExitAction.cs.meta │ ├── EcsUguiUpAction.cs.meta │ ├── EcsUguiDragEndAction.cs.meta │ ├── EcsUguiDragStartAction.cs.meta │ ├── EcsUguiTmpInputEndAction.cs.meta │ ├── EcsUguiDownAction.cs.meta │ ├── EcsUguiTmpDropdownAction.cs.meta │ ├── EcsUguiActionBase.cs.meta │ ├── EcsUguiClickAction.cs.meta │ ├── EcsUguiDropAction.cs.meta │ ├── EcsUguiEnterAction.cs.meta │ ├── EcsUguiNoAction.cs.meta │ ├── EcsUguiDragMoveAction.cs.meta │ ├── EcsUguiScrollViewAction.cs.meta │ ├── EcsUguiSliderAction.cs.meta │ ├── EcsUguiTmpInputChangeAction.cs.meta │ ├── EcsUguiNoAction.cs │ ├── EcsUguiExitAction.cs │ ├── EcsUguiEnterAction.cs │ ├── EcsUguiDropAction.cs │ ├── EcsUguiClickAction.cs │ ├── EcsUguiUpAction.cs │ ├── EcsUguiDownAction.cs │ ├── EcsUguiDragEndAction.cs │ ├── EcsUguiDragStartAction.cs │ ├── EcsUguiDragMoveAction.cs │ ├── EcsUguiSliderAction.cs │ ├── EcsUguiTmpInputEndAction.cs │ ├── EcsUguiTmpInputChangeAction.cs │ ├── EcsUguiTmpDropdownAction.cs │ ├── EcsUguiScrollViewAction.cs │ └── EcsUguiActionBase.cs ├── Systems │ ├── EcsUguiCallbackSystem.cs.meta │ ├── EcsUguiProxyEmitter.cs.meta │ ├── Extensions.cs.meta │ ├── EcsUguiEmitter.cs.meta │ ├── EcsUguiEmitter.cs │ ├── EcsUguiProxyEmitter.cs │ ├── Extensions.cs │ └── EcsUguiCallbackSystem.cs ├── Actions.meta ├── Components.meta ├── Systems.meta ├── Leopotam.EcsLite.Unity.Ugui.asmdef.meta ├── Widgets.meta ├── Components │ ├── EcsUguiDownEvent.cs.meta │ ├── EcsUguiUpEvent.cs.meta │ ├── EcsUguiSliderChangeEvent.cs.meta │ ├── EcsUguiTmpInputChangeEvent.cs.meta │ ├── EcsUguiTmpInputEndEvent.cs.meta │ ├── EcsUguiTmpDropdownChangeEvent.cs.meta │ ├── EcsUguiClickEvent.cs.meta │ ├── EcsUguiDragEndEvent.cs.meta │ ├── EcsUguiDragMoveEvent.cs.meta │ ├── EcsUguiDropEvent.cs.meta │ ├── EcsUguiEnterEvent.cs.meta │ ├── EcsUguiExitEvent.cs.meta │ ├── EcsUguiDragStartEvent.cs.meta │ ├── EcsUguiScrollViewEvent.cs.meta │ ├── EcsUguiExitEvent.cs │ ├── EcsUguiEnterEvent.cs │ ├── EcsUguiTmpInputEndEvent.cs │ ├── EcsUguiSliderChangeEvent.cs │ ├── EcsUguiTmpDropdownChangeEvent.cs │ ├── EcsUguiTmpInputChangeEvent.cs │ ├── EcsUguiScrollViewEvent.cs │ ├── EcsUguiDropEvent.cs │ ├── EcsUguiClickEvent.cs │ ├── EcsUguiUpEvent.cs │ ├── EcsUguiDownEvent.cs │ ├── EcsUguiDragEndEvent.cs │ ├── EcsUguiDragStartEvent.cs │ └── EcsUguiDragMoveEvent.cs ├── Widgets │ ├── EcsUguiNonVisualWidget.cs.meta │ └── EcsUguiNonVisualWidget.cs └── Leopotam.EcsLite.Unity.Ugui.asmdef ├── LICENSE.md.meta ├── package.json.meta ├── Editor ├── Leopotam.EcsLite.Unity.Ugui.Editor.asmdef.meta ├── Widgets.meta ├── Widgets │ ├── EcsUguiNonVisualWidgetInspector.cs.meta │ └── EcsUguiNonVisualWidgetInspector.cs └── Leopotam.EcsLite.Unity.Ugui.Editor.asmdef ├── README.md.meta ├── Editor.meta ├── Runtime.meta ├── package.json ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.sln 2 | .vscode 3 | .idea 4 | Library 5 | bin 6 | obj 7 | Temp 8 | .DS_Store 9 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiExitAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3bf116c79bd24dda814523c9d3373458 3 | timeCreated: 1626635002 -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiUpAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2674167661ca4d0a9cea6955daff62fc 3 | timeCreated: 1626634739 -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragEndAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b56b7c884843428eb0dabd7b984b8599 3 | timeCreated: 1624124793 -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragStartAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3c1d87b6090e485ca1e79a0836ce0e9c 3 | timeCreated: 1624124584 -------------------------------------------------------------------------------- /Runtime/Systems/EcsUguiCallbackSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 986fbef21f78490a9296b3960a40d5e0 3 | timeCreated: 1643397976 -------------------------------------------------------------------------------- /Runtime/Systems/EcsUguiProxyEmitter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7179e343c10d4752bfeb872477553ee 3 | timeCreated: 1610219225 -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpInputEndAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 393acb5bfb3e4f209a352e948545bc6d 3 | timeCreated: 1626634836 -------------------------------------------------------------------------------- /LICENSE.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a8cd787613f14bd58b8efd80de0c207 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef52c01d8a3c34c1ab926b8f51a214e9 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Runtime/Actions.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b03adc212ebc4761bc9aaceb47c7fe2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Components.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c361c2dfc6761467db0291272a27bd51 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Systems.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26d35bd0547a54935a97fba63e15dc18 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Runtime/Leopotam.EcsLite.Unity.Ugui.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: de6c4adc3aaac4bb09212ed7b9ba2781 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Editor/Leopotam.EcsLite.Unity.Ugui.Editor.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d63728878a8ad4588b4c8343d659fd4d 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57ae8861be9a740dbbe922dff33a6c20 3 | timeCreated: 1515891012 4 | licenseType: Free 5 | TextScriptImporter: 6 | externalObjects: {} 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fa7d3578554543459ffb288874a25cc 3 | folderAsset: yes 4 | timeCreated: 1515842406 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a187de1858f44d3c8ab82101e809ab5 3 | folderAsset: yes 4 | timeCreated: 1515842394 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Editor/Widgets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 104e538b7972a465cb4aec2048d41cde 3 | folderAsset: yes 4 | timeCreated: 1515842602 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Runtime/Widgets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e630f3920d71b4834bb71c8850c9b21f 3 | folderAsset: yes 4 | timeCreated: 1515841944 5 | licenseType: Free 6 | DefaultImporter: 7 | externalObjects: {} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Runtime/Systems/Extensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1fe291c8cb2144de39ea9ee049644a50 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDownAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e0ce5452989b457f81fe40069e44fd6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDownEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80f65d17b555245edb6a4e147a75b344 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiUpEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 033979c4bb04246efb1bf45fa77dd040 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpDropdownAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5ef5bff6d18643cfa88be793e62ea23 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiSliderChangeEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6a52a6709a394871be8274f9dd66d89 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpInputChangeEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cda7c947b12b34c4cbd1afda18a2e61f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpInputEndEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8b46957bcc41418ca5cd15de483be91 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpDropdownChangeEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dd2f1c8c17c2464288a3a380b73bb76 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiActionBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4e4b3777f9f9425197125fa5ddeeb2f 3 | timeCreated: 1515866241 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiClickAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44b6b406923f44eb196499bd257618bb 3 | timeCreated: 1515863681 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDropAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 247b8f8c71757482d92dd03be66d4dda 3 | timeCreated: 1515967757 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiEnterAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db1eb6e4b0acb4cb0a387e0ca33f25c0 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiNoAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a2bb647df7944f4b8f1a565fb2bc704 3 | timeCreated: 1516022818 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 | -------------------------------------------------------------------------------- /Runtime/Systems/EcsUguiEmitter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b063c93934787408083465660cb96d7b 3 | timeCreated: 1515841847 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragMoveAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 55f9bac33805e404f8930f9c01202984 3 | timeCreated: 1515863681 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiScrollViewAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b0e6d41216a6449bb82bf4bf3b889a56 3 | timeCreated: 1516038216 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiSliderAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cbd03914733584c9786624881f68a150 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiClickEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a301ee9b7ef9d4da3b2520f99a16aef3 3 | timeCreated: 1515878129 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragEndEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a0239c06c1ce84ddcad78d19eca732bc 3 | timeCreated: 1515884421 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragMoveEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee46598c88a324c3494f5ab266259d21 3 | timeCreated: 1515884421 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDropEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d87c966f247b1490c8e62b30caa7a3a2 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiEnterEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 593b4f01f79fc4007ab9afa1832bd459 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiExitEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a7d80af185a3463e8c0fb4f71660698 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Widgets/EcsUguiNonVisualWidget.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9468a6935640420da10145cedb8d451 3 | timeCreated: 1515891771 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpInputChangeAction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d82236022ff5491eb2e273a4489b00e 3 | timeCreated: 1515967758 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragStartEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e18943c17a70c4c339f1f46e953d0db3 3 | timeCreated: 1515884421 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 | -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiScrollViewEvent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd5c41f9e7d4241cc9a8a35074a635a4 3 | timeCreated: 1516038216 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 | -------------------------------------------------------------------------------- /Editor/Widgets/EcsUguiNonVisualWidgetInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31e68718421e448abbd1da1d8bad3a43 3 | timeCreated: 1515891771 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 | -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiNoAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | namespace Leopotam.EcsLite.Unity.Ugui { 7 | public struct EcsUguiNoActionEvent { } 8 | 9 | public sealed class EcsUguiNoAction : EcsUguiActionBase { } 10 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiExitEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiExitEvent { 10 | public string WidgetName; 11 | public GameObject Sender; 12 | } 13 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiEnterEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiEnterEvent { 10 | public string WidgetName; 11 | public GameObject Sender; 12 | } 13 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpInputEndEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiTmpInputEndEvent { 10 | public string WidgetName; 11 | public TMP_InputField Sender; 12 | public string Value; 13 | } 14 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiSliderChangeEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.UI; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiSliderChangeEvent { 10 | public string WidgetName; 11 | public Slider Sender; 12 | public float Value; 13 | } 14 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpDropdownChangeEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiTmpDropdownChangeEvent { 10 | public string WidgetName; 11 | public TMP_Dropdown Sender; 12 | public int Value; 13 | } 14 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiTmpInputChangeEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public struct EcsUguiTmpInputChangeEvent { 10 | public string WidgetName; 11 | public TMP_InputField Sender; 12 | public string Value; 13 | } 14 | } -------------------------------------------------------------------------------- /Runtime/Leopotam.EcsLite.Unity.Ugui.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Leopotam.EcsLite.Unity.Ugui", 3 | "rootNamespace": "Leopotam.EcsLite.Unity.Ugui", 4 | "references": [ 5 | "Leopotam.EcsLite", 6 | "Unity.TextMeshPro" 7 | ], 8 | "includePlatforms": [], 9 | "excludePlatforms": [], 10 | "allowUnsafeCode": false, 11 | "overrideReferences": false, 12 | "precompiledReferences": [], 13 | "autoReferenced": true, 14 | "defineConstraints": [], 15 | "versionDefines": [], 16 | "noEngineReferences": false 17 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiScrollViewEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiScrollViewEvent { 11 | public string WidgetName; 12 | public ScrollRect Sender; 13 | public Vector2 Value; 14 | } 15 | } -------------------------------------------------------------------------------- /Editor/Leopotam.EcsLite.Unity.Ugui.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Leopotam.EcsLite.Unity.Ugui.Editor", 3 | "rootNamespace": "Leopotam.EcsLite.Unity.Ugui.Editor", 4 | "references": [ 5 | "Leopotam.EcsLite.Unity.Ugui" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": false, 13 | "precompiledReferences": [], 14 | "autoReferenced": true, 15 | "defineConstraints": [], 16 | "versionDefines": [], 17 | "noEngineReferences": false 18 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDropEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiDropEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public PointerEventData.InputButton Button; 14 | } 15 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.leopotam.ecslite.unity.ugui", 3 | "author": "Leopotam", 4 | "displayName": "LeoECS Lite uGui Bindings", 5 | "description": "LeoECS Lite uGui Bindings - поддержка событий uGui в ECS-мире.", 6 | "unity": "2020.3", 7 | "version": "2025.4.22", 8 | "keywords": [ 9 | "leoecslite", 10 | "leoecs", 11 | "ecs", 12 | "performance", 13 | "ui" 14 | ], 15 | "dependencies": {}, 16 | "repository": { 17 | "type": "git", 18 | "url": "https://github.com/Leopotam/ecslite-unity-ugui.git" 19 | } 20 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiClickEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiClickEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public PointerEventData.InputButton Button; 15 | } 16 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiUpEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiUpEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public int PointerId; 15 | public PointerEventData.InputButton Button; 16 | } 17 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDownEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiDownEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public int PointerId; 15 | public PointerEventData.InputButton Button; 16 | } 17 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragEndEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiDragEndEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public int PointerId; 15 | public PointerEventData.InputButton Button; 16 | } 17 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragStartEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiDragStartEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public int PointerId; 15 | public PointerEventData.InputButton Button; 16 | } 17 | } -------------------------------------------------------------------------------- /Runtime/Components/EcsUguiDragMoveEvent.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.EventSystems; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | public struct EcsUguiDragMoveEvent { 11 | public string WidgetName; 12 | public GameObject Sender; 13 | public Vector2 Position; 14 | public int PointerId; 15 | public Vector2 Delta; 16 | public PointerEventData.InputButton Button; 17 | } 18 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiExitAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiExitAction : EcsUguiActionBase, IPointerExitHandler { 10 | public void OnPointerExit (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiEnterAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiEnterAction : EcsUguiActionBase, IPointerEnterHandler { 10 | public void OnPointerEnter (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDropAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiDropAction : EcsUguiActionBase, IDropHandler { 10 | public void OnDrop (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Button = eventData.button; 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Runtime/Widgets/EcsUguiNonVisualWidget.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (CanvasRenderer))] 11 | [RequireComponent (typeof (RectTransform))] 12 | public class EcsUguiNonVisualWidget : Graphic { 13 | public override void SetMaterialDirty () { } 14 | public override void SetVerticesDirty () { } 15 | public override Material material { get => defaultMaterial; set { } } 16 | public override void Rebuild (CanvasUpdate update) { } 17 | } 18 | } -------------------------------------------------------------------------------- /Editor/Widgets/EcsUguiNonVisualWidgetInspector.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEditor; 7 | using UnityEditor.UI; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui.Editor { 10 | [CustomEditor (typeof (EcsUguiNonVisualWidget), false)] 11 | [CanEditMultipleObjects] 12 | sealed class EcsUguiNonVisualWidgetInspector : GraphicEditor { 13 | public override void OnInspectorGUI () { 14 | serializedObject.Update (); 15 | EditorGUILayout.PropertyField (m_Script); 16 | RaycastControlsGUI (); 17 | serializedObject.ApplyModifiedProperties (); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiClickAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiClickAction : EcsUguiActionBase, IPointerClickHandler { 10 | public void OnPointerClick (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.Button = eventData.button; 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiUpAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiUpAction : EcsUguiActionBase, IPointerUpHandler { 10 | public void OnPointerUp (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.PointerId = eventData.pointerId; 17 | msg.Button = eventData.button; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDownAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiDownAction : EcsUguiActionBase, IPointerDownHandler { 10 | public void OnPointerDown (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.PointerId = eventData.pointerId; 17 | msg.Button = eventData.button; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragEndAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiDragEndAction : EcsUguiActionBase, IEndDragHandler { 10 | public void OnEndDrag (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.PointerId = eventData.pointerId; 17 | msg.Button = eventData.button; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragStartAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiDragStartAction : EcsUguiActionBase, IBeginDragHandler { 10 | public void OnBeginDrag (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.PointerId = eventData.pointerId; 17 | msg.Button = eventData.button; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiDragMoveAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine.EventSystems; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public sealed class EcsUguiDragMoveAction : EcsUguiActionBase, IDragHandler { 10 | public void OnDrag (PointerEventData eventData) { 11 | if (IsValidForEvent ()) { 12 | ref var msg = ref CreateEvent (); 13 | msg.WidgetName = GetWidgetName (); 14 | msg.Sender = gameObject; 15 | msg.Position = eventData.position; 16 | msg.PointerId = eventData.pointerId; 17 | msg.Delta = eventData.delta; 18 | msg.Button = eventData.button; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiSliderAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (Slider))] 11 | public sealed class EcsUguiSliderAction : EcsUguiActionBase { 12 | Slider _slider; 13 | 14 | protected override void Awake () { 15 | base.Awake (); 16 | _slider = GetComponent (); 17 | _slider.onValueChanged.AddListener (OnSliderValueChanged); 18 | } 19 | 20 | void OnSliderValueChanged (float value) { 21 | if (IsValidForEvent ()) { 22 | ref var msg = ref CreateEvent (); 23 | msg.WidgetName = GetWidgetName (); 24 | msg.Sender = _slider; 25 | msg.Value = value; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpInputEndAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | using UnityEngine; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (TMP_InputField))] 11 | public sealed class EcsUguiTmpInputEndAction : EcsUguiActionBase { 12 | TMP_InputField _input; 13 | 14 | protected override void Awake () { 15 | base.Awake (); 16 | _input = GetComponent (); 17 | _input.onEndEdit.AddListener (OnInputEnded); 18 | } 19 | 20 | void OnInputEnded (string value) { 21 | if (IsValidForEvent ()) { 22 | ref var msg = ref CreateEvent (); 23 | msg.WidgetName = GetWidgetName (); 24 | msg.Sender = _input; 25 | msg.Value = value; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpInputChangeAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | using UnityEngine; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (TMP_InputField))] 11 | public sealed class EcsUguiTmpInputChangeAction : EcsUguiActionBase { 12 | TMP_InputField _input; 13 | 14 | protected override void Awake () { 15 | base.Awake (); 16 | _input = GetComponent (); 17 | _input.onValueChanged.AddListener (OnInputValueChanged); 18 | } 19 | 20 | void OnInputValueChanged (string value) { 21 | if (IsValidForEvent ()) { 22 | ref var msg = ref CreateEvent (); 23 | msg.WidgetName = GetWidgetName (); 24 | msg.Sender = _input; 25 | msg.Value = value; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiTmpDropdownAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using TMPro; 7 | using UnityEngine; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (TMP_Dropdown))] 11 | public sealed class EcsUguiTmpDropdownAction : EcsUguiActionBase { 12 | TMP_Dropdown _dropdown; 13 | 14 | protected override void Awake () { 15 | base.Awake (); 16 | _dropdown = GetComponent (); 17 | _dropdown.onValueChanged.AddListener (OnDropdownValueChanged); 18 | } 19 | 20 | void OnDropdownValueChanged (int value) { 21 | if (IsValidForEvent ()) { 22 | ref var msg = ref CreateEvent (); 23 | msg.WidgetName = GetWidgetName (); 24 | msg.Sender = _dropdown; 25 | msg.Value = value; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiScrollViewAction.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | namespace Leopotam.EcsLite.Unity.Ugui { 10 | [RequireComponent (typeof (ScrollRect))] 11 | public sealed class EcsUguiScrollViewAction : EcsUguiActionBase { 12 | ScrollRect _scrollView; 13 | 14 | protected override void Awake () { 15 | base.Awake (); 16 | _scrollView = GetComponent (); 17 | _scrollView.onValueChanged.AddListener (OnScrollViewValueChanged); 18 | } 19 | 20 | void OnScrollViewValueChanged (Vector2 value) { 21 | if (IsValidForEvent ()) { 22 | ref var msg = ref CreateEvent (); 23 | msg.WidgetName = GetWidgetName (); 24 | msg.Sender = _scrollView; 25 | msg.Value = value; 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2025 leopotam@yandex.ru 2 | 3 | Данное программное обеспечение и сопутствующая документация (далее - Продукт) 4 | выпускается под MIT-Red лицензией. 5 | 6 | MIT-Red регулируется совокупностью следующих правил, если хотя бы 7 | одно из них невыполнимо - использование Продукта запрещено: 8 | 9 | Если вы за применение opensource программного обеспечения в 10 | военной сфере - вы не можете использовать этот Продукт. 11 | 12 | Если вы испытываете ненависть к русским или поддерживаете 13 | любые нападки на них - вы не можете использовать этот Продукт. 14 | 15 | Данная лицензия разрешает лицам, получившим копию данного Продукта, 16 | безвозмездно использовать Программное обеспечение без ограничений, включая 17 | неограниченное право на использование, копирование, изменение, слияние, 18 | публикацию и распространение копий Продукта. 19 | 20 | Указанное выше уведомление об авторском праве и данные условия должны быть 21 | включены во все копии или значимые части данного Продукта. 22 | 23 | ДАННЫЙ ПРОДУКТ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО 24 | ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ ГАРАНТИИ ТОВАРНОЙ ПРИГОДНОСТИ, 25 | СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ, НО 26 | НЕ ОГРАНИЧИВАЯСЬ ИМИ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ 27 | ОТВЕТСТВЕННОСТИ ПО КАКИМ-ЛИБО ИСКАМ, ЗА УЩЕРБ ИЛИ ПО ИНЫМ ТРЕБОВАНИЯМ, 28 | В ТОМ ЧИСЛЕ, ПРИ ДЕЙСТВИИ КОНТРАКТА, ДЕЛИКТЕ ИЛИ ИНОЙ СИТУАЦИИ, ВОЗНИКШИМ 29 | ИЗ-ЗА ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫХ ДЕЙСТВИЙ С ПРОДУКТОМ. -------------------------------------------------------------------------------- /Runtime/Systems/EcsUguiEmitter.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using System; 7 | using System.Collections.Generic; 8 | using UnityEngine; 9 | 10 | namespace Leopotam.EcsLite.Unity.Ugui { 11 | /// 12 | /// Emitter system for uGui events to ECS world. 13 | /// 14 | public class EcsUguiEmitter : MonoBehaviour { 15 | EcsWorld _world; 16 | readonly Dictionary _actions = new Dictionary (64); 17 | 18 | internal void SetWorld (EcsWorld world) { 19 | _world = world; 20 | } 21 | 22 | public virtual EcsWorld GetWorld () { 23 | if (_world != null && !_world.IsAlive ()) { 24 | _world = null; 25 | } 26 | return _world; 27 | } 28 | 29 | public virtual void SetNamedObject (string widgetName, GameObject go) { 30 | if (!string.IsNullOrEmpty (widgetName)) { 31 | var id = widgetName.GetHashCode (); 32 | if (_actions.ContainsKey (id)) { 33 | if (!go) { 34 | _actions.Remove (id); 35 | } 36 | #if DEBUG && !LEOECSLITE_NO_SANITIZE_CHECKS 37 | if (go) { 38 | throw new Exception ($"Action with \"{widgetName}\" name already registered"); 39 | } 40 | #endif 41 | } else { 42 | if ((object) go != null) { 43 | _actions[id] = go.gameObject; 44 | } 45 | } 46 | } 47 | } 48 | 49 | /// 50 | /// Gets link to named GameObject to use it later from code. 51 | /// 52 | /// Logical name. 53 | public virtual GameObject GetNamedObject (string widgetName) { 54 | _actions.TryGetValue (widgetName.GetHashCode (), out var retVal); 55 | return retVal; 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Runtime/Systems/EcsUguiProxyEmitter.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | public class EcsUguiProxyEmitter : EcsUguiEmitter { 10 | public enum SearchType { 11 | InGlobal, 12 | InHierarchy 13 | } 14 | 15 | [SerializeField] EcsUguiEmitter _parent; 16 | [SerializeField] SearchType _searchType = SearchType.InGlobal; 17 | 18 | public override EcsWorld GetWorld () { 19 | return ValidateEmitter () ? _parent.GetWorld () : default; 20 | } 21 | 22 | public override void SetNamedObject (string widgetName, GameObject go) { 23 | if (ValidateEmitter ()) { _parent.SetNamedObject (widgetName, go); } 24 | } 25 | 26 | public override GameObject GetNamedObject (string widgetName) { 27 | return ValidateEmitter () ? _parent.GetNamedObject (widgetName) : default; 28 | } 29 | 30 | bool ValidateEmitter () { 31 | if (_parent) { return true; } 32 | // parent was killed. 33 | if ((object) _parent != null) { return false; } 34 | 35 | EcsUguiEmitter parent = default; 36 | if (_searchType == SearchType.InGlobal) { 37 | var validType = typeof (EcsUguiEmitter); 38 | foreach (var em in FindObjectsOfType ()) { 39 | if (em.GetType () == validType) { 40 | parent = em; 41 | break; 42 | } 43 | } 44 | } else { 45 | parent = GetComponentInParent (); 46 | } 47 | // fix for GetComponentInParent. 48 | if (parent == this) { parent = null; } 49 | #if DEBUG && !LEOECSLITE_NO_SANITIZE_CHECKS 50 | if (parent == null) { 51 | Debug.LogError ("EcsUiEmitter not found in hierarchy", this); 52 | return false; 53 | } 54 | #endif 55 | _parent = parent; 56 | return true; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Runtime/Actions/EcsUguiActionBase.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using UnityEngine; 7 | 8 | namespace Leopotam.EcsLite.Unity.Ugui { 9 | enum EcsUguiActionNameRegistrationType { 10 | None, 11 | OnAwake, 12 | OnStart 13 | } 14 | 15 | public abstract class EcsUguiActionBase : MonoBehaviour where T : struct { 16 | [SerializeField] string _widgetName; 17 | [SerializeField] EcsUguiEmitter _emitter; 18 | [SerializeField] EcsUguiActionNameRegistrationType _nameRegistrationType = EcsUguiActionNameRegistrationType.None; 19 | [SerializeField] UnityEngine.UI.Selectable _selectable; 20 | 21 | EcsPool _pool; 22 | 23 | protected virtual void Awake () { 24 | if (_nameRegistrationType == EcsUguiActionNameRegistrationType.OnAwake) { 25 | ValidateEmitter (); 26 | _emitter.SetNamedObject (_widgetName, gameObject); 27 | } 28 | } 29 | 30 | void Start () { 31 | if (_nameRegistrationType == EcsUguiActionNameRegistrationType.OnStart) { 32 | ValidateEmitter (); 33 | _emitter.SetNamedObject (_widgetName, gameObject); 34 | } 35 | if (_nameRegistrationType == EcsUguiActionNameRegistrationType.None) { 36 | ValidateEmitter (); 37 | } 38 | } 39 | 40 | void OnDestroy () { 41 | if (_emitter) { 42 | _emitter.SetNamedObject (_widgetName, null); 43 | _emitter = null; 44 | } 45 | } 46 | 47 | void ValidateEmitter () { 48 | if (_emitter == null) { 49 | _emitter = GetComponentInParent (); 50 | } 51 | #if DEBUG 52 | if (_emitter == null) { 53 | Debug.LogError ("EcsUguiEmitter not found in hierarchy", this); 54 | } 55 | #endif 56 | } 57 | 58 | protected bool IsValidForEvent () { 59 | if (!_emitter) { return false; } 60 | #if DEBUG 61 | if (_emitter.GetWorld () == null) { throw new System.Exception ("[EcsUguiEmitter] Call EcsSystems.InjectUi() first."); } 62 | #endif 63 | return _emitter.GetWorld ().IsAlive () && (_selectable == null || _selectable.interactable); 64 | } 65 | 66 | protected ref T CreateEvent () { 67 | _pool ??= _emitter.GetWorld ().GetPool (); 68 | return ref _pool.Add (_emitter.GetWorld ().NewEntity ()); 69 | } 70 | 71 | public string GetWidgetName () { 72 | return _widgetName; 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /Runtime/Systems/Extensions.cs: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // The MIT-Red License 3 | // Copyright (c) 2012-2025 Leopotam 4 | // ---------------------------------------------------------------------------- 5 | 6 | using System; 7 | using System.Reflection; 8 | using UnityEngine; 9 | 10 | #if ENABLE_IL2CPP 11 | using Unity.IL2CPP.CompilerServices; 12 | #endif 13 | 14 | namespace Leopotam.EcsLite.Unity.Ugui { 15 | public sealed class EcsUguiNamedAttribute : Attribute { 16 | public readonly string Name; 17 | 18 | public EcsUguiNamedAttribute (string name) { 19 | Name = name; 20 | } 21 | } 22 | 23 | #if ENABLE_IL2CPP 24 | [Il2CppSetOption (Option.NullChecks, false)] 25 | [Il2CppSetOption (Option.ArrayBoundsChecks, false)] 26 | #endif 27 | sealed class DelUguiEventSystem : IEcsRunSystem where T : struct { 28 | readonly EcsFilter _filter; 29 | readonly EcsPool _pool; 30 | 31 | public DelUguiEventSystem (EcsWorld world) { 32 | _filter = world.Filter ().End (); 33 | _pool = world.GetPool (); 34 | } 35 | 36 | public void Run (IEcsSystems systems) { 37 | foreach (var entity in _filter) { 38 | _pool.Del (entity); 39 | } 40 | } 41 | } 42 | 43 | public static class EcsSystemsExtensions { 44 | /// 45 | /// Injects named UI objects and Emitter to all systems added to EcsSystems. 46 | /// 47 | /// EcsSystems group. 48 | /// EcsUiEmitter instance. 49 | /// World name. 50 | /// Not throw exception if named action not registered in emitter. 51 | /// Skip DelHere() registration. 52 | public static IEcsSystems InjectUgui (this IEcsSystems ecsSystems, EcsUguiEmitter emitter, string worldName = null, bool skipNoExists = false, bool skipDelHere = false) { 53 | var world = ecsSystems.GetWorld (worldName); 54 | if (!skipDelHere) { 55 | AddDelHereSystems (ecsSystems, world); 56 | } 57 | emitter.SetWorld (world); 58 | var uiNamedType = typeof (EcsUguiNamedAttribute); 59 | var goType = typeof (GameObject); 60 | var componentType = typeof (Component); 61 | var emitterType = typeof (EcsUguiEmitter); 62 | foreach (var system in ecsSystems.GetAllSystems ()) { 63 | var systemType = system.GetType (); 64 | foreach (var f in systemType.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) { 65 | // skip statics. 66 | if (f.IsStatic) { 67 | continue; 68 | } 69 | // emitter. 70 | if (f.FieldType == emitterType) { 71 | f.SetValue (system, emitter); 72 | continue; 73 | } 74 | // skip fields without [EcsUiNamed] attribute. 75 | if (!Attribute.IsDefined (f, uiNamedType)) { 76 | continue; 77 | } 78 | var name = ((EcsUguiNamedAttribute) Attribute.GetCustomAttribute (f, uiNamedType)).Name; 79 | #if DEBUG && !LEOECSLITE_NO_SANITIZE_CHECKS 80 | if (string.IsNullOrEmpty (name)) { throw new Exception ($"Cant Inject field \"{f.Name}\" at \"{systemType}\" due to [EcsUiNamed] \"Name\" parameter is invalid."); } 81 | if (!(f.FieldType == goType || componentType.IsAssignableFrom (f.FieldType))) { 82 | throw new Exception ($"Cant Inject field \"{f.Name}\" at \"{systemType}\" due to [EcsUiNamed] attribute can be applied only to GameObject or Component type."); 83 | } 84 | if (!skipNoExists && !emitter.GetNamedObject (name)) { throw new Exception ($"Cant Inject field \"{f.Name}\" at \"{systemType}\" due to there is no UI action with name \"{name}\"."); } 85 | #endif 86 | var go = emitter.GetNamedObject (name); 87 | // GameObject. 88 | if (f.FieldType == goType) { 89 | f.SetValue (system, go); 90 | continue; 91 | } 92 | // Component. 93 | if (componentType.IsAssignableFrom (f.FieldType)) { 94 | f.SetValue (system, go != null ? go.GetComponent (f.FieldType) : null); 95 | } 96 | } 97 | } 98 | return ecsSystems; 99 | } 100 | 101 | static void AddDelHereSystems (IEcsSystems ecsSystems, EcsWorld world) { 102 | ecsSystems.Add (new DelUguiEventSystem (world)); 103 | ecsSystems.Add (new DelUguiEventSystem (world)); 104 | ecsSystems.Add (new DelUguiEventSystem (world)); 105 | ecsSystems.Add (new DelUguiEventSystem (world)); 106 | ecsSystems.Add (new DelUguiEventSystem (world)); 107 | ecsSystems.Add (new DelUguiEventSystem (world)); 108 | ecsSystems.Add (new DelUguiEventSystem (world)); 109 | ecsSystems.Add (new DelUguiEventSystem (world)); 110 | ecsSystems.Add (new DelUguiEventSystem (world)); 111 | ecsSystems.Add (new DelUguiEventSystem (world)); 112 | ecsSystems.Add (new DelUguiEventSystem (world)); 113 | ecsSystems.Add (new DelUguiEventSystem (world)); 114 | ecsSystems.Add (new DelUguiEventSystem (world)); 115 | ecsSystems.Add (new DelUguiEventSystem (world)); 116 | } 117 | } 118 | } 119 | 120 | #if ENABLE_IL2CPP 121 | // Unity IL2CPP performance optimization attribute. 122 | namespace Unity.IL2CPP.CompilerServices { 123 | enum Option { 124 | NullChecks = 1, 125 | ArrayBoundsChecks = 2 126 | } 127 | 128 | [AttributeUsage (AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] 129 | class Il2CppSetOptionAttribute : Attribute { 130 | public Option Option { get; private set; } 131 | public object Value { get; private set; } 132 | 133 | public Il2CppSetOptionAttribute (Option option, object value) { Option = option; Value = value; } 134 | } 135 | } 136 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LeoECS Lite uGui Bindings - поддержка событий uGui в ECS-мире 2 | Интеграция событий uGui в ECS-мир. 3 | 4 | > **ВАЖНО!** АКТИВНАЯ РАЗРАБОТКА ПРЕКРАЩЕНА, ВОЗМОЖНО ТОЛЬКО ИСПРАВЛЕНИЕ ОБНАРУЖЕННЫХ ОШИБОК. СОСТОЯНИЕ СТАБИЛЬНОЕ, ИЗВЕСТНЫХ ОШИБОК НЕ ОБНАРУЖЕНО. ЗА НОВЫМ ПОКОЛЕНИЕМ ФРЕЙМВОРКА СТОИТ СЛЕДИТЬ В БЛОГЕ https://leopotam.ru/ 5 | 6 | > **ВАЖНО!** ПОДДЕРЖКА БУДЕТ ПРЕКРАЩЕНА И РЕПОЗИТОРИЙ БУДЕТ ОТПРАВЛЕН В АРХИВ 22.04.2026. 7 | 8 | > Проверено на Unity 2020.3 (зависит от Unity) и содержит asmdef-описания для компиляции в виде отдельных сборок и уменьшения времени рекомпиляции основного проекта. 9 | 10 | > **ВАЖНО!** Зависит от [LeoECS Lite](https://github.com/Leopotam/ecslite) - зависимость должна быть установлена до установки этого модуля. 11 | 12 | * [Установка](#Установка) 13 | * [В виде unity модуля](#В-виде-unity-модуля) 14 | * [В виде исходников](#В-виде-исходников) 15 | * [Классы](#Классы) 16 | * [EcsUguiEmitter](#EcsUguiEmitter) 17 | * [EcsUguiCallbackSystem](#EcsUguiCallbackSystem) 18 | * [Действия](#Действия) 19 | * [Компоненты](#Компоненты) 20 | * [Лицензия](#Лицензия) 21 | 22 | # Социальные ресурсы 23 | [Блог разработчика](https://leopotam.ru/) 24 | 25 | # Установка 26 | 27 | ## В виде unity модуля 28 | Поддерживается установка в виде unity-модуля через git-ссылку в PackageManager или прямое редактирование `Packages/manifest.json`: 29 | ``` 30 | "com.leopotam.ecslite.unity.ugui": "https://github.com/Leopotam/ecslite-unity-ugui.git", 31 | ``` 32 | По умолчанию используется последняя релизная версия. Если требуется версия "в разработке" с актуальными изменениями - следует переключиться на ветку `develop`: 33 | ``` 34 | "com.leopotam.ecslite.unity.ugui": "https://github.com/Leopotam/ecslite-unity-ugui.git#develop", 35 | ``` 36 | 37 | ## В виде исходников 38 | Код так же может быть склонирован или получен в виде архива со страницы релизов. 39 | 40 | # Классы 41 | 42 | ## EcsUguiEmitter 43 | `EcsUiEmitter` является `MonoBehaviour`-классом, отвечающим за генерацию ECS-событий на основе uGui-событий (нажатие, отпускание, перетаскивание и т.п). 44 | Должен быть размещен на корневом `GameObject`-е UI-иерархии (или хотя бы на корневом `Canvas`-е) и подключен к ECS-инфраструктуре через инспектор: 45 | ```c# 46 | using Leopotam.EcsLite.Unity.Ugui; 47 | 48 | public class Startup : MonoBehaviour { 49 | // Поле должно быть проинициализировано в инспекторе средствами редактора Unity. 50 | [SerializeField] EcsUguiEmitter _uguiEmitter; 51 | 52 | IEcsSystems _systems; 53 | 54 | void Start () { 55 | _systems = new EcsSystems (new EcsWorld ()); 56 | _systems 57 | .Add (new Test1System ()) 58 | .Add (new Test2System ()) 59 | // Этот вызов должен быть размещен после всех систем, 60 | // в которых есть зависимость от uGui-событий. 61 | .InjectUgui (_uguiEmitter) 62 | .Init (); 63 | } 64 | 65 | void Update () { 66 | _systems?.Update (); 67 | } 68 | 69 | void OnDestroy () { 70 | if (_systems != null) { 71 | _systems.GetWorld ("ugui-events").Destroy (); 72 | _systems.Destroy (); 73 | _systems.GetWorld ().Destroy (); 74 | _systems = null; 75 | } 76 | } 77 | } 78 | 79 | public class Test1System : IEcsInitSystem { 80 | // Это поле будет автоматически инициализировано 81 | // ссылкой на экземпляр эмиттера на сцене. 82 | readonly EcsCustomInject _ugui = default; 83 | 84 | GameObject _btnGo; 85 | Transform _btnTransform; 86 | Button _btn; 87 | 88 | public void Init (IEcsSystems systems) { 89 | // Получение ссылки на виджет-действие с именем "MyButton". 90 | _btnGo = _ugui.GetNamedObject ("MyButton"); 91 | // Чтение Transform-компонента с него. 92 | _btnTransform = _ugui.GetNamedObject ("MyButton").GetComponent (); 93 | // Чтение Button-компонента с него. 94 | _btn = _ugui.GetNamedObject ("MyButton").GetComponent