예제 #1
0
        void CreateNewGame()
        {
            gameSettings = new ECSLib.NewGameSettings
            {
                GameName   = ImGuiSDL2CSHelper.StringFromBytes(_nameInputBuffer),
                MaxSystems = _maxSystems,
                SMPassword = ImGuiSDL2CSHelper.StringFromBytes(_smPassInputbuffer),
                //DataSets = options.SelectedModList.Select(dvi => dvi.Directory),
                CreatePlayerFaction   = true,
                DefaultFactionName    = ImGuiSDL2CSHelper.StringFromBytes(_factionInputBuffer),
                DefaultPlayerPassword = ImGuiSDL2CSHelper.StringFromBytes(_passInputBuffer),
                DefaultSolStart       = true,
                MasterSeed            = _masterSeed
            };

            _state.Game = new ECSLib.Game(gameSettings);
            //_state.LoadedWindows.Add(new TimeControl(_state));
            //_state.LoadedWindows.Remove(this);
            ECSLib.FactionVM factionVM = new ECSLib.FactionVM(_state.Game);
            _state.FactionUIState = factionVM;

            factionVM.CreateDefaultFaction(ImGuiSDL2CSHelper.StringFromBytes(_factionInputBuffer), ImGuiSDL2CSHelper.StringFromBytes(_passInputBuffer));

            _state.SetFaction(factionVM.FactionEntity);
            //_state.MapRendering.SetSystem(factionVM.KnownSystems[0]);
            //_state.MapRendering.SetSystem(factionVM);
            _state.SetActiveSystem(factionVM.KnownSystems[0].Guid);
            DebugWindow.GetInstance().SetGameEvents();
            IsActive = false;
            //we initialize window instances so that they get always displayed and automatically open after new game is created.
            TimeControl.GetInstance().IsActive            = true;
            ToolBarUI.GetInstance().IsActive              = true;
            EntityUIWindowSelector.GetInstance().IsActive = true;
            EntityInfoPanel.GetInstance().IsActive        = true;
        }
예제 #2
0
        internal static EntityUIWindowSelector GetInstance()
        {
            EntityUIWindowSelector thisItem;

            if (!_state.LoadedWindows.ContainsKey(typeof(EntityUIWindowSelector)))
            {
                thisItem = new EntityUIWindowSelector();
            }
            else
            {
                thisItem = (EntityUIWindowSelector)_state.LoadedWindows[typeof(EntityUIWindowSelector)];
            }


            return(thisItem);
        }