Ejemplo n.º 1
0
        private void AddClicked(object sender, RoutedEventArgs e)
        {
            e.Handled = true;

            // A double-click can only select a marker in its own list
            // (Little bug here: double-clicking in the empty zone of a list with a selected marker adds it)
            if(sender is ListBox && ((ListBox)sender).SelectedIndex == -1) return;

            if(recentList.SelectedIndex != -1) result = (Data.MarkerModel)recentList.SelectedItem;
            if(allList.SelectedIndex != -1) result = (Data.MarkerModel)allList.SelectedItem;
            if(defaultList.SelectedIndex != -1)
            {
                DefaultMarkerModel m = ((DefaultMarkerModel)defaultList.SelectedItem);
                m.SetName(nameBox.Text);
                result = m.Clone();
            }

            if(result == null) return;

            int qty;
            if(!int.TryParse(quantityBox.Text, out qty) || qty < 0)
            {
                var anim = new ColorAnimation(Colors.Red, new Duration(TimeSpan.FromMilliseconds(800))) { AutoReverse = true };
                validationBrush.BeginAnimation(SolidColorBrush.ColorProperty, anim, HandoffBehavior.Compose);
                return;
            }

            Program.Game.AddRecentMarker(result);
            DialogResult = true;
        }
Ejemplo n.º 2
0
        public void AddMarker(Player player, Card card, Guid id, string name, ushort count)
        {
            Data.MarkerModel   model = Program.Game.GetMarkerModel(id);
            DefaultMarkerModel defaultMarkerModel = model as DefaultMarkerModel;

            if (defaultMarkerModel != null)
            {
                (defaultMarkerModel).SetName(name);
            }
            // Ignore markers created by oneself (already created for responsiveness issues)
            if (player != Player.LocalPlayer)
            {
                card.AddMarker(model, count);
            }
            if (count != 0)
            {
                Program.Trace.TraceEvent(TraceEventType.Information, EventIds.Event | EventIds.PlayerFlag(player),
                                         "{0} adds {1} {2} marker(s) on {3}", player, count, model, card);
            }
        }
Ejemplo n.º 3
0
 public Marker(Card card, Data.MarkerModel model)
 {
     this.card = card; _model = model;
 }