Skip to content

Commit 7fc3c13

Browse files
committed
先还原
1 parent d8dbbb8 commit 7fc3c13

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

KBEngine.cs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ public class KBEngineApp
2929

3030
KBEngineArgs _args = null;
3131

32-
//上传服务器玩家位置信息间隔,单位毫秒
33-
private float updatePlayerToServerPeroid = 100.0f;
34-
35-
private const int ONE_MS_TO_100_NS = 10000;
3632
// 客户端的类别
3733
// http://www.kbengine.org/docs/programming/clientsdkprogramming.html
3834
// http://www.kbengine.org/cn/docs/programming/clientsdkprogramming.html
@@ -162,8 +158,6 @@ public virtual bool initialize(KBEngineArgs args)
162158
{
163159
_args = args;
164160

165-
updatePlayerToServerPeroid = 1000f / args.threadUpdateHZ;
166-
167161
initNetwork();
168162

169163
// 注册事件
@@ -1929,15 +1923,14 @@ public void updatePlayerToServer()
19291923
var now = DateTime.Now;
19301924
TimeSpan span = now - _lastUpdateToServerTime;
19311925

1932-
if (span.Ticks < updatePlayerToServerPeroid * ONE_MS_TO_100_NS)
1933-
return;
1934-
1935-
Entity playerEntity = player();
1936-
if (playerEntity == null || playerEntity.inWorld == false || playerEntity.isControlled)
1937-
return;
1938-
1939-
_lastUpdateToServerTime = now - (span - TimeSpan.FromTicks(Convert.ToInt64(updatePlayerToServerPeroid * ONE_MS_TO_100_NS)));
1926+
if (span.Ticks < 1000000)
1927+
return;
1928+
1929+
Entity playerEntity = player();
1930+
if (playerEntity == null || playerEntity.inWorld == false || playerEntity.isControlled)
1931+
return;
19401932

1933+
_lastUpdateToServerTime = now - (span - TimeSpan.FromTicks(1000000));
19411934

19421935
Vector3 position = playerEntity.position;
19431936
Vector3 direction = playerEntity.direction;

0 commit comments

Comments
 (0)