-
Notifications
You must be signed in to change notification settings - Fork 0
/
StateFactoryAddName.cs
60 lines (51 loc) · 1.37 KB
/
StateFactoryAddName.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using app.extension;
using app.state;
using ModestTree;
namespace app.zenject
{
public enum States
{
State1,
State2,
State3
}
public class StateFactoryAddName : StateFactoryBase
{
private EnumConverter enumConverter;
private State1.Factory state1;
private State2.Factory state2;
private State3.Factory state3;
public StateFactoryAddName(
EnumConverter enumConverter,
State1.Factory state1,
State2.Factory state2,
State3.Factory state3
)
{
this.enumConverter = enumConverter;
this.state1 = state1;
this.state2 = state2;
this.state3 = state3;
}
public override State CreateState(string _state)
{
var state = enumConverter.GetEnumStringEnumType<States>(_state);
switch (state)
{
case States.State1:
{
return state1.Create();
}
case States.State2:
{
return state2.Create();
}
case States.State3:
{
return state3.Create();
}
}
throw Assert.CreateException();
}
}
}