Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
2026d35b
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,发现更多精彩内容 >>
提交
2026d35b
编写于
3月 07, 2019
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.目前一秒可以生成65535个Id,InstanceId也占用了这个空间,其实InstanceId跟Id是不会冲突的,所以没必要占用Id的空间,直接自增就行了,不需要带上时间戳
2.InstanceId的Set方法改成private,不应该由使用者来设置
上级
f5d9b283
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
40 addition
and
15 deletion
+40
-15
Server/Hotfix/Module/ActorLocation/ActorLocationSenderSystem.cs
.../Hotfix/Module/ActorLocation/ActorLocationSenderSystem.cs
+2
-2
Server/Model/Module/Actor/ActorMessageSenderComponent.cs
Server/Model/Module/Actor/ActorMessageSenderComponent.cs
+1
-1
Unity/Assets/Hotfix/Base/Object/Component.cs
Unity/Assets/Hotfix/Base/Object/Component.cs
+3
-3
Unity/Assets/Hotfix/Entity/Scene.cs
Unity/Assets/Hotfix/Entity/Scene.cs
+0
-2
Unity/Assets/Model/Base/Async/ETCancellationTokenSource.cs.meta
...Assets/Model/Base/Async/ETCancellationTokenSource.cs.meta
+11
-0
Unity/Assets/Model/Base/Helper/IdGenerater.cs
Unity/Assets/Model/Base/Helper/IdGenerater.cs
+20
-4
Unity/Assets/Model/Base/Object/Component.cs
Unity/Assets/Model/Base/Object/Component.cs
+3
-3
未找到文件。
Server/Hotfix/Module/ActorLocation/ActorLocationSenderSystem.cs
浏览文件 @
2026d35b
...
...
@@ -27,7 +27,7 @@ namespace ETHotfix
{
self
.
ActorId
=
await
Game
.
Scene
.
GetComponent
<
LocationProxyComponent
>().
Get
(
self
.
Id
);
self
.
Address
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
FromId
(
self
.
ActorId
));
self
.
Address
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
(
self
.
ActorId
));
self
.
UpdateAsync
().
Coroutine
();
}
...
...
@@ -158,7 +158,7 @@ namespace ETHotfix
// 等待0.5s再发送
await
Game
.
Scene
.
GetComponent
<
TimerComponent
>().
WaitAsync
(
500
);
self
.
ActorId
=
await
Game
.
Scene
.
GetComponent
<
LocationProxyComponent
>().
Get
(
self
.
Id
);
self
.
Address
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
FromId
(
self
.
ActorId
));
self
.
Address
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
(
self
.
ActorId
));
self
.
AllowGet
();
return
;
...
...
Server/Model/Module/Actor/ActorMessageSenderComponent.cs
浏览文件 @
2026d35b
...
...
@@ -11,7 +11,7 @@ namespace ETModel
{
throw
new
Exception
(
$"actor id is 0"
);
}
IPEndPoint
ipEndPoint
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
FromId
(
actorId
));
IPEndPoint
ipEndPoint
=
StartConfigComponent
.
Instance
.
GetInnerAddress
(
IdGenerater
.
GetAppId
(
actorId
));
ActorMessageSender
actorMessageSender
=
new
ActorMessageSender
(
actorId
,
ipEndPoint
);
return
actorMessageSender
;
}
...
...
Unity/Assets/Hotfix/Base/Object/Component.cs
浏览文件 @
2026d35b
...
...
@@ -11,7 +11,7 @@ namespace ETHotfix
public
abstract
class
Component
:
Object
,
IDisposable
{
[
BsonIgnore
]
public
long
InstanceId
{
get
;
pr
otected
set
;
}
public
long
InstanceId
{
get
;
pr
ivate
set
;
}
#if !SERVER
public
static
GameObject
Global
{
get
;
}
=
GameObject
.
Find
(
"/Global"
);
...
...
@@ -41,7 +41,7 @@ namespace ETHotfix
if
(
this
.
InstanceId
==
0
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
InstanceId
=
IdGenerater
.
GenerateI
nstanceI
d
();
}
}
}
...
...
@@ -99,7 +99,7 @@ namespace ETHotfix
protected
Component
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
InstanceId
=
IdGenerater
.
GenerateI
nstanceI
d
();
#if !SERVER
if
(!
this
.
GetType
().
IsDefined
(
typeof
(
HideInHierarchy
),
true
))
{
...
...
Unity/Assets/Hotfix/Entity/Scene.cs
浏览文件 @
2026d35b
...
...
@@ -8,12 +8,10 @@ namespace ETHotfix
public
Scene
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
Scene
(
long
id
):
base
(
id
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
override
void
Dispose
()
...
...
Unity/Assets/Model/Base/Async/ETCancellationTokenSource.cs.meta
0 → 100644
浏览文件 @
2026d35b
fileFormatVersion: 2
guid: d84361f4f81274c3d807bb783cc8a864
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Model/Base/Helper/IdGenerater.cs
浏览文件 @
2026d35b
...
...
@@ -2,7 +2,18 @@
{
public
static
class
IdGenerater
{
public
static
long
AppId
{
private
get
;
set
;
}
private
static
long
instanceIdGenerator
;
private
static
long
appId
;
public
static
long
AppId
{
set
{
appId
=
value
;
instanceIdGenerator
=
appId
<<
48
;
}
}
private
static
ushort
value
;
...
...
@@ -10,12 +21,17 @@
{
long
time
=
TimeHelper
.
ClientNowSeconds
();
return
(
AppId
<<
48
)
+
(
time
<<
16
)
+
++
value
;
return
(
appId
<<
48
)
+
(
time
<<
16
)
+
++
value
;
}
public
static
long
GenerateInstanceId
()
{
return
++
instanceIdGenerator
;
}
public
static
int
GetAppId
FromId
(
long
id
)
public
static
int
GetAppId
(
long
v
)
{
return
(
int
)(
id
>>
48
);
return
(
int
)(
v
>>
48
);
}
}
}
\ No newline at end of file
Unity/Assets/Model/Base/Object/Component.cs
浏览文件 @
2026d35b
...
...
@@ -11,7 +11,7 @@ namespace ETModel
public
abstract
class
Component
:
Object
,
IDisposable
{
[
BsonIgnore
]
public
long
InstanceId
{
get
;
pr
otected
set
;
}
public
long
InstanceId
{
get
;
pr
ivate
set
;
}
#if !SERVER
public
static
GameObject
Global
{
get
;
}
=
GameObject
.
Find
(
"/Global"
);
...
...
@@ -41,7 +41,7 @@ namespace ETModel
if
(
this
.
InstanceId
==
0
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
InstanceId
=
IdGenerater
.
GenerateI
nstanceI
d
();
}
}
}
...
...
@@ -99,7 +99,7 @@ namespace ETModel
protected
Component
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
InstanceId
=
IdGenerater
.
GenerateI
nstanceI
d
();
#if !SERVER
if
(!
this
.
GetType
().
IsDefined
(
typeof
(
HideInHierarchy
),
true
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录