Ejemplo n.º 1
0
        public LookupModel(string key, SectorModel sector, LookupRules rules, PlayerModel player, bool readOnly)
            : base(key)
        {
            this.Cards = new ModelCollection(this);

              this.Player = player;
              this.ReadOnly = readOnly;
              this.Sector = sector;
              this.Rules = rules;
              if(rules == null)
            this.Rules = new LookupRules(LookupStyle.All, -1, new List<string>());

              int i = 0;
              switch(rules.Style)
              {
            case LookupStyle.All:
            case LookupStyle.KeepVisibleTop:
            case LookupStyle.Top:
              this.Sector.Cards.CollectionChanged += new CollectionChangedEventHandler(Cards_CollectionChanged);
              for(i = 0; i < sector.Cards.Count(); i++)
              {
            if(this.Rules.Style == LookupStyle.Top && i < Rules.Amount)
              visibleCards.Add(sector.Cards.ElementAt(i).Key);
            InsertCard(sector.Cards.ElementAt(i).Key, i);
              }
              break;
              }
        }
 void Log(PlayerModel player)
 {
     string playerName = player.Info.NickName;
       string commandName = Receiver.GetCommandByKey(COMMANDCODE).Data.Name;
       Receiver.Console.WriteLine(MessageCategory.Warning, string.Concat(
     "[", playerName, "] ", commandName));
 }
Ejemplo n.º 3
0
        public CardModel(string key, PlayerModel owner, CardItem data, bool isPawn)
            : base(owner, key)
        {
            Data = data;
              IsPawn = isPawn;
              Position = new ObservableProperty<CardPosition, CardModel>(this, new CardPosition(0, 0));
              Visibility = new ObservableProperty<CardVisibility, CardModel>(this, CardVisibility.Visible);
              Reversed = new ObservableProperty<bool, CardModel>(this, false);
              Locked = new ObservableProperty<bool, CardModel>(this, false);
              Rotated = new ObservableProperty<bool, CardModel>(this, false);
              CustomCharacteristics = new ObservableProperty<string, CardModel>(this, string.Empty);
              Tokens = new ModelCollection(this);

              SaveState();

              this.Visibility.Changed += new EventHandler<ChangedEventArgs<CardVisibility>>(Visibility_Changed);
        }
 void Log(PlayerModel destinationPlayer, SectorModel sector)
 {
     string playerName = Receiver.GetPlayerByKey(Invoker).Info.NickName;
     string commandName = string.Empty;
     switch(Arguments.Mode)
     {
       case DisplayCardsMode.ByKeys:
     commandName = Receiver.GetCommandByKey(COMMANDCODE_MULTIPLE).Data.Name;
     commandName = commandName.Replace("#amount#", Arguments.CardKeys.Count.ToString());
     break;
       case DisplayCardsMode.Random:
     commandName = Receiver.GetCommandByKey(COMMANDCODE_RANDOM).Data.Name;
     commandName = commandName.Replace("#amount#", Arguments.Amount.ToString());
     break;
     }
     Receiver.Console.WriteLog(string.Concat(
       "[", playerName, "] ",
       commandName, " (", sector.Data.Name, ")", ">", destinationPlayer.Info.NickName));
 }