Example #1
0
 private void _game_NewHUDItemEvent(object sender, HUDItemEventArgs e)
 {
     if (this.NewHUDItem != null)
     {
         NewHUDItem(this, e);
     }
 }
Example #2
0
 private void _game_RemoveHUDItemEvent(object sender, HUDItemEventArgs e)
 {
     if (RemoveHUDItem != null)
     {
         RemoveHUDItem(this, e);
     }
 }
Example #3
0
 private void _game_UpdateHUDItemEvent(object sender, HUDItemEventArgs e)
 {
     if (this.UpdateHUDItem != null)
     {
         UpdateHUDItem(this, e);
     }
 }
Example #4
0
        void item_Changed(object sender, HUDItemEventArgs e)
        {
            HUDItem item = sender as HUDItem;

            if (UpdateHUDItemEvent != null)
            {
                UpdateHUDItemEvent(this, new HUDItemEventArgs()
                {
                    Item = item
                });
            }
        }
Example #5
0
        private void _engine_RemoveHUDItem(object sender, HUDItemEventArgs e)
        {
            this.Dispatcher.Invoke((Action)(() =>
            {
                var hudItems = this.HUDGrid.Children;
                List <FrameworkElement> removeList = new List <FrameworkElement>();

                foreach (FrameworkElement element in hudItems)
                {
                    if (element.Name == e.Item.Name)
                    {
                        removeList.Add(element);
                    }
                }

                removeList.ForEach(x => HUDGrid.Children.Remove(x));
            }));
        }
Example #6
0
        void _hudItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (NewHUDItemEvent != null && e.NewItems != null)
            {
                var args = new HUDItemEventArgs();

                foreach (HUDItem item in e.NewItems)
                {
                    item.Changed += item_Changed;
                    args.Item     = item;
                    NewHUDItemEvent(this, args);
                }
            }
            if (RemoveHUDItemEvent != null && e.OldItems != null)
            {
                var args = new HUDItemEventArgs();
                foreach (HUDItem item in e.OldItems)
                {
                    item.Changed -= item_Changed;
                    args.Item     = item;
                    RemoveHUDItemEvent(this, args);
                }
            }
        }
Example #7
0
 private void _engine_UpdateHUDItem(object sender, HUDItemEventArgs e)
 {
     UpdateHUDItem(e.Item);
 }
Example #8
0
 private void _engine_NewHUDItem(object sender, HUDItemEventArgs e)
 {
     AddHUDItem(e.Item);
 }