Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
a883cffe
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,发现更多精彩内容 >>
提交
a883cffe
编写于
11月 27, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改对象池机制,如果Entity没有使用对象池,那么挂载组件也不使用对象池
上级
a064917d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
66 addition
and
45 deletion
+66
-45
Unity/Assets/Hotfix/Base/Object/Entity.cs
Unity/Assets/Hotfix/Base/Object/Entity.cs
+5
-5
Unity/Assets/Hotfix/Base/Object/ObjectPool.cs
Unity/Assets/Hotfix/Base/Object/ObjectPool.cs
+2
-1
Unity/Assets/Hotfix/Entity/Game.cs
Unity/Assets/Hotfix/Entity/Game.cs
+21
-12
Unity/Assets/Model/Base/Object/Entity.cs
Unity/Assets/Model/Base/Object/Entity.cs
+5
-5
Unity/Assets/Model/Base/Object/ObjectPool.cs
Unity/Assets/Model/Base/Object/ObjectPool.cs
+2
-1
Unity/Assets/Model/Component/SceneChangeComponent.cs
Unity/Assets/Model/Component/SceneChangeComponent.cs
+3
-4
Unity/Assets/Model/Entity/Game.cs
Unity/Assets/Model/Entity/Game.cs
+26
-14
Unity/Assets/Model/Module/Message/Session.cs
Unity/Assets/Model/Module/Message/Session.cs
+2
-3
Unity/Assets/Res/Code/Hotfix.mdb.bytes
Unity/Assets/Res/Code/Hotfix.mdb.bytes
+0
-0
未找到文件。
Unity/Assets/Hotfix/Base/Object/Entity.cs
浏览文件 @
a883cffe
...
...
@@ -69,7 +69,7 @@ namespace ETHotfix
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
type
.
Name
}
"
);
}
Component
component
=
ComponentFactory
.
CreateWithParent
(
type
,
this
);
Component
component
=
ComponentFactory
.
CreateWithParent
(
type
,
this
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -83,7 +83,7 @@ namespace ETHotfix
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
>(
this
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
>(
this
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -97,7 +97,7 @@ namespace ETHotfix
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
>(
this
,
p1
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
>(
this
,
p1
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -111,7 +111,7 @@ namespace ETHotfix
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
>(
this
,
p1
,
p2
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
>(
this
,
p1
,
p2
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -125,7 +125,7 @@ namespace ETHotfix
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
,
P3
>(
this
,
p1
,
p2
,
p3
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
,
P3
>(
this
,
p1
,
p2
,
p3
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
Unity/Assets/Hotfix/Base/Object/ObjectPool.cs
浏览文件 @
a883cffe
...
...
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace
ETHotfix
{
public
class
ObjectPool
public
class
ObjectPool
:
Component
{
private
readonly
Dictionary
<
Type
,
Queue
<
Component
>>
dictionary
=
new
Dictionary
<
Type
,
Queue
<
Component
>>();
...
...
@@ -36,6 +36,7 @@ namespace ETHotfix
public
void
Recycle
(
Component
obj
)
{
obj
.
Parent
=
this
;
Type
type
=
obj
.
GetType
();
Queue
<
Component
>
queue
;
if
(!
this
.
dictionary
.
TryGetValue
(
type
,
out
queue
))
...
...
Unity/Assets/Hotfix/Entity/Game.cs
浏览文件 @
a883cffe
namespace
ETHotfix
using
UnityEngine
;
namespace
ETHotfix
{
public
static
class
Game
{
private
static
EventSystem
eventSystem
;
public
static
EventSystem
EventSystem
{
get
{
return
eventSystem
??
(
eventSystem
=
new
EventSystem
());
}
}
private
static
Scene
scene
;
public
static
Scene
Scene
...
...
@@ -18,23 +30,19 @@
}
}
private
static
EventSystem
eventSystem
;
public
static
EventSystem
EventSystem
{
get
{
return
eventSystem
??
(
eventSystem
=
new
EventSystem
());
}
}
private
static
ObjectPool
objectPool
;
public
static
ObjectPool
ObjectPool
{
get
{
return
objectPool
??
(
objectPool
=
new
ObjectPool
());
if
(
objectPool
!=
null
)
{
return
objectPool
;
}
objectPool
=
new
ObjectPool
();
objectPool
.
GameObject
.
transform
.
SetParent
(
GameObject
.
Find
(
"/Global"
).
transform
);
return
objectPool
;
}
}
...
...
@@ -43,6 +51,7 @@
scene
.
Dispose
();
scene
=
null
;
eventSystem
=
null
;
objectPool
.
Dispose
();
objectPool
=
null
;
}
}
...
...
Unity/Assets/Model/Base/Object/Entity.cs
浏览文件 @
a883cffe
...
...
@@ -69,7 +69,7 @@ namespace ETModel
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
type
.
Name
}
"
);
}
Component
component
=
ComponentFactory
.
CreateWithParent
(
type
,
this
);
Component
component
=
ComponentFactory
.
CreateWithParent
(
type
,
this
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -83,7 +83,7 @@ namespace ETModel
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
>(
this
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
>(
this
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -97,7 +97,7 @@ namespace ETModel
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
>(
this
,
p1
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
>(
this
,
p1
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -111,7 +111,7 @@ namespace ETModel
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
>(
this
,
p1
,
p2
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
>(
this
,
p1
,
p2
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
@@ -125,7 +125,7 @@ namespace ETModel
throw
new
Exception
(
$"AddComponent, component already exist, id:
{
this
.
Id
}
, component:
{
typeof
(
K
).
Name
}
"
);
}
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
,
P3
>(
this
,
p1
,
p2
,
p3
);
K
component
=
ComponentFactory
.
CreateWithParent
<
K
,
P1
,
P2
,
P3
>(
this
,
p1
,
p2
,
p3
,
this
.
IsFromPool
);
this
.
componentDict
.
Add
(
type
,
component
);
return
component
;
...
...
Unity/Assets/Model/Base/Object/ObjectPool.cs
浏览文件 @
a883cffe
...
...
@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace
ETModel
{
public
class
ObjectPool
public
class
ObjectPool
:
Component
{
private
readonly
Dictionary
<
Type
,
Queue
<
Component
>>
dictionary
=
new
Dictionary
<
Type
,
Queue
<
Component
>>();
...
...
@@ -36,6 +36,7 @@ namespace ETModel
public
void
Recycle
(
Component
obj
)
{
obj
.
Parent
=
this
;
Type
type
=
obj
.
GetType
();
Queue
<
Component
>
queue
;
if
(!
this
.
dictionary
.
TryGetValue
(
type
,
out
queue
))
...
...
Unity/Assets/Model/Component/SceneChangeComponent.cs
浏览文件 @
a883cffe
...
...
@@ -53,14 +53,13 @@ namespace ETModel
{
return
;
}
base
.
Dispose
();
if
(
this
.
Entity
.
IsDisposed
)
{
return
;
this
.
Entity
.
RemoveComponent
<
SceneChangeComponent
>()
;
}
this
.
Entity
.
RemoveComponent
<
SceneChangeComponent
>
();
base
.
Dispose
();
}
}
}
\ No newline at end of file
Unity/Assets/Model/Entity/Game.cs
浏览文件 @
a883cffe
namespace
ETModel
using
UnityEngine
;
namespace
ETModel
{
public
static
class
Game
{
private
static
EventSystem
eventSystem
;
public
static
EventSystem
EventSystem
{
get
{
return
eventSystem
??
(
eventSystem
=
new
EventSystem
());
}
}
private
static
Scene
scene
;
public
static
Scene
Scene
...
...
@@ -13,28 +25,24 @@
return
scene
;
}
scene
=
new
Scene
();
scene
.
GameObject
.
transform
.
SetParent
(
scene
.
GameObject
.
transform
.
Find
(
"/Global"
)
);
scene
.
GameObject
.
transform
.
SetParent
(
GameObject
.
Find
(
"/Global"
).
transform
);
return
scene
;
}
}
private
static
EventSystem
eventSystem
;
public
static
EventSystem
EventSystem
{
get
{
return
eventSystem
??
(
eventSystem
=
new
EventSystem
());
}
}
private
static
ObjectPool
objectPool
;
public
static
ObjectPool
ObjectPool
{
get
{
return
objectPool
??
(
objectPool
=
new
ObjectPool
());
if
(
objectPool
!=
null
)
{
return
objectPool
;
}
objectPool
=
new
ObjectPool
();
objectPool
.
GameObject
.
transform
.
SetParent
(
GameObject
.
Find
(
"/Global"
).
transform
);
return
objectPool
;
}
}
...
...
@@ -50,10 +58,14 @@
public
static
void
Close
()
{
scene
.
Dispose
();
eventSystem
=
null
;
scene
.
Dispose
();
scene
=
null
;
objectPool
.
Dispose
();
objectPool
=
null
;
hotfix
=
null
;
}
}
...
...
Unity/Assets/Model/Module/Message/Session.cs
浏览文件 @
a883cffe
...
...
@@ -64,8 +64,8 @@ namespace ETModel
return
;
}
long
id
=
this
.
Id
;
this
.
Network
.
Remove
(
this
.
Id
)
;
base
.
Dispose
();
foreach
(
Action
<
IResponse
>
action
in
this
.
requestCallback
.
Values
.
ToArray
())
...
...
@@ -80,7 +80,6 @@ namespace ETModel
//}
this
.
channel
.
Dispose
();
this
.
Network
.
Remove
(
id
);
this
.
requestCallback
.
Clear
();
}
...
...
Unity/Assets/Res/Code/Hotfix.mdb.bytes
已删除
100644 → 0
浏览文件 @
a064917d
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录