CQUI-Org / cqui

Civilization 6 - Chao's Quick UI. Reduce clicks and manage your empire faster!
MIT License
318 stars 64 forks source link

Renovate score victory panel #53

Open chaorace opened 8 years ago

chaorace commented 8 years ago

Compress information on the victory panel so it's easier to use. See here for discussion

zyxpsilon commented 8 years ago

Dunno when the SDK will be out.. but i'll just start looking into the XML/LUA sources for this. Can't commit yet to offer proper alterations though. :) If anything, i'll share opinions & hints once you have code templates for it.

zyxpsilon commented 7 years ago

Alright.. i feel it's time for a mockup that would develop the generic coding principles from which anyone should be able to actually make this work. I've already made a few attempts.. but my LUA solutions must be flawed.

First -- a calibration reference image of the necessary XML framework;

scoreinstance_calibrated6

-- The colored underlines were inserted for clarity. -- Each Labels are supposed to be "Centered" relatively to the entire Panel width of 470 pixels while ideally adding the Equal sign after the pseudo-string of Six Values & before the default slot for Total Score(s).

Second -- a general coding theory (based on WorldRankings files) that should give direct hints on the possible Logic steps involved; --------------- XML/Coding..... Lines #287/298 ---------------

<Instance Name="ScoreInstance">
<GridButton ID="ButtonBG" Size="470,180" Texture="Controls_ListButton" SliceCorner="209,29" SliceTextureSize="417,51">
            <Grid ID="LocalPlayer" Offset="-7,-5" Size="parent+14,parent+9" Texture="Controls_YouIndicatorLine" SliceCorner="28,42" SliceSize="2,1" SliceTextureSize="60,60"/>
            <Image ID="CivIconBacking" Offset="10,10" Size="36,36" Texture="CircleBacking36"/>
            <Image ID="CivIcon" Offset="10,10" Size="36,36" Texture="CivSymbols36"/>
            <Label ID="CivName" Offset="55,20" String="CivName" Style="FontNormal18" FontStyle="shadow" Color="206,218,225,255" EffectColor="0,0,0,191"/>
---------))) ! We need to insert 6 more individual Custom/Labels here...
            <Label ID="Civics" Offset="150,15" Align="center" Anchor="C,T" String="ScoreCV" Style="FontFlair18" FontStyle="shadow" Color="207,94,205,255" EffectColor="0,0,0,191"/>
            <Label ID="Empire" Offset="190,15" Align="center" Anchor="C,T" String="ScoreEM" Style="FontFlair18" FontStyle="shadow" Color="166,230,74,255" EffectColor="0,0,0,191"/>
            <Label ID="GPeople" Offset="230,15" Align="center" Anchor="C,T" String="ScoreGP" Style="FontFlair18" FontStyle="shadow" Color="178,115,0,255" EffectColor="0,0,0,191"/>
            <Label ID="Religion" Offset="270,15" Align="center" Anchor="C,T" String="ScoreRL" Style="FontFlair18" FontStyle="shadow" Color="230,230,242,255" EffectColor="0,0,0,191"/>
            <Label ID="Technology" Offset="310,15" Align="center" Anchor="C,T" String="ScoreTC" Style="FontFlair18" FontStyle="shadow" Color="33,191,247,255" EffectColor="0,0,0,191"/>
            <Label ID="Wonders" Offset="350,15" Align="center" Anchor="C,T" String="ScoreWD" Style="FontFlair18" FontStyle="shadow" Color="232,214,0,255" EffectColor="0,0,0,191"/>
(((---------
            <Label ID="Details" Offset="15,40" Align="right" Anchor="R,T" String="Details" Style="FontNormalMedium14" Color="206,218,225,255"/>
            <Label ID="Score" Offset="13,15" Align="right" Anchor="R,T" String="Score" Style="FontFlair26" FontStyle="shadow" Color="206,218,225,255" EffectColor="0,0,0,191"/>
</GridButton>
</Instance>

--------------- AND --- --------------- LUA/Coding..... Lines #802/840 ---------------

function PopulateScoreInstance(instance:table, pPlayer:table)
    local playerID:number = pPlayer:GetID();
    local civName, civIcon:string = GetCivNameAndIcon(playerID, true);

    local textureOffsetX:number, textureOffsetY:number, textureSheet:string = IconManager:FindIconAtlas(civIcon, SIZE_CIV_ICON);
    if(textureSheet == nil or textureSheet == "") then
        UI.DataError("Could not find icon in PopulateScoreInstance: icon=\""..civIcon.."\", iconSize="..tostring(SIZE_CIV_ICON));
    else
        instance.CivIcon:SetTexture(textureOffsetX, textureOffsetY, textureSheet);
        SetLeaderTooltip(instance, playerID);
    end

    ColorCivIcon(instance, playerID);
    instance.CivName:SetText(civName);
---------))) ! New instance.Score2:SetText(pPlayer:gGetScore()); of six strings
    instance.Score:SetText(pPlayer:GetScore());
    instance.LocalPlayer:SetHide(pPlayer ~= m_LocalPlayer);

---------))) !! We'll probably need to rewrite this kind of Logic and insert it as/for a new Instance above..
    if(m_ShowScoreDetails) then
        instance.ButtonBG:SetSizeY(SIZE_SCORE_ITEM_DETAILS);

        local detailsText:string = "";
        local scoreCategories = GameInfo.ScoringCategories;
        local numCategories:number = #scoreCategories;
        for i = 0, numCategories - 1 do
            if scoreCategories[i].Multiplier > 0 or m_isDebugForceShowAllScoreCategories then
                local category:table = scoreCategories[i];
                detailsText = detailsText .. Locale.Lookup(category.Name) .. ": " .. pPlayer:GetCategoryScore(i);
                if(i <= numCategories) then
                    detailsText = detailsText .. "[NEWLINE]";
                end
            end
        end
        instance.Details:SetText(detailsText);
        instance.Details:SetHide(false);
(((---------
    else
        instance.ButtonBG:SetSizeY(SIZE_SCORE_ITEM_DEFAULT);
        instance.Details:SetHide(true);
    end
end

-------------

Of course, this stuff might very well be flawed as is. Feel free to offer a better (or real!) solution. Good luck to anyone willing to pick this task up! :)

PS; Sorry about the formatting issues.. but i just can't grasp the whole editing principles in this limited set of UI controls! :(