Ticket #4406: ai-info-v2.patch

File ai-info-v2.patch, 8.5 KB (added by mimo, 7 years ago)
  • binaries/data/config/default.cfg

     
    2929; Show detailed tooltips (Unit stats)
    3030showdetailedtooltips = false
    3131
    32 ; Enable/disable the splashscreen
    33 splashscreendisable = false
    34 
    35 ; Splashscreen version (date of last modification). By default, 0 to force splashscreen to appear at first launch.
    36 splashscreenversion = 0
    37 
    3832; Pause the game on window focus loss (Only applicable to single player mode)
    3933pauseonfocusloss = true
    4034
     
    327321[gui]
    328322cursorblinkrate = 0.5             ; Cursor blink rate in seconds (0.0 to disable blinking)
    329323scale = 1.0                       ; GUI scaling factor, for improved compatibility with 4K displays
     324enablesplashscreen = true         ; Enable/disable the splashscreen
     325splashscreenversion = 0           ; Splashscreen version (date of last modification). By default, 0 to force splashscreen to appear at first launch
     326enablespinfo = true               ; Enable/Disable tips for SP newcomers
    330327
    331328[gui.menu]
    332329limitfps = true                   ; Limit FPS in the menus and loading screen
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    303303
    304304    if (g_IsNetworked)
    305305        Engine.GetGUIObjectByName("chatInput").focus();
     306    else
     307        initSPInfo();
    306308
    307309    if (g_IsController)
    308310    {
     
    340342    g_GameAttributes.mapFilter = "default";
    341343}
    342344
     345function initSPInfo()
     346{
     347    if (Engine.ConfigDB_GetValue("user", "gui.enablespinfo") !== "true")
     348        return;
     349
     350    let tips = Engine.ReadJSONFile("gui/gamesetup/singleplayerTips.json");
     351    Engine.GetGUIObjectByName("spInfo").hidden = false;
     352    Engine.GetGUIObjectByName("displaySPInfo").checked = true;
     353    Engine.GetGUIObjectByName("aiInfo").caption = Engine.TranslateLines(tips.ai);
     354}
     355
    343356/**
    344357 * Remove empty space in case of hidden options (like cheats, rating or wonder duration)
    345358 */
     
    19982011    g_LastGameStanza = stanza;
    19992012    Engine.SendRegisterGame(stanza);
    20002013}
     2014
     2015function saveSPInfoSetting()
     2016{
     2017    let enabled = String(Engine.GetGUIObjectByName("displaySPInfo").checked);
     2018    Engine.ConfigDB_CreateValue("user", "gui.enablespinfo", enabled);
     2019    Engine.ConfigDB_WriteValueToFile("user", "gui.enablespinfo", enabled, "config/user.cfg");
     2020}
  • 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="spInfo" hidden="true">
     138                <object size="4 10 28 34" type="image" sprite="ModernGear"/>
     139                <object name="aiInfo" 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="displaySPInfo" size="8 100%-30 22 100%-8" type="checkbox" style="ModernTickBox">
     144                    <action on="Press">saveSPInfoSetting();</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/gamesetup/singleplayerTips.json

     
     1{
     2    "ai": "Although reasonably 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 advised to start by playing against 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."
     3}
  • binaries/data/mods/public/gui/options/options.json

     
    2727        },
    2828        {
    2929            "type": "boolean",
    30             "label": "Disable Welcome Screen",
     30            "label": "Enable Welcome Screen",
    3131            "tooltip": "When disabled, the welcome screen will nevertheless be shown once when a new version is available and you can always launch it from the main menu.",
    32             "parameters": { "config": "splashscreendisable" }
     32            "parameters": { "config": "gui.enablesplashscreen" }
    3333        },
    3434        {
    3535            "type": "boolean",
     36            "label": "Enable SP info panel",
     37            "tooltip": "Show the SP info panel with some tips for newcomers.",
     38            "parameters": { "config": "gui.enablespinfo" }
     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" }
  • binaries/data/mods/public/gui/pregame/mainmenu.js

     
    128128    {
    129129        g_ShowSplashScreens = false;
    130130
    131         if (Engine.ConfigDB_GetValue("user", "splashscreendisable") !== "true" ||
    132             Engine.ConfigDB_GetValue("user", "splashscreenversion") < Engine.GetFileMTime("gui/splashscreen/splashscreen.txt"))
     131        if (Engine.ConfigDB_GetValue("user", "gui.enablesplashscreen") === "true" ||
     132            Engine.ConfigDB_GetValue("user", "gui.splashscreenversion") < Engine.GetFileMTime("gui/splashscreen/splashscreen.txt"))
    133133            Engine.PushGuiPage("page_splashscreen.xml", { "page": "splashscreen", callback : "SplashScreenClosedCallback" } );
    134134        else
    135135            ShowRenderPathMessage();
  • binaries/data/mods/public/gui/splashscreen/splashscreen.js

     
    11function init(data)
    22{
    33    Engine.GetGUIObjectByName("mainText").caption = Engine.TranslateLines(Engine.ReadFile("gui/splashscreen/" + data.page + ".txt"));
    4     Engine.GetGUIObjectByName("displaySplashScreen").checked = Engine.ConfigDB_GetValue("user", "splashscreendisable") !== "true";
     4    Engine.GetGUIObjectByName("displaySplashScreen").checked = Engine.ConfigDB_GetValue("user", "gui.enablesplashscreen") === "true";
    55}
  • binaries/data/mods/public/gui/splashscreen/splashscreen.xml

     
    2727        <object name="btnOK" type="button" style="ModernButtonRed" size="18 100%-45 50%-5 100%-17" hotkey="cancel">
    2828            <translatableAttribute id="caption">OK</translatableAttribute>
    2929            <action on="Press"><![CDATA[
    30             let disabled = "" + !Engine.GetGUIObjectByName("displaySplashScreen").checked;
    31             Engine.ConfigDB_CreateValue("user", "splashscreendisable", disabled);
    32             Engine.ConfigDB_WriteValueToFile("user", "splashscreendisable", disabled, "config/user.cfg");
     30            let enabled = String(Engine.GetGUIObjectByName("displaySplashScreen").checked);
     31            Engine.ConfigDB_CreateValue("user", "gui.enablesplashscreen", enabled);
     32            Engine.ConfigDB_WriteValueToFile("user", "gui.enablesplashscreen", enabled, "config/user.cfg");
    3333            let version = Engine.GetFileMTime("gui/splashscreen/splashscreen.txt");
    34             Engine.ConfigDB_CreateValue("user", "splashscreenversion", version);
    35             Engine.ConfigDB_WriteValueToFile("user", "splashscreenversion", version, "config/user.cfg");
     34            Engine.ConfigDB_CreateValue("user", "gui.splashscreenversion", version);
     35            Engine.ConfigDB_WriteValueToFile("user", "gui.splashscreenversion", version, "config/user.cfg");
    3636            Engine.PopGuiPageCB();
    3737            ]]></action>
    3838        </object>