01
02
03
04
05
06
07
08
09
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
|
class
EquipDevelopPanelScript : IPanelScript
{
...
public
void
SetType(DevelopType Type)
{
...
if
(Type == DevelopType.Split)
{
TODO
}
else
if
(Type == xxx)
{
TODO
}
else
if
(Type == xxxx)
{
TODO
}
...
}
...
}
|
1
2
3
4
5
6
|
public
interface
IDevelopType
{
void
SetInfoByType();
}
|
1
2
|
IDevelopType typeInfo = XXXX.GetInfoByType(Type);
teypInfo.SetInfoByType();
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
|
//参数只要实现IDisposable接口即可,不是具体的类型
public
IDisposable AddBinding(IDisposable binding)
{
if
(!Bindings.ContainsKey(-1))
{
Bindings[-1] =
new
List
}
Bindings[-1].Add(binding);
return
binding;
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
|
Fox(游戏最高层管理器或者称为总入口)
/ \
/ \
/ \
LogicMgr(逻辑管理) HttpMgr(网络管理)
/ | \ / \
/ | \ / \
/ | \ / \
UISysManager XXXXMgr XXXXMgr YYYMgr YYYYMgr
|
|
UIClass ui = Fox.LogicMgr.UISysManager.GetUI(id);
|
1
2
3
4
5
6
|
public
interface
IObservable<
out
T>
{
IDisposable Subscribe(IObserver
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
|
public
interface
IObserver<
in
T>
{
void
OnCompleted();
void
OnError(Exception error);
void
OnNext(T value);
}
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
|
public
IDisposable Subscribe(IObserver
{
PropertyChangedEventHandler propertyChanged = (sender, args) =>
{
var property = sender
as
IObservableProperty;
//if (property != null)
observer.OnNext(property);
};
PropertyChanged += propertyChanged;
return
Disposable.Create(() => PropertyChanged -= propertyChanged);
}
|
01
02
03
04
05
06
07
08
09
10
11
12
|
this
.BindButtonToHandler(LevelSelectButton, () =>
{
Publish(
new
RequestMainMenuScreenCommand()
{
ScreenType =
typeof
(LevelSelectScreenViewModel)
});
});
|
1
2
3
4
|
var evt=
new
RequestMainMenuScreenCommand();
evt.ScreenType =
typeof
(LevelSelectScreenViewModel);
Publish(evt);
|
|
this
.OnEvent
this
.RequestMainMenuScreenCommandHandler);
|