feat: marble full game

This commit is contained in:
Somebody
2025-05-10 23:08:38 +08:00
parent c95b957da3
commit 182b679cd7
24 changed files with 858 additions and 183 deletions

View File

@@ -11,6 +11,11 @@ public class HandlerFightHeartBeatCsReq : Handler
{
var req = FightHeartBeatCsReq.Parser.ParseFrom(data);
if (connection.MarbleRoom != null)
{
await connection.MarbleRoom.OnPlayerHeartBeat();
}
await connection.SendPacket(new PacketFightHeartBeatScRsp(req.ClientTimeMs));
}
}

View File

@@ -0,0 +1,21 @@
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Recv.Multiplayer;
[Opcode(CmdIds.MultiplayerFightGiveUpCsReq)]
public class HandlerMultiplayerFightGiveUpCsReq : Handler
{
public override async Task OnHandle(Connection connection, byte[] header, byte[] data)
{
var req = MultiplayerFightGiveUpCsReq.Parser.ParseFrom(data);
var roomId = req.GateRoomId;
ServerUtils.MultiPlayerGameServerManager.Rooms.TryGetValue((long)roomId, out var room);
var player = room?.GetPlayerById(connection.MarblePlayer?.LobbyPlayer.Player.Uid ?? connection.Player!.Uid);
if (player != null)
player.LeaveGame = true;
await connection.SendPacket(CmdIds.MultiplayerFightGiveUpScRsp);
}
}

View File

@@ -51,11 +51,7 @@ public class PacketFightGeneralScNotify : BasePacket
NetworkMsgType = (uint)msgType,
FightGeneralInfo = new FightGeneralServerInfo
{
FightGameInfo = { sync.Select(x => new FightGameInfo
{
GameMessageType = (uint)x.MessageType,
MarbleGameSyncInfo = x.ToProto()
}) }
FightGameInfo = { sync.Select(x => x.ToProto()) }
}
};

View File

@@ -0,0 +1,22 @@
using EggLink.DanhengServer.GameServer.Game.MultiPlayer;
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Fight;
public class PacketFightSessionStopScNotify : BasePacket
{
public PacketFightSessionStopScNotify(BaseMultiPlayerGameRoomInstance room) : base(CmdIds.FightSessionStopScNotify)
{
var proto = new FightSessionStopScNotify
{
SessionInfo = new FightSessionInfo
{
SessionGameMode = room.GameMode,
SessionRoomId = (ulong)room.RoomId
}
};
SetData(proto);
}
}

View File

@@ -0,0 +1,22 @@
using EggLink.DanhengServer.GameServer.Game.MultiPlayer;
using EggLink.DanhengServer.Kcp;
using EggLink.DanhengServer.Proto;
namespace EggLink.DanhengServer.GameServer.Server.Packet.Send.Multiplayer;
public class PacketMultiplayerFightGameFinishScNotify : BasePacket
{
public PacketMultiplayerFightGameFinishScNotify(BaseMultiPlayerGameRoomInstance room) : base(CmdIds.MultiplayerFightGameFinishScNotify)
{
var proto = new MultiplayerFightGameFinishScNotify
{
SessionInfo = new FightSessionInfo
{
SessionGameMode = room.GameMode,
SessionRoomId = (ulong)room.RoomId
}
};
SetData(proto);
}
}