Ticket #4406: ai-info.patch

File ai-info.patch, 3.7 KB (added by mimo, 7 years ago)
  • binaries/data/mods/public/gui/gamesetup/aiInfo.txt

     
     1Although reasonnably easy for an experienced player, the default AI level is quite challenging for new players before they master the basic mechanisms of the game. It is adviced to start by playing to a lower level (sandbox or very easy) when beginning with the game. Changing the AI level is done by clicking on the gear icon next to each AI player in the player selection panel above.
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    261261    for (let i in g_DefaultPlayerData)
    262262        g_DefaultPlayerData[i].Civ = "random";
    263263
     264    // AI info panel
     265    if (!g_IsNetworked && Engine.ConfigDB_GetValue("user", "aipaneldisable") !== "true")
     266    {
     267        Engine.GetGUIObjectByName("aiInfo").hidden = false;
     268        Engine.GetGUIObjectByName("displayAIPanel").checked = true;
     269        Engine.GetGUIObjectByName("aiText").caption = Engine.TranslateLines(Engine.ReadFile("gui/gamesetup/aiInfo.txt"));
     270    }
     271    else
     272        Engine.GetGUIObjectByName("aiInfo").hidden = true;
     273
    264274    setTimeout(displayGamestateNotifications, 1000);
    265275}
    266276
     
    19982008    g_LastGameStanza = stanza;
    19992009    Engine.SendRegisterGame(stanza);
    20002010}
     2011
     2012function saveAIPanelSetting()
     2013{
     2014    let disabled = "" + !Engine.GetGUIObjectByName("displayAIPanel").checked;
     2015    Engine.ConfigDB_CreateValue("user", "aipaneldisable", disabled);
     2016    Engine.ConfigDB_WriteValueToFile("user", "aipaneldisable", disabled, "config/user.cfg");
     2017}
  • binaries/data/mods/public/gui/gamesetup/gamesetup.xml

     
    133133                </object>
    134134            </object>
    135135            <object size="24 64 100%-460 358" type="image" sprite="CoverFillDark" name="playerAssignmentsPanelCover" hidden="true"/>
     136
     137            <object size="24 370 560 520" type="image" name="aiInfo">
     138                <object size="4 10 28 34" type="image" sprite="ModernGear"/>
     139                <object name="aiText" type="text" style="ModernLeftLabelText" size="32 0 100%-20 100%-32"/>
     140                <object size="30 100%-30 100% 100%-8" type="text" style="ModernLeftLabelText">
     141                    <translatableAttribute id="caption">Show this message in the future</translatableAttribute>
     142                </object>
     143                <object name="displayAIPanel" size="8 100%-30 22 100%-8" type="checkbox" style="ModernTickBox">
     144                    <action on="Press">saveAIPanelSetting();</action>
     145                </object>
     146            </object>
    136147            <!-- Map selection -->
    137148
    138149            <object size="100%-425 355 100%-285 470" name="mapTypeTooltip">
  • binaries/data/mods/public/gui/options/options.json

     
    3333        },
    3434        {
    3535            "type": "boolean",
     36            "label": "Disable AI info panel",
     37            "tooltip": "Do not show the AI info panel explaining how to change AI levels.",
     38            "parameters": { "config": "aipaneldisable" }
     39        },
     40        {
     41            "type": "boolean",
    3642            "label": "Detailed Tooltips",
    3743            "tooltip": "Show detailed tooltips for trainable units in unit-producing buildings.",
    3844            "parameters": { "config": "showdetailedtooltips" }