コード例 #1
0
        private void DrawInspector(GameObject gameObject)
        {
            if (ImGui.Button("Kill"))
            {
                // TODO: Time isn't right.
                gameObject.Kill(DeathType.Exploded, Context.Game.MapTime);
            }

            if (ImGui.CollapsingHeader("General", ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiUtility.BeginPropertyList();
                ImGuiUtility.PropertyRow("DisplayName", gameObject.Definition.DisplayName);
                ImGuiUtility.PropertyRow("ModelConditionFlags", gameObject.ModelConditionFlags.DisplayName);
                ImGuiUtility.PropertyRow("Speed", gameObject.Speed);
                ImGuiUtility.PropertyRow("Lift", gameObject.Lift);
                ImGuiUtility.EndPropertyList();
            }

            foreach (var drawModule in gameObject.DrawModules)
            {
                if (ImGui.CollapsingHeader(drawModule.GetType().Name, ImGuiTreeNodeFlags.DefaultOpen))
                {
                    ImGuiUtility.BeginPropertyList();
                    drawModule.DrawInspector();
                    ImGuiUtility.EndPropertyList();
                }
            }

            if (ImGui.CollapsingHeader(gameObject.Body.GetType().Name, ImGuiTreeNodeFlags.DefaultOpen))
            {
                ImGuiUtility.BeginPropertyList();
                ImGuiUtility.PropertyRow("Max health", gameObject.Body.MaxHealth);
                ImGuiUtility.PropertyRow("Health", gameObject.Body.Health);
                ImGuiUtility.EndPropertyList();
            }

            if (gameObject.CurrentWeapon != null)
            {
                var weapon = gameObject.CurrentWeapon;
                if (ImGui.CollapsingHeader("Weapon", ImGuiTreeNodeFlags.DefaultOpen))
                {
                    ImGuiUtility.BeginPropertyList();
                    ImGuiUtility.PropertyRow("Uses clip", weapon.UsesClip);
                    ImGuiUtility.PropertyRow("Current rounds", weapon.CurrentRounds);
                    ImGuiUtility.PropertyRow("Current target", weapon.CurrentTarget?.TargetType);
                    ImGuiUtility.PropertyRow("Current target position", weapon.CurrentTarget?.TargetPosition);
                    ImGuiUtility.EndPropertyList();
                }
            }

            foreach (var behaviorModule in gameObject.BehaviorModules)
            {
                if (ImGui.CollapsingHeader(behaviorModule.GetType().Name, ImGuiTreeNodeFlags.DefaultOpen))
                {
                    ImGuiUtility.BeginPropertyList();
                    behaviorModule.DrawInspector();
                    ImGuiUtility.EndPropertyList();
                }
            }
        }
コード例 #2
0
        void IInspectable.DrawInspector()
        {
            ImGuiUtility.BeginPropertyList();

            DrawObject(_value);

            ImGuiUtility.EndPropertyList();
        }
コード例 #3
0
ファイル: AptView.cs プロジェクト: Avatarchik/OpenSAGE
        protected override void DrawOverride(ref bool isGameViewFocused)
        {
            foreach (var aptWindow in Game.Scene2D.AptWindowManager.WindowStack)
            {
                ImGui.BeginChild("DisplayLists", new Vector2(400, 0), true, ImGuiWindowFlags.HorizontalScrollbar);

                if (ImGui.TreeNodeEx(aptWindow.Name, ImGuiTreeNodeFlags.DefaultOpen | ImGuiTreeNodeFlags.OpenOnArrow))
                {
                    DrawDisplayListRecursive(0, aptWindow.Root);
                }
                ImGui.EndChild();

                ImGui.SameLine();
                ImGui.BeginChild("ScriptObject");
                if (_selectedItem != null)
                {
                    ImGuiUtility.BeginPropertyList();
                    ImGuiUtility.PropertyRow("Type", _selectedItem.Character.GetType());
                    ImGuiUtility.PropertyRow("ClipDepth", _selectedItem.ClipDepth);
                    ImGuiUtility.EndPropertyList();

                    switch (_selectedItem)
                    {
                    case SpriteItem si:
                        ImGuiUtility.BeginPropertyList();
                        // CurrentFrame shows the next frame that should be played
                        ImGuiUtility.PropertyRow("CurrentFrame", si.CurrentFrame - 1);
                        ImGuiUtility.PropertyRow("State", si.State);
                        ImGuiUtility.EndPropertyList();

                        if (ImGui.CollapsingHeader("FrameLabels", ImGuiTreeNodeFlags.DefaultOpen))
                        {
                            ImGuiUtility.BeginPropertyList();
                            foreach (var frameLabels in si.FrameLabels)
                            {
                                ImGuiUtility.PropertyRow(frameLabels.Key, frameLabels.Value);
                            }
                            ImGuiUtility.EndPropertyList();
                        }
                        break;

                    case RenderItem ri:
                        if (_selectedItem.Character is Text)
                        {
                            var text = _selectedItem.Character as Text;
                            ImGuiUtility.BeginPropertyList();
                            ImGuiUtility.PropertyRow("Content", text.Content);
                            ImGuiUtility.PropertyRow("InitialValue", text.Value);
                            ImGuiUtility.PropertyRow("Color", text.Color.ToString());
                            ImGuiUtility.PropertyRow("Multiline", text.Multiline);
                            ImGuiUtility.PropertyRow("Wordwrap", text.WordWrap);
                            ImGuiUtility.EndPropertyList();
                        }
                        else if (_selectedItem.Character is Shape)
                        {
                            var shape = _selectedItem.Character as Shape;
                            ImGuiUtility.BeginPropertyList();
                            ImGuiUtility.PropertyRow("GeometryID", shape.Geometry);
                            ImGuiUtility.EndPropertyList();
                        }
                        break;
                    }

                    if (ImGui.CollapsingHeader("Variables", ImGuiTreeNodeFlags.DefaultOpen))
                    {
                        ImGuiUtility.BeginPropertyList();
                        if (_selectedItem.ScriptObject != null)
                        {
                            foreach (var variable in _selectedItem.ScriptObject.Variables)
                            {
                                ImGuiUtility.PropertyRow(variable.Key, CreateObject(variable.Value));
                            }
                        }
                        ImGuiUtility.EndPropertyList();
                    }

                    if (ImGui.CollapsingHeader("Constants", ImGuiTreeNodeFlags.DefaultOpen))
                    {
                        ImGuiUtility.BeginPropertyList();
                        int index = 0;
                        if (_selectedItem.ScriptObject != null)
                        {
                            foreach (var variable in _selectedItem.ScriptObject?.Constants)
                            {
                                ImGuiUtility.PropertyRow($"{index++}", CreateObject(variable));
                            }
                        }
                        ImGuiUtility.EndPropertyList();
                    }
                }
                ImGui.EndChild();
            }
        }