Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd0a2275

Browse files
authored
Merge pull request#97 from bazyleu/feature/reflex-documentation
Add Reflex Documentation
2 parents475b4d5 +effec68 commitd0a2275

File tree

1 file changed

+76
-2
lines changed

1 file changed

+76
-2
lines changed

‎README.md‎

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pattern or be used to address specific tasks.
2828

2929
##Table of Contents
3030

31-
##Table of Contents
32-
3331
<!-- TOC start (generated with https://github.com/derlin/bitdowntoc)-->
3432

3533
-[Getting Started](#getting-started)
@@ -80,6 +78,10 @@ pattern or be used to address specific tasks.
8078
+[Zenject Preparation](#zenject-preparation)
8179
+[Zenject Usage](#zenject-usage)
8280
+[Zenject Registering](#zenject-registering)
81+
*[Reflex](#reflex)
82+
+[Reflex Preparation](#reflex-preparation)
83+
+[Reflex Usage](#reflex-usage)
84+
+[Reflex Registering](#reflex-registering)
8385
-[License](#license)
8486

8587
<!-- TOC end-->
@@ -1131,6 +1133,78 @@ private void BindStates(DiContainer container)
11311133
}
11321134
```
11331135

1136+
###Reflex
1137+
1138+
>**Note:** The Reflex integration is experimental, not fully tested, and subject to change.
1139+
1140+
GitHub:[Reflex](https://github.com/gustavopsantos/Reflex)
1141+
1142+
####Reflex Preparation
1143+
1144+
If Reflex is installed via UPM, you can skip this step and proceed directly to the[Reflex Usage](#reflex-usage)
1145+
section.
1146+
1147+
If Reflex is not installed via UPM, manually add the`UNISTATE_REFLEX_SUPPORT` define symbol to your Scripting Define
1148+
Symbols (Player Settings -> Player -> Scripting Define Symbols).
1149+
1150+
####Reflex Usage
1151+
1152+
No additional setup is required after registering. Simply resolve the state machine from the Reflex DI container and
1153+
invoke its`Execute` method.
1154+
1155+
Here's an example:
1156+
1157+
```csharp
1158+
usingSystem.Threading;
1159+
usingCysharp.Threading.Tasks;
1160+
usingExamples.States;
1161+
usingUniState;
1162+
1163+
namespaceExamples.Infrastructure.Reflex
1164+
{
1165+
publicclassDiceEntryPoint
1166+
{
1167+
privatereadonlyIStateMachine_stateMachine;
1168+
1169+
publicDiceEntryPoint(IStateMachinestateMachine)=>_stateMachine=stateMachine;
1170+
1171+
publicvoidStart()
1172+
{
1173+
_stateMachine.Execute<StartGameState>(CancellationToken.None).Forget();
1174+
}
1175+
}
1176+
}
1177+
```
1178+
1179+
####Reflex Registering
1180+
1181+
All state machines, states, and their dependencies should be registered in the DI container using Reflex's
1182+
`ContainerBuilder`. Special extension methods have been provided for convenient registration.
1183+
1184+
Here's example code demonstrating the available extension methods:
1185+
1186+
```csharp
1187+
usingReflex.Core;
1188+
usingUniState;
1189+
1190+
privatevoidRegisterStates(ContainerBuilderbuilder)
1191+
{
1192+
// Recommended usage for general cases
1193+
1194+
builder.AddStateMachine<IStateMachine,BarStateMachine>();
1195+
builder.AddState<BarState>();
1196+
builder.AddState<IBarState,BarState>();
1197+
builder.AddState(typeof(BarState));
1198+
1199+
// Singleton version (use cautiously, not recommended in most cases)
1200+
1201+
builder.AddSingletonStateMachine<IStateMachine,BarStateMachine>();
1202+
builder.AddSingletonState<BarState>();
1203+
builder.AddSingletonState<IBarState,BarState>();
1204+
builder.AddSingletonState(typeof(BarState));
1205+
}
1206+
```
1207+
11341208
##License
11351209

11361210
This library is under the MIT License. Full text is[here](LICENSE).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp