Beispiel #1
0
 private void OnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     if (UnitsChanged != null)
     {
         UnitsChanged(action, affectedUnit);
     }
 }
Beispiel #2
0
 private void OnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     if (UnitsChanged != null)
     {
         UnitsChanged(action, affectedUnit);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Update selection.
 /// </summary>
 /// <param name="newUnit">Unit that will be added to selection or replace existing unit.</param>
 /// <param name="slot">Selection slot to update</param>
 public void UpdateSelectedUnit(IUnitModel newUnit, SelectionSlot slot)
 {
     _selectedUnits[slot] = newUnit;
     if (SelectionChanged != null)
     {
         SelectionChanged(slot, newUnit);
     }
 }
 public void Initialize(IUnitModel unit)
 {
     UnsubscribeFromEvents();
     _unit = unit;
     OnShellstarListChanged();
     Navigate(0);
     SubscribeToEvents();
 }
Beispiel #5
0
 /// <summary>
 /// Update selection.
 /// </summary>
 /// <param name="newUnit">Unit that will be added to selection or replace existing unit.</param>
 /// <param name="slot">Selection slot to update</param>
 public void UpdateSelectedUnit(IUnitModel newUnit, SelectionSlot slot)
 {
     _selectedUnits[slot] = newUnit;
     if (SelectionChanged != null)
     {
         SelectionChanged(slot, newUnit);
     }
 }
Beispiel #6
0
        public void AddUnit(IUnitModel unitModel)
        {
            if (unitModel == null || string.IsNullOrEmpty(unitModel.Name))
            {
                throw new ArgumentException(Resources.UnitListModel_AddUnit_MustHaveName, "unitModel");
            }

            Models.Add(unitModel);
            OnUnitsChanged(ListAction.Added, unitModel);
        }
Beispiel #7
0
        public void AddUnit(IUnitModel unitModel)
        {
            if (unitModel == null || string.IsNullOrEmpty(unitModel.Name))
            {
                throw new ArgumentException(Resources.UnitListModel_AddUnit_MustHaveName, "unitModel");
            }

            Models.Add(unitModel);
            OnUnitsChanged(ListAction.Added, unitModel);
        }
Beispiel #8
0
        private void Deselect(IUnitModel affectedUnit)
        {
            var affectedKeys = _selectedUnits.Where(kvp => kvp.Value == affectedUnit).Select(kvp => kvp.Key).ToArray();

            foreach (var key in affectedKeys)
            {
                _selectedUnits.Remove(key);
                SelectionChanged(key, null);
            }
        }
 public UnitInfoPaneViewModel(IUnitModel unitModel, IUnitSetupModel unitSetupModel, INavigationService navigationService)
 {
     if (unitModel == null)
     {
         throw new ArgumentNullException("unitModel");
     }
     _unitModel = unitModel;
     _unitSetupModel = unitSetupModel;
     ShowShellstars = navigationService.GetShellstarListRequest(AcquireShellstarListContext);
     SubscribeToEvents();
 }
Beispiel #10
0
 public UnitInfoPaneViewModel(IUnitModel unitModel, IUnitSetupModel unitSetupModel, INavigationService navigationService)
 {
     if (unitModel == null)
     {
         throw new ArgumentNullException("unitModel");
     }
     _unitModel      = unitModel;
     _unitSetupModel = unitSetupModel;
     ShowShellstars  = navigationService.GetShellstarListRequest(AcquireShellstarListContext);
     SubscribeToEvents();
 }
Beispiel #11
0
 private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     switch (action)
     {
         case ListAction.Reset:
             ResetSelection();
             return;
         case ListAction.Removed:
             Deselect(affectedUnit);
             return;
     }
 }
        public void SetupData(IUnitModel attacker, IUnitModel target)
        {
            _launchBoardModel = new LaunchBoardModel(attacker, target, _currentTurnModel);
            _launchPrerequisites.Initialize(_launchBoardModel);
            _targetingAvid.Initialize(_launchBoardModel);
            _shotGeometry.Initialize(_launchBoardModel);
            _rocWorksheet.Initialize(_launchBoardModel);
            _missilePositionAdjustment.Initialize(_launchBoardModel);
            _missileAcceleration.Initialize(_launchBoardModel);

            OnPropertyChanged(Properties.Title);
        }
Beispiel #13
0
        private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
        {
            switch (action)
            {
            case ListAction.Reset:
                ResetSelection();
                return;

            case ListAction.Removed:
                Deselect(affectedUnit);
                return;
            }
        }
        public void Initialize(IUnitModel target, IShellstarModel shellstar, AvidWindow[] launchWindows)
        {
            UnsubscribeFromEvents();
            _target = target;
            _shellstar = shellstar;
            CanAttach = GetCanAttachShellstar();
            Caption = GetCaption();
            IsDataAvailable = GetIsDataAvailable();

            string targetName = _target != null ? _target.Name : string.Empty;
            _shellstarViewModel.Initialize(shellstar, targetName);
            _launchWindowControlViewModel.Initialize(_shellstar != null ? _shellstar.EvasionInfo : null, launchWindows);
            SubscribeToEvents();
        }
        public void Initialize(IUnitModel target, IShellstarModel shellstar, AvidWindow[] launchWindows)
        {
            UnsubscribeFromEvents();
            _target         = target;
            _shellstar      = shellstar;
            CanAttach       = GetCanAttachShellstar();
            Caption         = GetCaption();
            IsDataAvailable = GetIsDataAvailable();

            string targetName = _target != null ? _target.Name : string.Empty;

            _shellstarViewModel.Initialize(shellstar, targetName);
            _launchWindowControlViewModel.Initialize(_shellstar != null ? _shellstar.EvasionInfo : null, launchWindows);
            SubscribeToEvents();
        }
        public void Initialize(object dataContext)
        {
            _newUnit = new UnitModel();

            if (!string.IsNullOrEmpty(_configurationController.StartingUnitPosition))
            {
                _newUnit.Position = HexGridCoordinate.Parse(_configurationController.StartingUnitPosition);
            }

            Position = _newUnit.Position.ToString();

            OnPropertyChanged(Properties.UnitName);
            OnPropertyChanged(Properties.Position);
            OnPropertyChanged(Properties.NoErrors);
            OnPropertyChanged(Properties.Configured);
        }
Beispiel #17
0
        public void Initialize(object dataContext)
        {
            _newUnit = new UnitModel();

            if (!string.IsNullOrEmpty(_configurationController.StartingUnitPosition))
            {
                _newUnit.Position = HexGridCoordinate.Parse(_configurationController.StartingUnitPosition);
            }

            Position = _newUnit.Position.ToString();

            OnPropertyChanged(Properties.UnitName);
            OnPropertyChanged(Properties.Position);
            OnPropertyChanged(Properties.NoErrors);
            OnPropertyChanged(Properties.Configured);
        }
Beispiel #18
0
 ////public ProductModel(ITypeModel typeModel, IAlternateIdModel alternateIdModel, IKitModel kitModel, ICustomFieldModel customFieldModel, IOptionModel optionModel, IUnitModel unitModel, IInventoryModel inventoryModel, IExternalIdModel externalIdModel, IVariantModel variantModel, IWebhookModel webHookModel, IBaseContextModel contextModel, ICategoryAssignmentModel categoryAssignmentModel)
 public ProductModel(ICustomFieldModel customFieldModel, ITypeModel typeModel, IAlternateIdModel alternateIdModel, IKitModel kitModel, IOptionModel optionModel, IUnitModel unitModel, IInventoryModel inventoryModel, IExternalIdModel externalIdModel, IVariantModel variantModel, IWebhookModel webHookModel, IBaseContextModel contextModel, ICategoryAssignmentModel categoryAssignmentModel, IOptions <Sheev.Common.Models.MongoDbSetting> mongoDbSettings, IOptions <Sheev.Common.Models.ApiUrlSetting> apiSettings)
 {
     _categoryAssignmentModel = categoryAssignmentModel;
     _webHookModel            = webHookModel;
     context = new Models.ContextModel(mongoDbSettings, apiSettings);
     ////context = contextModel;
     _variantModel     = variantModel;
     _externalIdModel  = externalIdModel;
     _inventoryModel   = inventoryModel;
     _unitModel        = unitModel;
     _optionModel      = optionModel;
     _customFieldModel = customFieldModel;
     _kitModel         = kitModel;
     _alternateIdModel = alternateIdModel;
     _typeModel        = typeModel;
 }
 private void UnitSetupModelOnSelectionChanged(SelectionSlot slot, IUnitModel newUnit)
 {
     if (slot == Slot)
     {
         UnsubscribeFromEvents();
         _selectedUnit = newUnit;
         PositionViewModel.SelectUnit(_selectedUnit);
         VectorsViewModel.SelectUnit(_selectedUnit);
         SubscribeToEvents();
         OnNewUnitSelected();
         UpdateShellstarInfo();
     }
     else
     {
         OnPropertyChanged(Properties.CanFire);
     }
 }
Beispiel #20
0
    public void Initialize(IUnitModel model)
    {
        _model = model;
        _model.OnTypeChanged += InstantiateNewUnitAnimation;

        var rectTransform = gameObject.AddComponent <RectTransform>();

        rectTransform.anchorMax        = new Vector2(.7f, .8f);
        rectTransform.anchorMin        = new Vector2(.3f, .2f);
        rectTransform.anchoredPosition = Vector2.zero;

        var collider = gameObject.AddComponent <BoxCollider2D>();

        collider.size   = rectTransform.rect.size / 2;
        collider.offset = new Vector2(0, -(rectTransform.rect.size.y / 4));

        InstantiateNewUnitAnimation();
    }
 private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     switch (action)
     {
         case ListAction.Added:
             _units.Add(new UnitInfoPaneViewModel(affectedUnit, _unitSetupModel, _navigationService));
             return;
         case ListAction.Removed:
             var affectedVm = _units.SingleOrDefault(un => un.Model == affectedUnit);
             if (affectedUnit != null)
             {
                 _units.Remove(affectedVm);
             }
             return;
         case ListAction.Reset:
             _units.Clear();
             _unitListModel.Models.ForEach(um => _units.Add(new UnitInfoPaneViewModel(um, _unitSetupModel, _navigationService)));
             return;
     }
 }
        private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
        {
            switch (action)
            {
            case ListAction.Added:
                _units.Add(new UnitInfoPaneViewModel(affectedUnit, _unitSetupModel, _navigationService));
                return;

            case ListAction.Removed:
                var affectedVm = _units.SingleOrDefault(un => un.Model == affectedUnit);
                if (affectedUnit != null)
                {
                    _units.Remove(affectedVm);
                }
                return;

            case ListAction.Reset:
                _units.Clear();
                _unitListModel.Models.ForEach(um => _units.Add(new UnitInfoPaneViewModel(um, _unitSetupModel, _navigationService)));
                return;
            }
        }
        public LaunchBoardModel(IUnitModel launchingUnit, IUnitModel targetUnit, ICurrentTurnModel currentTurn)
        {
            if (launchingUnit == null)
            {
                throw new ArgumentNullException("launchingUnit");
            }

            if (targetUnit == null)
            {
                throw new ArgumentNullException("targetUnit");
            }

            _avidCalculator           = ServiceFactory.Library.AvidCalculator;
            _hexGridCalculator        = ServiceFactory.Library.HexGridCalculator;
            _hexVectorUtility         = ServiceFactory.Library.HexVectorUtility;
            _firingSolutionCalculator = ServiceFactory.Library.FiringSolutionCalculator;
            _shellstarBuilder         = ServiceFactory.Library.ShellstarBuilder;
            _weaponSelectionModel     = new WeaponSelectionModel();

            _launchingUnit = launchingUnit;
            _targetUnit    = targetUnit;
            _currentTurn   = currentTurn;
        }
        public LaunchBoardModel(IUnitModel launchingUnit, IUnitModel targetUnit, ICurrentTurnModel currentTurn)
        {
            if (launchingUnit == null)
            {
                throw new ArgumentNullException("launchingUnit");
            }

            if (targetUnit == null)
            {
                throw new ArgumentNullException("targetUnit");
            }

            _avidCalculator = ServiceFactory.Library.AvidCalculator;
            _hexGridCalculator = ServiceFactory.Library.HexGridCalculator;
            _hexVectorUtility = ServiceFactory.Library.HexVectorUtility;
            _firingSolutionCalculator = ServiceFactory.Library.FiringSolutionCalculator;
            _shellstarBuilder = ServiceFactory.Library.ShellstarBuilder;
            _weaponSelectionModel = new WeaponSelectionModel();

            _launchingUnit = launchingUnit;
            _targetUnit = targetUnit;
            _currentTurn = currentTurn;
        }
Beispiel #25
0
 public void SelectUnit(IUnitModel unit)
 {
     _selectedUnit = unit;
     OnNewUnitSelected();
 }
 public void SelectUnit(IUnitModel unit)
 {
     _selectedUnit = unit;
     OnNewUnitSelected();
 }
 private void UnitSetupModelOnSelectionChanged(SelectionSlot slot, IUnitModel newUnit)
 {
     if (slot == Slot)
     {
         UnsubscribeFromEvents();
         _selectedUnit = newUnit;
         PositionViewModel.SelectUnit(_selectedUnit);
         VectorsViewModel.SelectUnit(_selectedUnit);
         SubscribeToEvents();
         OnNewUnitSelected();
         UpdateShellstarInfo();
     }
     else
     {
         OnPropertyChanged(Properties.CanFire);
     }
 }
Beispiel #28
0
 private void Deselect(IUnitModel affectedUnit)
 {
     var affectedKeys = _selectedUnits.Where(kvp => kvp.Value == affectedUnit).Select(kvp => kvp.Key).ToArray();
     foreach (var key in affectedKeys)
     {
         _selectedUnits.Remove(key);
         SelectionChanged(key, null);
     }
 }
        public void SetupData(IUnitModel attacker, IUnitModel target)
        {
            _launchBoardModel = new LaunchBoardModel(attacker, target, _currentTurnModel);
            _launchPrerequisites.Initialize(_launchBoardModel);
            _targetingAvid.Initialize(_launchBoardModel);
            _shotGeometry.Initialize(_launchBoardModel);
            _rocWorksheet.Initialize(_launchBoardModel);
            _missilePositionAdjustment.Initialize(_launchBoardModel);
            _missileAcceleration.Initialize(_launchBoardModel);

            OnPropertyChanged(Properties.Title);
        }
Beispiel #30
0
 public void RemoveUnit(IUnitModel unitModel)
 {
     Models.Remove(unitModel);
     OnUnitsChanged(ListAction.Removed, unitModel);
 }
 public void Initialize(IUnitModel unit)
 {
     UnsubscribeFromEvents();
     _unit = unit;
     OnShellstarListChanged();
     Navigate(0);
     SubscribeToEvents();
 }
Beispiel #32
0
 public void RemoveUnit(IUnitModel unitModel)
 {
     Models.Remove(unitModel);
     OnUnitsChanged(ListAction.Removed, unitModel);
 }