238 lines
7.8 KiB
C#
238 lines
7.8 KiB
C#
using System.Collections.Generic;
|
|
using Thousandto.Plugins.Common;
|
|
using Thousandto.Code.Logic.Network;
|
|
|
|
namespace MSG_Achievement
|
|
{
|
|
public partial class achivementInfo : ProtoBuf.IMessageInfo, ProtoBuf.IExtensible
|
|
{
|
|
public void Send(){}
|
|
public void Excute(){}
|
|
public void ReadMessage(ref int readPos, int totalCount)
|
|
{
|
|
int endIndex = totalCount + readPos - 1;
|
|
while (readPos <= endIndex)
|
|
{
|
|
int fieldNumber = ProtoBufUtils.ReadFieldNumber(ref readPos);
|
|
switch (fieldNumber)
|
|
{
|
|
case 1 :
|
|
id = ProtoBufUtils.ReadInt32(ref readPos);
|
|
break;
|
|
case 2 :
|
|
pro = ProtoBufUtils.ReadInt32(ref readPos);
|
|
break;
|
|
case 3 :
|
|
state = ProtoBufUtils.ReadInt32(ref readPos);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
public int WriteMessage(int fieldNumber)
|
|
{
|
|
ProtoBufUtils.WriteHeader(fieldNumber, ProtoBuf.WireType.String);
|
|
int subItemInfoId = ProtoBufUtils.GetSubItemInfoId();
|
|
ProtoBufUtils.SetEmptyLength(subItemInfoId);
|
|
ProtoBufUtils.SetVBeginIndex(subItemInfoId);
|
|
ProtoBufUtils.WriteInt32(1,id);
|
|
ProtoBufUtils.WriteInt32(2,pro);
|
|
ProtoBufUtils.WriteInt32(3,state);
|
|
ProtoBufUtils.SetVEndIndex(subItemInfoId);
|
|
return ProtoBufUtils.CheckAndSetLength(subItemInfoId);
|
|
}
|
|
public void Clear()
|
|
{
|
|
id = 0;
|
|
pro = 0;
|
|
state = 0;
|
|
}
|
|
public int id;
|
|
public int pro;
|
|
public int state;
|
|
}
|
|
public partial class ResAchievementInfo : ProtoBuf.IExtensible, ProtoBuf.IResMessage
|
|
{
|
|
public void Excute()
|
|
{
|
|
HandleMsgResult.getInstance().GS2U_ResAchievementInfo(this);
|
|
}
|
|
|
|
public const uint MsgID = 122101;
|
|
public void Send(){}
|
|
public void ReadMessage(byte[] bytes)
|
|
{
|
|
lock (ProtoBufUtils.ReadLocker)
|
|
{
|
|
Clear();
|
|
int endIndex = bytes.Length - 1;
|
|
int readPos = 0;
|
|
int totalCount = 0;
|
|
ProtoBufUtils.InitReadData(bytes, ref readPos);
|
|
while (readPos <= endIndex)
|
|
{
|
|
int curType = bytes[readPos] & 7;
|
|
int fieldNumber = ProtoBufUtils.ReadFieldNumber(ref readPos);
|
|
switch (fieldNumber)
|
|
{
|
|
case 1:
|
|
if(hasGetIds == null)
|
|
{
|
|
hasGetIds = new List<int>();
|
|
}
|
|
hasGetIds.Add(ProtoBufUtils.ReadInt32(ref readPos));
|
|
break;
|
|
case 2:
|
|
if(canGetIds == null)
|
|
{
|
|
canGetIds = new List<int>();
|
|
}
|
|
canGetIds.Add(ProtoBufUtils.ReadInt32(ref readPos));
|
|
break;
|
|
case 3:
|
|
if(infos == null)
|
|
{
|
|
infos = new List<achivementInfo>();
|
|
}
|
|
infos.Add(new achivementInfo());
|
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
|
infos[infos.Count - 1].ReadMessage(ref readPos, totalCount);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public void Clear()
|
|
{
|
|
if(hasGetIds != null)
|
|
{
|
|
hasGetIds.Clear();
|
|
}
|
|
if(canGetIds != null)
|
|
{
|
|
canGetIds.Clear();
|
|
}
|
|
if(infos != null)
|
|
{
|
|
infos.Clear();
|
|
}
|
|
}
|
|
public List<int> hasGetIds = new List<int>();
|
|
public List<int> canGetIds = new List<int>();
|
|
public List<achivementInfo> infos = new List<achivementInfo>();
|
|
}
|
|
public partial class ResUpdateAchivement : ProtoBuf.IExtensible, ProtoBuf.IResMessage
|
|
{
|
|
public void Excute()
|
|
{
|
|
HandleMsgResult.getInstance().GS2U_ResUpdateAchivement(this);
|
|
}
|
|
|
|
public const uint MsgID = 122102;
|
|
public void Send(){}
|
|
public void ReadMessage(byte[] bytes)
|
|
{
|
|
lock (ProtoBufUtils.ReadLocker)
|
|
{
|
|
Clear();
|
|
int endIndex = bytes.Length - 1;
|
|
int readPos = 0;
|
|
int totalCount = 0;
|
|
ProtoBufUtils.InitReadData(bytes, ref readPos);
|
|
while (readPos <= endIndex)
|
|
{
|
|
int curType = bytes[readPos] & 7;
|
|
int fieldNumber = ProtoBufUtils.ReadFieldNumber(ref readPos);
|
|
switch (fieldNumber)
|
|
{
|
|
case 1:
|
|
if(infos == null)
|
|
{
|
|
infos = new List<achivementInfo>();
|
|
}
|
|
infos.Add(new achivementInfo());
|
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
|
infos[infos.Count - 1].ReadMessage(ref readPos, totalCount);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public void Clear()
|
|
{
|
|
if(infos != null)
|
|
{
|
|
infos.Clear();
|
|
}
|
|
}
|
|
public List<achivementInfo> infos = new List<achivementInfo>();
|
|
}
|
|
public partial class ReqGetAchievement : ProtoBuf.IExtensible, ProtoBuf.IReqMessage
|
|
{
|
|
|
|
public const uint MsgID = 122201;
|
|
public void Excute(){}
|
|
public void Send()
|
|
{
|
|
lock (ProtoBufUtils.WriteLocker)
|
|
{
|
|
byte[] bytes = null;
|
|
ProtoBufUtils.InitWriteData();
|
|
ProtoBufUtils.WriteInt32(1,id);
|
|
bytes = ProtoBufUtils.GetData();
|
|
Thousandto.Plugins.Common.Networker.Instance.Send(bytes, MsgID);
|
|
}
|
|
}
|
|
public void Clear()
|
|
{
|
|
id = 0;
|
|
}
|
|
public int id;
|
|
}
|
|
public partial class ResGetAchievement : ProtoBuf.IExtensible, ProtoBuf.IResMessage
|
|
{
|
|
public void Excute()
|
|
{
|
|
HandleMsgResult.getInstance().GS2U_ResGetAchievement(this);
|
|
}
|
|
|
|
public const uint MsgID = 122103;
|
|
public void Send(){}
|
|
public void ReadMessage(byte[] bytes)
|
|
{
|
|
lock (ProtoBufUtils.ReadLocker)
|
|
{
|
|
Clear();
|
|
int endIndex = bytes.Length - 1;
|
|
int readPos = 0;
|
|
int totalCount = 0;
|
|
ProtoBufUtils.InitReadData(bytes, ref readPos);
|
|
while (readPos <= endIndex)
|
|
{
|
|
int curType = bytes[readPos] & 7;
|
|
int fieldNumber = ProtoBufUtils.ReadFieldNumber(ref readPos);
|
|
switch (fieldNumber)
|
|
{
|
|
case 1:
|
|
id = ProtoBufUtils.ReadInt32(ref readPos);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public void Clear()
|
|
{
|
|
id = 0;
|
|
}
|
|
public int id;
|
|
}
|
|
}
|
|
|