本文整理汇总了C#中WindBot.Game.Network.GameServerPacket类的典型用法代码示例。如果您正苦于以下问题:C# GameServerPacket类的具体用法?C# GameServerPacket怎么用?C# GameServerPacket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameServerPacket类属于WindBot.Game.Network命名空间,在下文中一共展示了GameServerPacket类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnPacket
public void OnPacket(GameServerPacket packet)
{
StocMessage id = packet.ReadStoc();
if (id == StocMessage.GameMsg)
{
GameMessage msg = packet.ReadGameMsg();
if (_messages.ContainsKey(msg)){
_messages[msg](packet);
#if DEBUG
Logger.WriteLine("GameMessage deal "+msg);
#endif
}
else{
#if DEBUG
Logger.WriteLine("GameMessage don't deal "+msg);
#endif
}
return;
}
if (_packets.ContainsKey(id)){
_packets[id](packet);
#if DEBUG
Logger.WriteLine("id deal "+id);
#endif
}else{
#if DEBUG
Logger.WriteLine("id don't deal "+id);
#endif
}
}
开发者ID:247321453,项目名称:YgoServer,代码行数:31,代码来源:GameBehavior.cs
示例2: OnPacket
public void OnPacket(GameServerPacket packet)
{
StocMessage id = packet.ReadStoc();
if (id == StocMessage.GameMsg)
{
GameMessage msg = packet.ReadGameMsg();
if (_messages.ContainsKey(msg))
_messages[msg](packet);
return;
}
if (_packets.ContainsKey(id))
_packets[id](packet);
}
开发者ID:Ygocore,项目名称:windbot_v0.1.1,代码行数:13,代码来源:GameBehavior.cs
示例3: OnSelectDisfield
private void OnSelectDisfield(GameServerPacket packet)
{
OnSelectPlace(packet);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs
示例4: OnNewTurn
private void OnNewTurn(GameServerPacket packet)
{
_duel.Turn++;
_duel.Player = GetLocalPlayer(packet.ReadByte());
_ai.OnNewTurn();
}
开发者ID:247321453,项目名称:YgoServer,代码行数:6,代码来源:GameBehavior.cs
示例5: 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);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:28,代码来源:GameBehavior.cs
示例6: OnAnnounceAttrib
private void OnAnnounceAttrib(GameServerPacket packet)
{
IList<CardAttribute> attributes = new List<CardAttribute>();
packet.ReadByte(); // player
int count = packet.ReadByte();
int available = packet.ReadInt32();
int filter = 0x1;
for (int i = 0; i < 7; ++i)
{
if ((available & filter) != 0)
attributes.Add((CardAttribute) filter);
filter <<= 1;
}
attributes = _ai.OnAnnounceAttrib(count, attributes);
int reply = 0;
for (int i = 0; i < count; ++i)
reply += (int)attributes[i];
Connection.Send(CtosMessage.Response, reply);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:19,代码来源:GameBehavior.cs
示例7: OnAnnounceNumber
private void OnAnnounceNumber(GameServerPacket packet)
{
IList<int> numbers = new List<int>();
packet.ReadByte(); // player
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
numbers.Add(packet.ReadInt32());
Connection.Send(CtosMessage.Response, _ai.OnAnnounceNumber(numbers));
}
开发者ID:247321453,项目名称:YgoServer,代码行数:9,代码来源:GameBehavior.cs
示例8: OnSelectOption
private void OnSelectOption(GameServerPacket packet)
{
IList<int> options = new List<int>();
packet.ReadByte(); // player
int count = packet.ReadByte();
for (int i = 0; i < count; ++i)
options.Add(packet.ReadInt32());
Connection.Send(CtosMessage.Response, _ai.OnSelectOption(options));
}
开发者ID:247321453,项目名称:YgoServer,代码行数:9,代码来源:GameBehavior.cs
示例9: OnDamage
private void OnDamage(GameServerPacket packet)
{
int player = GetLocalPlayer(packet.ReadByte());
int final = _duel.LifePoints[player] - packet.ReadInt32();
if (final < 0) final = 0;
_duel.LifePoints[player] = final;
}
开发者ID:247321453,项目名称:YgoServer,代码行数:7,代码来源:GameBehavior.cs
示例10: OnChainSorting
private void OnChainSorting(GameServerPacket packet)
{
Connection.Send(CtosMessage.Response, -1);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs
示例11: OnUpdateCard
private void OnUpdateCard(GameServerPacket packet)
{
int player = GetLocalPlayer(packet.ReadByte());
int loc = packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadInt32(); // ???
ClientCard card = _duel.GetCard(player, (CardLocation)loc, seq);
if (card == null) return;
card.Update(packet,_duel);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:13,代码来源:GameBehavior.cs
示例12: OnChaining
private void OnChaining(GameServerPacket packet)
{
packet.ReadInt32(); // card id
int pcc = GetLocalPlayer(packet.ReadByte());
int pcl = packet.ReadByte();
int pcs = packet.ReadSByte();
int subs = packet.ReadSByte();
ClientCard card = _duel.GetCard(pcc, pcl, pcs, subs);
int cc = GetLocalPlayer(packet.ReadByte());
_ai.OnChaining(card, cc);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:11,代码来源:GameBehavior.cs
示例13: OnChainEnd
private void OnChainEnd(GameServerPacket packet)
{
_ai.OnChainEnd();
}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs
示例14: OnPosChange
private void OnPosChange(GameServerPacket packet)
{
packet.ReadInt32(); // card id
int pc = GetLocalPlayer(packet.ReadByte());
int pl = packet.ReadByte();
int ps = packet.ReadSByte();
packet.ReadSByte(); // pp
int cp = packet.ReadSByte();
ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);
if (card != null)
card.Position = cp;
}
开发者ID:247321453,项目名称:YgoServer,代码行数:12,代码来源:GameBehavior.cs
示例15: OnMove
private void OnMove(GameServerPacket packet)
{
int cardId = packet.ReadInt32();
int pc = GetLocalPlayer(packet.ReadByte());
int pl = packet.ReadByte();
int ps = packet.ReadSByte();
packet.ReadSByte(); // pp
int cc = GetLocalPlayer(packet.ReadByte());
int cl = packet.ReadByte();
int cs = packet.ReadSByte();
int cp = packet.ReadSByte();
packet.ReadInt32(); // reason
ClientCard card = _duel.GetCard(pc, (CardLocation)pl, ps);
if ((pl & (int)CardLocation.Overlay) != 0)
{
pl = pl & 0x7f;
card = _duel.GetCard(pc, (CardLocation)pl, ps);
if (card != null)
card.Overlays.Remove(cardId);
}
else
_duel.RemoveCard((CardLocation)pl, card, pc, ps);
if ((cl & (int)CardLocation.Overlay) != 0)
{
cl = cl & 0x7f;
card = _duel.GetCard(cc, (CardLocation)cl, cs);
if (card != null)
card.Overlays.Add(cardId);
}
else
{
_duel.AddCard((CardLocation)cl, cardId, cc, cs, cp);
if ((pl & (int)CardLocation.Overlay) == 0 && card != null)
{
ClientCard newcard = _duel.GetCard(cc, (CardLocation)cl, cs);
if (newcard != null)
newcard.Overlays.AddRange(card.Overlays);
}
}
}
开发者ID:247321453,项目名称:YgoServer,代码行数:43,代码来源:GameBehavior.cs
示例16: OnLpUpdate
private void OnLpUpdate(GameServerPacket packet)
{
int player = GetLocalPlayer(packet.ReadByte());
_duel.LifePoints[player] = packet.ReadInt32();
}
开发者ID:247321453,项目名称:YgoServer,代码行数:5,代码来源:GameBehavior.cs
示例17: OnSelectEffectYn
private void OnSelectEffectYn(GameServerPacket packet)
{
packet.ReadByte(); // player
int cardId = packet.ReadInt32();
int player = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
packet.ReadByte();
ClientCard card = _duel.GetCard(player, loc, seq);
if (card == null)
{
Connection.Send(CtosMessage.Response, 0);
return;
}
if (card.Id == 0) card.SetId(cardId);
int reply = _ai.OnSelectEffectYn(card) ? (1) : (0);
Connection.Send(CtosMessage.Response, reply);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:22,代码来源:GameBehavior.cs
示例18: OnSelectPosition
private void OnSelectPosition(GameServerPacket packet)
{
packet.ReadByte(); // player
int cardId = packet.ReadInt32();
int pos = packet.ReadByte();
if (pos == 0x1 || pos == 0x2 || pos == 0x4 || pos == 0x8)
{
Connection.Send(CtosMessage.Response, pos);
return;
}
IList<CardPosition> positions = new List<CardPosition>();
if ((pos & (int)CardPosition.FaceUpAttack) != 0)
positions.Add(CardPosition.FaceUpAttack);
if ((pos & (int)CardPosition.FaceDownAttack) != 0)
positions.Add(CardPosition.FaceDownAttack);
if ((pos & (int)CardPosition.FaceUpDefence) != 0)
positions.Add(CardPosition.FaceUpDefence);
if ((pos & (int)CardPosition.FaceDownDefence) != 0)
positions.Add(CardPosition.FaceDownDefence);
Connection.Send(CtosMessage.Response, (int)_ai.OnSelectPosition(cardId, positions));
}
开发者ID:247321453,项目名称:YgoServer,代码行数:21,代码来源:GameBehavior.cs
示例19: OnSelectIdleCmd
private void OnSelectIdleCmd(GameServerPacket packet)
{
packet.ReadByte(); // player
_duel.MainPhase = new MainPhase();
MainPhase main = _duel.MainPhase;
int count;
for (int k = 0; k < 5; k++)
{
count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
packet.ReadInt32(); // card id
int con = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
ClientCard card = _duel.GetCard(con, loc, seq);
if (card == null) continue;
card.ActionIndex[k] = i;
switch (k)
{
case 0:
main.SummonableCards.Add(card);
break;
case 1:
main.SpecialSummonableCards.Add(card);
break;
case 2:
main.ReposableCards.Add(card);
break;
case 3:
main.MonsterSetableCards.Add(card);
break;
case 4:
main.SpellSetableCards.Add(card);
break;
}
}
}
count = packet.ReadByte();
for (int i = 0; i < count; ++i)
{
packet.ReadInt32(); // card id
int con = GetLocalPlayer(packet.ReadByte());
CardLocation loc = (CardLocation)packet.ReadByte();
int seq = packet.ReadByte();
int desc = packet.ReadInt32();
ClientCard card = _duel.GetCard(con, loc, seq);
if (card == null) continue;
card.ActionIndex[5] = i;
if (card.ActionActivateIndex.ContainsKey(desc))
card.ActionActivateIndex.Remove(desc);
card.ActionActivateIndex.Add(desc, i);
main.ActivableCards.Add(card);
main.ActivableDescs.Add(desc);
}
main.CanBattlePhase = packet.ReadByte() != 0;
main.CanEndPhase = packet.ReadByte() != 0;
packet.ReadByte(); // CanShuffle
Connection.Send(CtosMessage.Response, _ai.OnSelectIdleCmd(main).ToValue());
}
开发者ID:247321453,项目名称:YgoServer,代码行数:64,代码来源:GameBehavior.cs
示例20: OnSelectTribute
private void OnSelectTribute(GameServerPacket packet)
{
InternalOnSelectCard(packet, _ai.OnSelectTribute);
}
开发者ID:247321453,项目名称:YgoServer,代码行数:4,代码来源:GameBehavior.cs
注:本文中的WindBot.Game.Network.GameServerPacket类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论