Ticket #3841: 3841_ingame_summary_v1.3.patch

File 3841_ingame_summary_v1.3.patch, 7.8 KB (added by Imarok, 3 years ago)

style; remove .map().filter()

  • binaries/data/mods/public/gui/session/menu.js

     
    620620    Engine.PushGuiPage("page_summary.xml", {
    621621        "sim": {
    622622            "mapSettings": g_GameAttributes.settings,
    623             "playerStates": extendedSimState.players,
     623            "playerStates":extendedSimState.players.filter((state,player) =>
     624                g_IsObserver || player == 0 || player == g_ViewedPlayer ||
     625                extendedSimState.players[g_ViewedPlayer].hasSharedLos && g_Players[player].isMutualAlly[g_ViewedPlayer]),
    624626            "timeElapsed" : extendedSimState.timeElapsed
    625627        },
    626628        "gui": {
  • binaries/data/mods/public/gui/session/menu.xml

     
    4848            style="StoneButtonFancy"
    4949            size="0 96 100% 124"
    5050            tooltip_style="sessionToolTip"
    51             enabled="false"
    5251        >
    5352            <translatableAttribute id="caption">Summary</translatableAttribute>
    5453            <action on="Press">openGameSummary();</action>
  • binaries/data/mods/public/gui/session/session.js

     
    480480    // Disable stuff observers shouldn't use
    481481    Engine.GetGUIObjectByName("pauseButton").enabled = !g_IsObserver || !g_IsNetworked;
    482482    Engine.GetGUIObjectByName("menuResignButton").enabled = !g_IsObserver;
    483     Engine.GetGUIObjectByName("summaryButton").enabled = g_IsObserver;
    484483}
    485484
    486485function reportPerformance(time)
     
    933932    debug.caption = text.replace(/\[/g, "\\[");
    934933}
    935934
     935function getAllyStatTooltip(resource)
     936{
     937    let playersState = GetSimState().players;
     938    let ret = "";
     939    for (let player in playersState)
     940        if (player != 0 && player != g_ViewedPlayer &&
     941            (g_IsObserver || playersState[g_ViewedPlayer].hasSharedLos && g_Players[player].isMutualAlly[g_ViewedPlayer]))
     942            ret += sprintf(translate("\n%(playername)s: %(statValue)s"),{
     943                "playername": colorizePlayernameByID(player),
     944                "statValue": resource == "pop" ?
     945                    playersState[player].popCount + "/" + playersState[player].popLimit :
     946                    playersState[player].resourceCounts[resource]
     947            });
     948    return ret;
     949}
     950
    936951function updatePlayerDisplay()
    937952{
    938953    let playerState = GetSimState().players[g_ViewedPlayer];
     
    939954    if (!playerState)
    940955        return;
    941956
    942     Engine.GetGUIObjectByName("resourceFood").caption = Math.floor(playerState.resourceCounts.food);
    943     Engine.GetGUIObjectByName("resourceWood").caption = Math.floor(playerState.resourceCounts.wood);
    944     Engine.GetGUIObjectByName("resourceStone").caption = Math.floor(playerState.resourceCounts.stone);
    945     Engine.GetGUIObjectByName("resourceMetal").caption = Math.floor(playerState.resourceCounts.metal);
     957    for (let res of RESOURCES)
     958    {
     959        Engine.GetGUIObjectByName("resource_" + res).caption = Math.floor(playerState.resourceCounts[res]);
     960        Engine.GetGUIObjectByName(res).tooltip = localisedResourceNames.firstWord[res] + getAllyStatTooltip(res);
     961    }
    946962    Engine.GetGUIObjectByName("resourcePop").caption = playerState.popCount + "/" + playerState.popLimit;
    947963    Engine.GetGUIObjectByName("population").tooltip = translate("Population (current / limit)") + "\n" +
    948                     sprintf(translate("Maximum population: %(popCap)s"), { "popCap": playerState.popMax });
     964        sprintf(translate("Maximum population: %(popCap)s"), { "popCap": playerState.popMax }) +
     965        getAllyStatTooltip("pop");
    949966
    950967    g_IsTrainingBlocked = playerState.trainingBlocked;
    951968}
  • binaries/data/mods/public/gui/session/top_panel/resource_food.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<object name="food" size="10 0 100 100%" type="image" style="resourceCounter" tooltip_style="sessionToolTipBold">
    3         <translatableAttribute id="tooltip">Food</translatableAttribute>
    43        <object size="0 -4 40 36" type="image" sprite="stretched:session/icons/resources/food.png" ghost="true"/>
    5         <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resourceFood"/>
     4        <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resource_food"/>
    65</object>
  • binaries/data/mods/public/gui/session/top_panel/resource_metal.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<object name="metal" size="280 0 370 100%" type="image" style="resourceCounter" tooltip_style="sessionToolTipBold">
    3         <translatableAttribute id="tooltip">Metal</translatableAttribute>
    43        <object size="0 -4 40 36" type="image" sprite="stretched:session/icons/resources/metal.png" ghost="true"/>
    5         <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resourceMetal"/>
     4        <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resource_metal"/>
    65</object>
  • binaries/data/mods/public/gui/session/top_panel/resource_stone.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<object name="stone" size="190 0 280 100%" type="image" style="resourceCounter" tooltip_style="sessionToolTipBold">
    3         <translatableAttribute id="tooltip">Stone</translatableAttribute>
    43        <object size="0 -4 40 36" type="image" sprite="stretched:session/icons/resources/stone.png" ghost="true"/>
    5         <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resourceStone"/>
     4        <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resource_stone"/>
    65</object>
  • binaries/data/mods/public/gui/session/top_panel/resource_wood.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<object name="wood" size="100 0 190 100%" type="image" style="resourceCounter" tooltip_style="sessionToolTipBold">
    3         <translatableAttribute id="tooltip">Wood</translatableAttribute>
    43        <object size="0 -4 40 36" type="image" sprite="stretched:session/icons/resources/wood.png" ghost="true"/>
    5         <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resourceWood"/>
     4        <object size="32 0 100% 100%-2" type="text" style="resourceText" name="resource_wood"/>
    65</object>
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    106106            "teamsLocked": cmpPlayer.GetLockTeams(),
    107107            "cheatsEnabled": cmpPlayer.GetCheatsEnabled(),
    108108            "disabledTemplates": cmpPlayer.GetDisabledTemplates(),
     109            "hasSharedLos": cmpTechnologyManager && cmpTechnologyManager.IsTechnologyResearched("unlock_shared_los"),
    109110            "hasSharedDropsites": cmpPlayer.HasSharedDropsites(),
    110111            "phase": phase,
    111112            "isAlly": allies,