コード例 #1
0
ファイル: EntityUIWindows.cs プロジェクト: mqrause/Pulsar4x
 internal static bool checkIfCanOpenWindow(Type T, EntityState _entityState, GlobalUIState _state)
 {
     if (T == typeof(JumpThroughJumpPointBlankMenuHelper))
     {
         if (checkIfCanOpenWindow(typeof(GotoSystemBlankMenuHelper), _entityState, _state))
         {
             if (_state.PrimaryEntity != null)
             {
                 if (_state.PrimaryEntity.BodyType == UserOrbitSettings.OrbitBodyType.Ship && (ECSLib.Distance.DistanceBetween(_state.PrimaryEntity.Position.AbsolutePosition_m, _entityState.Position.AbsolutePosition_m) < _entityState.Entity.GetDataBlob <JPSurveyableDB>().MinimumDistanceToJump_m))
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
コード例 #2
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);
        }
コード例 #3
0
ファイル: EntityContextMenu.cs プロジェクト: mqrause/Pulsar4x
 public EntityContextMenu(GlobalUIState state, Guid entityGuid)
 {
     _state = state;
     //_state.OpenWindows.Add(this);
     //IsActive = true;
     _entityState = state.StarSystemStates[state.SelectedStarSysGuid].EntityStatesWithNames[entityGuid];
 }
コード例 #4
0
        public TranslateMoveOrderWidget(GlobalUIState state, Entity orderingEntity)
        {
            _state           = state;
            _currentDateTime = _state.PrimarySystemDateTime;

            _movingEntity = orderingEntity;

            Setup();
        }
コード例 #5
0
        public static GraphicDebugWindow GetWindow(GlobalUIState state)
        {
            if (_graphicDebugWindow == null)
            {
                _graphicDebugWindow = new GraphicDebugWindow(state);
            }



            return(_graphicDebugWindow);
        }
コード例 #6
0
ファイル: NameIcon.cs プロジェクト: UberWaffe/Pulsar4x
        public NameIcon(EntityState entityState, GlobalUIState state) : base(entityState.Entity.GetDataBlob <PositionDB>())
        {
            _state      = state;
            _entityGuid = entityState.Entity.Guid;
            StarSystem starsys = (StarSystem)entityState.Entity.Manager;

            _starSysGuid         = starsys.Guid;
            _nameDB              = entityState.Entity.GetDataBlob <NameDB>();
            NameString           = _nameDB.GetName(state.Faction);
            entityState.Name     = NameString;
            entityState.NameIcon = this;
            _bodyType            = entityState.BodyType;
        }
コード例 #7
0
        internal SystemMapRendering(ImGuiSDL2CSWindow window, GlobalUIState state)
        {
            _state = state;

            _camera     = _state.Camera;
            _window     = window;
            windowPtr   = window.Handle;
            surfacePtr  = SDL.SDL_GetWindowSurface(windowPtr);
            rendererPtr = SDL.SDL_GetRenderer(windowPtr);
            //UIWidgets.Add(new CursorCrosshair(new Vector4())); //used for debugging the cursor world position.
            foreach (var item in TestDrawIconData.GetTestIcons())
            {
                _testIcons.TryAdd(Guid.NewGuid(), item);
            }
        }
コード例 #8
0
        public GalacticMapRender(ImGuiSDL2CSWindow window, GlobalUIState state)
        {
            _state  = state;
            _window = window;
            _camera = state.Camera;

            var windowPtr  = window.Handle;
            var surfacePtr = SDL.SDL_GetWindowSurface(windowPtr);

            _renderPtr = SDL.SDL_GetRenderer(windowPtr);

            var size     = window.Size;
            int cellSize = 16;
            int gridwid  = (int)size.X / cellSize;
            int gridhig  = (int)size.Y / cellSize;

            grid = new CollisionGrid(gridwid, gridhig, cellSize);
            _state.EntityClickedEvent += _state_EntityClickedEvent;
        }
コード例 #9
0
 public void Enable(bool enable, GlobalUIState state)
 {
     if (enable && !_isEnabled)
     {
         if (!state.SelectedSysMapRender.SelectedEntityExtras.Contains(_debugWidget))
         {
             state.SelectedSysMapRender.SelectedEntityExtras.Add(_debugWidget);
         }
         _isEnabled = true;
     }
     else if (!enable && _isEnabled)
     {
         if (state.SelectedSysMapRender.SelectedEntityExtras.Contains(_debugWidget))
         {
             state.SelectedSysMapRender.SelectedEntityExtras.Remove(_debugWidget);
         }
         _isEnabled = false;
     }
 }
コード例 #10
0
        //new internal static GlobalUIState _uiState;

        public PartDesignUI(int designType, GlobalUIState state)
        {
            _designType = designType;
            _state      = state;
            SetName("Part Designer " + _designType.ToString());
            //_flags = ImGuiWindowFlags.Popup;

            var factionTech = _state.Faction.GetDataBlob <FactionTechDB>();
            var staticdata  = StaticRefLib.StaticData;

            IsActive     = true;
            _designables = StaticRefLib.StaticData.ComponentTemplates.Values.ToArray();
            int count = _designables.Length;

            _designTypes = new string[count];
            for (int i = 0; i < count; i++)
            {
                _designTypes[i] = _designables[i].Name;
            }
            _componentDesigner = new ComponentDesigner(_designables[_designType], factionTech);
            _windowname        = _componentDesigner.Name;
            StartDisplay();
        }
コード例 #11
0
        public PulsarMainWindow()
            : base("Pulsar4X")
        {
            _state = new GlobalUIState(this);
            //_state.MainWinSize = this.Size;
            //_state.ShowMetrixWindow = true;
            // Create any managed resources and set up the main game window here.

            /*
             * _MemoryEditorData = new byte[1024];
             * Random rnd = new Random();
             * for (int i = 0; i < _MemoryEditorData.Length; i++)
             * {
             *  _MemoryEditorData[i] = (byte)rnd.Next(255);
             * }
             */
            backColor = new Vector3(0 / 255f, 0 / 255f, 28 / 255f);

            _state.GalacticMap = new GalacticMapRender(this, _state);
            //_state.MapRendering = new SystemMapRendering(this, _state);


            OnEvent = MyEventHandler;
        }
コード例 #12
0
 public GraphicDebugWindow(GlobalUIState state)
 {
     _state       = state;
     _debugWidget = new GraphicDebugWidget(new Vector3());
 }
コード例 #13
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))
                    {
                    }
                }
            }
        }