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));
 }
Example #2
0
 public ConfigurationPanel(
     UIHelperBase uiHelperBase,
     ModFullTitle modFullTitle,
     Configuration configuration,
     LanguageResource languageResource)
 {
     _uiHelperBase     = uiHelperBase ?? throw new ArgumentNullException(nameof(uiHelperBase));
     _modFullTitle     = modFullTitle ?? throw new ArgumentNullException(nameof(modFullTitle));
     _configuration    = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _languageResource = languageResource ?? throw new ArgumentNullException(nameof(languageResource));
 }
Example #3
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();
        }
 public UiBuilderOutOfGame(UIHelperBase uIHelperBase, ModFullTitle modFullTitle)
 {
     this.uIHelperBase = uIHelperBase ?? throw new ArgumentNullException(nameof(uIHelperBase));
     this.modFullTitle = modFullTitle ?? throw new ArgumentNullException(nameof(modFullTitle));
 }