private void DrawCharacterCollectionSelectors()
        {
            ImGui.Dummy(_window._defaultSpace);
            if (ImGui.CollapsingHeader("Active Collections", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGui.Dummy(_window._defaultSpace);
                DrawDefaultCollectionSelector();
                ImGui.Dummy(_window._defaultSpace);
                foreach (var name in Penumbra.CollectionManager.Characters.Keys.OrderBy(k => k).ToArray())
                {
                    using var id = ImRaii.PushId(name);
                    DrawCollectionSelector(string.Empty, _window._inputTextWidth.X, ModCollection.Type.Character, true, name);
                    ImGui.SameLine();
                    if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Trash.ToIconString(), _window._iconButtonSize, string.Empty,
                                                     false,
                                                     true))
                    {
                        Penumbra.CollectionManager.RemoveCharacterCollection(name);
                    }

                    ImGui.SameLine();
                    ImGui.AlignTextToFramePadding();
                    ImGui.TextUnformatted(name);
                }

                DrawNewCharacterCollection();
                ImGui.NewLine();
            }
        }
        private void DrawGeneralSettings()
        {
            if (ImGui.Checkbox(_localizer.Localize("Recording"), ref Config.Recording))
            {
                Config.Save();
            }
            if (Config.ShowTooltips && ImGui.IsItemHovered())
            {
                ImGui.SetTooltip(_localizer.Localize("Automatically record messages with maplink and retrieve later."));
            }
            ImGui.SameLine(ImGui.GetColumnWidth() - 80);
            ImGui.TextUnformatted(_localizer.Localize("Tooltips"));
            ImGui.AlignTextToFramePadding();
            ImGui.SameLine();
            if (ImGui.Checkbox("##hideTooltipsOnOff", ref Config.ShowTooltips))
            {
                Config.Save();
            }

            if (ImGui.Checkbox(_localizer.Localize("Call /tp to teleport to the nearest aetheryte"), ref Config.Teleport))
            {
                Config.Save();
            }
            if (Config.ShowTooltips && ImGui.IsItemHovered())
            {
                ImGui.SetTooltip(_localizer.Localize("Add an option to call /tp to teleport to the nearest aetheryte.\n" +
                                                     "Make sure you have downloaded Teleporter Plugin."));
            }
            if (ImGui.Checkbox(_localizer.Localize("Reverse sorting of maplinks"), ref Config.SortDesc))
            {
                Config.Save();
            }
            if (ImGui.DragInt(_localizer.Localize("Max Records"), ref Config.MaxRecordings, 1, 10, 100))
            {
                Config.Save();
            }

            ImGui.TextUnformatted(_localizer.Localize("Language:"));
            if (Plugin.Config.ShowTooltips && ImGui.IsItemHovered())
            {
                ImGui.SetTooltip(_localizer.Localize("Change the UI Language."));
            }
            ImGui.SameLine();
            ImGui.SetNextItemWidth(200);
            if (ImGui.Combo("##hideLangSetting", ref _selectedLanguage, _languageList, _languageList.Length))
            {
                Config.UILanguage   = _languageList[_selectedLanguage];
                _localizer.Language = Config.UILanguage;
                Config.Save();
            }
            if (ImGui.Checkbox(_localizer.Localize("Print Debug Message"), ref Config.PrintMessage))
            {
                Config.Save();
            }
            if (ImGui.Checkbox(_localizer.Localize("Print Error Message"), ref Config.PrintError))
            {
                Config.Save();
            }
        }
Example #3
0
        public void ModelTab()
        {
            ImGui.BeginChild("##tabinner");
            if (ImGui.Button("Add"))
            {
                modelSelector        = new FileSelector(context.FlDirectory);
                modelSelector.Filter = FileSelector.MakeFilter(".3db", ".cmp");
                modelSelector.Open();
            }
            string newfile;

            if ((newfile = modelSelector.Draw()) != null)
            {
                var name = Path.GetFileName(newfile);
                resources.Models.Add(new InterfaceModel()
                {
                    Name = name, Path = newfile
                });
            }
            ImGui.Columns(2);
            ImGui.BeginChild("##items");
            for (int i = 0; i < resources.Models.Count; i++)
            {
                if (ImGui.Selectable(ImGuiExt.IDWithExtra(resources.Models[i].Name, i.ToString()), _selModelIndex == i))
                {
                    _selModelIndex = i;
                    drawable       = context.GetModel(resources.Models[i].Path);
                    modelName.SetText(resources.Models[i].Name);
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            ImGui.BeginChild("##pane");
            if (_selModelIndex >= 0 && _selModelIndex < resources.Models.Count)
            {
                var mdl = resources.Models[_selModelIndex];
                ImGui.SameLine(ImGui.GetColumnWidth() - 65);
                if (ImGui.Button("Delete"))
                {
                    resources.Models.RemoveAt(_selModelIndex);
                    _selModelIndex = -1;
                }
                ImGui.AlignTextToFramePadding();
                ImGui.Text("Name: ");
                ImGui.SameLine();
                modelName.InputText("##Name", ImGuiInputTextFlags.None);
                mdl.Name = modelName.GetText();
                ImGui.Text($"Path: {mdl.Path}");
                ImGui.InputFloat("Offset X", ref mdl.X);
                ImGui.InputFloat("Offset Y", ref mdl.Y);
                ImGui.InputFloat("Scale X", ref mdl.XScale);
                ImGui.InputFloat("Scale Y", ref mdl.YScale);
                DoViewport(mdl);
            }

            ImGui.EndChild();
            ImGui.EndChild();
        }
Example #4
0
 public static void PropertyRow(string name, object value)
 {
     ImGui.AlignTextToFramePadding();
     ImGui.Text(name);
     ImGui.NextColumn();
     ImGui.AlignTextToFramePadding();
     ImGui.Text(value?.ToString() ?? "<null>");
     ImGui.NextColumn();
 }
 static void SoundSlider(string text, ref float flt)
 {
     ImGui.PushID(text);
     ImGui.AlignTextToFramePadding();
     ImGui.Text(text);
     ImGui.SameLine();
     ImGui.SliderFloat("##slider", ref flt, 0, 1);
     ImGui.PopID();
 }
Example #6
0
    private static bool DrawMatrixInput(float width, ref Matrix4x4 matrix)
    {
        using var table = ImRaii.Table(string.Empty, 5, ImGuiTableFlags.BordersInner | ImGuiTableFlags.SizingFixedFit);
        if (!table)
        {
            return(false);
        }

        var changes = false;

        ImGui.TableNextColumn();
        ImGui.TableNextColumn();
        ImGuiUtil.Center("R");
        ImGui.TableNextColumn();
        ImGuiUtil.Center("G");
        ImGui.TableNextColumn();
        ImGuiUtil.Center("B");
        ImGui.TableNextColumn();
        ImGuiUtil.Center("A");

        var inputWidth = width / 6;

        ImGui.TableNextColumn();
        ImGui.AlignTextToFramePadding();
        ImGui.Text("R    ");
        changes |= DragFloat("##RR", inputWidth, ref matrix.M11);
        changes |= DragFloat("##RG", inputWidth, ref matrix.M12);
        changes |= DragFloat("##RB", inputWidth, ref matrix.M13);
        changes |= DragFloat("##RA", inputWidth, ref matrix.M14);

        ImGui.TableNextColumn();
        ImGui.AlignTextToFramePadding();
        ImGui.Text("G    ");
        changes |= DragFloat("##GR", inputWidth, ref matrix.M21);
        changes |= DragFloat("##GG", inputWidth, ref matrix.M22);
        changes |= DragFloat("##GB", inputWidth, ref matrix.M23);
        changes |= DragFloat("##GA", inputWidth, ref matrix.M24);

        ImGui.TableNextColumn();
        ImGui.AlignTextToFramePadding();
        ImGui.Text("B    ");
        changes |= DragFloat("##BR", inputWidth, ref matrix.M31);
        changes |= DragFloat("##BG", inputWidth, ref matrix.M32);
        changes |= DragFloat("##BB", inputWidth, ref matrix.M33);
        changes |= DragFloat("##BA", inputWidth, ref matrix.M34);

        ImGui.TableNextColumn();
        ImGui.AlignTextToFramePadding();
        ImGui.Text("A    ");
        changes |= DragFloat("##AR", inputWidth, ref matrix.M41);
        changes |= DragFloat("##AG", inputWidth, ref matrix.M42);
        changes |= DragFloat("##AB", inputWidth, ref matrix.M43);
        changes |= DragFloat("##AA", inputWidth, ref matrix.M44);

        return(changes);
    }
Example #7
0
        /// <summary>
        /// aligns a button and label in the same way LabelText and regular widgets are lined up
        /// </summary>
        /// <param name="label"></param>
        /// <param name="buttonText"></param>
        /// <returns></returns>
        public static bool LabelButton(string label, string buttonText)
        {
            ImGui.AlignTextToFramePadding();

            var wasClicked = ImGui.Button(buttonText);

            ImGui.SameLine(0, ImGui.GetWindowWidth() * 0.65f - ImGui.GetItemRectSize().X + ImGui.GetStyle().ItemInnerSpacing.X);
            ImGui.Text(label);

            return(wasClicked);
        }
Example #8
0
        public static void TextRow(string name, string value)
        {
            ImGui.AlignTextToFramePadding();
            ImGui.TreeNodeEx(name, RowFlags);
            ImGui.NextColumn();
            ImGui.SetNextItemWidth(-1);

            ImGui.Text(value);

            ImGui.NextColumn();
        }
Example #9
0
        void FLPane()
        {
            var totalH = ImGui.GetWindowHeight();

            ImGuiExt.SplitterV(2f, ref fl_h1, ref fl_h2, 8, 8, -1);
            fl_h1 = totalH - fl_h2 - 6f;
            ImGui.BeginChild("1", new Vector2(-1, fl_h1), false, ImGuiWindowFlags.None);
            ImGui.Separator();
            //3DB list
            if (ImGui.TreeNodeEx("Model/"))
            {
                int i = 0;
                foreach (var mdl in output)
                {
                    FLTree(mdl, ref i);
                }
            }
            ImGui.EndChild();
            ImGui.BeginChild("2", new Vector2(-1, fl_h2), false, ImGuiWindowFlags.None);
            if (ImGuiExt.ToggleButton("Options", curTab == 0))
            {
                curTab = 0;
            }
            ImGui.SameLine();
            if (ImGuiExt.ToggleButton("Materials", curTab == 1))
            {
                curTab = 1;
            }
            ImGui.Separator();
            switch (curTab)
            {
            case 0:     //OPTIONS
                ImGui.AlignTextToFramePadding();
                ImGui.Text("Model Name:");
                ImGui.SameLine();
                modelNameBuffer.InputText("##mdlname", ImGuiInputTextFlags.None);
                ImGui.Checkbox("Generate Materials", ref generateMaterials);
                break;

            case 1:     //MATERIALS
                if (selected == null)
                {
                    ImGui.Text("No object selected");
                }
                else
                {
                    MatNameEdit();
                }
                break;
            }
            ImGui.EndChild();
        }
        private static bool DrawDragDropTargetSources(CooldownTrigger trigger, IList <int> toSwap)
        {
            const string payloadIdentifier = "PRIORITY_PAYLOAD";

            if (ImGui.BeginDragDropSource(ImGuiDragDropFlags.SourceNoHoldToOpenOthers |
                                          ImGuiDragDropFlags.SourceNoPreviewTooltip))
            {
                unsafe
                {
                    var prio = trigger.Priority;
                    var ptr  = new IntPtr(&prio);
                    ImGui.SetDragDropPayload(payloadIdentifier, ptr, sizeof(int));
                }

                ImGui.SameLine();
                ImGui.AlignTextToFramePadding();
#if DEBUG
                ImGui.Text($"{trigger.Priority + 1} Dragging {trigger.ActionName}.");
#else
                ImGui.Text($"Dragging {trigger.ActionName}.");
#endif
                ImGui.EndDragDropSource();
                return(true);
            }

            if (!ImGui.BeginDragDropTarget())
            {
                return(false);
            }
            var imGuiPayloadPtr = ImGui.AcceptDragDropPayload(payloadIdentifier,
                                                              ImGuiDragDropFlags.AcceptNoPreviewTooltip |
                                                              ImGuiDragDropFlags.AcceptNoDrawDefaultRect);
            unsafe
            {
                if (imGuiPayloadPtr.NativePtr is not null)
                {
                    var prio = *(int *)imGuiPayloadPtr.Data;
                    toSwap[0] = prio;
                    toSwap[1] = trigger.Priority;
                }
            }

            ImGui.SameLine();
            ImGui.AlignTextToFramePadding();
#if DEBUG
            ImGui.Text($"{trigger.Priority + 1} Swap with {trigger.ActionName}");
#else
            ImGui.Text($"Swap with {trigger.ActionName}");
#endif
            ImGui.EndDragDropTarget();
            return(true);
        }
Example #11
0
        public override void draw()
        {
            var entity = getValue <Entity>();

            ImGui.AlignTextToFramePadding();
            ImGui.Text(_name);
            ImGui.SameLine();
            if (ImGui.Button(entity.name))
            {
                Core.getGlobalManager <ImGuiManager>().startInspectingEntity(entity);
            }
            handleTooltip();
        }
Example #12
0
        private void renderNull(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "null";
            string s   = "null";

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGuiNETExtensions.InputText($"##{node.GetHashCode()}", ref s, 1024U, InputTextFlags.ReadOnly);
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            _renderCount++;
        }
Example #13
0
        private static void DrawStatusSelectorTitles(float width)
        {
            const string disabledHeader = "Disabled Statuses";
            const string enabledHeader  = "Monitored Statuses";
            var          pos1           = width / 4 - ImGui.CalcTextSize(disabledHeader).X / 2;
            var          pos2           = 3 * width / 4 + ImGui.GetStyle().ItemSpacing.X - ImGui.CalcTextSize(enabledHeader).X / 2;

            ImGui.SetCursorPosX(pos1);
            ImGui.AlignTextToFramePadding();
            ImGui.Text(disabledHeader);
            ImGui.SameLine(pos2);
            ImGui.AlignTextToFramePadding();
            ImGui.Text(enabledHeader);
        }
Example #14
0
        private void renderBool(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "bool";
            bool   b   = node.AsBool;

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGui.Checkbox($"##{_renderCount}", ref b);
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            node.AsBool = b;
            _renderCount++;
        }
Example #15
0
        private void DrawRow(string name, object propertyValue)
        {
            var hasChildNodes = false;

            if (propertyValue != null)
            {
                var propertyType = propertyValue.GetType();
                var typeCode     = Type.GetTypeCode(propertyType);
                if (typeCode == TypeCode.Object && propertyType != typeof(Percentage))
                {
                    hasChildNodes = true;
                }
            }

            ImGui.AlignTextToFramePadding();

            var nodeOpen = false;

            if (hasChildNodes)
            {
                nodeOpen = ImGui.TreeNode(name);
            }
            else
            {
                ImGui.TreeNodeEx(name, ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen);
            }

            ImGui.NextColumn();
            ImGui.AlignTextToFramePadding();

            if (propertyValue is AudioFile audioFile && audioFile.Entry != null)
            {
                if (ImGui.Button("Play audio"))
                {
                    ImGui.OpenPopup("Audio player");
                    _currentSoundView = AddDisposable(new SoundView(Context, audioFile));
                }
                var isAudioPlayerOpen = _currentSoundView != null;
                if (ImGui.BeginPopupModal("Audio player", ref isAudioPlayerOpen))
                {
                    _currentSoundView.Draw();
                    ImGui.EndPopup();
                }
                if (!isAudioPlayerOpen && _currentSoundView != null)
                {
                    RemoveAndDispose(ref _currentSoundView);
                }
            }
Example #16
0
        private void DrawRow(string name, object propertyValue, Action <object> setPropertyValue)
        {
            InspectableDrawer drawer = null;
            var hasChildNodes        = false;

            if (propertyValue != null)
            {
                var propertyType = propertyValue.GetType();
                drawer        = Drawers.First(x => x.Type.IsAssignableFrom(propertyType));
                hasChildNodes = drawer.HasChildNodes;
            }

            ImGui.AlignTextToFramePadding();

            var nodeOpen = false;

            if (hasChildNodes)
            {
                nodeOpen = ImGui.TreeNode(name);
            }
            else
            {
                ImGui.TreeNodeEx(name, ImGuiTreeNodeFlags.Leaf | ImGuiTreeNodeFlags.NoTreePushOnOpen);
            }

            ImGui.NextColumn();
            ImGui.AlignTextToFramePadding();

            if (drawer != null)
            {
                if (drawer.Draw(ref propertyValue, _context))
                {
                    setPropertyValue?.Invoke(propertyValue);
                }
            }
            else
            {
                ImGui.Text("<null>");
            }

            ImGui.NextColumn();

            if (nodeOpen)
            {
                DrawObject(propertyValue);
                ImGui.TreePop();
            }
        }
Example #17
0
        public static bool ButtonRow(string name, string button)
        {
            ImGui.PushID(name.GetHashCode());

            ImGui.AlignTextToFramePadding();
            ImGui.TreeNodeEx(name, RowFlags);
            ImGui.NextColumn();
            ImGui.SetNextItemWidth(-1);

            var clicked = ImGui.SmallButton(button);

            ImGui.NextColumn();
            ImGui.PopID();

            return(clicked);
        }
Example #18
0
        public static bool DetailsRow <T>(string name, ref T value, RowDelegate <T> selector)
        {
            ImGui.PushID(name.GetHashCode());

            ImGui.AlignTextToFramePadding();
            ImGui.TreeNodeEx(name, RowFlags);
            ImGui.NextColumn();
            ImGui.SetNextItemWidth(-1);

            var changed = selector(ref value);

            ImGui.NextColumn();
            ImGui.PopID();

            return(changed);
        }
Example #19
0
        private void renderFloat(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "float";
            float  f   = node.AsFloat;

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGui.DragFloat($"##{_renderCount}", ref f, float.MinValue, float.MaxValue, 0.01f, "%.4f");
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            //if (Math.Abs(node.AsFloat - f) > float.Epsilon) _jsonDirty = true;
            node.AsFloat = f;
            _renderCount++;
        }
        public static void InputTextPlaceholder(Vector2 pos, string placeholder, bool visible = true)
        {
            if (!visible)
            {
                return;
            }

            PushCursorPos(pos);

            ImGui.AlignTextToFramePadding();
            ImGui.SetCursorPosX(ImGui.GetCursorPosX() + ImGui.GetStyle().FramePadding.X);

            ImGui.TextDisabled(placeholder);

            PopCursorPos();
        }
Example #21
0
        private void renderInt(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "int";
            int    i   = node.AsInt;

            ImGui.Text(key);
            node.Validate(_validationEventHandler);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGui.DragInt($"##{_renderCount}", ref i, 1.0f, int.MinValue, int.MaxValue, i.ToString());
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            //if (node.Schema != null) node.Token.Validate(node.Schema, _validationEventHandler);
            node.AsInt = i;
            _renderCount++;
        }
Example #22
0
        private static void DrawTraceCombo(TraceRecord trace, bool abbreviate)
        {
            var    tracelist = trace.Target.GetTracesUIList();
            string selString = (abbreviate ? "PID " : "Process ") + trace.PID;

            if (ImGui.TableNextColumn())
            {
                ImGui.AlignTextToFramePadding();
                ImGuiUtils.DrawHorizCenteredText($"{tracelist.Length}x");
                SmallWidgets.MouseoverText($"This target binary has {tracelist.Length} loaded trace{(tracelist.Length != 1 ? 's' : "")} associated with it");
            }

            if (ImGui.TableNextColumn())
            {
                ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 35);
                if (ImGui.BeginCombo("##ProcessTraceCombo", selString))
                {
                    foreach (var selectableTrace in tracelist)
                    {
                        bool   current = trace.PID == selectableTrace.PID && trace.randID == selectableTrace.randID;
                        string label   = "PID " + selectableTrace.PID;
                        if (current is false)
                        {
                            //label = "Parent: " + label + $" ({selectableTrace.Target.FileName})";
                            label = label + $" ({selectableTrace.Target.FileName})";
                        }
                        if (selectableTrace.GraphCount == 0)
                        {
                            label = label + "[0 graphs]";
                        }
                        if (ImGui.Selectable(label, current))
                        {
                            rgatState.SelectActiveTrace(selectableTrace);
                        }
                        if (selectableTrace.Children.Length > 0)
                        {
                            CreateTracesDropdown(selectableTrace, 1);
                        }
                    }
                    ImGui.EndCombo();
                }
                ImGui.SameLine();
                ImGui.Text($"{ImGuiController.FA_ICON_COGS}");
            }
        }
Example #23
0
        private void DrawSymbolsSelectControls(PlottedGraph plot)
        {
            float height = 30;

            if (_activeHighlights.selectedHighlightTab == 0)
            {
                if (ImGui.BeginChild(ImGui.GetID("highlightSymsControls"), new Vector2(ImGui.GetContentRegionAvail().X, height)))
                {
                    ImGui.AlignTextToFramePadding();
                    ImGui.Text($"{_activeHighlights.SelectedSymbols.Count} highlighted symbols ({plot.HighlightedSymbolNodes.Count} nodes)");
                    ImGui.SameLine();
                    ImGui.Dummy(new Vector2(6, 10));
                    ImGui.SameLine();
                    if (ImGui.Button("Clear"))
                    {
                        foreach (var sym in _activeHighlights.SelectedSymbols)
                        {
                            symbolInfo symdat = _activeHighlights.displayedModules[sym.moduleID].symbols[sym.address];
                            symdat.selected = false;
                            _activeHighlights.displayedModules[sym.moduleID].symbols[sym.address] = symdat;
                        }

                        plot.LayoutState.Lock.EnterUpgradeableReadLock();
                        plot.RemoveHighlightedNodes(plot.HighlightedSymbolNodes, CONSTANTS.HighlightType.Externals);
                        plot.LayoutState.Lock.ExitUpgradeableReadLock();

                        _activeHighlights.SelectedSymbols.Clear();
                    }

                    /*
                     * ImGui.SameLine(ImGui.GetContentRegionAvail().X - 100);
                     * ImGui.PushStyleColor(ImGuiCol.Button, Themes.GetThemeColourUINT(Themes.eThemeColour.GraphBackground));
                     * ImGui.PushStyleColor(ImGuiCol.Text, WritableRgbaFloat.ToUint(Color.Cyan));
                     * if (ImGui.Button("Highlight Colour"))
                     * {
                     *  //todo: highlight colour picker
                     * }
                     * ImGui.PopStyleColor();
                     * ImGui.PopStyleColor();
                     */

                    ImGui.EndChild();
                }
            }
        }
Example #24
0
        public void PropEditorFMG(FMG.Entry entry, string name, float boxsize)
        {
            ImGui.PushID(_fmgID);
            ImGui.AlignTextToFramePadding();
            ImGui.Text(name);
            ImGui.NextColumn();
            ImGui.SetNextItemWidth(-1);
            // ImGui.AlignTextToFramePadding();
            var    typ                = typeof(string);
            var    oldval             = entry.Text;
            bool   shouldUpdateVisual = false;
            bool   changed            = false;
            object newval             = null;

            string val = (string)oldval;

            if (val == null)
            {
                val = "";
            }
            if (boxsize > 0.0f)
            {
                if (ImGui.InputTextMultiline("##value", ref val, 2000, new Vector2(-1, boxsize)))
                {
                    newval  = val;
                    changed = true;
                }
            }
            else
            {
                if (ImGui.InputText("##value", ref val, 2000))
                {
                    newval  = val;
                    changed = true;
                }
            }

            bool committed = ImGui.IsItemDeactivatedAfterEdit();

            UpdateProperty(entry.GetType().GetProperty("Text"), null, entry, newval, changed, committed, shouldUpdateVisual, false);

            ImGui.NextColumn();
            ImGui.PopID();
            _fmgID++;
        }
        private static bool DrawPatternSteps(VibrationPattern pattern, float scale)
        {
            var changed = false;

            ImGui.PushFont(UiBuilder.IconFont);
            if (ImGui.Button($"{FontAwesomeIcon.Plus.ToIconString()}##PatternStep",
                             new Vector2(23 * scale, 23 * scale)))
            {
                pattern.Steps.Add(new VibrationPattern.Step(0, 0));
                changed = true;
            }

            ImGui.PopFont();
            var toRemoveSteps = new List <int>();

            ImGui.SameLine();
            ImGui.AlignTextToFramePadding();
            ImGui.Text("Steps");
            for (var i = 0; i < pattern.Steps.Count; i++)
            {
                ImGui.PushID(i);
                var s = pattern.Steps[i];
                ImGui.AlignTextToFramePadding();
                ImGui.Text($"{i + 1}");
                ImGui.SameLine();
                changed |= DrawHorizontalStep(scale, s);
                ImGui.SameLine();
                if (DrawDeleteButton(FontAwesomeIcon.TrashAlt,
                                     new Vector2(23 * scale, 23 * scale),
                                     "Delete this Step."))
                {
                    toRemoveSteps.Add(i);
                    changed = true;
                }

                ImGui.PopID();
            }

            foreach (var i in toRemoveSteps)
            {
                pattern.Steps.RemoveAt(i);
            }
            ImGui.TreePop();
            return(changed);
        }
Example #26
0
        private void renderString(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key = node.Key ?? "string";
            string s   = node.AsString;

            ImGui.Text(key);
            ImGui.NextColumn();
            ImGui.PushItemWidth(-1);
            ImGuiNETExtensions.InputText($"##{_renderCount}", ref s);
            ImGui.PopItemWidth();
            ImGui.NextColumn();
            if (node.Schema != null && !node.AsString.Equals(s))
            {
                //node.Token.Validate(node.Schema, _validationEventHandler);
            }
            node.AsString = s;
            _renderCount++;
        }
Example #27
0
        private static bool Header(ref object value, out bool open, Property property, ITool tool, ToolState toolState)
        {
            ImGui.AlignTextToFramePadding();
            open = ImGui.TreeNode(property.Name);

            ImGui.NextColumn();
            ImGui.AlignTextToFramePadding();
            var changed = false;

            if (value == null)
            {
                ImGui.Text("null");
            }
            else
            {
                changed = tool.HeaderValue(ref value, toolState);
            }

            ImGui.NextColumn();
            return(changed);
        }
Example #28
0
        private void renderObject(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key        = node.Key ?? "object";
            bool   objectNode = ImGui.TreeNode(key);

            ImGui.NextColumn();
            ImGui.NextColumn();

            if (objectNode)
            {
                ImGui.PushID(key);
                foreach (KeyValuePair <string, JsonNode> kv in node.AsDictionary)
                {
                    renderNode(kv.Value);
                }
                ImGui.TreePop();
                ImGui.PopID();
            }
            _renderCount++;
        }
Example #29
0
        private void renderArray(JsonNode node)
        {
            ImGui.AlignTextToFramePadding();
            string key       = node.Key ?? "array";
            bool   arrayNode = ImGui.TreeNode($"{key}[{node.AsList.Count}]##{node.GetHashCode()}");

            ImGui.NextColumn();
            ImGui.NextColumn();

            if (arrayNode)
            {
                ImGui.PushID(key);

                foreach (JsonNode n in node.AsList)
                {
                    renderNode(n);
                }
                ImGui.TreePop();
                ImGui.PopID();
            }
            _renderCount++;
        }
Example #30
0
 private void ChaliceDungeonImportButton()
 {
     ImGui.Selectable($@"   {ForkAwesome.PlusCircle} Load Chalice Dungeon...", false);
     if (ImGui.BeginPopupContextItem("chalice", 0))
     {
         ImGui.AlignTextToFramePadding();
         ImGui.Text("Chalice ID (m29_xx_xx_xx): ");
         ImGui.SameLine();
         var pname = _chaliceMapID;
         ImGui.SetNextItemWidth(100);
         if (_chaliceLoadError)
         {
             ImGui.PushStyleColor(ImGuiCol.FrameBg, new Vector4(0.8f, 0.2f, 0.2f, 1.0f));
         }
         if (ImGui.InputText("##chalicename", ref pname, 12))
         {
             _chaliceMapID = pname;
         }
         if (_chaliceLoadError)
         {
             ImGui.PopStyleColor();
         }
         ImGui.SameLine();
         if (ImGui.Button("Load"))
         {
             if (!_universe.LoadMap(_chaliceMapID))
             {
                 _chaliceLoadError = true;
             }
             else
             {
                 ImGui.CloseCurrentPopup();
                 _chaliceLoadError = false;
                 _chaliceMapID     = "m29_";
             }
         }
         ImGui.EndPopup();
     }
 }