Пример #1
0
        public LevelController(IConfig config, MapSerializationModel mapSerializationModel)
        {
            /*
             * Bootstrap simulation
             */
            var levelContainer = LevelBootstrapper.CreateContainer(config);

            _graphicsResourceManager = levelContainer.Resolve <GraphicsResourceManager>();

            _uiState = levelContainer.Resolve <UiStateModel>();

            _updateController  = levelContainer.Resolve <UpdateController>();
            _overlayController = levelContainer.Resolve <OverlayController>();
            _fieldController   = levelContainer.Resolve <FieldController>();

            var map       = levelContainer.Resolve <MapModel>();
            var mapLoader = levelContainer.Resolve <MapLoader>();

            mapLoader.InitializeMap(map, mapSerializationModel);

            /*
             * Other initialization
             */

            var simulationManager    = levelContainer.Resolve <ISimulationManager>();
            var simulationStateModel = levelContainer.Resolve <SimulationStateModel>();

            _updateEventArgs = new UpdateEventArgs(simulationManager, simulationStateModel);
        }
Пример #2
0
        public OverlayController(UiStateModel uiState,
                                 ISimulationManager simulationManager,
                                 ISimulationState simulationState,
                                 IIndicatorProvider indicatorProvider,
                                 StatusBar statusBar)
        {
            _uiState = uiState ?? throw new ArgumentNullException(nameof(uiState));
            if (simulationManager == null)
            {
                throw new ArgumentNullException(nameof(simulationManager));
            }
            if (simulationState == null)
            {
                throw new ArgumentNullException(nameof(simulationState));
            }
            if (indicatorProvider == null)
            {
                throw new ArgumentNullException(nameof(indicatorProvider));
            }
            _statusBar = statusBar ?? throw new ArgumentNullException(nameof(statusBar));

            _executeEventArgs = new ExecuteEventArgs()
            {
                Manager = simulationManager,
                Sim     = simulationState,
            };

            _updateReadinessEventArgs = new UpdateReadinessEventArgs
            {
                Sim = simulationState,
            };

            _lastHover          = HexCoords.CreateFromOffset(-1, -1);
            _hoverTileIndicator = indicatorProvider.GetIndicator("HoverTileIndicator");
        }
Пример #3
0
        public FieldController(IConfig config, UiStateModel uiState, MapModel map, IIndicatorRegistry indicatorRegistry, PrerenderProvider prerenderProvider)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            _uiState           = uiState ?? throw new ArgumentNullException(nameof(uiState));
            _map               = map ?? throw new ArgumentNullException(nameof(map));
            _prerenderProvider = prerenderProvider ?? throw new ArgumentNullException(nameof(config));
            _indicatorRegistry = indicatorRegistry ?? throw new ArgumentNullException(nameof(indicatorRegistry));

            _tileRadius  = config.GetFloat(CoreConfig.TileRadius);
            _tileRadiusH = HexUtils.GetRadiusHeight(_tileRadius);

            _pan  = Vector2.Zero;
            _zoom = 1.0f;
        }
Пример #4
0
        public StatusBar(UiStateModel uiState, StyleProvider styleProvider)
        {
            _uiState = uiState ?? throw new ArgumentNullException(nameof(uiState));
            if (styleProvider == null)
            {
                throw new ArgumentNullException(nameof(styleProvider));
            }

            // copy down config
            _barHeight = 26;

            _fgStyle = styleProvider.GetStyle("StatusBarForegroundStyle");
            _bgStyle = styleProvider.GetStyle("StatusBarBackgroundStyle");

            _fgTextFormat = new CanvasTextFormat()
            {
                VerticalAlignment   = CanvasVerticalAlignment.Center,
                HorizontalAlignment = CanvasHorizontalAlignment.Left,
                FontWeight          = FontWeights.Bold,
                FontSize            = _barHeight * 0.75f
            };
        }