Files
Main/Assets/Code/Logic/_NetMessage/Messages/ServerStoreEx.cs

340 lines
11 KiB
C#
Raw Normal View History

2025-01-25 04:38:09 +08:00
using System.Collections.Generic;
using Thousandto.Plugins.Common;
using Thousandto.Code.Logic.Network;
namespace MSG_ServerStore
{
public partial class ServerStroeLog : 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 :
name = ProtoBufUtils.ReadString(ref readPos);
break;
case 2 :
type = ProtoBufUtils.ReadInt32(ref readPos);
break;
case 3 :
if(items == null)
{
items = new MSG_backpack.ItemInfo();
}
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
items.ReadMessage(ref readPos, totalCount);
break;
case 4 :
time = ProtoBufUtils.ReadUint64(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.WriteString(1,name);
ProtoBufUtils.WriteInt32(2,type);
if(items != null)
{
items.WriteMessage(3);
}
ProtoBufUtils.WriteUint64(4,time);
ProtoBufUtils.SetVEndIndex(subItemInfoId);
return ProtoBufUtils.CheckAndSetLength(subItemInfoId);
}
public void Clear()
{
name = null;
type = 0;
if(items != null)
{
items.Clear();
}
time = 0;
}
public string name;
public int type;
public MSG_backpack.ItemInfo items;
public ulong time;
}
public partial class ReqServerStore : ProtoBuf.IExtensible, ProtoBuf.IReqMessage
{
public const uint MsgID = 178201;
public void Excute(){}
public void Send()
{
lock (ProtoBufUtils.WriteLocker)
{
byte[] bytes = null;
ProtoBufUtils.InitWriteData();
bytes = ProtoBufUtils.GetData();
Thousandto.Plugins.Common.Networker.Instance.Send(bytes, MsgID);
}
}
public void Clear()
{
}
}
public partial class ReqServerStoreOperation : ProtoBuf.IExtensible, ProtoBuf.IReqMessage
{
public const uint MsgID = 178202;
public void Excute(){}
public void Send()
{
lock (ProtoBufUtils.WriteLocker)
{
byte[] bytes = null;
ProtoBufUtils.InitWriteData();
ProtoBufUtils.WriteInt32(1,type);
for (int i = 0; i < itemId.Count; i++)
{
ProtoBufUtils.WriteUint64(2,itemId[i]);
}
if(modeId != null)
{
modeId.WriteMessage(3);
}
bytes = ProtoBufUtils.GetData();
Thousandto.Plugins.Common.Networker.Instance.Send(bytes, MsgID);
}
}
public void Clear()
{
type = 0;
if(itemId != null)
{
itemId.Clear();
}
if(modeId != null)
{
modeId.Clear();
}
}
public int type;
public List<ulong> itemId = new List<ulong>();
public MSG_backpack.Key_Value modeId;
}
public partial class ResServerStore : ProtoBuf.IExtensible, ProtoBuf.IResMessage
{
public void Excute()
{
HandleMsgResult.getInstance().GS2U_ResServerStore(this);
}
public const uint MsgID = 178101;
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(items == null)
{
items = new List<MSG_backpack.ItemInfo>();
}
items.Add(new MSG_backpack.ItemInfo());
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
items[items.Count - 1].ReadMessage(ref readPos, totalCount);
break;
case 2:
if(itemId == null)
{
itemId = new List<int>();
}
itemId.Add(ProtoBufUtils.ReadInt32(ref readPos));
break;
case 3:
cellNum = ProtoBufUtils.ReadInt32(ref readPos);
break;
case 4:
currency = ProtoBufUtils.ReadInt32(ref readPos);
break;
default:
break;
}
}
}
}
public void Clear()
{
if(items != null)
{
items.Clear();
}
if(itemId != null)
{
itemId.Clear();
}
cellNum = 0;
currency = 0;
}
public List<MSG_backpack.ItemInfo> items = new List<MSG_backpack.ItemInfo>();
public List<int> itemId = new List<int>();
public int cellNum;
public int currency;
}
public partial class ResServerStroeLog : ProtoBuf.IExtensible, ProtoBuf.IResMessage
{
public void Excute()
{
HandleMsgResult.getInstance().GS2U_ResServerStroeLog(this);
}
public const uint MsgID = 178102;
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(log == null)
{
log = new List<ServerStroeLog>();
}
log.Add(new ServerStroeLog());
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
log[log.Count - 1].ReadMessage(ref readPos, totalCount);
break;
default:
break;
}
}
}
}
public void Clear()
{
if(log != null)
{
log.Clear();
}
}
public List<ServerStroeLog> log = new List<ServerStroeLog>();
}
public partial class ResServerStoreOperation : ProtoBuf.IExtensible, ProtoBuf.IResMessage
{
public void Excute()
{
HandleMsgResult.getInstance().GS2U_ResServerStoreOperation(this);
}
public const uint MsgID = 178103;
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:
state = ProtoBufUtils.ReadInt32(ref readPos);
break;
case 2:
if(log == null)
{
log = new List<ServerStroeLog>();
}
log.Add(new ServerStroeLog());
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
log[log.Count - 1].ReadMessage(ref readPos, totalCount);
break;
case 3:
currency = ProtoBufUtils.ReadInt32(ref readPos);
break;
case 4:
type = ProtoBufUtils.ReadInt32(ref readPos);
break;
case 5:
if(itemId == null)
{
itemId = new List<ulong>();
}
itemId.Add(ProtoBufUtils.ReadUint64(ref readPos));
break;
case 6:
if(item == null)
{
item = new List<MSG_backpack.ItemInfo>();
}
item.Add(new MSG_backpack.ItemInfo());
totalCount = ProtoBufUtils.ReadInt32(ref readPos);
item[item.Count - 1].ReadMessage(ref readPos, totalCount);
break;
default:
break;
}
}
}
}
public void Clear()
{
state = 0;
if(log != null)
{
log.Clear();
}
currency = 0;
type = 0;
if(itemId != null)
{
itemId.Clear();
}
if(item != null)
{
item.Clear();
}
}
public int state;
public List<ServerStroeLog> log = new List<ServerStroeLog>();
public int currency;
public int type;
public List<ulong> itemId = new List<ulong>();
public List<MSG_backpack.ItemInfo> item = new List<MSG_backpack.ItemInfo>();
}
}