275 lines
9.5 KiB
C#
275 lines
9.5 KiB
C#
|
using System.Collections.Generic;
|
||
|
using Thousandto.Plugins.Common;
|
||
|
using Thousandto.Code.Logic.Network;
|
||
|
|
||
|
namespace MSG_FunctionTask
|
||
|
{
|
||
|
public partial class FunctionTask : 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 :
|
||
|
num = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
break;
|
||
|
case 3 :
|
||
|
maxNum = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
break;
|
||
|
case 4 :
|
||
|
get = ProtoBufUtils.ReadBoolean(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,num);
|
||
|
ProtoBufUtils.WriteInt32(3,maxNum);
|
||
|
ProtoBufUtils.WriteBoolean(4,get);
|
||
|
ProtoBufUtils.SetVEndIndex(subItemInfoId);
|
||
|
return ProtoBufUtils.CheckAndSetLength(subItemInfoId);
|
||
|
}
|
||
|
public void Clear()
|
||
|
{
|
||
|
id = 0;
|
||
|
num = 0;
|
||
|
maxNum = 0;
|
||
|
get = false;
|
||
|
}
|
||
|
public int id;
|
||
|
public int num;
|
||
|
public int maxNum;
|
||
|
public bool get;
|
||
|
}
|
||
|
public partial class FunctionRechargeTask : 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 :
|
||
|
rechargeid = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
break;
|
||
|
case 2 :
|
||
|
num = ProtoBufUtils.ReadFloat(ref readPos);
|
||
|
break;
|
||
|
case 3 :
|
||
|
if(rewards == null)
|
||
|
{
|
||
|
rewards = new List<MSG_Common.ShowItemInfo>();
|
||
|
}
|
||
|
rewards.Add(new MSG_Common.ShowItemInfo());
|
||
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
rewards[rewards.Count - 1].ReadMessage(ref readPos, totalCount);
|
||
|
break;
|
||
|
case 4 :
|
||
|
get = ProtoBufUtils.ReadBoolean(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,rechargeid);
|
||
|
ProtoBufUtils.WriteFloat(2,num);
|
||
|
for (int i = 0; i < rewards.Count; i++)
|
||
|
{
|
||
|
if(rewards != null)
|
||
|
{
|
||
|
rewards[i].WriteMessage(3);
|
||
|
}
|
||
|
}
|
||
|
ProtoBufUtils.WriteBoolean(4,get);
|
||
|
ProtoBufUtils.SetVEndIndex(subItemInfoId);
|
||
|
return ProtoBufUtils.CheckAndSetLength(subItemInfoId);
|
||
|
}
|
||
|
public void Clear()
|
||
|
{
|
||
|
rechargeid = 0;
|
||
|
num = 0;
|
||
|
if(rewards != null)
|
||
|
{
|
||
|
rewards.Clear();
|
||
|
}
|
||
|
get = false;
|
||
|
}
|
||
|
public int rechargeid;
|
||
|
public float num;
|
||
|
public List<MSG_Common.ShowItemInfo> rewards = new List<MSG_Common.ShowItemInfo>();
|
||
|
public bool get;
|
||
|
}
|
||
|
public partial class ResAllFunctionTask : ProtoBuf.IExtensible, ProtoBuf.IResMessage
|
||
|
{
|
||
|
public void Excute()
|
||
|
{
|
||
|
HandleMsgResult.getInstance().GS2U_ResAllFunctionTask(this);
|
||
|
}
|
||
|
|
||
|
public const uint MsgID = 538101;
|
||
|
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(tasks == null)
|
||
|
{
|
||
|
tasks = new List<FunctionTask>();
|
||
|
}
|
||
|
tasks.Add(new FunctionTask());
|
||
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
tasks[tasks.Count - 1].ReadMessage(ref readPos, totalCount);
|
||
|
break;
|
||
|
case 2:
|
||
|
if(rechargeTask == null)
|
||
|
{
|
||
|
rechargeTask = new FunctionRechargeTask();
|
||
|
}
|
||
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
rechargeTask.ReadMessage(ref readPos, totalCount);
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public void Clear()
|
||
|
{
|
||
|
if(tasks != null)
|
||
|
{
|
||
|
tasks.Clear();
|
||
|
}
|
||
|
if(rechargeTask != null)
|
||
|
{
|
||
|
rechargeTask.Clear();
|
||
|
}
|
||
|
}
|
||
|
public List<FunctionTask> tasks = new List<FunctionTask>();
|
||
|
public FunctionRechargeTask rechargeTask;
|
||
|
}
|
||
|
public partial class ResFunctionTaskUpdate : ProtoBuf.IExtensible, ProtoBuf.IResMessage
|
||
|
{
|
||
|
public void Excute()
|
||
|
{
|
||
|
HandleMsgResult.getInstance().GS2U_ResFunctionTaskUpdate(this);
|
||
|
}
|
||
|
|
||
|
public const uint MsgID = 538102;
|
||
|
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(tasks == null)
|
||
|
{
|
||
|
tasks = new FunctionTask();
|
||
|
}
|
||
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
tasks.ReadMessage(ref readPos, totalCount);
|
||
|
break;
|
||
|
case 2:
|
||
|
if(rechargeTask == null)
|
||
|
{
|
||
|
rechargeTask = new FunctionRechargeTask();
|
||
|
}
|
||
|
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
|
||
|
rechargeTask.ReadMessage(ref readPos, totalCount);
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public void Clear()
|
||
|
{
|
||
|
if(tasks != null)
|
||
|
{
|
||
|
tasks.Clear();
|
||
|
}
|
||
|
if(rechargeTask != null)
|
||
|
{
|
||
|
rechargeTask.Clear();
|
||
|
}
|
||
|
}
|
||
|
public FunctionTask tasks;
|
||
|
public FunctionRechargeTask rechargeTask;
|
||
|
}
|
||
|
public partial class ReqFunctionTaskGetAward : ProtoBuf.IExtensible, ProtoBuf.IReqMessage
|
||
|
{
|
||
|
|
||
|
public const uint MsgID = 538201;
|
||
|
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;
|
||
|
}
|
||
|
}
|
||
|
|