|
1 |
| -# UnityMvvmToolkit |
| 1 | +# UnityMvvmToolkit |
| 2 | + |
| 3 | +A package that brings data-binding to your Unity project. |
| 4 | + |
| 5 | +## :open_book: Table of Contents |
| 6 | + |
| 7 | +- [About](#pencil-about) |
| 8 | + - [Restrictions](#restrictions) |
| 9 | + - [Samples](#samples) |
| 10 | +- [Folder Structure](#cactus-folder-structure) |
| 11 | +- [Installation](#gear-installation) |
| 12 | +- [How To Use](#rocket-how-to-use) |
| 13 | + - [Add new icons set](#add-new-icons-set) |
| 14 | + - [Custom control] |
| 15 | +- [External Assets](#external-assets) |
| 16 | + - [UniTask](#unitask) |
| 17 | +- [Benchmarks](#benchmarks) |
| 18 | +- [Contributing](#bookmark_tabs-contributing) |
| 19 | + - [Discussions](#discussions) |
| 20 | + - [Report a bug](#report-a-bug) |
| 21 | + - [Request a feature](#request-a-feature) |
| 22 | + - [Show your support](#show-your-support) |
| 23 | +- [License](#balance_scale-license) |
| 24 | + |
| 25 | +## :pencil: About |
| 26 | + |
| 27 | +The **UnityMvvmToolkit** is designed to accelerate the development of MVVM applications in Unity. Use the samples as a starting point for understanding how to utilize the package. |
| 28 | + |
| 29 | +<!--This repository contains initial samples for how to utilize the package. |
| 30 | +
|
| 31 | +It mostly designed for UI Toolkit but you can use it with UGUI as well.--> |
| 32 | + |
| 33 | +It is built around the following principles: |
| 34 | +- ... |
| 35 | +- ... |
| 36 | +- ... |
| 37 | + |
| 38 | +### Restrictions |
| 39 | + |
| 40 | +... |
| 41 | + |
| 42 | +### Samples |
| 43 | + |
| 44 | +<details open><summary><b>CounterView</b></summary> |
| 45 | +<br /> |
| 46 | + |
| 47 | +```xml |
| 48 | +<UXML> |
| 49 | + <BindableContentPage binding-theme-mode-path="ThemeMode" class="counter-screen"> |
| 50 | + <VisualElement class="number-container"> |
| 51 | + <BindableCountLabel binding-text-path="Count" class="count-label count-label--animation" /> |
| 52 | + </VisualElement> |
| 53 | + <BindableThemeSwitcher binding-value-path="ThemeMode, Converter={ThemeModeToBoolConverter}" /> |
| 54 | + <BindableCounterSlider increase-command="IncreaseCommand" decrease-command="DecreaseCommand" /> |
| 55 | + </BindableContentPage> |
| 56 | +</UXML> |
| 57 | +``` |
| 58 | + |
| 59 | +</details> |
| 60 | + |
| 61 | +<details><summary><b>CounterViewModel</b></summary> |
| 62 | +<br /> |
| 63 | + |
| 64 | +```csharp |
| 65 | +public class CounterViewModel : ViewModel |
| 66 | +{ |
| 67 | + private int _count; |
| 68 | + private ThemeMode _themeMode; |
| 69 | + |
| 70 | + public CounterViewModel() |
| 71 | + { |
| 72 | + IncreaseCommand = new Command(IncreaseCount); |
| 73 | + DecreaseCommand = new Command(DecreaseCount); |
| 74 | + } |
| 75 | + |
| 76 | + public int Count |
| 77 | + { |
| 78 | + get => _count; |
| 79 | + set => Set(ref _count, value); |
| 80 | + } |
| 81 | + |
| 82 | + public ThemeMode ThemeMode |
| 83 | + { |
| 84 | + get => _themeMode; |
| 85 | + set => Set(ref _themeMode, value); |
| 86 | + } |
| 87 | + |
| 88 | + public ICommand IncreaseCommand { get; } |
| 89 | + public ICommand DecreaseCommand { get; } |
| 90 | + |
| 91 | + private void IncreaseCount() |
| 92 | + { |
| 93 | + Count++; |
| 94 | + } |
| 95 | + |
| 96 | + private void DecreaseCount() |
| 97 | + { |
| 98 | + Count--; |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | + |
| 103 | +</details> |
| 104 | + |
| 105 | +<table> |
| 106 | + <tr> |
| 107 | + <td align="center">Counter</td> |
| 108 | + <td align="center">Calculator</td> |
| 109 | + <td align="center">ToDoList</td> |
| 110 | + </tr> |
| 111 | + <tr> |
| 112 | + <td align="center"> |
| 113 | + <video src="https://user-images.githubusercontent.com/28132516/187030099-a440bc89-4c28-44e3-9898-9894eac5bff4.mp4" alt="CounterSample" /> |
| 114 | + </td> |
| 115 | + <td align="center"> |
| 116 | + <video src="https://user-images.githubusercontent.com/28132516/187030102-2b02c663-31cb-4d63-a764-4be9484359f0.mp4" alt="CalculatorSample" /> |
| 117 | + </td> |
| 118 | + <td align="center"> |
| 119 | + <video src="https://user-images.githubusercontent.com/28132516/187030101-ad1f2123-59d5-4d1e-a9ca-ab983589e52f.mp4" alt="ToDoListSample" /> |
| 120 | + </td> |
| 121 | + </tr> |
| 122 | +</table> |
| 123 | + |
| 124 | +## :cactus: Folder Structure |
| 125 | + |
| 126 | + . |
| 127 | + ├── samples |
| 128 | + │ ├── Unity.Mvvm.Calc |
| 129 | + │ ├── Unity.Mvvm.Counter |
| 130 | + │ ├── Unity.Mvvm.ToDoList |
| 131 | + │ └── Unity.Mvvm.CounterLegacy |
| 132 | + │ |
| 133 | + ├── src |
| 134 | + │ ├── UnityMvvmToolkit.Core |
| 135 | + │ └── UnityMvvmToolkit.UnityPackage |
| 136 | + │ ├── Core # Auto-generated |
| 137 | + │ ├── Common |
| 138 | + │ ├── External |
| 139 | + │ ├── UGUI |
| 140 | + │ └── UI # UI Toolkit |
| 141 | + │ |
| 142 | + ├── UnityMvvmToolkit.sln |
| 143 | + |
| 144 | +## :gear: Installation |
| 145 | + |
| 146 | +Dependencies: |
| 147 | +- Unity UnityMvvmToolkit: [UniTask](https://openupm.com/packages/com.cysharp.unitask/) |
| 148 | + |
| 149 | +You can install UnityMvvmToolkit in one of the following ways: |
| 150 | + |
| 151 | +<details><summary>1. Install via Package Manager</summary> |
| 152 | +<br /> |
| 153 | + |
| 154 | + The package is available on the [OpenUPM](https://openupm.com/packages/com.chebanovdd.unitymvvmtoolkit/). |
| 155 | + |
| 156 | + - Open `Edit/Project Settings/Package Manager` |
| 157 | + - Add a new `Scoped Registry` (or edit the existing OpenUPM entry) |
| 158 | + |
| 159 | + ``` |
| 160 | + Name package.openupm.com |
| 161 | + URL https://package.openupm.com |
| 162 | + Scope(s) com.cysharp.unitask |
| 163 | + com.chebanovdd.unitymvvmtoolkit |
| 164 | + ``` |
| 165 | + - Open `Window/Package Manager` |
| 166 | + - Select `My Registries` |
| 167 | + - Install `UniTask` and `UnityMvvmToolkit` packages |
| 168 | + |
| 169 | +</details> |
| 170 | +
|
| 171 | +<details><summary>2. Install via Git URL</summary> |
| 172 | +<br /> |
| 173 | + |
| 174 | + You can add `https://github.com/ChebanovDD/UnityMvvmToolkit.git?path=src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit` to the Package Manager. |
| 175 | +
|
| 176 | + If you want to set a target version, UnityMvvmToolkit uses the `v*.*.*` release tag, so you can specify a version like `#v0.1.0`. For example `https://github.com/ChebanovDD/UnityMvvmToolkit.git?path=src/UnityMvvmToolkit.UnityPackage/Assets/Plugins/UnityMvvmToolkit#v0.1.0`. |
| 177 | +
|
| 178 | + > **Note:** Dependencies must be installed before installing the package. |
| 179 | + |
| 180 | +</details> |
| 181 | +
|
| 182 | +### [Releases Page](https://github.com/ChebanovDD/UnityMvvmToolkit/releases) |
| 183 | +
|
| 184 | +- ... |
| 185 | +- ... |
| 186 | +- ... |
| 187 | +
|
| 188 | +> **Note:** Dependencies must be installed before installing the packages. |
| 189 | +
|
| 190 | +## :rocket: How To Use |
| 191 | +
|
| 192 | +### Add new icons set |
| 193 | +
|
| 194 | +... |
| 195 | +
|
| 196 | +## :cherries: External Assets |
| 197 | +
|
| 198 | +### UniTask |
| 199 | +
|
| 200 | +#### Async commands |
| 201 | +
|
| 202 | +... |
| 203 | +<!--For IAsyncCommand support, it is required to import com.demigiant.unitask from OpenUPM or--> |
| 204 | +
|
| 205 | +#### Transition async extensions |
| 206 | +
|
| 207 | +... |
| 208 | +
|
| 209 | +## :chart_with_upwards_trend: Benchmarks |
| 210 | +
|
| 211 | +... |
| 212 | +
|
| 213 | +## :bookmark_tabs: Contributing |
| 214 | +
|
| 215 | +You may contribute in several ways like creating new features, fixing bugs or improving documentation and examples. |
| 216 | +
|
| 217 | +### Discussions |
| 218 | +
|
| 219 | +Use [discussions](https://github.com/ChebanovDD/UnityMvvmToolkit/discussions) to have conversations and post answers without opening issues. |
| 220 | +
|
| 221 | +Discussions is a place to: |
| 222 | +* Share ideas |
| 223 | +* Ask questions |
| 224 | +* Engage with other community members |
| 225 | +
|
| 226 | +### Report a bug |
| 227 | +
|
| 228 | +If you find a bug in the source code, please [create bug report](https://github.com/ChebanovDD/UnityMvvmToolkit/issues/new?assignees=ChebanovDD&labels=bug&template=bug_report.md&title=). |
| 229 | +
|
| 230 | +> Please browse [existing issues](https://github.com/ChebanovDD/UnityMvvmToolkit/issues) to see whether a bug has previously been reported. |
| 231 | +
|
| 232 | +### Request a feature |
| 233 | +
|
| 234 | +If you have an idea, or you're missing a capability that would make development easier, please [submit feature request](https://github.com/ChebanovDD/UnityMvvmToolkit/issues/new?assignees=ChebanovDD&labels=enhancement&template=feature_request.md&title=). |
| 235 | +
|
| 236 | +> If a similar feature request already exists, don't forget to leave a "+1" or add additional information, such as your thoughts and vision about the feature. |
| 237 | +
|
| 238 | +### Show your support |
| 239 | +
|
| 240 | +Give a :star: if this project helped you! |
| 241 | +
|
| 242 | +<a href="https://www.buymeacoffee.com/chebanovdd" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-orange.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a> |
| 243 | +
|
| 244 | +## :balance_scale: License |
| 245 | +
|
| 246 | +Usage is provided under the [MIT License](LICENSE). |
0 commit comments