Ejemplo n.º 1
0
        public void Initialize(
            string modSystemName,
            Configuration configuration,
            LanguageResource languageResource,
            GameEngineService gameEngineService,
            InfoManager infoManager)
        {
            _modSystemName = modSystemName ?? throw new ArgumentNullException(nameof(modSystemName));
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            if (_configuration.MainPanelColumnCount < 1)
            {
                throw new ArgumentOutOfRangeException($"'{nameof(_configuration.MainPanelColumnCount)}' parameter must be bigger or equal to 1.");
            }
            _languageResource  = languageResource ?? throw new ArgumentNullException(nameof(languageResource));
            _gameEngineService = gameEngineService ?? throw new ArgumentNullException(nameof(gameEngineService));
            _infoManager       = infoManager;

            color            = configuration.MainPanelBackgroundColor;
            name             = modSystemName + "MainPanel";
            backgroundSprite = "GenericPanelLight";
            isInteractive    = false;

            CreateAndAddDragHandle();
            CreateAndAddAllUiItems();

            UpdateItemsLayoutAndSize();
            relativePosition = _configuration.MainPanelPosition;

            _uiDragHandle.eventMouseUp += UiDragHandle_eventMouseUp;

            StartCoroutine(KeepUpdatingUICoroutine());
        }
 public UiBuilderInGame(UIHelperBase uIHelperBase, ModFullTitle modFullTitle, GameEngineService gameEngineService, List <NetInfoGroupViewReadModel> netInfoGroupReadModel)
 {
     this.uIHelperBase      = uIHelperBase ?? throw new ArgumentNullException(nameof(uIHelperBase));
     this.modFullTitle      = modFullTitle ?? throw new ArgumentNullException(nameof(modFullTitle));
     this.gameEngineService = gameEngineService ?? throw new ArgumentNullException(nameof(gameEngineService));
     if (netInfoGroupReadModel.Count < 1)
     {
         throw new ArgumentException(nameof(netInfoGroupReadModel) + " must contain at least one element.");
     }
     this.netInfoGroupViewReadModel = netInfoGroupReadModel ?? throw new ArgumentNullException(nameof(netInfoGroupReadModel));
 }
Ejemplo n.º 3
0
        private void InitializeMainPanel()
        {
            var gameEngineService = new GameEngineService(
                DistrictManager.instance,
                BuildingManager.instance,
                EconomyManager.instance,
                ImmaterialResourceManager.instance,
                CitizenManager.instance,
                VehicleManager.instance
                );

            _mainPanel = UIView.GetAView().AddUIComponent(typeof(MainPanel)) as MainPanel;
            _mainPanel.Initialize(SystemName, _configuration, _languageResource, gameEngineService, InfoManager.instance);
            if (_configurationPanel != null)
            {
                _configurationPanel.MainPanel = _mainPanel;
            }
        }
Ejemplo n.º 4
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            var modFullTitle = new ModFullTitle(this.Name, this.Version);

            IUiBuilder uiBuilder;

            if (this.onCreatedInvoked)
            {
                this.onCreatedInvoked = false;

                var coverageManager   = Singleton <CoverageManager> .instance;
                var netManager        = Singleton <NetManager> .instance;
                var simulationManager = Singleton <SimulationManager> .instance;
                var gameEngineService = new GameEngineService(coverageManager, netManager, simulationManager);

                var netInfoGroupsMOM            = new NetInfoGroupInitializer_MOM(); //TODO improve MOM support
                var afterDarkDlcInstalled       = SteamHelper.IsDLCOwned(SteamHelper.DLC.AfterDarkDLC);
                var inMotionDlcInstalled        = SteamHelper.IsDLCOwned(SteamHelper.DLC.InMotionDLC);
                var netInfoGroupsNeExt2         = new NetInfoGroupInitializer_NeExt2(afterDarkDlcInstalled, inMotionDlcInstalled);
                var netInfoGroupsRoadsForNeExt2 = new NetInfoGroupInitializer_RoadsForNeExt2();
                //TODO one-way train tracks
                //TODO Ronyx Highway

                var netInfoGroups = netInfoGroupsMOM.Create()
                                    .Concat(netInfoGroupsNeExt2.Create())
                                    .Concat(netInfoGroupsRoadsForNeExt2.Create());

                var netInfoGroupViewReadModelFactory = new NetInfoGroupViewReadModelFactory();
                var netInfoGroupViewReadModels       = netInfoGroups
                                                       .Select(x => netInfoGroupViewReadModelFactory.Create(x))
                                                       .ToList();

                uiBuilder = new UiBuilderInGame(helper, modFullTitle, gameEngineService, netInfoGroupViewReadModels);
            }
            else
            {
                uiBuilder = new UiBuilderOutOfGame(helper, modFullTitle);
            }

            uiBuilder.BuildUi();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SessionService"/> class.
 /// </summary>
 /// <param name="gameEngineService">GameEngineService.</param>
 /// <param name="localStorageService">ILocalStorageService.</param>
 /// <param name="sessionStorageService">ISessionStorageService.</param>
 public SessionService(GameEngineService gameEngineService, ILocalStorageService localStorageService, ISessionStorageService sessionStorageService)
     : base(gameEngineService)
 {
     this.localStorageService   = localStorageService;
     this.sessionStorageService = sessionStorageService;
 }