Parse() public static method

public static Parse ( Player p ) : PlayerItem
p Sanguosha.Core.Players.Player
return PlayerItem
Ejemplo n.º 1
0
        public static AskForCardUsageResponse Parse(int id, ISkill skill, List <Card> cards, List <Player> players, int wrtPlayerId)
        {
            AskForCardUsageResponse response = new AskForCardUsageResponse();

            response.Id        = id;
            response.SkillItem = SkillItem.Parse(skill);
            if (cards == null)
            {
                response.CardItems = null;
            }
            else
            {
                response.CardItems = new List <CardItem>();
                foreach (var card in cards)
                {
                    response.CardItems.Add(CardItem.Parse(card, wrtPlayerId));
                }
            }
            if (players == null)
            {
                response.PlayerItems = null;
            }
            else
            {
                response.PlayerItems = new List <PlayerItem>();
                foreach (var player in players)
                {
                    response.PlayerItems.Add(PlayerItem.Parse(player));
                }
            }
            return(response);
        }
Ejemplo n.º 2
0
 public void MoveHandCard(int from, int to)
 {
     networkService.Send(new HandCardMovementNotification()
     {
         From = from, To = to, PlayerItem = PlayerItem.Parse(SelfId)
     });
 }
Ejemplo n.º 3
0
        public static DeckPlaceItem Parse(DeckPlace dp)
        {
            DeckPlaceItem dpi = new DeckPlaceItem();

            dpi.PlayerItem = PlayerItem.Parse(dp.Player);
            dpi.DeckName   = dp.DeckType.AbbriviatedName;
            return(dpi);
        }
Ejemplo n.º 4
0
 public void SendMultipleCardUsageResponded(Player player)
 {
     for (int i = 0; i < server.MaxClients; i++)
     {
         server.SendPacket(i, new MultiCardUsageResponded()
         {
             PlayerItem = PlayerItem.Parse(player)
         });
     }
 }
Ejemplo n.º 5
0
        public static SkillItem Parse(ISkill skill)
        {
            if (skill == null)
            {
                return(null);
            }
            SkillItem result;

            if (skill is CheatSkill)
            {
                CheatSkillItem csi = new CheatSkillItem();
                CheatSkill     cs  = skill as CheatSkill;
                result        = csi;
                csi.CardId    = cs.CardId;
                csi.CheatType = (int)cs.CheatType;
                csi.SkillName = cs.SkillName;
            }
            else if (skill is IAdditionalTypedSkill)
            {
                var atsi = new AdditionalTypedSkillItem();
                var ats  = skill as IAdditionalTypedSkill;
                result = atsi;
                atsi.AdditionalTypeId = GameEngine.Serialize(ats.AdditionalType);
            }
            else
            {
                result = new SkillItem();
            }

            result.PlayerItem = PlayerItem.Parse(skill.Owner);
            if (skill.Owner != null)
            {
                result.SkillId = (byte)skill.Owner.ActionableSkills.IndexOf(skill);
            }
            return(result);
        }