Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
b32a9597
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b32a9597
编写于
7月 22, 2020
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
EventSystem 事件方法修改,改名成publish,参数改成统一为struct,这样的好处是,不会出现订阅的事件与发布的事件参数不一致的问题
上级
d218f30e
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
105 addition
and
357 deletion
+105
-357
Server/App/Program.cs
Server/App/Program.cs
+1
-1
Server/Hotfix/Module/Scene/AppStart_InitGame.cs
Server/Hotfix/Module/Scene/AppStart_InitGame.cs
+8
-8
Server/Model/Base/Event/EventIdType.cs
Server/Model/Base/Event/EventIdType.cs
+0
-8
Server/Model/EventType.cs
Server/Model/EventType.cs
+9
-0
Server/Model/Other/Options.cs
Server/Model/Other/Options.cs
+1
-1
Server/Model/Server.Model.csproj
Server/Model/Server.Model.csproj
+0
-3
Unity/Assets/Hotfix/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs
...Hotfix/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs
+4
-4
Unity/Assets/HotfixView/Demo/UI/UILoading/LoadingBeginEvent_CreateLoadingUI.cs
...ew/Demo/UI/UILoading/LoadingBeginEvent_CreateLoadingUI.cs
+4
-4
Unity/Assets/HotfixView/Demo/UI/UILoading/LoadingFinishEvent_RemoveLoadingUI.cs
...w/Demo/UI/UILoading/LoadingFinishEvent_RemoveLoadingUI.cs
+3
-3
Unity/Assets/HotfixView/Demo/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs
...otfixView/Demo/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs
+4
-6
Unity/Assets/HotfixView/Demo/UI/UILobby/LoginFinish_CreateLobbyUI.cs
...s/HotfixView/Demo/UI/UILobby/LoginFinish_CreateLobbyUI.cs
+3
-3
Unity/Assets/HotfixView/Demo/UI/UILogin/InitSceneStart_CreateLoginUI.cs
...otfixView/Demo/UI/UILogin/InitSceneStart_CreateLoginUI.cs
+0
-14
Unity/Assets/HotfixView/Demo/UI/UILogin/LoginFinish_RemoveLoginUI.cs
...s/HotfixView/Demo/UI/UILogin/LoginFinish_RemoveLoginUI.cs
+3
-3
Unity/Assets/HotfixView/Demo/Unit/AfterUnitCreate_CreateUnitView.cs
...ts/HotfixView/Demo/Unit/AfterUnitCreate_CreateUnitView.cs
+4
-4
Unity/Assets/Model/Base/Event/EventAttribute.cs
Unity/Assets/Model/Base/Event/EventAttribute.cs
+0
-6
Unity/Assets/Model/Base/Event/EventIdType.cs
Unity/Assets/Model/Base/Event/EventIdType.cs
+0
-30
Unity/Assets/Model/Base/Event/IEvent.cs
Unity/Assets/Model/Base/Event/IEvent.cs
+1
-104
Unity/Assets/Model/Base/Object/EventProxy.cs
Unity/Assets/Model/Base/Object/EventProxy.cs
+0
-46
Unity/Assets/Model/Base/Object/EventSystem.cs
Unity/Assets/Model/Base/Object/EventSystem.cs
+8
-98
Unity/Assets/Model/Demo/Helper/LoginHelper.cs
Unity/Assets/Model/Demo/Helper/LoginHelper.cs
+1
-1
Unity/Assets/Model/Demo/Helper/MapHelper.cs
Unity/Assets/Model/Demo/Helper/MapHelper.cs
+1
-1
Unity/Assets/Model/Demo/Helper/UnitFactory.cs
Unity/Assets/Model/Demo/Helper/UnitFactory.cs
+1
-1
Unity/Assets/Model/EventType.cs
Unity/Assets/Model/EventType.cs
+25
-0
Unity/Assets/Model/Helper/BundleHelper.cs
Unity/Assets/Model/Helper/BundleHelper.cs
+2
-2
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
+19
-1
Unity/Unity.HotfixView.csproj
Unity/Unity.HotfixView.csproj
+1
-2
Unity/Unity.Model.csproj
Unity/Unity.Model.csproj
+2
-3
未找到文件。
Server/App/Program.cs
浏览文件 @
b32a9597
...
...
@@ -36,7 +36,7 @@ namespace ET
Log
.
Info
(
$"server start........................
{
Game
.
Scene
.
Id
}
"
);
// 先加这里,后面删掉
Game
.
EventSystem
.
Run
(
EventIdType
.
AfterScenesAdd
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
AppStart
()
);
while
(
true
)
{
...
...
Server/Hotfix/Module/Scene/A
fterScenesAdd_CreateScen
e.cs
→
Server/Hotfix/Module/Scene/A
ppStart_InitGam
e.cs
浏览文件 @
b32a9597
...
...
@@ -2,10 +2,15 @@
namespace
ET
{
[
Event
(
EventIdType
.
AfterScenesAdd
)
]
public
class
A
fterScenesAdd_CreateScene
:
AEvent
[
Event
]
public
class
A
ppStart_Init
:
AEvent
<
EventType
.
AppStart
>
{
public
override
void
Run
()
public
override
void
Run
(
EventType
.
AppStart
args
)
{
RunAsync
().
Coroutine
();
}
public
async
ETVoid
RunAsync
()
{
Game
.
Scene
.
AddComponent
<
ConfigComponent
>();
...
...
@@ -30,11 +35,6 @@ namespace ET
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
processConfig
.
InnerAddress
);
RunInner
().
Coroutine
();
}
public
async
ETVoid
RunInner
()
{
var
processScenes
=
StartSceneConfigCategory
.
Instance
.
GetByProcess
(
IdGenerater
.
Process
);
foreach
(
StartSceneConfig
startConfig
in
processScenes
)
{
...
...
Server/Model/Base/Event/EventIdType.cs
已删除
100644 → 0
浏览文件 @
d218f30e
namespace
ET
{
public
static
class
EventIdType
{
public
const
string
NumbericChange
=
"NumbericChange"
;
public
const
string
AfterScenesAdd
=
"AfterScenesAdd"
;
}
}
\ No newline at end of file
Server/Model/EventType.cs
0 → 100644
浏览文件 @
b32a9597
namespace
ET
{
namespace
EventType
{
public
struct
AppStart
{
}
}
}
\ No newline at end of file
Server/Model/Other/Options.cs
浏览文件 @
b32a9597
...
...
@@ -4,7 +4,7 @@ namespace ET
{
public
class
Options
:
Entity
{
[
Option
(
"
p
rocess"
,
Required
=
false
,
Default
=
1
)]
[
Option
(
"
P
rocess"
,
Required
=
false
,
Default
=
1
)]
public
int
Process
{
get
;
set
;
}
}
}
\ No newline at end of file
Server/Model/Server.Model.csproj
浏览文件 @
b32a9597
...
...
@@ -77,9 +77,6 @@
<Compile Include="..\..\Unity\Assets\Model\Base\Object\EntityFactory.cs">
<Link>Base\Object\EntityFactory.cs</Link>
</Compile>
<Compile Include="..\..\Unity\Assets\Model\Base\Object\EventProxy.cs">
<Link>Base\Object\EventProxy.cs</Link>
</Compile>
<Compile Include="..\..\Unity\Assets\Model\Base\Object\EventSystem.cs">
<Link>Base\Object\EventSystem.cs</Link>
</Compile>
...
...
Unity/Assets/Hotfix/Module/Numeric/NumericChangeEvent_NotifyWatcher.cs
浏览文件 @
b32a9597
namespace
ET
{
// 分发数值监听
[
Event
(
EventIdType
.
NumbericChange
)
]
public
class
NumericChangeEvent_NotifyWatcher
:
AEvent
<
long
,
NumericType
,
int
>
[
Event
]
public
class
NumericChangeEvent_NotifyWatcher
:
AEvent
<
EventType
.
NumbericChange
>
{
public
override
void
Run
(
long
id
,
NumericType
numericType
,
int
value
)
public
override
void
Run
(
EventType
.
NumbericChange
args
)
{
Game
.
Scene
.
GetComponent
<
NumericWatcherComponent
>().
Run
(
numericType
,
id
,
value
);
Game
.
Scene
.
GetComponent
<
NumericWatcherComponent
>().
Run
(
args
.
NumericType
,
args
.
Parent
.
Id
,
args
.
New
);
}
}
}
Unity/Assets/HotfixView/Demo/UI/UILoading/LoadingBeginEvent_CreateLoadingUI.cs
浏览文件 @
b32a9597
...
...
@@ -2,12 +2,12 @@
namespace
ET
{
[
Event
(
EventIdType
.
LoadingBegin
)]
public
class
LoadingBeginEvent_CreateLoadingUI
:
AEvent
<
E
ntity
>
[
Event
()]
public
class
LoadingBeginEvent_CreateLoadingUI
:
AEvent
<
E
ventType
.
LoadingBegin
>
{
public
override
void
Run
(
E
ntity
domain
)
public
override
void
Run
(
E
ventType
.
LoadingBegin
args
)
{
UI
ui
=
UILoadingFactory
.
Create
(
domain
);
UI
ui
=
UILoadingFactory
.
Create
(
args
.
Scene
);
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Add
(
ui
);
}
}
...
...
Unity/Assets/HotfixView/Demo/UI/UILoading/LoadingFinishEvent_RemoveLoadingUI.cs
浏览文件 @
b32a9597
namespace
ET
{
[
Event
(
EventIdType
.
LoadingFinish
)
]
public
class
LoadingFinishEvent_RemoveLoadingUI
:
AEvent
[
Event
]
public
class
LoadingFinishEvent_RemoveLoadingUI
:
AEvent
<
EventType
.
LoadingFinish
>
{
public
override
void
Run
()
public
override
void
Run
(
EventType
.
LoadingFinish
args
)
{
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Remove
(
UIType
.
UILoading
);
}
...
...
Unity/Assets/HotfixView/Demo/UI/UILobby/EnterMapFinish_RemoveLobbyUI.cs
浏览文件 @
b32a9597
namespace
ET
namespace
ET
{
[
Event
(
EventIdType
.
EnterMapFinish
)
]
public
class
EnterMapFinish_RemoveLobbyUI
:
AEvent
[
Event
]
public
class
EnterMapFinish_RemoveLobbyUI
:
AEvent
<
EventType
.
EnterMapFinish
>
{
public
override
void
Run
()
public
override
void
Run
(
EventType
.
EnterMapFinish
args
)
{
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Remove
(
UIType
.
UILobby
);
Game
.
Scene
.
GetComponent
<
ResourcesComponent
>().
UnloadBundle
(
UIType
.
UILobby
.
StringToAB
());
...
...
Unity/Assets/HotfixView/Demo/UI/UILobby/LoginFinish_CreateLobbyUI.cs
浏览文件 @
b32a9597
...
...
@@ -2,10 +2,10 @@
namespace
ET
{
[
Event
(
EventIdType
.
LoginFinish
)
]
public
class
LoginFinish_CreateLobbyUI
:
AEvent
[
Event
]
public
class
LoginFinish_CreateLobbyUI
:
AEvent
<
EventType
.
LoginFinish
>
{
public
override
void
Run
()
public
override
void
Run
(
EventType
.
LoginFinish
args
)
{
UI
ui
=
UILobbyFactory
.
Create
();
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Add
(
ui
);
...
...
Unity/Assets/HotfixView/Demo/UI/UILogin/InitSceneStart_CreateLoginUI.cs
已删除
100644 → 0
浏览文件 @
d218f30e
namespace
ET
{
[
Event
(
EventIdType
.
InitSceneStart
)]
public
class
InitSceneStart_CreateLoginUI
:
AEvent
{
public
override
void
Run
()
{
UI
ui
=
UILoginFactory
.
Create
();
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Add
(
ui
);
}
}
}
Unity/Assets/HotfixView/Demo/UI/UILogin/LoginFinish_RemoveLoginUI.cs
浏览文件 @
b32a9597
...
...
@@ -2,10 +2,10 @@
namespace
ET
{
[
Event
(
EventIdType
.
LoginFinish
)
]
public
class
LoginFinish_RemoveLoginUI
:
AEvent
[
Event
]
public
class
LoginFinish_RemoveLoginUI
:
AEvent
<
EventType
.
LoginFinish
>
{
public
override
void
Run
()
public
override
void
Run
(
EventType
.
LoginFinish
args
)
{
Game
.
Scene
.
GetComponent
<
UIComponent
>().
Remove
(
UIType
.
UILogin
);
Game
.
Scene
.
GetComponent
<
ResourcesComponent
>().
UnloadBundle
(
UIType
.
UILogin
.
StringToAB
());
...
...
Unity/Assets/HotfixView/Demo/Unit/AfterUnitCreate_CreateUnitView.cs
浏览文件 @
b32a9597
...
...
@@ -2,10 +2,10 @@
namespace
ET
{
[
Event
(
EventIdType
.
AfterUnitCreate
)
]
public
class
AfterUnitCreate_CreateUnitView
:
AEvent
<
Unit
>
[
Event
]
public
class
AfterUnitCreate_CreateUnitView
:
AEvent
<
EventType
.
AfterUnitCreate
>
{
public
override
void
Run
(
Unit
unit
)
public
override
void
Run
(
EventType
.
AfterUnitCreate
args
)
{
// Unit View层
ResourcesComponent
resourcesComponent
=
Game
.
Scene
.
GetComponent
<
ResourcesComponent
>();
...
...
@@ -14,7 +14,7 @@ namespace ET
GameObject
go
=
UnityEngine
.
Object
.
Instantiate
(
prefab
);
u
nit
.
AddComponent
<
AnimatorComponent
>();
args
.
U
nit
.
AddComponent
<
AnimatorComponent
>();
}
}
}
\ No newline at end of file
Unity/Assets/Model/Base/Event/EventAttribute.cs
浏览文件 @
b32a9597
...
...
@@ -5,11 +5,5 @@ namespace ET
[
AttributeUsage
(
AttributeTargets
.
Class
,
AllowMultiple
=
true
)]
public
class
EventAttribute
:
BaseAttribute
{
public
string
Type
{
get
;
}
public
EventAttribute
(
string
type
)
{
this
.
Type
=
type
;
}
}
}
\ No newline at end of file
Unity/Assets/Model/Base/Event/EventIdType.cs
已删除
100644 → 0
浏览文件 @
d218f30e
namespace
ET
{
public
static
class
EventIdType
{
public
const
string
RecvHotfixMessage
=
"RecvHotfixMessage"
;
public
const
string
BehaviorTreeRunTreeEvent
=
"BehaviorTreeRunTreeEvent"
;
public
const
string
BehaviorTreeOpenEditor
=
"BehaviorTreeOpenEditor"
;
public
const
string
BehaviorTreeClickNode
=
"BehaviorTreeClickNode"
;
public
const
string
BehaviorTreeAfterChangeNodeType
=
"BehaviorTreeAfterChangeNodeType"
;
public
const
string
BehaviorTreeCreateNode
=
"BehaviorTreeCreateNode"
;
public
const
string
BehaviorTreePropertyDesignerNewCreateClick
=
"BehaviorTreePropertyDesignerNewCreateClick"
;
public
const
string
BehaviorTreeMouseInNode
=
"BehaviorTreeMouseInNode"
;
public
const
string
BehaviorTreeConnectState
=
"BehaviorTreeConnectState"
;
public
const
string
BehaviorTreeReplaceClick
=
"BehaviorTreeReplaceClick"
;
public
const
string
BehaviorTreeRightDesignerDrag
=
"BehaviorTreeRightDesignerDrag"
;
public
const
string
SessionRecvMessage
=
"SessionRecvMessage"
;
public
const
string
NumbericChange
=
"NumbericChange"
;
public
const
string
MessageDeserializeFinish
=
"MessageDeserializeFinish"
;
public
const
string
SceneChange
=
"SceneChange"
;
public
const
string
FrameUpdate
=
"FrameUpdate"
;
public
const
string
LoadingBegin
=
"LoadingBegin"
;
public
const
string
LoadingFinish
=
"LoadingFinish"
;
public
const
string
TestHotfixSubscribMonoEvent
=
"TestHotfixSubscribMonoEvent"
;
public
const
string
MaxModelEvent
=
"MaxModelEvent"
;
public
const
string
InitSceneStart
=
"InitSceneStart"
;
public
const
string
LoginFinish
=
"LoginFinish"
;
public
const
string
EnterMapFinish
=
"EnterMapFinish"
;
public
const
string
AfterUnitCreate
=
"AfterUnitCreate"
;
}
}
\ No newline at end of file
Unity/Assets/Model/Base/Event/IEvent.cs
浏览文件 @
b32a9597
...
...
@@ -2,111 +2,8 @@
namespace
ET
{
public
interface
IEven
t
public
abstract
class
AEvent
<
A
>
where
A
:
struc
t
{
void
Handle
();
void
Handle
(
object
a
);
void
Handle
(
object
a
,
object
b
);
void
Handle
(
object
a
,
object
b
,
object
c
);
}
public
abstract
class
AEvent
:
IEvent
{
public
void
Handle
()
{
this
.
Run
();
}
public
void
Handle
(
object
a
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
,
object
c
)
{
throw
new
NotImplementedException
();
}
public
abstract
void
Run
();
}
public
abstract
class
AEvent
<
A
>:
IEvent
{
public
void
Handle
()
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
)
{
this
.
Run
((
A
)
a
);
}
public
void
Handle
(
object
a
,
object
b
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
,
object
c
)
{
throw
new
NotImplementedException
();
}
public
abstract
void
Run
(
A
a
);
}
public
abstract
class
AEvent
<
A
,
B
>:
IEvent
{
public
void
Handle
()
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
)
{
this
.
Run
((
A
)
a
,
(
B
)
b
);
}
public
void
Handle
(
object
a
,
object
b
,
object
c
)
{
throw
new
NotImplementedException
();
}
public
abstract
void
Run
(
A
a
,
B
b
);
}
public
abstract
class
AEvent
<
A
,
B
,
C
>:
IEvent
{
public
void
Handle
()
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
)
{
throw
new
NotImplementedException
();
}
public
void
Handle
(
object
a
,
object
b
,
object
c
)
{
this
.
Run
((
A
)
a
,
(
B
)
b
,
(
C
)
c
);
}
public
abstract
void
Run
(
A
a
,
B
b
,
C
c
);
}
}
\ No newline at end of file
Unity/Assets/Model/Base/Object/EventProxy.cs
已删除
100644 → 0
浏览文件 @
d218f30e
using
System
;
using
System.Collections.Generic
;
namespace
ET
{
public
class
EventProxy
:
IEvent
{
public
Action
<
List
<
object
>>
action
;
public
List
<
object
>
param
=
new
List
<
object
>();
public
EventProxy
(
Action
<
List
<
object
>>
action
)
{
this
.
action
=
action
;
}
public
void
Handle
()
{
this
.
param
.
Clear
();
this
.
action
.
Invoke
(
this
.
param
);
}
public
void
Handle
(
object
a
)
{
this
.
param
.
Clear
();
this
.
param
.
Add
(
a
);
this
.
action
.
Invoke
(
this
.
param
);
}
public
void
Handle
(
object
a
,
object
b
)
{
this
.
param
.
Clear
();
this
.
param
.
Add
(
a
);
this
.
param
.
Add
(
b
);
this
.
action
.
Invoke
(
this
.
param
);
}
public
void
Handle
(
object
a
,
object
b
,
object
c
)
{
this
.
param
.
Clear
();
this
.
param
.
Add
(
a
);
this
.
param
.
Add
(
b
);
this
.
param
.
Add
(
c
);
this
.
action
.
Invoke
(
this
.
param
);
}
}
}
Unity/Assets/Model/Base/Object/EventSystem.cs
浏览文件 @
b32a9597
...
...
@@ -36,7 +36,7 @@ namespace ET
private
readonly
UnOrderMultiMapSet
<
Type
,
Type
>
types
=
new
UnOrderMultiMapSet
<
Type
,
Type
>();
private
readonly
Dictionary
<
string
,
List
<
object
>>
allEvents
=
new
Dictionary
<
string
,
List
<
object
>>();
private
readonly
Dictionary
<
Type
,
List
<
object
>>
allEvents
=
new
Dictionary
<
Type
,
List
<
object
>>();
private
readonly
UnOrderMultiMap
<
Type
,
IAwakeSystem
>
awakeSystems
=
new
UnOrderMultiMap
<
Type
,
IAwakeSystem
>();
...
...
@@ -140,19 +140,12 @@ namespace ET
this
.
allEvents
.
Clear
();
foreach
(
Type
type
in
types
[
typeof
(
EventAttribute
)])
{
object
[]
attrs
=
type
.
GetCustomAttributes
(
typeof
(
EventAttribute
),
false
);
foreach
(
object
attr
in
attrs
)
object
obj
=
Activator
.
CreateInstance
(
type
);
if
(!
this
.
allEvents
.
ContainsKey
(
type
))
{
EventAttribute
aEventAttribute
=
(
EventAttribute
)
attr
;
object
obj
=
Activator
.
CreateInstance
(
type
);
IEvent
iEvent
=
obj
as
IEvent
;
if
(
iEvent
==
null
)
{
Log
.
Error
(
$"
{
obj
.
GetType
().
Name
}
没有继承IEvent"
);
}
this
.
RegisterEvent
(
aEventAttribute
.
Type
,
iEvent
);
this
.
allEvents
.
Add
(
type
,
new
List
<
object
>());
}
this
.
allEvents
[
type
].
Add
(
obj
);
}
this
.
Load
();
...
...
@@ -162,15 +155,6 @@ namespace ET
{
return
this
.
assemblies
[
name
];
}
public
void
RegisterEvent
(
string
eventId
,
IEvent
e
)
{
if
(!
this
.
allEvents
.
ContainsKey
(
eventId
))
{
this
.
allEvents
.
Add
(
eventId
,
new
List
<
object
>());
}
this
.
allEvents
[
eventId
].
Add
(
e
);
}
public
HashSet
<
Type
>
GetTypes
(
Type
systemAttributeType
)
{
...
...
@@ -628,35 +612,10 @@ namespace ET
ObjectHelper
.
Swap
(
ref
this
.
lateUpdates
,
ref
this
.
lateUpdates2
);
}
public
void
Run
(
string
type
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
if
(!(
obj
is
AEvent
aEvent
))
{
Log
.
Error
(
$"event error:
{
obj
.
GetType
().
Name
}
"
);
continue
;
}
aEvent
.
Run
();
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
);
}
}
}
public
void
Run
<
A
>(
string
type
,
A
a
)
public
void
Publish
<
T
>(
T
a
)
where
T
:
struct
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
if
(!
this
.
allEvents
.
TryGetValue
(
type
of
(
T
)
,
out
iEvents
))
{
return
;
}
...
...
@@ -664,7 +623,7 @@ namespace ET
{
try
{
if
(!(
obj
is
AEvent
<
A
>
aEvent
))
if
(!(
obj
is
AEvent
<
T
>
aEvent
))
{
Log
.
Error
(
$"event error:
{
obj
.
GetType
().
Name
}
"
);
continue
;
...
...
@@ -678,55 +637,6 @@ namespace ET
}
}
public
void
Run
<
A
,
B
>(
string
type
,
A
a
,
B
b
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
if
(!(
obj
is
AEvent
<
A
,
B
>
aEvent
))
{
Log
.
Error
(
$"event error:
{
obj
.
GetType
().
Name
}
"
);
continue
;
}
aEvent
.
Run
(
a
,
b
);
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
);
}
}
}
public
void
Run
<
A
,
B
,
C
>(
string
type
,
A
a
,
B
b
,
C
c
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
if
(!(
obj
is
AEvent
<
A
,
B
,
C
>
aEvent
))
{
Log
.
Error
(
$"event error:
{
obj
.
GetType
().
Name
}
"
);
continue
;
}
aEvent
.
Run
(
a
,
b
,
c
);
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
);
}
}
}
public
override
string
ToString
()
{
...
...
Unity/Assets/Model/Demo/Helper/LoginHelper.cs
浏览文件 @
b32a9597
...
...
@@ -34,7 +34,7 @@ namespace ET
PlayerComponent
playerComponent
=
Game
.
Scene
.
GetComponent
<
PlayerComponent
>();
playerComponent
.
MyPlayer
=
player
;
Game
.
EventSystem
.
Run
(
EventIdType
.
LoginFinish
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
LoginFinish
()
);
// 测试消息有成员是class类型
G2C_PlayerInfo
g2CPlayerInfo
=
(
G2C_PlayerInfo
)
await
SessionComponent
.
Instance
.
Session
.
Call
(
new
C2G_PlayerInfo
());
...
...
Unity/Assets/Model/Demo/Helper/MapHelper.cs
浏览文件 @
b32a9597
...
...
@@ -26,7 +26,7 @@ namespace ET
Game
.
Scene
.
AddComponent
<
OperaComponent
>();
Game
.
EventSystem
.
Run
(
EventIdType
.
EnterMapFinish
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
EnterMapFinish
()
);
}
catch
(
Exception
e
)
{
...
...
Unity/Assets/Model/Demo/Helper/UnitFactory.cs
浏览文件 @
b32a9597
...
...
@@ -12,7 +12,7 @@ namespace ET
unit
.
AddComponent
<
TurnComponent
>();
unit
.
AddComponent
<
UnitPathComponent
>();
Game
.
EventSystem
.
Run
(
EventIdType
.
AfterUnitCreate
,
unit
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
AfterUnitCreate
()
{
Unit
=
unit
}
);
UnitComponent
unitComponent
=
Game
.
Scene
.
GetComponent
<
UnitComponent
>();
unitComponent
.
Add
(
unit
);
...
...
Unity/Assets/Model/EventType.cs
0 → 100644
浏览文件 @
b32a9597
namespace
ET
{
namespace
EventType
{
public
struct
LoginFinish
{}
public
struct
LoadingBegin
{
public
Scene
Scene
;
}
public
struct
LoadingFinish
{
}
public
struct
EnterMapFinish
{}
public
struct
AfterUnitCreate
{
public
Unit
Unit
;
}
}
}
\ No newline at end of file
Unity/Assets/Model/Helper/BundleHelper.cs
浏览文件 @
b32a9597
...
...
@@ -17,12 +17,12 @@ namespace ET
{
await
bundleDownloaderComponent
.
StartAsync
(
url
);
Game
.
EventSystem
.
Run
(
EventIdType
.
LoadingBegin
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
LoadingBegin
()
{
Scene
=
Game
.
Scene
}
);
await
bundleDownloaderComponent
.
DownloadAsync
(
url
);
}
Game
.
EventSystem
.
Run
(
EventIdType
.
LoadingFinish
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
LoadingFinish
()
);
Game
.
Scene
.
GetComponent
<
ResourcesComponent
>().
LoadOneBundle
(
"StreamingAssets"
);
ResourcesComponent
.
AssetBundleManifestObject
=
(
AssetBundleManifest
)
Game
.
Scene
.
GetComponent
<
ResourcesComponent
>().
GetAsset
(
"StreamingAssets"
,
"AssetBundleManifest"
);
...
...
Unity/Assets/Model/Module/Numeric/NumericComponent.cs
浏览文件 @
b32a9597
...
...
@@ -2,6 +2,17 @@
namespace
ET
{
namespace
EventType
{
public
struct
NumbericChange
{
public
Entity
Parent
;
public
NumericType
NumericType
;
public
int
Old
;
public
int
New
;
}
}
[
ObjectSystem
]
public
class
NumericComponentAwakeSystem
:
AwakeSystem
<
NumericComponent
>
{
...
...
@@ -92,9 +103,16 @@ namespace ET
// 一个数值可能会多种情况影响,比如速度,加个buff可能增加速度绝对值100,也有些buff增加10%速度,所以一个值可以由5个值进行控制其最终结果
// final = (((base + add) * (100 + pct) / 100) + finalAdd) * (100 + finalPct) / 100;
int
old
=
this
.
NumericDic
[
final
];
int
result
=
(
int
)(((
this
.
GetByKey
(
bas
)
+
this
.
GetByKey
(
add
))
*
(
100
+
this
.
GetAsFloat
(
pct
))
/
100f
+
this
.
GetByKey
(
finalAdd
))
*
(
100
+
this
.
GetAsFloat
(
finalPct
))
/
100f
*
10000
);
this
.
NumericDic
[
final
]
=
result
;
Game
.
EventSystem
.
Run
(
EventIdType
.
NumbericChange
,
this
.
Parent
.
Id
,
(
NumericType
)
final
,
result
);
Game
.
EventSystem
.
Publish
(
new
EventType
.
NumbericChange
()
{
Parent
=
this
.
Parent
,
NumericType
=
(
NumericType
)
final
,
Old
=
old
,
New
=
result
});
}
}
}
\ No newline at end of file
Unity/Unity.HotfixView.csproj
浏览文件 @
b32a9597
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<LangVersion>
latest
</LangVersion>
...
...
@@ -67,7 +67,6 @@
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILobby\LoginFinish_CreateLobbyUI.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILobby\UILobbyComponentSystem.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILobby\UILobbyFactory.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILogin\InitSceneStart_CreateLoginUI.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILogin\LoginFinish_RemoveLoginUI.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILogin\UILoginComponentSystem.cs"
/>
<Compile
Include=
"Assets\HotfixView\Demo\UI\UILogin\UILoginFactory.cs"
/>
...
...
Unity/Unity.Model.csproj
浏览文件 @
b32a9597
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<PropertyGroup>
<LangVersion>
latest
</LangVersion>
...
...
@@ -73,7 +73,6 @@
<Compile
Include=
"Assets\Model\Base\Event\Env.cs"
/>
<Compile
Include=
"Assets\Model\Base\Event\EnvKey.cs"
/>
<Compile
Include=
"Assets\Model\Base\Event\EventAttribute.cs"
/>
<Compile
Include=
"Assets\Model\Base\Event\EventIdType.cs"
/>
<Compile
Include=
"Assets\Model\Base\Event\IEvent.cs"
/>
<Compile
Include=
"Assets\Model\Base\Helper\ByteHelper.cs"
/>
<Compile
Include=
"Assets\Model\Base\Helper\Dumper.cs"
/>
...
...
@@ -101,7 +100,6 @@
<Compile
Include=
"Assets\Model\Base\Object\EntityCreateComponet.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\EntityEventAttribute.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\EntityFactory.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\EventProxy.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\EventSystem.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\HideInHierarchy.cs"
/>
<Compile
Include=
"Assets\Model\Base\Object\IAwakeSystem.cs"
/>
...
...
@@ -158,6 +156,7 @@
<Compile
Include=
"Assets\Model\Entity\SceneChangeComponent.cs"
/>
<Compile
Include=
"Assets\Model\Entity\SceneType.cs"
/>
<Compile
Include=
"Assets\Model\Entity\TimerComponent.cs"
/>
<Compile
Include=
"Assets\Model\EventType.cs"
/>
<Compile
Include=
"Assets\Model\Helper\BundleHelper.cs"
/>
<Compile
Include=
"Assets\Model\Helper\PathHelper.cs"
/>
<Compile
Include=
"Assets\Model\Helper\PositionHelper.cs"
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录