Exemple #1
0
        //constructs the toolbar with the given buttons
        private ToolBarUI()
        {
            _flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar;

            ToolbuttonData btn = new ToolbuttonData()
            {
                Picture     = _state.SDLImageDictionary["DesComp"],
                TooltipText = "Design a new component or facility",
                OnClick     = new Action(ComponentDesignUI.GetInstance().ToggleActive)
                              //Opens up the component design menu
            };

            ToolButtons.Add(btn);

            btn = new ToolbuttonData()
            {
                Picture     = _state.SDLImageDictionary["DesShip"],
                TooltipText = "Design a new Ship",
                OnClick     = new Action(ShipDesignUI.GetInstance().ToggleActive)
                              //Opens up the ship design menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _state.SDLImageDictionary["Research"],
                TooltipText = "Research",
                OnClick     = new Action(ResearchWindow.GetInstance().ToggleActive)
                              //Opens up the research menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _state.SDLImageDictionary["GalMap"],
                TooltipText = "Galaxy Browser",
                OnClick     = new Action(GalaxyWindow.GetInstance().ToggleActive)
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _state.SDLImageDictionary["Ruler"],
                TooltipText = "Measure distance",
                OnClick     = new Action(DistanceRuler.GetInstance().ToggleActive)
                              //Opens the ruler menu
            };
            ToolButtons.Add(btn);
        }
Exemple #2
0
        //displays selected entity info



        internal override void Display()
        {
            ImGui.SetNextWindowSize(new Vector2(150, 200), ImGuiCond.Once);
            if (ImGui.Begin("Actions", _flags))
            {
                //check if ANY entity has been clicked
                //if true, display all possible toolbar menu icons for it
                if (_state.LastClickedEntity != null)
                {
                    //Gets the last clicked entity
                    var _entityState = _state.LastClickedEntity;

                    ToolbuttonData btn;

                    void NewButton(Type T, string PictureString, string TooltipText, List <ToolbuttonData> ButtonList)
                    {
                        //Creates a buttton if it is usuable in this situation
                        if (EntityUIWindows.checkIfCanOpenWindow(T, _entityState))
                        {
                            btn = new ToolbuttonData()
                            {
                                Picture     = _state.SDLImageDictionary[PictureString],
                                TooltipText = TooltipText,
                                ClickType   = T
                                              //Opens up the componet design menu
                            };
                            ButtonList.Add(btn);
                        }
                    }

                    void NewCondtionalButton(Type T, string PictureString, string TooltipText)
                    {
                        NewButton(T, PictureString, TooltipText, CondtionalButtons);
                    }

                    void NewStandardButton(Type T, string PictureString, string TooltipText)
                    {
                        NewButton(T, PictureString, TooltipText, StandardButtons);
                    }

                    //Populates Buttons

                    NewStandardButton(typeof(SelectPrimaryBlankMenuHelper), "Select", "Selects the entity");
                    NewStandardButton(typeof(PinCameraBlankMenuHelper), "Pin", "Focuses camera");
                    NewStandardButton(typeof(RenameWindow), "Rename", "Renames the entity");

                    NewCondtionalButton(typeof(PowerGen), "Power", "Shows power stats");
                    NewCondtionalButton(typeof(CargoTransfer), "Cargo", "Shows cargo");
                    NewCondtionalButton(typeof(ColonyPanel), "Industry", "Opens Industry menu");
                    NewCondtionalButton(typeof(WeaponTargetingControl), "Firecon", "Opens firecontrol menu");

                    //Displays all buttons in a list
                    void PrintButtonList(ref List <ToolbuttonData> PrintButtons)
                    {
                        uint iterations = 0;

                        foreach (var button in PrintButtons)
                        {
                            ImGui.SameLine();
                            ImGui.PushID(iterations.ToString());
                            if (ImGui.ImageButton(button.Picture, BtnSizes))
                            {
                                EntityUIWindows.openUIWindow(button.ClickType, _entityState, _state);
                            }
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip(button.TooltipText);
                            }

                            ImGui.PopID();
                            iterations++;
                        }
                        ImGui.NewLine();
                        PrintButtons = new List <ToolbuttonData>();
                    }

                    //Prints both button lists
                    PrintButtonList(ref StandardButtons);
                    PrintButtonList(ref CondtionalButtons);

                    void ActionButton(Type T)
                    {
                        //Makes a small button if it is usable in this situation
                        if (EntityUIWindows.checkIfCanOpenWindow(T, _entityState))
                        {
                            bool buttonresult = ImGui.SmallButton(GlobalUIState.namesForMenus[T]);
                            EntityUIWindows.openUIWindow(T, _entityState, _state, buttonresult);
                            if (ImGui.IsItemHovered())
                            {
                                ImGui.SetTooltip(GlobalUIState.namesForMenus[T]);
                            }
                        }
                    }

                    //Makes all small buttons
                    ActionButton(typeof(PlanetaryWindow));
                    ActionButton(typeof(GotoSystemBlankMenuHelper));
                    ActionButton(typeof(OrbitOrderWindow));
                    ActionButton(typeof(ChangeCurrentOrbitWindow));
                }
                ImGui.End();
            }
        }
Exemple #3
0
        //constructs the toolbar with the given buttons
        private ToolBarUI()
        {
            _flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.AlwaysAutoResize;



            ToolbuttonData btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["DesComp"],
                TooltipText = "Design a new component or facility",
                OnClick     = new Action(ComponentDesignUI.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ComponentDesignUI.GetInstance().GetActive)
                              //Opens up the component design menu
            };

            ToolButtons.Add(btn);

            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["DesShip"],
                TooltipText = "Design a new Ship",
                OnClick     = new Action(ShipDesignUI.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ShipDesignUI.GetInstance().GetActive)
                              //Opens up the ship design menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Research"],
                TooltipText = "Research",
                OnClick     = new Action(ResearchWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ResearchWindow.GetInstance().GetActive)
                              //Opens up the research menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["GalMap"],
                TooltipText = "Galaxy Browser",
                OnClick     = new Action(GalaxyWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(GalaxyWindow.GetInstance().GetActive)
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Ruler"],
                TooltipText = "Measure distance",
                OnClick     = new Action(DistanceRuler.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(DistanceRuler.GetInstance().GetActive)
                              //Opens the ruler menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Tree"],
                TooltipText = "View objects in the system",
                OnClick     = new Action(SystemTreeViewer.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(SystemTreeViewer.GetInstance().GetActive)
                              //Display a tree with all objects in the system
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Tree"],
                TooltipText = "Spawn ships and planets",
                OnClick     = new Action(EntitySpawnWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(EntitySpawnWindow.GetInstance().GetActive),
                //Display a tree with all objects in the system
            };
            SMToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Tree"],
                TooltipText = "View SM debug info about a body",
                OnClick     = new Action(SMPannel.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(SMPannel.GetInstance().GetActive),
                //Display a list of bodies with some info about them.
            };
            SMToolButtons.Add(btn);
        }
Exemple #4
0
        //constructs the toolbar with the given buttons
        private ToolBarUI()
        {
            _flags = ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoTitleBar;


            ToolbuttonData btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["DesComp"],
                TooltipText = "Design a new component or facility",
                OnClick     = new Action(ComponentDesignUI.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ComponentDesignUI.GetInstance().GetActive)
                              //Opens up the component design menu
            };

            ToolButtons.Add(btn);

            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["DesShip"],
                TooltipText = "Design a new Ship",
                OnClick     = new Action(ShipDesignUI.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ShipDesignUI.GetInstance().GetActive)
                              //Opens up the ship design menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["DesOrd"],
                TooltipText = "Design a Missile",
                OnClick     = new Action(OrdinanceDesignUI.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(OrdinanceDesignUI.GetInstance().GetActive)
                              //Opens up the ship design menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Research"],
                TooltipText = "Research",
                OnClick     = new Action(ResearchWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(ResearchWindow.GetInstance().GetActive)
                              //Opens up the research menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["GalMap"],
                TooltipText = "Galaxy Browser",
                OnClick     = new Action(GalaxyWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(GalaxyWindow.GetInstance().GetActive)
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Ruler"],
                TooltipText = "Measure distance",
                OnClick     = new Action(DistanceRuler.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(DistanceRuler.GetInstance().GetActive)
                              //Opens the ruler menu
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Tree"],
                TooltipText = "View objects in the system",
                OnClick     = new Action(SystemTreeViewer.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(SystemTreeViewer.GetInstance().GetActive)
                              //Display a tree with all objects in the system
            };
            ToolButtons.Add(btn);
            btn = new ToolbuttonData()
            {
                Picture     = _uiState.SDLImageDictionary["Tree"],
                TooltipText = "View objects in the system",
                OnClick     = new Action(EntitySpawnWindow.GetInstance().ToggleActive),
                GetActive   = new Func <bool>(EntitySpawnWindow.GetInstance().GetActive)
                              //Display a tree with all objects in the system
            };
            ToolButtons.Add(btn);
        }