Modding the UI, a problem...

Cope

Chieftain
Joined
Sep 30, 2010
Messages
35
I've been working on a UI mod that includes a lot of tweaks and things that I think are missing, taking some inspiration from the UI changes suggestion thread that's floating around. I'm running into a problem though.

Right now I'm trying to add a simple Protected By: line for city states to the Relations screen of the Diplomacy popup. It's working fine, except that a copy of the Relationships panel never disappears anymore. Not if I click close, not even when the game is freshly loaded so that it was never open in the first place. If I open the Diplomacy popup again later, when I've met some city states say, and then close it again the panel disappears as it should, but the old (stuck) copy of it is there forever. I've attached a screenshot of the problem.

Question is, when I'm changing parts of the UI like this what's the proper way to convey those changes to the game? Do I need to copy-paste the entire .xml file into a new file in my mod, then make my changes there? Can I do a database update instead like you can for units or resources?

Right now I've copy-pasted the entire DiploRelationships .lua and .xml files, made the changes, then added a "InGameUIAddin" pointing to the .lua only.

The logs aren't showing anything out of the ordinary either :(
 

Attachments

  • SS010.jpg
    SS010.jpg
    135.7 KB · Views: 104
  • SS009.jpg
    SS009.jpg
    16.8 KB · Views: 142
I guess the changes I made might help too heh

DiploRelations.xml changes:
Spoiler :
Code:
<Label ID="AllyLabel" Anchor="L,T" Offset="32,0" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_POP_CSTATE_ALLIED_WITH">
                    <Label ID="AllyInfo" Anchor="L,T" Offset="170,0" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" />
                </Label>
    <!-- Added "Protected By:" info to city states -->
                <Label ID="ProtectorsLabel" Anchor="L,T" Offset="32,0" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_MINORCIV_PROTECTED_BY">
                    <Label ID="ProtectorsInfo" Anchor="L,T" Offset="170,0" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" />
                </Label>
    <!-- ______________ -->
                <!-- Resources -->
                <Label ID="ResourcesLabel" Anchor="L,T" Offset="32,0" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_POP_CSTATE_RESOURCES">
                    <Label ID="ResourcesInfo" Anchor="L,T" Offset="170,0" WrapWidth="200" Font="TwCenMT14" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" />
                </Label>
And the .lua changes:
Spoiler :
Code:
pStack.AllyInfo:SetToolTipString(strAllyTT);
    pStack.AllyLabel:SetToolTipString(strAllyTT);

-- Find out who's protecting this city state
    local strProtectors = "";

    for iCivLoop = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-1, 1 do
        local pOtherCiv = Players[iCivLoop]
        local isMinor = pOtherCiv:IsMinorCiv();

        if (not isMinor and pOtherCiv:IsProtectingMinor(pOtherPlayer)) then
            strProtectors = strProtectors .. Locale.ConvertTextKey(pOtherCiv:GetCivilizationShortDescriptionKey()) .. "[NEWLINE]";
        end
    end
    if (strProtectors == "") then
        strProtectors = Locale.ConvertTextKey("TXT_KEY_CITY_STATE_NOBODY");
    end

    pStack.ProtectorsInfo:SetText(strProtectors);
    local protSizeY = pStack.ProtectorsInfo:GetSizeY();
    pStack.ProtectorsLabel:SetSizeY(protSizeY);
    local strProtectorsTT = Locale.ConvertTextKey("TXT_KEY_MINORCIV_PROTECTED_DESC");
    pStack.ProtectorsInfo:SetToolTipString(strProtectorsTT);
-------------
        -- Nearby Resources
    local pCapital = pPlayer:GetCapitalCity();
 
Back
Top Bottom