Esempio n. 1
0
        internal void SetSystem(FactionVM factionVM)
        {
            if (_sysState != null)
            {
                _sysState.StarSystem.ManagerSubpulses.SystemDateChangedEvent -= OnSystemDateChange;
                _sysState.StarSystem.GetSensorContacts(_faction.Guid).Changes.Unsubscribe(_sensorChanges);
            }
            if (_state.StarSystemStates.ContainsKey(factionVM.SystemMap.StarSystem.Guid))
            {
                _sysState = _state.StarSystemStates[factionVM.SystemMap.StarSystem.Guid];
            }
            else
            {
                _sysState = new SystemState(factionVM.SystemMap.StarSystem, factionVM.FactionEntity);
                _state.StarSystemStates[_sysState.StarSystem.Guid] = _sysState;
            }
            var starSys = _sysState.StarSystem;

            _faction = _state.Faction;
            starSys.ManagerSubpulses.SystemDateChangedEvent += OnSystemDateChange;
            _sensorMgr     = starSys.GetSensorContacts(_faction.Guid);
            _sensorChanges = _sensorMgr.Changes.Subscribe();



            _state.SetActiveSystem(starSys.Guid);


            foreach (var entityItem in _sysState.EntityStatesWithPosition.Values)
            {
                AddIconable(entityItem);
            }

            _state.LastClickedEntity = _sysState.EntityStatesWithPosition.Values.ElementAt(0);
        }
Esempio n. 2
0
        internal static void openUIWindow(Type T, EntityState _entityState, GlobalUIState _state, bool open = true, bool managesUIPopUps = false)
        {
            if (open)
            {
                //If the user has requested a menu be opened and if
                //Menu is pin menu
                if (T == typeof(PinCameraBlankMenuHelper))
                {
                    _state.Camera.PinToEntity(_entityState.Entity);
                    if (managesUIPopUps)
                    {
                        ImGui.CloseCurrentPopup();
                    }
                }
                //Menu is goto system menu
                else if (T == typeof(GotoSystemBlankMenuHelper))
                {
                    _state.SetActiveSystem(_entityState.Entity.GetDataBlob <JPSurveyableDB>().JumpPointTo.GetDataBlob <PositionDB>().SystemGuid);
                }
                else if (T == typeof(SelectPrimaryBlankMenuHelper))
                {
                    _state.EntitySelectedAsPrimary(_entityState.Entity.Guid, _entityState.StarSysGuid);
                }
                //if entity can warp
                else if (T == typeof(WarpOrderWindow))
                {
                    WarpOrderWindow.GetInstance(_entityState).IsActive = true;
                    _state.ActiveWindow = WarpOrderWindow.GetInstance(_entityState);
                }
                //Menu is change orbit menu
                else if (T == typeof(ChangeCurrentOrbitWindow))
                {
                    ChangeCurrentOrbitWindow.GetInstance(_entityState).IsActive = true;
                    _state.ActiveWindow = ChangeCurrentOrbitWindow.GetInstance(_entityState);
                }
                //Menu is ficrecontrol menu
                else if (T == typeof(WeaponTargetingControl))
                {
                    var instance = WeaponTargetingControl.GetInstance(_entityState);
                    instance.SetOrderEntity(_entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
                //Menu is rename menu
                else if (T == typeof(RenameWindow))
                {
                    RenameWindow.GetInstance(_entityState).IsActive = true;
                    _state.ActiveWindow = RenameWindow.GetInstance(_entityState);
                    if (managesUIPopUps)
                    {
                        ImGui.CloseCurrentPopup();
                    }
                }
                //Menu is cargo menu
                else if (T == typeof(CargoTransfer))
                {
                    var instance = CargoTransfer.GetInstance(_state.Game.StaticData, _entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
                //Menu is econ menu
                else if (T == typeof(ColonyPanel))
                {
                    var instance = ColonyPanel.GetInstance(_state.Game.StaticData, _entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
                //
                if (T == typeof(PlanetaryWindow))
                {
                    var instance = PlanetaryWindow.GetInstance(_entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;

                    //TODO: implement this(moving a ship entity[_state.PrimaryEntity] from one system to another one and placing it at a given location[_entityState.Entity.GetDataBlob<JPSurveyableDB>().JumpPointTo.GetDataBlob<PositionDB>(). etc...])
                    if (T == typeof(JumpThroughJumpPointBlankMenuHelper))
                    {
                    }
                }
            }
        }