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.
60 lines
2.2 KiB
60 lines
2.2 KiB
using Sog;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using ProtoCSStruct;
|
|
using MySql.Data.MySqlClient;
|
|
|
|
namespace Operation
|
|
{
|
|
class PlaydataOp
|
|
{
|
|
public static void OnGetPlayDataOpReq(uint remoteAppID, StructPacket packet, DBOperator dbOperator)
|
|
{
|
|
ref var req = ref packet.GetMessage<SSPlayDataOpReq>();
|
|
TraceLog.Debug("PlaydataOp.OnGetPlayDataOpReq - uid:{0}, currentId:{1}", req.Uid, req.CurrentId);
|
|
|
|
var currentMaxId = dbOperator.DBSelectMaxIdPlayerOp();
|
|
if(currentMaxId == req.CurrentId)
|
|
{
|
|
SSPlayDataOpRes res = new SSPlayDataOpRes();
|
|
res.Uid = req.Uid;
|
|
OperationServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.PlaydataOpRes
|
|
, ref res, packet.ObjectID, packet.Header.ServerID);
|
|
return;
|
|
}
|
|
|
|
List<DBPlayerDataOp> retList = dbOperator.DBSelectPlayOpData(req.Uid, req.CurrentId);
|
|
if(retList.Count > 0)
|
|
{
|
|
SSPlayDataOpRes res = new SSPlayDataOpRes();
|
|
|
|
for (int i = 0; i < retList.Count; i++)
|
|
{
|
|
var item = retList[i];
|
|
res.Uid = req.Uid;
|
|
res.MaxId = item.Id;
|
|
res.OpData.Add(ref item);
|
|
if ((i + 1)% res.OpData.GetMaxCount() == 0 || (i + 1) == retList.Count)
|
|
{
|
|
OperationServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.PlaydataOpRes, ref res, packet.ObjectID, packet.Header.ServerID);
|
|
res.Clear();
|
|
res = new SSPlayDataOpRes();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
SSPlayDataOpRes res = new SSPlayDataOpRes();
|
|
res.Uid = req.Uid;
|
|
res.MaxId = currentMaxId;
|
|
OperationServerUtils.GetPacketSender().SendToServerByID(remoteAppID, (int)SSGameMsgID.PlaydataOpRes
|
|
, ref res, packet.ObjectID, packet.Header.ServerID);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|