mirror of
https://github.com/SoDOff-Project/sodoff-mmo.git
synced 2026-01-13 12:51:52 -08:00
Made ElapsedTimeSyncHandler use Runtime.CurrentRuntime instead of creating a stopwatch per-room.
This commit is contained in:
parent
dcbdc93bbd
commit
ad303f569d
@ -10,7 +10,7 @@ class ElapsedTimeSyncHandler : CommandHandler {
|
||||
if (client.Room != null) {
|
||||
NetworkObject cmd = new();
|
||||
NetworkObject obj = new();
|
||||
obj.Add("arr", new string[] { "RTM", "-1", client.Room.ElapsedTime.ElapsedMilliseconds.ToString() });
|
||||
obj.Add("arr", new string[] { "RTM", "-1", Runtime.CurrentRuntime.ToString() });
|
||||
cmd.Add("c", "RTM");
|
||||
cmd.Add("p", obj);
|
||||
client.Send(NetworkObject.WrapObject(1, 13, cmd).Serialize());
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using sodoffmmo.Data;
|
||||
|
||||
namespace sodoffmmo.Core;
|
||||
@ -19,7 +18,6 @@ public class Room {
|
||||
|
||||
public bool AllowChatOverride { get; set; } = false;
|
||||
public NetworkArray RoomVariables = new();
|
||||
public readonly Stopwatch ElapsedTime = new Stopwatch();
|
||||
|
||||
public Room(string? name, string? group = null, bool autoRemove = false) {
|
||||
Id = ++MaxId;
|
||||
@ -35,7 +33,6 @@ public class Room {
|
||||
}
|
||||
AutoRemove = autoRemove;
|
||||
rooms.Add(Name, this);
|
||||
ElapsedTime.Start();
|
||||
}
|
||||
|
||||
public int ClientsCount => clients.Count;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user