Ejemplo n.º 1
0
        public void DrawInstanceTableRow(KeyValuePair <string, PropertyInfo> propertyPair)
        {
            ImGui.TableSetColumnIndex(0);
            propertyDrawer.DrawType(propertyPair.Value.PropertyType);

            Caller.Try(() =>
            {
                bool readable   = PropertyCanRead(propertyPair.Value);
                object instance = readable ? propertyPair.Value.GetValue(GetClassInstance(), null) : null;

                ImGui.TableSetColumnIndex(1);
                propertyDrawer.DrawName(
                    propertyPair.Key,
                    propertyPair.Value.PropertyType,
                    GetClass().type,
                    instance);
            });

            ImGui.TableSetColumnIndex(2);
            propertyDrawer.DrawPropertyValue(propertyPair.Value, GetClassInstance());

            ImGuiEx.TableTextRow(
                3,
                propertyPair.Value.CanRead.ToString(),
                propertyPair.Value.CanWrite.ToString());
        }
Ejemplo n.º 2
0
        public void DrawPropertyTable(
            SortedList <string, PropertyInfo> property_list,
            string table_name = "PropertyTable"
            )
        {
            if (property_list.Count == 0)
            {
                return;
            }

            if (ImGui.BeginTable(table_name, 4, TableFlags))
            {
                ImGuiEx.TableSetupHeaders(
                    "Type",
                    "Name",
                    "Gettable",
                    "Settable");
                foreach (var property in property_list)
                {
                    ImGui.TableNextRow();
                    ImGui.TableSetColumnIndex(0);
                    propertyDrawer.DrawType(property.Value.PropertyType);

                    ImGuiEx.TableTextRow(1, property.Key, property.Value.CanRead.ToString(), property.Value.CanWrite.ToString());
                }
                ImGui.EndTable();
            }
        }
Ejemplo n.º 3
0
        public void DrawFieldTable(
            SortedList <string, FieldInfo> field_list,
            string table_name = "FieldTable"
            )
        {
            if (field_list.Count == 0)
            {
                return;
            }

            if (ImGui.BeginTable(table_name, 2, TableFlags))
            {
                ImGuiEx.TableSetupHeaders("Type", "Name");

                foreach (var fieldPair in field_list)
                {
                    ImGui.TableNextRow();
                    ImGui.TableSetColumnIndex(0);
                    fieldDrawer.DrawType(fieldPair.Value.FieldType);

                    ImGuiEx.TableTextRow(1, fieldPair.Key);
                }
                ImGui.EndTable();
            }
        }
Ejemplo n.º 4
0
        public void DrawLeft()
        {
            var color = new Vector4(0.6f, 0.6f, 0.6f, 0.65f);

            ImGui.BeginChild("InstanceTableChlid", new Vector2(ImGui.GetWindowContentRegionWidth() * 0.35f, ImGui.GetWindowHeight()));
            ImGui.Text("Instance List");

            InstanceInfo removeInfo = new InstanceInfo();

            ImGuiEx.TableView("InstanceTable", () =>
            {
                foreach (InstanceInfo instance in instanceList)
                {
                    ImGui.TableNextRow();

                    if (instance == curInstance)
                    {
                        ImGui.TableSetBgColor(ImGuiTableBgTarget.RowBg0 + 1, ImGui.GetColorU32(color));
                    }

                    ImGuiEx.TableTextRow(0, instance.parent, instance.type.Name);

                    ImGui.TableSetColumnIndex(2);
                    if (ImGui.Button(instance.name.ToString()))
                    {
                        UpdateView(instance);
                        break;  //prevent error
                    }

                    ImGui.TableSetColumnIndex(3);
                    if (ImGui.ArrowButton(instance.GetHashCode().ToString(), ImGuiDir.Down))
                    {
                        removeInfo = instance;
                    }
                }
            }, tableFlags, "Parent", "Type", "Name", "Close");

            if (removeInfo != null)
            {
                instanceList.Remove(removeInfo);
            }

            ImGui.EndChild();
        }