private void CreateDataGroup(TankViewModelBase tank)
        {
            var groupViewDescriptor = new DataGroupViewDescriptor("TurretRotator");

            groupViewDescriptor.Items.Add(new DataItemViewDescriptor("Health", HealthDescriptor.SpecifySource(tank, this)));
            this.DataViewModel = new DataViewModel(groupViewDescriptor, tank.Owner)
            {
                ShowHeader = false
            };
            this.DataViewModel.DeltaValueDisplayMode = DeltaValueDisplayMode.Icon;

            this.DataViewModel.Tank = tank;
        }
        public CrewViewModelCollection Clone(TankViewModelBase owner, TankViewModelCloneFlags flags)
        {
            var clone = new CrewViewModelCollection(_commandBindings);

            foreach (var crew in this)
            {
                var deepCopy = false;
                foreach (var role in crew.Crew.AllRoles)
                {
                    switch (role)
                    {
                    case CrewRoleType.Commander:
                        deepCopy = (flags & TankViewModelCloneFlags.Commander) == TankViewModelCloneFlags.Commander;
                        break;

                    case CrewRoleType.Driver:
                        deepCopy = (flags & TankViewModelCloneFlags.Driver) == TankViewModelCloneFlags.Driver;
                        break;

                    case CrewRoleType.Gunner:
                        deepCopy = (flags & TankViewModelCloneFlags.Gunner) == TankViewModelCloneFlags.Gunner;
                        break;

                    case CrewRoleType.Loader:
                        deepCopy = (flags & TankViewModelCloneFlags.Loader) == TankViewModelCloneFlags.Loader;
                        break;

                    case CrewRoleType.Radioman:
                        deepCopy = (flags & TankViewModelCloneFlags.Radioman) == TankViewModelCloneFlags.Radioman;
                        break;
                    }

                    if (deepCopy)
                    {
                        break;
                    }
                }

                if (deepCopy)
                {
                    clone.Add(crew.Clone(owner, crew.Index));
                }
                else
                {
                    clone.Add(crew);
                }
            }
            return(clone);
        }
 public EmptyAccessoryViewModel(CommandBindingCollection commandBindings, TankViewModelBase owner)
     : base(commandBindings, owner)
 {
 }
Exemplo n.º 4
0
 public AccessoryViewModel(CommandBindingCollection commandBindings, Accessory accessory, TankViewModelBase owner)
     : base(commandBindings, owner)
 {
     this.Accessory = accessory;
     this.Price     = new PriceViewModel(accessory.Price, accessory.CurrencyType);
     this.Icon      = "gui" + accessory.Icon.Substring(2);
 }
Exemplo n.º 5
0
 public HullViewModel(CommandBindingCollection commandBindings, IHull hull, TankViewModelBase owner)
     : base(commandBindings, hull, owner)
 {
 }
Exemplo n.º 6
0
 public RemoveConsumableViewModel(CommandBindingCollection commandBindings, TankViewModelBase owner)
     : base(commandBindings, owner)
 {
     this.EquipCommand = new RelayCommand(this.Equip);
 }
Exemplo n.º 7
0
 public EmptyEquipmentViewModel(CommandBindingCollection commandBindings, TankViewModelBase owner)
     : base(commandBindings, owner)
 {
 }
Exemplo n.º 8
0
 public override void CompareTo(TankViewModelBase tank, bool?useInvertedComparation = null, DeltaValueDisplayMode?deltaValueDisplayMode = null)
 {
     // do nothing
 }
 public ReferenceTankChangedEventArgs(TankViewModelBase tank)
 {
     this.Tank = tank;
 }
Exemplo n.º 10
0
 public ConsumableViewModel(CommandBindingCollection commandBindings, Consumable consumable, TankViewModelBase owner)
     : base(commandBindings, consumable, owner)
 {
     this.EquipCommand = Command.FromAction(this.CommandBindings, this.Equip);
     this.Icon         = $"gui/maps/icons/artefact/{consumable.Icon}.png";
 }
 public DamagableModuleViewModel(CommandBindingCollection commandBindings, IDamageableModule module, TankViewModelBase owner)
     : base(commandBindings, module, owner)
 {
     this.Health = new HealthViewModel(module.MaxHealth, module.MaxRegenHealth);
 }
Exemplo n.º 12
0
 public EmptyConsumableViewModel(CommandBindingCollection commandBindings, TankViewModelBase owner)
     : base(commandBindings, owner)
 {
 }
Exemplo n.º 13
0
 public FuelTankViewModel(CommandBindingCollection commandBindings, IFuelTank fuelTank, TankViewModelBase owner)
     : base(commandBindings, fuelTank, owner)
 {
     this.CreateDataGroup(owner);
 }
Exemplo n.º 14
0
 public EquipmentViewModel(CommandBindingCollection commandBindings, Equipment equipment, TankViewModelBase owner)
     : base(commandBindings, equipment, owner)
 {
     this.EquipCommand = new RelayCommand(this.Equip);
 }
Exemplo n.º 15
0
 public ModuleViewModel(CommandBindingCollection commandBindings, IModule module, TankViewModelBase owner)
     : base(commandBindings, module)
 {
     this.Owner = owner;
 }