wip
This commit is contained in:
@@ -44,7 +44,7 @@ public class RagonData
|
||||
var toDelete = _data
|
||||
.Where(p => p.Value.Length == 0)
|
||||
.Select(p => p.Key);
|
||||
|
||||
|
||||
foreach (var prop in toDelete)
|
||||
_data.Remove(prop);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ public class RagonEvent
|
||||
{
|
||||
public RagonRoomPlayer Invoker { get; private set; }
|
||||
public ushort EventCode { get; private set; }
|
||||
public ushort Size => (ushort) _size;
|
||||
|
||||
public ushort Size => (ushort)_size;
|
||||
|
||||
private uint[] _data = new uint[128];
|
||||
private int _size = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class RagonEvent
|
||||
Invoker = invoker;
|
||||
EventCode = eventCode;
|
||||
}
|
||||
|
||||
|
||||
public void Read(RagonStream buffer)
|
||||
{
|
||||
// _size = buffer.Capacity;
|
||||
|
||||
@@ -29,7 +29,8 @@ public sealed class RoomDataOperation : BaseOperation
|
||||
{
|
||||
var player = context.RoomPlayer;
|
||||
var room = context.Room;
|
||||
|
||||
|
||||
|
||||
var data = Reader.ReadBinary(Reader.Lenght);
|
||||
var dataSize = data.Length - 1;
|
||||
var headerSize = 3;
|
||||
|
||||
@@ -26,6 +26,7 @@ public sealed class RoomLeaveOperation: BaseOperation
|
||||
|
||||
public RoomLeaveOperation(RagonStream reader, RagonStream writer): base(reader, writer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Handle(RagonContext context, NetworkChannel channel)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Ragon.Protocol;
|
||||
using Ragon.Server.IO;
|
||||
using Ragon.Server.Logging;
|
||||
|
||||
@@ -21,5 +21,5 @@ namespace Ragon.Server.IO;
|
||||
public interface INetworkChannel
|
||||
{
|
||||
void Send(byte[] data);
|
||||
void Send(RagonBuffer buffer);
|
||||
void Send(RagonStream buffer);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ public class RagonLobbyDispatcher
|
||||
for (int i = 0; i < rooms.Count; i++)
|
||||
{
|
||||
var room = rooms[i];
|
||||
|
||||
|
||||
writer.WriteString(room.Id);
|
||||
writer.WriteString(room.Scene);
|
||||
writer.WriteUShort((ushort)room.PlayerMax);
|
||||
|
||||
@@ -73,6 +73,11 @@ public class LobbyInMemory : IRagonLobby
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool FindRoomByProperties(Dictionary<string, object> props)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Persist(RagonRoom room)
|
||||
{
|
||||
room.Attach();
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using Ragon.Server.Data;
|
||||
using Ragon.Server.IO;
|
||||
|
||||
namespace Ragon.Server.Lobby;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RagonContext
|
||||
|
||||
internal void SetRoom(RagonRoom room, RagonRoomPlayer player)
|
||||
{
|
||||
Room?.DetachPlayer(RoomPlayer);
|
||||
Room?.DetachPlayer(player);
|
||||
|
||||
Room = room;
|
||||
RoomPlayer = player;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class RagonServer : IRagonServer, INetworkListener
|
||||
_scheduler.Run(new RagonActionTimer(SendRoomList, 2.0f));
|
||||
_scheduler.Run(new RagonActionTimer(SendPlayerUserData, 0.1f));
|
||||
_scheduler.Run(new RagonActionTimer(SendRoomUserData, 0.1f));
|
||||
|
||||
|
||||
_serverPlugin.OnAttached(this);
|
||||
|
||||
_handlers = new BaseOperation[byte.MaxValue];
|
||||
@@ -93,18 +93,16 @@ public class RagonServer : IRagonServer, INetworkListener
|
||||
|
||||
if (_timer.ElapsedMilliseconds > _tickRate)
|
||||
{
|
||||
|
||||
SendTimestamp();
|
||||
|
||||
_scheduler.Update(_timer.ElapsedMilliseconds);
|
||||
_timer.Restart();
|
||||
}
|
||||
|
||||
SendTimestamp();
|
||||
|
||||
_server.Update();
|
||||
}
|
||||
|
||||
public void Start(bool executeInDedicatedThread = false)
|
||||
public void Listen()
|
||||
{
|
||||
CopyrightInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user