Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
7d488665
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,发现更多精彩内容 >>
提交
7d488665
编写于
4月 18, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.MessageDispatherComponent 注册handler时只注册本服的handler,重构时搞没了,这里加上
2.修复proto2cs在mac的路径错误 3.log warning不要打栈
上级
22c26425
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
136 addition
and
24 deletion
+136
-24
Server/App/NLog.config
Server/App/NLog.config
+19
-19
Server/Model/Module/Message/MessageDispatherComponent.cs
Server/Model/Module/Message/MessageDispatherComponent.cs
+113
-0
Server/Model/Server.Model.csproj
Server/Model/Server.Model.csproj
+0
-1
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
+4
-4
未找到文件。
Server/App/NLog.config
浏览文件 @
7d488665
...
...
@@ -12,8 +12,8 @@
<
targets
>
<
target
name
=
"trace"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Trace/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}"
/>
...
...
@@ -23,8 +23,8 @@
<
targets
>
<
target
name
=
"debug"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Debug/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}"
/>
...
...
@@ -34,8 +34,8 @@
<
targets
>
<
target
name
=
"info"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Info/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}"
/>
...
...
@@ -45,8 +45,8 @@
<
targets
>
<
target
name
=
"error"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Error/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}"
/>
...
...
@@ -56,19 +56,19 @@
<
targets
>
<
target
name
=
"warn"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Warning/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message}
${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}
"
/>
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message}"
/>
<
target
name
=
"warnConsole"
type
=
"ColoredConsole"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message}
${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}
"
/>
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message}"
/>
</
targets
>
<
targets
>
<
target
name
=
"fatal"
xsi
:
type
=
"File"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
openFileCacheTimeout
=
"3600"
ConcurrentWrites
=
"false"
fileName
=
"${basedir}/../Logs/Log-${var:appType}-${var:appId}/Fatal/${shortdate}.log"
deleteOldFileOnStartup
=
"false"
layout
=
"${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}"
/>
...
...
@@ -79,16 +79,16 @@
<
rules
>
<
logger
name
=
"*"
minlevel
=
"Trace"
writeTo
=
"all"
/>
<
logger
name
=
"*"
minlevel
=
"Trace"
maxlevel
=
"Trace"
writeTo
=
"trace"
/>
<
logger
name
=
"*"
minlevel
=
"Trace"
maxlevel
=
"Trace"
writeTo
=
"traceConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Trace"
maxlevel
=
"Trace"
writeTo
=
"traceConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Debug"
maxlevel
=
"Debug"
writeTo
=
"debug"
/>
<
logger
name
=
"*"
minlevel
=
"Debug"
maxlevel
=
"Debug"
writeTo
=
"debugConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Debug"
maxlevel
=
"Debug"
writeTo
=
"debugConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Info"
maxlevel
=
"Info"
writeTo
=
"info"
/>
<
logger
name
=
"*"
minlevel
=
"Info"
maxlevel
=
"Info"
writeTo
=
"infoConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Warn"
maxlevel
=
"Warn"
writeTo
=
"warn"
/>
<
logger
name
=
"*"
minlevel
=
"Info"
maxlevel
=
"Info"
writeTo
=
"infoConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Warn"
maxlevel
=
"Warn"
writeTo
=
"warn"
/>
<
logger
name
=
"*"
minlevel
=
"Warn"
maxlevel
=
"Warn"
writeTo
=
"warnConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Error"
maxlevel
=
"Error"
writeTo
=
"error"
/>
<
logger
name
=
"*"
minlevel
=
"Error"
maxlevel
=
"Error"
writeTo
=
"errorConsole"
/>
<
logger
name
=
"*"
minlevel
=
"Fatal"
maxlevel
=
"Fatal"
writeTo
=
"fatal"
/>
<
logger
name
=
"*"
minlevel
=
"Fatal"
maxlevel
=
"Fatal"
writeTo
=
"fatal"
/>
<
logger
name
=
"*"
minlevel
=
"Fatal"
maxlevel
=
"Fatal"
writeTo
=
"fatalConsole"
/>
</
rules
>
</
nlog
>
\ No newline at end of file
Server/Model/Module/Message/MessageDispatherComponent.cs
0 → 100644
浏览文件 @
7d488665
using
System
;
using
System.Collections.Generic
;
namespace
ETModel
{
[
ObjectSystem
]
public
class
MessageDispatherComponentAwakeSystem
:
AwakeSystem
<
MessageDispatherComponent
>
{
public
override
void
Awake
(
MessageDispatherComponent
self
)
{
self
.
AppType
=
Game
.
Scene
.
GetComponent
<
StartConfigComponent
>().
StartConfig
.
AppType
;
self
.
Load
();
}
}
[
ObjectSystem
]
public
class
MessageDispatherComponentLoadSystem
:
LoadSystem
<
MessageDispatherComponent
>
{
public
override
void
Load
(
MessageDispatherComponent
self
)
{
self
.
Load
();
}
}
/// <summary>
/// 消息分发组件
/// </summary>
public
class
MessageDispatherComponent
:
Component
{
public
AppType
AppType
;
private
readonly
Dictionary
<
ushort
,
List
<
IMHandler
>>
handlers
=
new
Dictionary
<
ushort
,
List
<
IMHandler
>>();
public
void
Load
()
{
this
.
handlers
.
Clear
();
Type
[]
types
=
DllHelper
.
GetMonoTypes
();
foreach
(
Type
type
in
types
)
{
object
[]
attrs
=
type
.
GetCustomAttributes
(
typeof
(
MessageHandlerAttribute
),
false
);
if
(
attrs
.
Length
==
0
)
{
continue
;
}
MessageHandlerAttribute
messageHandlerAttribute
=
attrs
[
0
]
as
MessageHandlerAttribute
;
if
(!
messageHandlerAttribute
.
Type
.
Is
(
this
.
AppType
))
{
continue
;
}
IMHandler
iMHandler
=
Activator
.
CreateInstance
(
type
)
as
IMHandler
;
if
(
iMHandler
==
null
)
{
Log
.
Error
(
$"message handle
{
type
.
Name
}
需要继承 IMHandler"
);
continue
;
}
Type
messageType
=
iMHandler
.
GetMessageType
();
ushort
opcode
=
this
.
Entity
.
GetComponent
<
OpcodeTypeComponent
>().
GetOpcode
(
messageType
);
if
(
opcode
==
0
)
{
Log
.
Error
(
$"消息opcode为0:
{
messageType
.
Name
}
"
);
continue
;
}
this
.
RegisterHandler
(
opcode
,
iMHandler
);
}
}
public
void
RegisterHandler
(
ushort
opcode
,
IMHandler
handler
)
{
if
(!
this
.
handlers
.
ContainsKey
(
opcode
))
{
this
.
handlers
.
Add
(
opcode
,
new
List
<
IMHandler
>());
}
this
.
handlers
[
opcode
].
Add
(
handler
);
}
public
void
Handle
(
Session
session
,
MessageInfo
messageInfo
)
{
List
<
IMHandler
>
actions
;
if
(!
this
.
handlers
.
TryGetValue
(
messageInfo
.
Opcode
,
out
actions
))
{
Log
.
Error
(
$"消息没有处理:
{
messageInfo
.
Opcode
}
{
JsonHelper
.
ToJson
(
messageInfo
.
Message
)}
"
);
return
;
}
foreach
(
IMHandler
ev
in
actions
)
{
try
{
ev
.
Handle
(
session
,
messageInfo
.
Message
);
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
);
}
}
}
public
override
void
Dispose
()
{
if
(
this
.
IsDisposed
)
{
return
;
}
base
.
Dispose
();
}
}
}
\ No newline at end of file
Server/Model/Server.Model.csproj
浏览文件 @
7d488665
...
...
@@ -77,7 +77,6 @@
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\IMessagePacker.cs" Link="Module\Message\IMessagePacker.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\IMHandler.cs" Link="Module\Message\IMHandler.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\MessageAttribute.cs" Link="Module\Message\MessageAttribute.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\MessageDispatherComponent.cs" Link="Module\Message\MessageDispatherComponent.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\MessageHandlerAttribute.cs" Link="Module\Message\MessageHandlerAttribute.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\MessageInfo.cs" Link="Module\Message\MessageInfo.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Module\Message\NetworkComponent.cs" Link="Module\Message\NetworkComponent.cs" />
...
...
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
浏览文件 @
7d488665
...
...
@@ -23,10 +23,10 @@ namespace ETEditor
public
class
Proto2CSEditor
:
EditorWindow
{
private
const
string
protoPath
=
@"..\Proto\
"
;
private
const
string
serverMessagePath
=
@"..\Server\Model\Module\Message\
"
;
private
const
string
clientMessagePath
=
@"Assets\Scripts\Module\Message\
"
;
private
const
string
hotfixMessagePath
=
@"Hotfix\Module\Message\
"
;
private
const
string
protoPath
=
"../Proto/
"
;
private
const
string
serverMessagePath
=
"../Server/Model/Module/Message/
"
;
private
const
string
clientMessagePath
=
"Assets/Scripts/Module/Message/
"
;
private
const
string
hotfixMessagePath
=
"Hotfix/Module/Message/
"
;
private
static
readonly
char
[]
splitChars
=
{
' '
,
'\t'
};
private
static
readonly
List
<
OpcodeInfo
>
msgOpcode
=
new
List
<
OpcodeInfo
>();
private
static
MultiMap
<
string
,
string
>
parentMsg
=
new
MultiMap
<
string
,
string
>();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录