本文整理汇总了C#中WindBot.Game.Network.GameServerPacket.ReadInt16方法的典型用法代码示例。如果您正苦于以下问题:C# GameServerPacket.ReadInt16方法的具体用法?C# GameServerPacket.ReadInt16怎么用?C# GameServerPacket.ReadInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindBot.Game.Network.GameServerPacket
的用法示例。
在下文中一共展示了GameServerPacket.ReadInt16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnSelectCounter
private void OnSelectCounter(GameServerPacket packet)
{
packet.ReadByte(); // player
int type = packet.ReadInt16();
int quantity = packet.ReadByte();
IList<ClientCard> cards = new List<ClientCard>();
IList<int> counters = new List<int>();
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
packet.ReadInt32(); // card id
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation) packet.ReadByte();
int seq = packet.ReadByte();
int num = packet.ReadByte();
cards.Add(_duel.GetCard(player, loc, seq));
counters.Add(num);
}
IList<int> used = _ai.OnSelectCounter(type, quantity, cards, counters);
byte[] result = new byte[used.Count];
for (int i = 0; i < quantity; ++i)
result[i] = (byte) used[i];
GameClientPacket reply = new GameClientPacket(CtosMessage.Response);
reply.Write(result);
Connection.Send(reply);
}
示例2: OnChat
private void OnChat(GameServerPacket packet)
{
packet.ReadInt16(); // player
string msg=packet.ReadUnicode(256); // message
Console.WriteLine("Message:"+msg);
}
示例3: OnStart
private void OnStart(GameServerPacket packet)
{
int type = packet.ReadByte();
_duel.IsFirst = (type & 0xF) == 0;
_duel.LifePoints[GetLocalPlayer(0)] = packet.ReadInt32();
_duel.LifePoints[GetLocalPlayer(1)] = packet.ReadInt32();
int deck = packet.ReadInt16();
int extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(0)].Init(deck, extra);
deck = packet.ReadInt16();
extra = packet.ReadInt16();
_duel.Fields[GetLocalPlayer(1)].Init(deck, extra);
if (!IsInGame())
{
Logger.WriteLine("AI is watch.");
Connection.Close();
return;
}
Logger.WriteLine("Duel started: " + _room.Names[0] + " versus " + _room.Names[1]);
_ai.OnStart();
}
示例4: OnChat
private void OnChat(GameServerPacket packet)
{
packet.ReadInt16(); // player
packet.ReadUnicode(256); // message
}