コード例 #1
0
        public static bool checkopenUIWindow(Type T, EntityState _entityState, GlobalUIState _state)
        {
            //If the user has requested a menu be opened and if
            bool returnval;

            if (T == typeof(WarpOrderWindow))
            {
                returnval = WarpOrderWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(ChangeCurrentOrbitWindow))
            {
                returnval = ChangeCurrentOrbitWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(FireControl))
            {
                returnval = FireControl.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(RenameWindow))
            {
                returnval = RenameWindow.GetInstance(_entityState).GetActive();
            }
            else if (T == typeof(CargoTransfer))
            {
                returnval = CargoTransfer.GetInstance(_state.Game.StaticData, _entityState).GetActive();
            }
            else if (T == typeof(ColonyPanel))
            {
                returnval = ColonyPanel.GetInstance(_state.Game.StaticData, _entityState).GetActive();
            }
            else
            {
                returnval = false;
            }
            return(returnval);
        }
コード例 #2
0
ファイル: ColonyPanel.cs プロジェクト: UberWaffe/Pulsar4x
        public static ColonyPanel GetInstance(StaticDataStore staticData, EntityState selectedEntity)
        {
            ColonyPanel instance;

            if (selectedEntity.CmdRef == null)
            {
                selectedEntity.CmdRef = CommandReferences.CreateForEntity(_state.Game, selectedEntity.Entity);
            }
            if (!_state.LoadedWindows.ContainsKey(typeof(ColonyPanel)))
            {
                instance = new ColonyPanel(staticData, selectedEntity);
                instance.HardRefresh();
                return(instance);
            }
            instance = (ColonyPanel)_state.LoadedWindows[typeof(ColonyPanel)];
            instance._selectedEntity = selectedEntity;

            return(instance);
        }
コード例 #3
0
ファイル: EntityUIWindows.cs プロジェクト: mqrause/Pulsar4x
        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))
                    {
                    }
                }
            }
        }
コード例 #4
0
        internal void Display()
        {
            ActiveEntity = _entityState.Entity;
            ImGui.BeginGroup();

            if (ImGui.SmallButton("Pin Camera"))
            {
                _state.Camera.PinToEntity(_entityState.Entity);
                ImGui.CloseCurrentPopup();
            }

            //if entity can move
            if (_entityState.Entity.HasDataBlob <PropulsionAbilityDB>())
            {
                if (ImGui.SmallButton("Translate to a new orbit"))
                {
                    OrbitOrderWindow.GetInstance(_entityState).IsActive = true;
                    _state.ActiveWindow = OrbitOrderWindow.GetInstance(_entityState);
                }
                if (ImGui.SmallButton("Change current orbit"))
                {
                    ChangeCurrentOrbitWindow.GetInstance(_entityState).IsActive = true;
                    _state.ActiveWindow = ChangeCurrentOrbitWindow.GetInstance(_entityState);
                }
            }
            if (_entityState.Entity.HasDataBlob <FireControlAbilityDB>())
            {
                if (ImGui.SmallButton("Fire Control"))
                {
                    var instance = WeaponTargetingControl.GetInstance(_entityState);
                    instance.SetOrderEntity(_entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
            }
            if (ImGui.SmallButton("Rename"))
            {
                RenameWindow.GetInstance(_entityState).IsActive = true;
                _state.ActiveWindow = RenameWindow.GetInstance(_entityState);
                ImGui.CloseCurrentPopup();
            }
            //if entity can target

            if (_entityState.Entity.HasDataBlob <CargoStorageDB>())
            {
                if (ImGui.SmallButton("Cargo"))
                {
                    var instance = CargoTransfer.GetInstance(_state.Game.StaticData, _entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
            }
            //if entity can mine || refine || build
            //econOrderwindow

            if (_entityState.Entity.HasDataBlob <ColonyInfoDB>())
            {
                if (ImGui.SmallButton("Econ"))
                {
                    var instance = ColonyPanel.GetInstance(_state.Game.StaticData, _entityState);
                    instance.IsActive   = true;
                    _state.ActiveWindow = instance;
                }
            }

            ImGui.EndGroup();
        }