Basically I'm trying to add unit tags (Armored, Massive etc) to a unit's info pane during progress and queue actions. As you know when a unit is, say, casting Yamato Cannon or training a marine, it's attribute tags vanish. I want to put them back.
This works fine. It puts text in the right places. Though the text is "xxx" (just used that to test). I'm wondering how I can replace "xxx" with the unit's real attributes? I've looked everywhere in the UI editor and I have no idea how the game actually fetches the unit's attributes and assigns them to the correct UI element.
The default UI uses hidden back-end implementations for this. There is nothing special defined in UI that reads that value from the selected unit (and currently there is no special frame that does this, although other aspects like life/shields/energy/behaviors can be added separately now).
The first solution idea might be animations, but since you need to show the InfoPaneUnit frame, you would need to hide its other elements to only show the attribute labels. The problem with this is, that it might be impossible to properly detect. It can be done via tricks with a unit selection panel, but that is buggy with observers and AI and I don't think Blizzard fixed that issue (I ran into that in some of my GameHeart UI versions).
But this is still possible with only using UI. But it needs to use an old dirty trick of mine. You can create a new InfoPanel within the InfoPanel's pages and hide the elements you don't want to see.
Usually, you cannot create new InfoPanels as they are flagged as Blizzard-only. But you can create multiple new info panels via using "Frame" as the type instead of "InfoPanel" and then applying the template to that Frame.
The resulting info panel will not work 100% (or at least it used to, no idea what changed over the last 2+ years).
<Frametype="InfoPanel"name="GameUI/UIContainer/ConsoleUIContainer/InfoPanel"file="GameUI"><Frametype="InfoPaneProgress"name="InfoPaneProgress"><!-- The new info panel - anchored to the default InfoPanel --><!-- Do NOT correct the type of the frame. In theory, we are not allowed to create InfoPanel (Blizzard-only), but with "Frame" plus template, we can. --><Frametype="Frame"name="CustomInfoPanel"template="InfoPanel/InfoPanelTemplate"><Anchorrelative="$parent/$parent"/><Heightval="199"/><Widthval="580"/><Frametype="InfoPaneCoopAI"name="InfoPaneCoopAI"><Visibleval="false"/></Frame><Frametype="InfoPaneUnit"name="UnitPanel"><Visibleval="false"/></Frame><Frametype="InfoPaneHero"name="InfoPaneHero"><Visibleval="false"/></Frame><Frametype="InfoPaneQueue"name="InfoPaneQueue"><Visibleval="false"/></Frame><Frametype="InfoPaneCargo"name="InfoPaneCargo"><Visibleval="false"/></Frame><Frametype="InfoPaneGroup"name="InfoPaneGroup"><Visibleval="false"/></Frame><!-- moved offscreen because it does not hide --><Frametype="InfoPaneProgress"name="InfoPaneProgress"><Anchorside="Top"relative="$parent"pos="Max"offset="999"/><Anchorside="Bottom"relative="$parent"pos="Max"offset="999"/><Visibleval="false"/></Frame><!-- InfoPaneUnit contains the attribute label --><Frametype="InfoPaneUnit"name="InfoPaneUnit"><Frametype="Label"name="NameLabel"><Visibleval="false"/></Frame><Frametype="Label"name="SubtitleLabel"><Visibleval="false"/></Frame><Frametype="ProgressBar"name="ProgressBar"><Visibleval="false"/></Frame><Frametype="Label"name="InfoLabel"><Visibleval="false"/></Frame><!-- hide equipment panel as only its position determines the equipment icons, not its visibility --><Frametype="EquipmentPanel"name="EquipmentPanel"><Anchorside="Top"relative="$parent"pos="Min"offset="1000"/><Visibleval="false"/></Frame><!-- Unit attributes --><!-- top offset is equipment panel's default top offset + its height + typeLabel's orig default top offset --><Frametype="Label"name="TypeLabel"><Anchorside="Top"relative="$parent"pos="Min"offset="176"/></Frame></Frame></Frame></Frame></Frame></Desc>
Oh wow, just when I was getting comfortable with the UI editor. I'd have never thought of just cloning an entire frame and hiding the unwanted parts. Works perfectly, thank you!
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Basically I'm trying to add unit tags (Armored, Massive etc) to a unit's info pane during progress and queue actions. As you know when a unit is, say, casting Yamato Cannon or training a marine, it's attribute tags vanish. I want to put them back.
This works fine. It puts text in the right places. Though the text is "xxx" (just used that to test). I'm wondering how I can replace "xxx" with the unit's real attributes? I've looked everywhere in the UI editor and I have no idea how the game actually fetches the unit's attributes and assigns them to the correct UI element.
Thanks!
The default UI uses hidden back-end implementations for this. There is nothing special defined in UI that reads that value from the selected unit (and currently there is no special frame that does this, although other aspects like life/shields/energy/behaviors can be added separately now).
The first solution idea might be animations, but since you need to show the InfoPaneUnit frame, you would need to hide its other elements to only show the attribute labels. The problem with this is, that it might be impossible to properly detect. It can be done via tricks with a unit selection panel, but that is buggy with observers and AI and I don't think Blizzard fixed that issue (I ran into that in some of my GameHeart UI versions).
But this is still possible with only using UI. But it needs to use an old dirty trick of mine. You can create a new InfoPanel within the InfoPanel's pages and hide the elements you don't want to see.
Usually, you cannot create new InfoPanels as they are flagged as Blizzard-only. But you can create multiple new info panels via using "Frame" as the type instead of "InfoPanel" and then applying the template to that Frame.
The resulting info panel will not work 100% (or at least it used to, no idea what changed over the last 2+ years).
Example Map
Example code snippet:
Screenshot:
Oh wow, just when I was getting comfortable with the UI editor. I'd have never thought of just cloning an entire frame and hiding the unwanted parts. Works perfectly, thank you!