コード例 #1
0
        private static void AxBySwapper()
        {
            ImGui.BulletText("Input Type:");
            ImGui.SameLine();
            if (ImGuiAddons.BeginComboFixed("##Current AxBy", FfxHelperMethods.AxByToName(SelectedFfxWindow.AxBy)))
            {
                if (FfxHelperMethods.AxByColorArray.Contains(SelectedFfxWindow.AxBy))
                {
                    foreach (string str in FfxHelperMethods.AxByColorArray)
                    {
                        bool selected = false;
                        if (SelectedFfxWindow.AxBy == str)
                        {
                            selected = true;
                        }
                        if (ImGui.Selectable(FfxHelperMethods.AxByToName(str), selected) & str != SelectedFfxWindow.AxBy)
                        {
                            XElement axbyElement = SelectedFfxWindow.FfxPropertyEditorElement;
                            if (str == "A19B7")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("19", "7");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "19"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "7"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A35B11")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("35", "11");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "35"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "11"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A67B19")
                            {
                                if (SelectedFfxWindow.AxBy == "A4163B35")
                                {
                                    var actionListQuick = new List <Action>();

                                    actionListQuick.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "67"));
                                    actionListQuick.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "19"));

                                    actionListQuick.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionListQuick));
                                    return;
                                }
                                XElement templateXElement = DefParser.TemplateGetter("67", "19");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "67"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "19"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A99B27")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("99", "27");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "99"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "27"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A4163B35")
                            {
                                if (SelectedFfxWindow.AxBy == "A67B19")
                                {
                                    var actionListQuick = new List <Action>();

                                    actionListQuick.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "4163"));
                                    actionListQuick.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "35"));

                                    actionListQuick.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionListQuick));
                                    return;
                                }
                                XElement templateXElement = DefParser.TemplateGetter("4163", "35");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "4163"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "35"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            return;
                        }
                    }
                }
                else if (FfxHelperMethods.AxByScalarArray.Contains(SelectedFfxWindow.AxBy))
                {
                    foreach (string str in FfxHelperMethods.AxByScalarArray)
                    {
                        bool selected = false;
                        if (SelectedFfxWindow.AxBy == str)
                        {
                            selected = true;
                        }
                        if (ImGui.Selectable(FfxHelperMethods.AxByToName(str), selected) & str != SelectedFfxWindow.AxBy)
                        {
                            XElement axbyElement = SelectedFfxWindow.FfxPropertyEditorElement;
                            if (str == "A0B0")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("0", "0");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "0"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "0"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A16B4")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("16", "4");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "16"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "4"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A32B8")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("32", "8");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "32"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "8"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A64B16")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("64", "16");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "64"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "16"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A96B24")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("96", "24");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "96"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "24"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            else if (str == "A4160B32")
                            {
                                XElement templateXElement = DefParser.TemplateGetter("4160", "32");
                                if (templateXElement != null)
                                {
                                    var actionList = new List <Action>();

                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "4160"));
                                    actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "32"));

                                    actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                                    actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                                    SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                                }
                            }
                            return;
                        }
                    }
                }
                else
                {
                    ImGui.Selectable(SelectedFfxWindow.AxBy, true);
                }
                ImGuiAddons.EndComboFixed();
            }
            ImGui.SameLine();
            if (ImGuiAddons.ButtonGradient("Flip C/S"))
            {
                XElement axbyElement = SelectedFfxWindow.FfxPropertyEditorElement;
                if (FfxHelperMethods.AxByColorArray.Contains(SelectedFfxWindow.AxBy))
                {
                    XElement templateXElement = DefParser.TemplateGetter("0", "0");
                    if (templateXElement != null)
                    {
                        var actionList = new List <Action>();

                        actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "0"));
                        actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "0"));

                        actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                        actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                        SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                    }
                }
                else
                {
                    XElement templateXElement = DefParser.TemplateGetter("19", "7");
                    if (templateXElement != null)
                    {
                        var actionList = new List <Action>();

                        actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumA"), "19"));
                        actionList.Add(new ModifyXAttributeString(axbyElement.Attribute("TypeEnumB"), "7"));

                        actionList.Add(new XElementReplaceChildren(axbyElement, templateXElement));

                        actionList.Add(new ResetEditorSelection(SelectedFfxWindow));

                        SelectedFfxWindow.ActionManager.ExecuteAction(new CompoundAction(actionList));
                    }
                }
            }
        }
コード例 #2
0
        public static void FfxEditor()
        {
            ImGui.SetNextWindowDockID(mainViewPortDockSpaceID, ImGuiCond.FirstUseEver);
            if (SelectedFfxWindow.ShowFfxEditorProperties)
            {
                AxBySwapper();
                ImGui.NewLine();
                switch (SelectedFfxWindow.AxBy)
                {
                case "A0B0":
                    break;

                case "A16B4":
                    break;

                case "A19B7":
                    break;

                case "A32B8":
                    SelectedFfxWindow.FfxPropertyA32B8StaticScalar(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A35B11":
                    SelectedFfxWindow.FfxPropertyA35B11StaticColor(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A64B16":
                    SelectedFfxWindow.FfxPropertyA64B16ScalarInterpolationLinear(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A67B19":
                    SelectedFfxWindow.FfxPropertyA67B19ColorInterpolationLinear(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A96B24":
                    SelectedFfxWindow.FfxPropertyA96B24ScalarInterpolationWithCustomCurve(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A99B27":
                    SelectedFfxWindow.FfxPropertyA99B27ColorInterpolationWithCustomCurve(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A4163B35":
                    SelectedFfxWindow.FfxPropertyA67B19ColorInterpolationLinear(SelectedFfxWindow.NodeListEditor);
                    break;

                case "A4160B32":
                    SelectedFfxWindow.FfxPropertyA64B16ScalarInterpolationLinear(SelectedFfxWindow.NodeListEditor);
                    break;

                default:
                    ImGui.Text("ERROR: FFX Property Handler not found, using Default Handler.");
                    foreach (XElement node in SelectedFfxWindow.NodeListEditor)
                    {
                        string dataType  = node.Attribute(FfxHelperMethods.Xsi + "type").Value;
                        int    nodeIndex = FfxHelperMethods.GetNodeIndexinParent(node);
                        if (dataType == "FFXFieldFloat")
                        {
                            SelectedFfxWindow.FloatInputDefaultNode(node, dataType + "##" + nodeIndex.ToString());
                        }
                        else if (dataType == "FFXFieldInt")
                        {
                            SelectedFfxWindow.IntInputDefaultNode(node, dataType + "##" + nodeIndex.ToString());
                        }
                    }
                    break;
                }
            }
            else if (SelectedFfxWindow.ShowFfxEditorFields)
            {
                DefParser.DefXmlParser(SelectedFfxWindow.NodeListEditor, SelectedFfxWindow.Fields[1], SelectedFfxWindow.Fields[0]);
            }
        }