public WorldTravelSelect(AtkUnitBase *address)
            {
                UnitBase = address;
                try {
                    RootNode = UnitBase->RootNode;
                    if (RootNode == null)
                    {
                        return;
                    }
                    WindowComponent       = (AtkComponentNode *)RootNode->ChildNode;
                    InformationBox        = (AtkComponentNode *)WindowComponent->AtkResNode.PrevSiblingNode;
                    InformationBoxBorder  = (AtkNineGridNode *)InformationBox->AtkResNode.PrevSiblingNode;
                    WorldListComponent    = (AtkComponentNode *)InformationBoxBorder->AtkResNode.PrevSiblingNode;
                    WorldListHeader       = (AtkTextNode *)WorldListComponent->AtkResNode.PrevSiblingNode;
                    CurrentWorldContainer = WorldListHeader->AtkResNode.PrevSiblingNode;
                    HomeWorldContainer    = CurrentWorldContainer->PrevSiblingNode;
                    WorldInfoHeader       = (AtkTextNode *)HomeWorldContainer->PrevSiblingNode;

                    CurrentWorldName            = (AtkTextNode *)CurrentWorldContainer->ChildNode;
                    CurrentWorldHeaderUnderline = (AtkNineGridNode *)CurrentWorldName->AtkResNode.PrevSiblingNode;
                    CurrentWorldHeader          = (AtkTextNode *)CurrentWorldHeaderUnderline->AtkResNode.PrevSiblingNode;
                    CurrentWorldIcon            = (AtkImageNode *)CurrentWorldHeader->AtkResNode.PrevSiblingNode;

                    IsValid = true;
                } catch (Exception ex) {
                    SimpleLog.Error(ex);
                    IsValid = false;
                }
            }
Пример #2
0
        private void DoShift(AtkResNode *node, bool reset = false)
        {
            if (node == null)
            {
                return;
            }
            var p = LoadedConfig.Offset;

            if (p < MinOffset)
            {
                p = MinOffset;
            }
            if (p > MaxOffset)
            {
                p = MaxOffset;
            }
            node->Height = reset ? (ushort)24 : (ushort)p;
            var textNode = (AtkTextNode *)node;

            textNode->AlignmentFontType = reset ? (byte)AlignmentType.BottomRight : (byte)LoadedConfig.NameAlignment;
            if (reset)
            {
                UiHelper.SetPosition(node, 0, null);
                UiHelper.SetSize(node, 197, null);
            }
            else
            {
                UiHelper.SetPosition(node, 8, null);
                UiHelper.SetSize(node, 188, null);
            }
        }
Пример #3
0
        private unsafe void DoShift(AtkResNode *node, bool reset = false)
        {
            if (node == null)
            {
                return;
            }
            if (node->ChildCount != 5)
            {
                return;                        // Should have 5 children
            }
            var skillTextNode = UiAdjustments.GetResNodeByPath(node, Child, Previous, Previous, Previous);

            if (skillTextNode == null)
            {
                return;
            }
            var p = PluginConfig.UiAdjustments.ShiftTargetCastBarText.Offset;

            if (p < MinOffset)
            {
                p = MinOffset;
            }
            if (p > MaxOffset)
            {
                p = MaxOffset;
            }
            Marshal.WriteInt16(new IntPtr(skillTextNode), 0x92, reset ? (short)24 : (short)p);
        }
        private void SetOffsetPosition(AtkResNode *node, float offsetX, float offsetY)
        {
            var defaultXPos = (ImGui.GetIO().DisplaySize.X * 1 / 2) - 512;
            var defaultYPos = (ImGui.GetIO().DisplaySize.Y * 3 / 5) - 20;

            UiHelper.SetPosition(node, defaultXPos + offsetX, defaultYPos - offsetY);
        }
Пример #5
0
        public static unsafe AtkResNode *CloneNode(AtkResNode *original)
        {
            var size = original->Type switch {
                NodeType.Res => sizeof(AtkResNode),
                NodeType.Image => sizeof(AtkImageNode),
                NodeType.Text => sizeof(AtkTextNode),
                NodeType.NineGrid => sizeof(AtkNineGridNode),
                NodeType.Counter => sizeof(AtkCounterNode),
                NodeType.Collision => sizeof(AtkCollisionNode),
                _ => throw new Exception("Unsupported Type")
            };

            var allocation = Common.Alloc((ulong)size);
            var bytes      = new byte[size];

            Marshal.Copy(new IntPtr(original), bytes, 0, bytes.Length);
            Marshal.Copy(bytes, 0, allocation, bytes.Length);

            var newNode = (AtkResNode *)allocation;

            newNode->ParentNode      = null;
            newNode->ChildNode       = null;
            newNode->ChildCount      = 0;
            newNode->PrevSiblingNode = null;
            newNode->NextSiblingNode = null;
            return(newNode);
        }
    }
Пример #6
0
        private void PrintNode(AtkResNode *node, bool printSiblings = true, string treePrefix = "")
        {
            if (node == null)
            {
                return;
            }

            if ((int)node->Type < 1000)
            {
                PrintSimpleNode(node, treePrefix);
            }
            else
            {
                PrintComponentNode(node, treePrefix);
            }

            if (printSiblings)
            {
                var prevNode = node;
                while ((prevNode = prevNode->PrevSiblingNode) != null)
                {
                    PrintNode(prevNode, false, "prev ");
                }

                var nextNode = node;
                while ((nextNode = nextNode->NextSiblingNode) != null)
                {
                    PrintNode(nextNode, false, "next ");
                }
            }
        }
Пример #7
0
        private void PrintResNode(AtkResNode *node)
        {
            ImGui.Text($"NodeID: {node->NodeID}");
            ImGui.SameLine();
            if (ImGui.SmallButton($"T:Visible##{(ulong)node:X}"))
            {
                node->Flags ^= 0x10;
            }
            ImGui.SameLine();
            if (ImGui.SmallButton($"C:Ptr##{(ulong)node:X}"))
            {
                ImGui.SetClipboardText($"{(ulong)node:X}");
            }


            ImGui.Text(
                $"X: {node->X} Y: {node->Y} " +
                $"ScaleX: {node->ScaleX} ScaleY: {node->ScaleY} " +
                $"Rotation: {node->Rotation} " +
                $"Width: {node->Width} Height: {node->Height} " +
                $"OriginX: {node->OriginX} OriginY: {node->OriginY}");
            ImGui.Text(
                $"RGBA: 0x{node->Color.R:X2}{node->Color.G:X2}{node->Color.B:X2}{node->Color.A:X2} " +
                $"AddRGB: {node->AddRed} {node->AddGreen} {node->AddBlue} " +
                $"MultiplyRGB: {node->MultiplyRed} {node->MultiplyGreen} {node->MultiplyBlue}");
        }
Пример #8
0
        private unsafe void PrintComponentNode(AtkResNode *node, string treePrefix)
        {
            var compNode = (AtkComponentNode *)node;

            bool popped    = false;
            bool isVisible = (node->Flags & 0x10) == 0x10;

            if (isVisible)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 255, 0, 255));
            }

            var componentInfo = compNode->Component->ULDData;

            var childCount = componentInfo.NodeListCount;

            var objectInfo = (ULDComponentInfo *)componentInfo.Objects;

            if (ImGui.TreeNode($"{treePrefix}{objectInfo->ComponentType} Component Node (ptr = {(long)node:X}, component ptr = {(long)compNode->Component:X}) child count = {childCount}  ###{(long)node}"))
            {
                if (ImGui.IsItemHovered())
                {
                    DrawOutline(node);
                }
                if (isVisible)
                {
                    ImGui.PopStyleColor();
                    popped = true;
                }

                PrintResNode(node);
                PrintNode(componentInfo.RootNode);

                switch (objectInfo->ComponentType)
                {
                case ComponentType.TextInput:
                    var textInputComponent = (AtkComponentTextInput *)compNode->Component;
                    ImGui.Text($"InputBase Text1: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->AtkComponentInputBase.UnkText1.StringPtr))}");
                    ImGui.Text($"InputBase Text2: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->AtkComponentInputBase.UnkText2.StringPtr))}");
                    ImGui.Text($"Text1: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText1.StringPtr))}");
                    ImGui.Text($"Text2: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText2.StringPtr))}");
                    ImGui.Text($"Text3: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText3.StringPtr))}");
                    ImGui.Text($"Text4: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText4.StringPtr))}");
                    ImGui.Text($"Text5: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText5.StringPtr))}");
                    break;
                }

                ImGui.TreePop();
            }
            else if (ImGui.IsItemHovered())
            {
                DrawOutline(node);
            }

            if (isVisible && !popped)
            {
                ImGui.PopStyleColor();
            }
        }
Пример #9
0
 private static unsafe AtkResNode *FinalPreviousNode(AtkResNode *node)
 {
     while (node->PrevSiblingNode != null)
     {
         node = node->PrevSiblingNode;
     }
     return(node);
 }
Пример #10
0
        private void DrawOutline(AtkResNode *node)
        {
            var position = GetNodePosition(node);
            var scale    = GetNodeScale(node);
            var size     = new Vector2(node->Width, node->Height) * scale;

            var nodeVisible = GetNodeVisible(node);

            ImGui.GetForegroundDrawList().AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
        }
Пример #11
0
 public static void SetVisible(AtkResNode *node, bool visible)
 {
     if (visible)
     {
         Show(node);
     }
     else
     {
         Hide(node);
     }
 }
Пример #12
0
 public static void SetScale(AtkResNode *atkUnitBase, float?scaleX, float?scaleY)
 {
     if (scaleX >= short.MinValue && scaleX <= short.MaxValue)
     {
         atkUnitBase->ScaleX = (short)scaleX.Value;
     }
     if (scaleY >= short.MinValue && scaleY <= short.MaxValue)
     {
         atkUnitBase->ScaleY = (short)scaleY.Value;
     }
 }
Пример #13
0
        public static unsafe void HighlightResNode(AtkResNode *node)
        {
            var position = GetNodePosition(node);
            var scale    = GetNodeScale(node);
            var size     = new Vector2(node->Width, node->Height) * scale;

            var nodeVisible = GetNodeVisible(node);

            ImGui.GetForegroundDrawList().AddRectFilled(position, position + size, (uint)(nodeVisible ? 0x5500FF00 : 0x550000FF));
            ImGui.GetForegroundDrawList().AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
        }
Пример #14
0
        private void DrawOutline(AtkResNode *node)
        {
            var position = this.GetNodePosition(node);
            var scale    = this.GetNodeScale(node);
            var size     = new Vector2(node->Width, node->Height) * scale;

            var nodeVisible = this.GetNodeVisible(node);

            position += ImGuiHelpers.MainViewport.Pos;

            ImGui.GetForegroundDrawList(ImGuiHelpers.MainViewport).AddRect(position, position + size, nodeVisible ? 0xFF00FF00 : 0xFF0000FF);
        }
Пример #15
0
 public static void SetSize(AtkResNode *node, int?width, int?height)
 {
     if (width != null && width >= ushort.MinValue && width <= ushort.MaxValue)
     {
         node->Width = (ushort)width.Value;
     }
     if (height != null && height >= ushort.MinValue && height <= ushort.MaxValue)
     {
         node->Height = (ushort)height.Value;
     }
     node->Flags_2 |= 0x1;
 }
Пример #16
0
 public static void SetPosition(AtkResNode *node, float?x, float?y)
 {
     if (x != null)
     {
         node->X = x.Value;
     }
     if (y != null)
     {
         node->Y = y.Value;
     }
     node->Flags_2 |= 0x1;
 }
Пример #17
0
        private Vector2 GetNodePosition(AtkResNode *node)
        {
            var pos = new Vector2(node->X, node->Y);
            var par = node->ParentNode;

            while (par != null)
            {
                pos *= new Vector2(par->ScaleX, par->ScaleY);
                pos += new Vector2(par->X, par->Y);
                par  = par->ParentNode;
            }
            return(pos);
        }
        private static void SetOffsetPosition(AtkResNode *node, float offsetX, float offsetY, float scale)
        {
            // default 1080p values
            var defaultXPos = 448.0f;
            var defaultYPos = 628.0f;

            try {
                defaultXPos = (ImGui.GetIO().DisplaySize.X * 1 / 2) - 512 * scale;
                defaultYPos = (ImGui.GetIO().DisplaySize.Y * 3 / 5) - 20 * scale;
            }
            catch (NullReferenceException) { }

            UiHelper.SetPosition(node, defaultXPos + offsetX, defaultYPos - offsetY);
        }
Пример #19
0
 private unsafe void PrintResNode(AtkResNode *node)
 {
     ImGui.Text($"NodeID: {node->NodeID}");
     ImGui.Text(
         $"X: {node->X} Y: {node->Y} " +
         $"ScaleX: {node->ScaleX} ScaleY: {node->ScaleY} " +
         $"Rotation: {node->Rotation} " +
         $"Width: {node->Width} Height: {node->Height} " +
         $"OriginX: {node->OriginX} OriginY: {node->OriginY}");
     ImGui.Text(
         $"RGBA: 0x{node->Color.R:X2}{node->Color.G:X2}{node->Color.B:X2}{node->Color.A:X2} " +
         $"AddRGB: {node->AddRed} {node->AddGreen} {node->AddBlue} " +
         $"MultiplyRGB: {node->MultiplyRed} {node->MultiplyGreen} {node->MultiplyBlue}");
 }
Пример #20
0
        private Vector2 GetNodeScale(AtkResNode *node)
        {
            if (node == null)
            {
                return(new Vector2(1, 1));
            }
            var scale = new Vector2(node->ScaleX, node->ScaleY);

            while (node->ParentNode != null)
            {
                node   = node->ParentNode;
                scale *= new Vector2(node->ScaleX, node->ScaleY);
            }
            return(scale);
        }
Пример #21
0
 private bool GetNodeVisible(AtkResNode *node)
 {
     if (node == null)
     {
         return(false);
     }
     while (node != null)
     {
         if ((node->Flags & (short)NodeFlags.Visible) != (short)NodeFlags.Visible)
         {
             return(false);
         }
         node = node->ParentNode;
     }
     return(true);
 }
Пример #22
0
        protected unsafe (float, float) BacktrackNodePoint(AtkResNode *node)
        {
            if (node == null)
            {
                throw new Exception("Node does not exist");
            }

            float x = node->X + (node->Width / 2);
            float y = node->Y + (node->Height / 2);

            AtkResNode *parent = node;

            while ((parent = parent->ParentNode) != null)
            {
                x += parent->X;
                y += parent->Y;
            }
            return(x, y);
        }
Пример #23
0
        public static unsafe AtkResNode *GetResNodeByPath(AtkResNode *root, params Step[] steps)
        {
            var current = root;

            foreach (var step in steps)
            {
                if (current == null)
                {
                    return(null);
                }

                current = step switch {
                    Step.Parent => current->ParentNode,
                    Step.Child => (ushort)current->Type >= 1000 ? ((AtkComponentNode *)current)->Component->UldManager.RootNode : current->ChildNode,
                    Step.Next => current->NextSiblingNode,
                    Step.Previous => current->PrevSiblingNode,
                    Step.PrevFinal => FinalPreviousNode(current),
                    _ => null,
                };
            }
            return(current);
        }
Пример #24
0
 public partial void AddTooltip(AtkTooltipType type, ushort parentID, AtkResNode *targetNode,
                                AtkTooltipArgs *tooltipArgs);
Пример #25
0
 public partial void RemoveTooltip(AtkResNode *targetNode);
Пример #26
0
 public void AddEvent(AtkEventType eventType, uint eventParam, AtkEventListener *listener, AtkResNode *nodeParam, bool isSystemEvent) => AddEvent((ushort)eventType, eventParam, listener, nodeParam, isSystemEvent);
Пример #27
0
 public static void Hide(AtkResNode *node)
 {
     node->Flags   &= ~0x10;
     node->Flags_2 |= 0x1;
 }
Пример #28
0
        private void PrintComponentNode(AtkResNode *node, string treePrefix)
        {
            var compNode = (AtkComponentNode *)node;

            bool popped    = false;
            bool isVisible = (node->Flags & 0x10) == 0x10;

            if (isVisible)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 255, 0, 255));
            }

            var componentInfo = compNode->Component->ULDData;

            var childCount = componentInfo.NodeListCount;

            var objectInfo = (ULDComponentInfo *)componentInfo.Objects;

            if (ImGui.TreeNode($"{treePrefix}{objectInfo->ComponentType} Component Node (ptr = {(long)node:X}, component ptr = {(long)compNode->Component:X}) child count = {childCount}  ###{(long)node}"))
            {
                if (ImGui.IsItemHovered())
                {
                    DrawOutline(node);
                }
                if (isVisible)
                {
                    ImGui.PopStyleColor();
                    popped = true;
                }

                ImGui.Text("Node: ");
                ImGui.SameLine();
                ClickToCopyText($"{(ulong)node:X}");
                ImGui.SameLine();
                PrintOutObject(*compNode, (ulong)compNode, new List <string>());
                ImGui.Text("Component: ");
                ImGui.SameLine();
                ClickToCopyText($"{(ulong)compNode->Component:X}");
                ImGui.SameLine();

                switch (objectInfo->ComponentType)
                {
                case ComponentType.Button: PrintOutObject(*(AtkComponentButton *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.Slider: PrintOutObject(*(AtkComponentSlider *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.Window: PrintOutObject(*(AtkComponentWindow *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.CheckBox: PrintOutObject(*(AtkComponentCheckBox *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.GaugeBar: PrintOutObject(*(AtkComponentGaugeBar *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.RadioButton: PrintOutObject(*(AtkComponentRadioButton *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.TextInput: PrintOutObject(*(AtkComponentTextInput *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                case ComponentType.Icon: PrintOutObject(*(AtkComponentIcon *)compNode->Component, (ulong)compNode->Component, new List <string>()); break;

                default: PrintOutObject(*compNode->Component, (ulong)compNode->Component, new List <string>()); break;
                }

                PrintResNode(node);
                PrintNode(componentInfo.RootNode);

                switch (objectInfo->ComponentType)
                {
                case ComponentType.TextInput:
                    var textInputComponent = (AtkComponentTextInput *)compNode->Component;
                    ImGui.Text($"InputBase Text1: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->AtkComponentInputBase.UnkText1.StringPtr))}");
                    ImGui.Text($"InputBase Text2: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->AtkComponentInputBase.UnkText2.StringPtr))}");
                    ImGui.Text($"Text1: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText1.StringPtr))}");
                    ImGui.Text($"Text2: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText2.StringPtr))}");
                    ImGui.Text($"Text3: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText3.StringPtr))}");
                    ImGui.Text($"Text4: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText4.StringPtr))}");
                    ImGui.Text($"Text5: {Marshal.PtrToStringAnsi(new IntPtr(textInputComponent->UnkText5.StringPtr))}");
                    break;
                }

                ImGui.PushStyleColor(ImGuiCol.Text, 0xFFFFAAAA);
                if (ImGui.TreeNode($"Node List##{(ulong) node:X}"))
                {
                    ImGui.PopStyleColor();

                    for (var i = 0; i < compNode->Component->ULDData.NodeListCount; i++)
                    {
                        PrintNode(compNode->Component->ULDData.NodeList[i], false, $"[{i}] ");
                    }

                    ImGui.TreePop();
                }
                else
                {
                    ImGui.PopStyleColor();
                }

                ImGui.TreePop();
            }
            else if (ImGui.IsItemHovered())
            {
                DrawOutline(node);
            }


            if (isVisible && !popped)
            {
                ImGui.PopStyleColor();
            }
        }
Пример #29
0
        private void PrintSimpleNode(AtkResNode *node, string treePrefix)
        {
            var popped    = false;
            var isVisible = (node->Flags & 0x10) == 0x10;

            if (isVisible)
            {
                ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0, 255, 0, 255));
            }

            if (ImGui.TreeNode($"{treePrefix}{node->Type} Node (ptr = {(long)node:X})###{(long)node}"))
            {
                if (ImGui.IsItemHovered())
                {
                    DrawOutline(node);
                }
                if (isVisible)
                {
                    ImGui.PopStyleColor();
                    popped = true;
                }

                ImGui.Text("Node: ");
                ImGui.SameLine();
                ClickToCopyText($"{(ulong)node:X}");
                ImGui.SameLine();
                switch (node->Type)
                {
                case NodeType.Text: PrintOutObject(*(AtkTextNode *)node, (ulong)node, new List <string>()); break;

                case NodeType.Image: PrintOutObject(*(AtkImageNode *)node, (ulong)node, new List <string>()); break;

                case NodeType.Collision: PrintOutObject(*(AtkCollisionNode *)node, (ulong)node, new List <string>()); break;

                case NodeType.NineGrid: PrintOutObject(*(AtkNineGridNode *)node, (ulong)node, new List <string>()); break;

                case NodeType.Counter: PrintOutObject(*(AtkCounterNode *)node, (ulong)node, new List <string>()); break;

                default: PrintOutObject(*node, (ulong)node, new List <string>()); break;
                }

                PrintResNode(node);

                if (node->ChildNode != null)
                {
                    PrintNode(node->ChildNode);
                }

                switch (node->Type)
                {
                case NodeType.Text:
                    var textNode = (AtkTextNode *)node;
                    ImGui.Text($"text: {Marshal.PtrToStringAnsi(new IntPtr(textNode->NodeText.StringPtr))}");

                    ImGui.InputText($"Replace Text##{(ulong) textNode:X}", new IntPtr(textNode->NodeText.StringPtr), (uint)textNode->NodeText.BufSize);


                    ImGui.Text($"AlignmentType: {(AlignmentType)textNode->AlignmentFontType}  FontSize: {textNode->FontSize}");
                    int b = textNode->AlignmentFontType;
                    if (ImGui.InputInt($"###setAlignment{(ulong) textNode:X}", ref b, 1))
                    {
                        while (b > byte.MaxValue)
                        {
                            b -= byte.MaxValue;
                        }
                        while (b < byte.MinValue)
                        {
                            b += byte.MaxValue;
                        }
                        textNode->AlignmentFontType   = (byte)b;
                        textNode->AtkResNode.Flags_2 |= 0x1;
                    }

                    ImGui.Text($"Color: #{textNode->TextColor.R:X2}{textNode->TextColor.G:X2}{textNode->TextColor.B:X2}{textNode->TextColor.A:X2}");
                    ImGui.SameLine();
                    ImGui.Text($"EdgeColor: #{textNode->EdgeColor.R:X2}{textNode->EdgeColor.G:X2}{textNode->EdgeColor.B:X2}{textNode->EdgeColor.A:X2}");
                    ImGui.SameLine();
                    ImGui.Text($"BGColor: #{textNode->BackgroundColor.R:X2}{textNode->BackgroundColor.G:X2}{textNode->BackgroundColor.B:X2}{textNode->BackgroundColor.A:X2}");

                    ImGui.Text($"TextFlags: {textNode->TextFlags}");
                    ImGui.SameLine();
                    ImGui.Text($"TextFlags2: {textNode->TextFlags2}");



                    break;

                case NodeType.Counter:
                    var counterNode = (AtkCounterNode *)node;
                    ImGui.Text($"text: {Marshal.PtrToStringAnsi(new IntPtr(counterNode->NodeText.StringPtr))}");
                    break;

                case NodeType.Image:
                    var imageNode = (AtkImageNode *)node;
                    if (imageNode->PartsList != null)
                    {
                        if (imageNode->PartId > imageNode->PartsList->PartCount)
                        {
                            ImGui.Text("part id > part count?");
                        }
                        else
                        {
                            var textureInfo = imageNode->PartsList->Parts[imageNode->PartId].ULDTexture;
                            var texType     = textureInfo->AtkTexture.TextureType;
                            ImGui.Text($"texture type: {texType} part_id={imageNode->PartId} part_id_count={imageNode->PartsList->PartCount}");
                            if (texType == TextureType.Resource)
                            {
                                var texFileNamePtr = textureInfo->AtkTexture.Resource->TexFileResourceHandle->ResourceHandle.FileName;
                                var texString      = Marshal.PtrToStringAnsi(new IntPtr(texFileNamePtr));
                                ImGui.Text($"texture path: {texString}");
                                var kernelTexture = textureInfo->AtkTexture.Resource->KernelTextureObject;

                                if (ImGui.TreeNode($"Texture##{(ulong) kernelTexture->D3D11ShaderResourceView:X}"))
                                {
                                    ImGui.Image(new IntPtr(kernelTexture->D3D11ShaderResourceView), new Vector2(kernelTexture->Width, kernelTexture->Height));
                                    ImGui.TreePop();
                                }
                            }
                            else if (texType == TextureType.KernelTexture)
                            {
                                if (ImGui.TreeNode($"Texture##{(ulong) textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView:X}"))
                                {
                                    ImGui.Image(new IntPtr(textureInfo->AtkTexture.KernelTexture->D3D11ShaderResourceView), new Vector2(textureInfo->AtkTexture.KernelTexture->Width, textureInfo->AtkTexture.KernelTexture->Height));
                                    ImGui.TreePop();
                                }
                            }
                        }
                    }
                    else
                    {
                        ImGui.Text("no texture loaded");
                    }
                    break;
                }

                ImGui.TreePop();
            }
            else if (ImGui.IsItemHovered())
            {
                DrawOutline(node);
            }

            if (isVisible && !popped)
            {
                ImGui.PopStyleColor();
            }
        }
Пример #30
0
 public partial void AddEvent(ushort eventType, uint eventParam, AtkEventListener *listener,
                              AtkResNode *nodeParam, bool isSystemEvent);