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.
71 lines
2.4 KiB
71 lines
2.4 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
|
|
namespace Game
|
|
{
|
|
public static class ClientBitFlagSvc
|
|
{
|
|
public static void ProcessSaveClientBitFlagReq(PlayerSession playerSession, StructPacket packet)
|
|
{
|
|
PlayerOnGame player = playerSession.Player;
|
|
if (player == null)
|
|
{
|
|
player.Error("ClientBitFlagSvc.ProcessSaveClientBitFlagReq no player object uid {0}"
|
|
, playerSession.UserID);
|
|
return;
|
|
}
|
|
|
|
|
|
ref CSSaveClientBitFlagReq req = ref packet.GetMessage<CSSaveClientBitFlagReq>();
|
|
|
|
|
|
player.unimportanceData.ClientBitFlag = req.ClientBitFlag;
|
|
player.MakeDirty();
|
|
|
|
CSSaveClientBitFlagRes res = new CSSaveClientBitFlagRes();
|
|
res.ClientBitFlag = req.ClientBitFlag;
|
|
|
|
player.SendToClient((int)CSGameMsgID.SaveClientBitFlagRes, ref res);
|
|
|
|
player.Trace("ClientBitFlagSvc.ProcessSaveClientBitFlagReq uid {0} ClientBitFlag {1}"
|
|
, player.UserID, res.ClientBitFlag);
|
|
|
|
}
|
|
|
|
public static void OnPlayerOnline(PlayerOnGame player)
|
|
{
|
|
//特殊代码,比如重置某个flag
|
|
//比赛提醒
|
|
SetFlag(player, 1);
|
|
}
|
|
|
|
public static void SetFlag(PlayerOnGame player,int id)
|
|
{
|
|
player.unimportanceData.ClientBitFlag = BitUtils.BitSet(player.unimportanceData.ClientBitFlag,id);
|
|
|
|
CSSaveClientBitFlagRes res = new CSSaveClientBitFlagRes();
|
|
res.ClientBitFlag = player.unimportanceData.ClientBitFlag;
|
|
|
|
player.SendToClient((int)CSGameMsgID.SaveClientBitFlagRes, ref res);
|
|
|
|
player.Trace("ClientBitFlagSvc.ProcessSaveClientBitFlagReq uid {0} ", player.UserID);
|
|
}
|
|
|
|
public static void ClearFlag(PlayerOnGame player, int id)
|
|
{
|
|
player.unimportanceData.ClientBitFlag = BitUtils.BitClear(player.unimportanceData.ClientBitFlag, id);
|
|
|
|
CSSaveClientBitFlagRes res = new CSSaveClientBitFlagRes();
|
|
res.ClientBitFlag = player.unimportanceData.ClientBitFlag;
|
|
|
|
player.SendToClient((int)CSGameMsgID.SaveClientBitFlagRes, ref res);
|
|
|
|
player.Trace("ClientBitFlagSvc.ProcessSaveClientBitFlagReq uid {0} ", player.UserID);
|
|
}
|
|
}
|
|
}
|
|
|