@@ -9,7 +9,7 @@ namespace GameFrameX.Core.Utility
9
9
/// 服务器id 类型 时间戳 自增
10
10
/// 玩家
11
11
/// 公会
12
- /// 服务器id * 1000 + 全局功能id
12
+ /// 服务器id * 100000 + 全局功能id
13
13
/// 全局玩法
14
14
/// </summary>
15
15
public static class IdGenerator
@@ -29,7 +29,7 @@ public static class IdGenerator
29
29
/// <returns></returns>
30
30
public static int GetServerId ( long id )
31
31
{
32
- return ( int ) ( id < GlobalConst . MaxGlobalId ? id / 1000 : id >> GlobalConst . ServerIdOrModuleIdMask ) ;
32
+ return ( int ) ( id < GlobalConst . MaxGlobalId ? id / 100000 : id >> GlobalConst . ServerIdOrModuleIdMask ) ;
33
33
}
34
34
35
35
/// <summary>
@@ -78,7 +78,7 @@ public static ActorType GetActorType(long id)
78
78
if ( id < GlobalConst . MaxGlobalId )
79
79
{
80
80
// 全局actor
81
- return ( ActorType ) ( id % 1000 ) ;
81
+ return ( ActorType ) id ;
82
82
}
83
83
84
84
return ( ActorType ) ( ( id >> GlobalConst . ActorTypeMask ) & 0xF ) ;
@@ -112,33 +112,19 @@ public static long GetActorId(ActorType type, int serverId = 0)
112
112
{
113
113
return GetMultiActorId ( type , serverId ) ;
114
114
}
115
- else
116
- {
117
- return GetGlobalActorId ( type , serverId ) ;
118
- }
115
+
116
+ return GetGlobalActorId ( type , serverId ) ;
119
117
}
120
118
121
119
/// <summary>
122
- /// 根据ActorType获取ActorId开始值
120
+ ///
123
121
/// </summary>
124
122
/// <param name="type"></param>
123
+ /// <param name="serverId"></param>
125
124
/// <returns></returns>
126
- /// <exception cref="ArgumentException"></exception>
127
- public static long GetMultiActorIdBegin ( ActorType type )
128
- {
129
- if ( type >= ActorType . Separator )
130
- {
131
- throw new ArgumentException ( $ "input actor type error: { type } ") ;
132
- }
133
-
134
- var id = ( long ) GlobalSettings . ServerId << GlobalConst . ServerIdOrModuleIdMask ;
135
- id |= ( long ) type << GlobalConst . ActorTypeMask ;
136
- return id ;
137
- }
138
-
139
125
private static long GetGlobalActorId ( ActorType type , int serverId )
140
126
{
141
- return ( long ) ( serverId * 1000 + type ) ;
127
+ return ( long ) ( serverId * 100000 + type ) ;
142
128
}
143
129
144
130
0 commit comments