Пример #1
0
        public void ActivateModule(IModule module)
        {
            switch (module.Category)
            {
            case Category.Weapon:
                OnActivateModule?.Invoke(module);
                //_ui.ConnectClosestObjects(_gameSession, module, SpaceMapActions.GetSpaceshipsByDistance(_gameSession), true);
                break;

            case Category.Shield:
                OnActivateModule?.Invoke(module);
                break;

            case Category.Propulsion:
                OnActivateModule?.Invoke(module);
                break;

            case Category.Reactor:
                OnActivateModule?.Invoke(module);
                break;

            case Category.SpaceScanner:
                OnActivateModule?.Invoke(module);
                break;

            case Category.DeepScanner:
                _ui.ConnectClosestObjects(_gameSession, module, SpaceMapActions.GetUnknownCelestialObjectsByDistance(_gameSession), true);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #2
0
        public void Initialization(IModule module)
        {
            _module = module;

            if (DebugTools.IsInDesignMode())
            {
                return;
            }

            actionIcon.Picture       = Properties.Resources.Radar;
            actionIcon.OnMouseEnter += delegate
            {
                OnActivateModule?.Invoke(module);
            };
            actionIcon.OnMouseLeave += delegate
            {
                OnDeactivateModule?.Invoke(module);
            };
        }