Exemple #1
0
    public void MoveAll(PCardArea Source, PCardArea Destination)
    {
        List <PCard> CardsToThrow = new List <PCard>(Source.CardList);

        CardsToThrow.ForEach((PCard Card) => {
            MoveCard(Card, Source, Destination);
        });
    }
Exemple #2
0
 public PCardManager(PGame _Game)
 {
     Game           = _Game;
     PlayerAreaList = new List <PPlayerCardArea>();
     CardHeap       = new PCardArea("牌堆");
     ThrownCardHeap = new PCardArea("弃牌堆");
     SettlingArea   = new PCardArea("结算区");
 }
Exemple #3
0
 public PPlayerCardArea(PPlayer _Owner)
 {
     Owner             = _Owner;
     Name              = Owner.Name + "的区域";
     HandCardArea      = new PCardArea(Owner.Name + "的手牌", Owner);
     EquipmentCardArea = new PCardArea(Owner.Name + "的装备区", Owner);
     AmbushCardArea    = new PCardArea(Owner.Name + "的伏兵区", Owner);
     OutOfGameArea     = new PCardArea(Owner.Name + "的移出游戏区", Owner);
 }
Exemple #4
0
 public void MoveCard(PCard Card, PCardArea Source, PCardArea Destination)
 {
     PLogger.Log("[" + Card.Name + "]将要从[" + Source.Name + "]移动到[" + Destination.Name + "]");
     if (Source.CardList.Contains(Card))
     {
         PMoveCardTag MoveCardTag = Game.Monitor.CallTime(PTime.Card.LeaveAreaTime, new PMoveCardTag(Card, Source, Destination));
         MoveCardTag.Source.CardList.Remove(Card);
         if (MoveCardTag.Source.Owner != null)
         {
             if (MoveCardTag.Source.IsHandCardArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshHandCardsOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshHandCardNumberOrder(MoveCardTag.Source.Owner.Index.ToString(), MoveCardTag.Source.CardNumber.ToString()));
             }
             else if (MoveCardTag.Source.IsEquipmentArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshEquipmentsOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshEquipStringOrder(MoveCardTag.Source.Owner));
             }
             else if (MoveCardTag.Source.IsAmbushArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Source.Owner, new PRefreshAmbushOrder(MoveCardTag.Source.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshAmbushStringOrder(MoveCardTag.Source.Owner));
             }
         }
         if (MoveCardTag.Destination.IsEquipmentArea())
         {
             PCard CurrentCard = MoveCardTag.Destination.Owner.GetEquipment(Card.Type);
             if (CurrentCard != null)
             {
                 MoveCard(CurrentCard, MoveCardTag.Destination, ThrownCardHeap);
             }
         }
         if (!MoveCardTag.Destination.Equals(SettlingArea))
         {
             Card.Model = PObject.ListSubTypeInstances <PCardModel>().Find((PCardModel Model) => Model.Name.Equals(Card.Name));
         }
         Game.Monitor.CallTime(PTime.Card.EnterAreaTime, MoveCardTag);
         MoveCardTag.Destination.CardList.Add(Card);
         if (MoveCardTag.Destination.Owner != null)
         {
             if (MoveCardTag.Destination.IsHandCardArea())
             {
                 MoveCardTag.Destination.Arrange();
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshHandCardsOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshHandCardNumberOrder(MoveCardTag.Destination.Owner.Index.ToString(), MoveCardTag.Destination.CardNumber.ToString()));
             }
             else if (MoveCardTag.Destination.IsEquipmentArea())
             {
                 MoveCardTag.Destination.Arrange();
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshEquipmentsOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshEquipStringOrder(MoveCardTag.Destination.Owner));
             }
             else if (MoveCardTag.Destination.IsAmbushArea())
             {
                 PNetworkManager.NetworkServer.TellClient(MoveCardTag.Destination.Owner, new PRefreshAmbushOrder(MoveCardTag.Destination.ToStringArray()));
                 PNetworkManager.NetworkServer.TellClients(new PRefreshAmbushStringOrder(MoveCardTag.Destination.Owner));
             }
         }
     }
 }
Exemple #5
0
 public void ThrowAll(PCardArea Area)
 {
     MoveAll(Area, ThrownCardHeap);
 }
Exemple #6
0
 public PMoveCardTag(PCard _Card, PCardArea _Source, PCardArea _Destination) : base(TagName)
 {
     AppendField(CardFieldName, _Card);
     AppendField(SourceFieldName, _Source);
     AppendField(DestinationFieldName, _Destination);
 }