Ejemplo n.º 1
0
        internal override void Display()
        {
            if (IsActive && ImGui.Begin("Component Design", ref IsActive, _flags))
            {
                ImGui.Columns(2);
                if (ImGui.ListBox("Type", ref _designType, _designTypes, _designTypes.Length))
                {
                    var factionTech = _state.Faction.GetDataBlob <FactionTechDB>();
                    var staticdata  = StaticRefLib.StaticData;
                    _componentDesigner = new ComponentDesigner(_designables[_designType], factionTech);
                    _nameInputBuffer   = ImGuiSDL2CSHelper.BytesFromString(_componentDesigner.Name, 32);
                }

                if (_componentDesigner != null)
                {
                    foreach (ComponentDesignAttribute attribute in _componentDesigner.ComponentDesignAttributes.Values)
                    {
                        switch (attribute.GuiHint)
                        {
                        case GuiHint.None:
                            break;

                        case GuiHint.GuiTechSelectionList:
                            GuiHintTechSelection(attribute);
                            break;

                        case GuiHint.GuiSelectionMaxMin:
                            GuiHintMaxMin(attribute);
                            break;

                        case GuiHint.GuiTextDisplay:
                            GuiHintText(attribute);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }

                    ImGui.InputText("Component Name", _nameInputBuffer, 32);
                    if (ImGui.Button("Create Design"))
                    {
                        _componentDesigner.Name = ImGuiSDL2CSHelper.StringFromBytes(_nameInputBuffer);
                        _componentDesigner.CreateDesign(_state.Faction);
                    }
                    ImGui.NextColumn();
                    ImGui.BeginChild("ComponentData");
                    ImGui.Columns(2);
                    ImGui.Text("Mass");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.MassValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Volume");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.VolumeValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Crew Requred");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.CrewReqValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Cost");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.CreditCostValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Research Cost");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.ResearchCostValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Build Cost");
                    ImGui.NextColumn();
                    ImGui.Text(_componentDesigner.BuildPointCostValue.ToString());
                    ImGui.NextColumn();

                    ImGui.Text("Resource Costs");
                    ImGui.NextColumn();
                    ImGui.NextColumn();
                    foreach (var mineral in _componentDesigner.MineralCostValues)
                    {
                        var mineralSD = StaticRefLib.StaticData.CargoGoods.GetMineral(mineral.Key);
                        var xpos      = ImGui.GetCursorPosX();
                        ImGui.SetCursorPosX(xpos + 12);
                        ImGui.Text(mineralSD.Name);
                        ImGui.NextColumn();
                        ImGui.Text(mineral.Value.ToString());
                        ImGui.NextColumn();
                    }
                    foreach (var material in _componentDesigner.MaterialCostValues)
                    {
                        var matSD = StaticRefLib.StaticData.CargoGoods.GetMaterial(material.Key);
                        var xpos  = ImGui.GetCursorPosX();
                        ImGui.SetCursorPosX(xpos + 12);
                        ImGui.Text(matSD.Name);
                        ImGui.NextColumn();
                        ImGui.Text(material.Value.ToString());
                        ImGui.NextColumn();
                    }
                    foreach (var component in _componentDesigner.ComponentCostValues)
                    {
                        var compSD = StaticRefLib.StaticData.CargoGoods.GetMaterial(component.Key);
                        var xpos   = ImGui.GetCursorPosX();
                        ImGui.SetCursorPosX(xpos + 12);
                        ImGui.Text(compSD.Name);
                        ImGui.NextColumn();
                        ImGui.Text(component.Value.ToString());
                        ImGui.NextColumn();
                    }

                    /*
                     * ImGui.Text("Materials");
                     * ImGui.NextColumn();
                     * ImGui.Text(_componentDesigner.MassValue.ToString());
                     * ImGui.NextColumn();
                     *
                     * ImGui.Text("Components");
                     * ImGui.NextColumn();
                     * ImGui.Text(_componentDesigner.MassValue.ToString());
                     * ImGui.NextColumn();
                     */
                }



                ImGui.End();
            }

            void GuiHintText(ComponentDesignAttribute attribute)
            {
                ImGui.Text(attribute.Name);
                ImGui.Text(attribute.Description);
                ImGui.Text(attribute.Value.ToString());
            }

            void GuiHintMaxMin(ComponentDesignAttribute attribute)
            {
                ImGui.Text(attribute.Name);
                ImGui.Text(attribute.Description);

                attribute.SetMax();
                attribute.SetMin();
                attribute.SetValue();
                attribute.SetStep();

                var    max   = attribute.MaxValue;
                var    min   = attribute.MinValue;
                double val   = attribute.Value;
                double step  = attribute.StepValue;
                double fstep = step * 10;
                IntPtr valPtr;
                IntPtr maxPtr;
                IntPtr minPtr;
                IntPtr stepPtr;
                IntPtr fstepPtr;

                unsafe
                {
                    valPtr   = new IntPtr(&val);
                    maxPtr   = new IntPtr(&max);
                    minPtr   = new IntPtr(&min);
                    stepPtr  = new IntPtr(&step);
                    fstepPtr = new IntPtr(&fstep);
                }
                //ImGui.DragScalar("##slider" + attribute.Name, ImGuiDataType.Double, valPtr, 1f, minPtr, maxPtr);
                if (ImGui.SliderScalar("##scaler" + attribute.Name, ImGuiDataType.Double, valPtr, minPtr, maxPtr))
                {
                    attribute.SetValueFromInput(val);
                }
                if (ImGui.InputScalar("##input" + attribute.Name, ImGuiDataType.Double, valPtr, stepPtr, fstepPtr))
                {
                    attribute.SetValueFromInput(val);
                }
            }

            void GuiHintTechSelection(ComponentDesignAttribute attribute)
            {
                ImGui.Text(attribute.Name);
                ImGui.Text(attribute.Description);
                //StaticRefLib.StaticData.Techs[attribute.Value]
                ImGui.Text(attribute.Value.ToString());

/*
 *              int techSelection;
 *              List<string> techs = attribute.GuidDictionary
 *
 *              if (ImGui.ListBox("Tech" + attribute.Name, ref _designType, _designTypes, _designTypes.Length))
 *              {
 *                  var factionTech = _uiState.Faction.GetDataBlob<FactionTechDB>();
 *                  var staticdata = StaticRefLib.StaticData;
 *                  _componentDesign = GenericComponentFactory.StaticToDesign(_designables[_designType], factionTech, staticdata);
 *              }*/
            }
        }
Ejemplo n.º 2
0
        internal override void Display()
        {
            if (IsActive && ImGui.Begin("Component Design", ref IsActive, _flags))
            {
                GuiDesignUI();            //Part design

                ImGui.Columns(2, "Main"); //Col 1 contains list of comp types, col 2 contains the cost

                int numelements = Convert.ToInt32((ImGui.GetContentRegionAvail().Y - 20) / 17);
                if (numelements < 4)
                {
                    numelements = 4;
                }
                else if (numelements > _designTypes.Length)
                {
                    numelements = _designTypes.Length;
                }
                ImGui.PushItemWidth(-1);
                if (ImGui.ListBox("", ref _designType, _designTypes, _designTypes.Length, numelements))//Lists the possible comp types
                {
                    var factionTech = _state.Faction.GetDataBlob <FactionTechDB>();
                    var staticdata  = StaticRefLib.StaticData;
                    _componentDesigner = new ComponentDesigner(_designables[_designType], factionTech);
                    _nameInputBuffer   = ImGuiSDL2CSHelper.BytesFromString(_componentDesigner.Name, 32);
                }

                ImGui.NextColumn();
                GuiCostText();//Print cost
                ImGui.End();
            }

            void GuiDesignUI()//Creates all UI elements need for designing the Component
            {
                ImGui.Text("Component Specifications");
                ImGui.SameLine(ImGui.GetWindowWidth() - 70);
                if (ImGui.Button("Compact"))
                {
                    compactmod = !compactmod;
                }


                ImGui.NewLine();

                if (_componentDesigner != null)                                                                         //Make sure comp is selected
                {
                    foreach (ComponentDesignAttribute attribute in _componentDesigner.ComponentDesignAttributes.Values) //For each property of the comp type
                    {
                        switch (attribute.GuiHint)                                                                      //Either
                        {
                        case GuiHint.None:
                            break;

                        case GuiHint.GuiTechSelectionList:    //Let the user pick a type from a list
                            GuiHintTechSelection(attribute);
                            break;

                        case GuiHint.GuiSelectionMaxMin:    //Set a value
                            GuiHintMaxMin(attribute);
                            break;

                        case GuiHint.GuiTextDisplay:    //Display a stat
                            GuiHintText(attribute);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }
                    ImGui.Text("Name");
                    ImGui.InputText("", _nameInputBuffer, 32);
                    if (ImGui.Button("Create Design"))
                    {
                        _componentDesigner.Name = ImGuiSDL2CSHelper.StringFromBytes(_nameInputBuffer);
                        _componentDesigner.CreateDesign(_state.Faction);
                        //we reset the designer here, so we don't end up trying to edit the precious design.
                        var factionTech = _state.Faction.GetDataBlob <FactionTechDB>();
                        _componentDesigner = new ComponentDesigner(_designables[_designType], factionTech);
                    }
                    ImGui.NewLine();
                }
                else//Tell the user they don't have a comp type selected
                {
                    ImGui.NewLine();
                    ImGui.Text("No component type selected");
                    ImGui.NewLine();
                }
            }

            void GuiCostText()//Prints a 2 col table with the costs of the part
            {
                ImGui.BeginChild("Cost");
                if (_componentDesigner != null)//If a part time is selected
                {
                    ImGui.Columns(2);
                    ImGui.BeginTabItem("Cost");

                    ImGui.Text("Mass");
                    ImGui.Text("Volume");
                    ImGui.Text("Crew Requred");
                    ImGui.Text("Cost");
                    ImGui.Text("Research Cost");
                    ImGui.Text("Build Cost");
                    ImGui.Text("Resource Costs");
                    ImGui.NextColumn();//Add all the cost names to col 1


                    ImGui.Text(_componentDesigner.MassValue.ToString());
                    ImGui.Text(_componentDesigner.VolumeValue.ToString());
                    ImGui.Text(_componentDesigner.CrewReqValue.ToString());
                    ImGui.Text(_componentDesigner.CreditCostValue.ToString());
                    ImGui.Text(_componentDesigner.ResearchCostValue.ToString());
                    ImGui.Text(_componentDesigner.IndustryPointCostsValue.ToString());
                    ImGui.NextColumn();//Add all the price values to col 2


                    foreach (var kvp in _componentDesigner.ResourceCostValues)
                    {
                        var resource = StaticRefLib.StaticData.CargoGoods.GetAny(kvp.Key);
                        if (resource == null)
                        {
                            resource = (ICargoable)_state.Faction.GetDataBlob <FactionInfoDB>().IndustryDesigns[kvp.Key];
                        }
                        var xpos = ImGui.GetCursorPosX();
                        ImGui.SetCursorPosX(xpos + 12);
                        ImGui.Text(resource.Name);
                        ImGui.NextColumn();
                        ImGui.Text(kvp.Value.ToString());
                        ImGui.NextColumn();
                    }

                    //Old Cost code I think
                    if (false)
                    {
                        /*
                         * foreach (var mineral in _componentDesigner.MineralCostValues)
                         * {
                         *  var mineralSD = StaticRefLib.StaticData.CargoGoods.GetMineral(mineral.Key);
                         *  var xpos = ImGui.GetCursorPosX();
                         *  ImGui.SetCursorPosX(xpos + 12);
                         *  ImGui.Text(mineralSD.Name);
                         *  ImGui.NextColumn();
                         *  ImGui.Text(mineral.Value.ToString());
                         *  ImGui.NextColumn();
                         * }
                         * foreach (var material in _componentDesigner.MaterialCostValues)
                         * {
                         *  var matSD = StaticRefLib.StaticData.CargoGoods.GetMaterial(material.Key);
                         *  var xpos = ImGui.GetCursorPosX();
                         *  ImGui.SetCursorPosX(xpos + 12);
                         *  ImGui.Text(matSD.Name);
                         *  ImGui.NextColumn();
                         *  ImGui.Text(material.Value.ToString());
                         *  ImGui.NextColumn();
                         * }
                         * foreach (var component in _componentDesigner.ComponentCostValues)
                         * {
                         *  var compSD = StaticRefLib.StaticData.CargoGoods.GetMaterial(component.Key);
                         *  var xpos = ImGui.GetCursorPosX();
                         *  ImGui.SetCursorPosX(xpos + 12);
                         *  ImGui.Text(compSD.Name);
                         *  ImGui.NextColumn();
                         *  ImGui.Text(component.Value.ToString());
                         *  ImGui.NextColumn();
                         * }
                         */

                        /*
                         * ImGui.Text("Materials");
                         * ImGui.NextColumn();
                         * ImGui.Text(_componentDesigner.MassValue.ToString());
                         * ImGui.NextColumn();
                         *
                         * ImGui.Text("Components");
                         * ImGui.NextColumn();
                         * ImGui.Text(_componentDesigner.MassValue.ToString());
                         * ImGui.NextColumn();
                         */
                    }
                }

                ImGui.EndChild();
            }

            void GuiHintText(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Value.ToString());
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Value.ToString());
                    ImGui.NewLine();
                }
            }

            void GuiHintMaxMin(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }

                attribute.SetMax();
                attribute.SetMin();
                attribute.SetValue();
                attribute.SetStep();

                var    max   = attribute.MaxValue;
                var    min   = attribute.MinValue;
                double val   = attribute.Value;
                double step  = attribute.StepValue;
                double fstep = step * 10;
                IntPtr valPtr;
                IntPtr maxPtr;
                IntPtr minPtr;
                IntPtr stepPtr;
                IntPtr fstepPtr;

                unsafe
                {
                    valPtr   = new IntPtr(&val);
                    maxPtr   = new IntPtr(&max);
                    minPtr   = new IntPtr(&min);
                    stepPtr  = new IntPtr(&step);
                    fstepPtr = new IntPtr(&fstep);
                }
                //ImGui.DragScalar("##slider" + attribute.Name, ImGuiDataType.Double, valPtr, 1f, minPtr, maxPtr);


                if (compactmod)
                {
                }
                else
                {
                    ImGui.PushItemWidth(-1);
                    if (ImGui.SliderScalar("##scaler" + attribute.Name, ImGuiDataType.Double, valPtr, minPtr, maxPtr))
                    {
                        attribute.SetValueFromInput(val);
                    }
                }
                ImGui.PushItemWidth(-1);
                if (ImGui.InputScalar("##input" + attribute.Name, ImGuiDataType.Double, valPtr, stepPtr, fstepPtr))
                {
                    attribute.SetValueFromInput(val);
                }
                ImGui.NewLine();
            }

            void GuiHintTechSelection(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }
                //StaticRefLib.StaticData.Techs[attribute.Value]
                ImGui.TextWrapped(attribute.Value.ToString());

/*
 *              int techSelection;
 *              List<string> techs = attribute.GuidDictionary
 *
 *              if (ImGui.ListBox("Tech" + attribute.Name, ref _designType, _designTypes, _designTypes.Length))
 *              {
 *                  var factionTech = _uiState.Faction.GetDataBlob<FactionTechDB>();
 *                  var staticdata = StaticRefLib.StaticData;
 *                  _componentDesign = GenericComponentFactory.StaticToDesign(_designables[_designType], factionTech, staticdata);
 *              }*/
                ImGui.NewLine();
            }
        }
Ejemplo n.º 3
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;
        }
Ejemplo n.º 4
0
        internal override void Display()
        {
            if (IsActive && ImGui.Begin(_windowname, ref IsActive, _flags))
            {
                GuiDesignUI(); //Part design

                GuiCostText(); //Print cost
                ImGui.End();
            }

            void GuiDesignUI()//Creates all UI elements need for designing the Component
            {
                ImGui.Text("Component Specifications");
                ImGui.SameLine(ImGui.GetWindowWidth() - 70);
                if (ImGui.Button("Compact"))
                {
                    compactmod = !compactmod;
                }


                ImGui.NewLine();

                if (_componentDesigner != null)                                                                         //Make sure comp is selected
                {
                    foreach (ComponentDesignAttribute attribute in _componentDesigner.ComponentDesignAttributes.Values) //For each property of the comp type
                    {
                        ImGui.PushID(attribute.Name);


                        if (attribute.IsEnabled)
                        {
                            switch (attribute.GuiHint) //Either
                            {
                            case GuiHint.None:
                                break;

                            case GuiHint.GuiTechSelectionList:     //Let the user pick a type from a list
                                GuiHintTechSelection(attribute);
                                break;

                            case GuiHint.GuiSelectionMaxMin:     //Set a value
                                GuiHintMaxMin(attribute);
                                break;

                            case GuiHint.GuiTextDisplay:     //Display a stat
                                GuiHintText(attribute);
                                break;

                            case GuiHint.GuiEnumSelectionList:     //Let the user pick a type from a hard coded list
                                GuiHintEnumSelection(attribute);
                                break;

                            case GuiHint.GuiOrdnanceSelectionList:
                                GuiHintOrdnanceSelection(attribute);
                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }
                        }

                        ImGui.PopID();
                    }



                    ImGui.Text("Name");
                    ImGui.InputText("", _nameInputBuffer, 32);
                    if (ImGui.Button("Create Design"))
                    {
                        _componentDesigner.Name = ImGuiSDL2CSHelper.StringFromBytes(_nameInputBuffer);
                        _componentDesigner.CreateDesign(_state.Faction);
                        //we reset the designer here, so we don't end up trying to edit the precious design.
                        var factionTech = _state.Faction.GetDataBlob <FactionTechDB>();
                        _componentDesigner = new ComponentDesigner(_designables[_designType], factionTech);
                    }
                    ImGui.NewLine();
                }
                else//Tell the user they don't have a comp type selected
                {
                    ImGui.NewLine();
                    ImGui.Text("No component type selected");
                    ImGui.NewLine();
                }
            }

            void GuiCostText()//Prints a 2 col table with the costs of the part
            {
                //ImGui.BeginChild("Cost");
                if (_componentDesigner != null)//If a part time is selected
                {
                    ImGui.Columns(2);
                    ImGui.BeginTabItem("Cost");

                    ImGui.Text("Mass");
                    ImGui.Text("Volume_km3");
                    ImGui.Text("Crew Requred");
                    ImGui.Text("Cost");
                    ImGui.Text("Research Cost");
                    ImGui.Text("Build Cost");
                    ImGui.Text("Resource Costs");
                    ImGui.NextColumn();//Add all the cost names to col 1


                    ImGui.Text(Stringify.Mass(_componentDesigner.MassValue));
                    ImGui.Text(Stringify.Volume(_componentDesigner.VolumeM3Value));
                    ImGui.Text(_componentDesigner.CrewReqValue.ToString());
                    ImGui.Text(_componentDesigner.CreditCostValue.ToString());
                    ImGui.Text(_componentDesigner.ResearchCostValue.ToString() + " RP");
                    ImGui.Text(_componentDesigner.IndustryPointCostsValue.ToString() + " BP");
                    ImGui.NextColumn();//Add all the price values to col 2


                    foreach (var kvp in _componentDesigner.ResourceCostValues)
                    {
                        var resource = StaticRefLib.StaticData.CargoGoods.GetAny(kvp.Key);
                        if (resource == null)
                        {
                            resource = (ICargoable)_state.Faction.GetDataBlob <FactionInfoDB>().IndustryDesigns[kvp.Key];
                        }
                        var xpos = ImGui.GetCursorPosX();
                        ImGui.SetCursorPosX(xpos + 12);
                        ImGui.Text(resource.Name);
                        ImGui.NextColumn();
                        ImGui.Text(kvp.Value.ToString());
                        ImGui.NextColumn();
                    }
                }

                //ImGui.EndChild();
            }

            void GuiHintText(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Value.ToString() + " " + attribute.Unit);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Value.ToString() + " " + attribute.Unit);
                    ImGui.NewLine();
                }
            }

            void GuiHintMaxMin(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }

                attribute.SetMax();
                attribute.SetMin();
                attribute.SetValue();
                attribute.SetStep();

                var    max   = attribute.MaxValue;
                var    min   = attribute.MinValue;
                double val   = attribute.Value;
                double step  = attribute.StepValue;
                double fstep = step * 10;
                IntPtr valPtr;
                IntPtr maxPtr;
                IntPtr minPtr;
                IntPtr stepPtr;
                IntPtr fstepPtr;

                unsafe
                {
                    valPtr   = new IntPtr(&val);
                    maxPtr   = new IntPtr(&max);
                    minPtr   = new IntPtr(&min);
                    stepPtr  = new IntPtr(&step);
                    fstepPtr = new IntPtr(&fstep);
                }
                //ImGui.DragScalar("##slider" + attribute.Name, ImGuiDataType.Double, valPtr, 1f, minPtr, maxPtr);


                if (compactmod)
                {
                }
                else
                {
                    ImGui.PushItemWidth(-1);
                    if (ImGui.SliderScalar("##scaler" + attribute.Name, ImGuiDataType.Double, valPtr, minPtr, maxPtr))
                    {
                        attribute.SetValueFromInput(val);
                    }
                }
                ImGui.PushItemWidth(-1);
                if (ImGui.InputScalar("##input" + attribute.Name, ImGuiDataType.Double, valPtr, stepPtr, fstepPtr))
                {
                    attribute.SetValueFromInput(val);
                }
                ImGui.NewLine();
            }

            void GuiHintTechSelection(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }

                int i = 0;

                _techSDs   = new TechSD[attribute.GuidDictionary.Count];
                _techNames = new string[attribute.GuidDictionary.Count];
                foreach (var kvp in attribute.GuidDictionary)
                {
                    TechSD sd = StaticRefLib.StaticData.Techs[Guid.Parse((string)kvp.Key)];
                    _techSDs[i]   = sd;
                    _techNames[i] = sd.Name;
                    i++;
                }

                ImGui.TextWrapped(attribute.Value.ToString());



                if (ImGui.Combo("Select Tech", ref _techSelectedIndex, _techNames, _techNames.Length))
                {
                    attribute.SetValueFromGuidList(_techSDs[_techSelectedIndex].ID);
                }

                ImGui.NewLine();
            }

            void GuiHintEnumSelection(ComponentDesignAttribute attribute)
            {
                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }


                int i = 0;

                //_techSDs = new TechSD[attribute.GuidDictionary.Count];
                _listNames = Enum.GetNames(attribute.EnumType);


                ImGui.TextWrapped(attribute.Value.ToString());

                if (ImGui.Combo("Select", ref attribute.ListSelection, _listNames, (int)attribute.MaxValue + 1))
                {
                    int enumVal = (int)Enum.Parse(attribute.EnumType, _listNames[attribute.ListSelection]);
                    attribute.SetValueFromInput(enumVal);
                }

                ImGui.NewLine();
            }

            void GuiHintOrdnanceSelection(ComponentDesignAttribute attribute)
            {
                var dict = _state.Faction.GetDataBlob <FactionInfoDB>().MissileDesigns;

                _listNames = new string[dict.Count];
                OrdnanceDesign[] ordnances = new OrdnanceDesign[dict.Count];
                int i = 0;

                foreach (var kvp in dict)
                {
                    _listNames[i] = kvp.Value.Name;
                    ordnances[i]  = kvp.Value;
                }



                if (compactmod)
                {
                    ImGui.TextWrapped(attribute.Name + ": " + attribute.Description);
                    ImGui.NewLine();
                }
                else
                {
                    ImGui.TextWrapped(attribute.Name + ":");
                    ImGui.SameLine();
                    ImGui.TextWrapped(attribute.Description);
                    ImGui.NewLine();
                }


                ImGui.TextWrapped(attribute.Value.ToString());

                if (ImGui.Combo("Select", ref attribute.ListSelection, _listNames, _listNames.Length))
                {
                    attribute.SetValueFromComponentList(ordnances[attribute.ListSelection].ID);
                }

                ImGui.NewLine();
            }
        }