You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.9 KiB
63 lines
1.9 KiB
using ProtoCSStruct;
|
|
using Sog;
|
|
|
|
namespace Game
|
|
{
|
|
public class BeginnerGuideHandler : BasePacketHandler
|
|
{
|
|
public override void Dispose()
|
|
{
|
|
}
|
|
|
|
public override int GetServiceType()
|
|
{
|
|
return GameServiceType.BeginnerGuideHandler;
|
|
}
|
|
|
|
public override void HandlerClientPacket(PlayerSession playerSession, StructPacket packet)
|
|
{
|
|
PlayerOnGame player = playerSession.Player;
|
|
if (player == null)
|
|
{
|
|
TraceLog.Error(
|
|
$"BeginnerGuideHandler.HandlerClientPacket player is null sessionid {playerSession.SessionID}");
|
|
return;
|
|
}
|
|
|
|
switch (packet.MsgID)
|
|
{
|
|
case (int)CSGameMsgID.BeginnerGuideChangeReq:
|
|
OnBeginnerGuideChangeReq(player, packet);
|
|
break;
|
|
case (int)CSGameMsgID.BeginnerGuideAwardReq:
|
|
OnGuideAward(player, packet);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
public override void HandlerServerPacket(uint serverID, StructPacket packet)
|
|
{
|
|
}
|
|
|
|
private void OnBeginnerGuideChangeReq(PlayerOnGame player, StructPacket packet)
|
|
{
|
|
ref var req = ref packet.GetMessage<CSBeginnerGuideChangeReq>();
|
|
CSBeginnerGuideChangeRes res = new CSBeginnerGuideChangeRes
|
|
{
|
|
Ret = BeginnerGuideSvc.ChangeState(player, req.Id)
|
|
};
|
|
res.BeginnerGuide.CopyFrom(ref player.RoleData.BeginnerGuide);
|
|
player.SendToClient((int)CSGameMsgID.BeginnerGuideChangeRes, ref res);
|
|
}
|
|
|
|
public void OnGuideAward(PlayerOnGame player,StructPacket packet)
|
|
{
|
|
|
|
BeginnerGuideSvc.Award(player, packet);
|
|
|
|
|
|
}
|
|
}
|
|
}
|