Ticket #2116: patch_splashscreen.4.diff

File patch_splashscreen.4.diff, 6.3 KB (added by Itms, 11 years ago)
  • binaries/data/config/default.cfg

     
    2222
    2323; Enable/disable the splashscreen
    2424splashscreenenable = true
     25; Splashscreen version (date of last modification). By default, 0 to force splashscreen to appear at first launch.
     26splashscreenversion = 0
    2527
    2628; Pause the game on window focus loss (Only applicable to single player mode)
    2729pauseonfocusloss = true
  • binaries/data/mods/public/gui/splashscreen/splashscreen.xml

     
    77    <!-- Add a translucent black background to fade out the menu page -->
    88    <object type="image" z="0" style="TranslucentPanel"/>
    99
    10     <object type="image" style="StoneDialog" size="50%-300 50%-200 50%+300 50%+200">
     10    <object type="image" style="StoneDialog" size="50%-300 50%-200 50%+300 50%+250">
    1111        <object type="text" style="TitleText" size="50%-128 0%-16 50%+128 16">Welcome to 0 A.D. !</object>
    1212
    13             <object type="image" sprite="BackgroundTranslucent" size="20 20 100%-20 100%-52">
    14                 <object name="openFundraiserPage" type="button" style="fundraiserButton" size="5 5 100% 150">
    15                     <action on="Press"><![CDATA[
    16                     Engine.OpenURL("http://play0ad.com/fundraiser");
    17                     ]]></action>
    18                 </object>
    19                 <object size="0 150 100% 100%">
    20                     <object name="mainText" type="text" style="textPanel"/>
    21                 </object>
     13        <object type="image" sprite="BackgroundTranslucent" size="20 20 100%-20 100%-105">
     14            <object name="openFundraiserPage" type="button" style="fundraiserButton" size="5 5 100% 150">
     15                <action on="Press"><![CDATA[
     16                Engine.OpenURL("http://play0ad.com/fundraiser");
     17                ]]></action>
    2218            </object>
    23         <object name="btnOK" type="button" style="StoneButton" tooltip_style="snToolTip" size="24 100%-52 188 100%-24">
    24             OK
     19            <object size="0 150 100% 100%">
     20                <object name="mainText" type="text" style="textPanel"/>
     21            </object>
     22        </object>
     23       
     24        <object name="btnFundraiser" type="button" style="StoneButtonFancy" tooltip_style="snToolTip" size="50 100%-104 100%-50 100%-75">
     25            Visit Fundraiser
    2526            <action on="Press"><![CDATA[
    26             Engine.SetSplashScreenEnabled(!getGUIObjectByName("displaySplashScreen").checked);
     27            Engine.OpenURL("http://play0ad.com/fundraiser");
     28            ]]></action>
     29        </object>
     30        <object name="btnDismiss" type="button" style="StoneButton" tooltip_style="snToolTip" size="24 100%-59 180 100%-30">
     31            Dismiss
     32            <action on="Press"><![CDATA[
     33            Engine.SynchroniseSplashScreen();
    2734            Engine.PopGuiPage();
    2835            ]]></action>
    2936        </object>
    30         <object name="btnFundraiser" type="button" style="StoneButton" tooltip_style="snToolTip" size="196 100%-52 360 100%-24">
    31             Visit Fundraiser
     37        <object name="btnRemind" type="button" style="StoneButton" tooltip_style="snToolTip" size="190 100%-59 350 100%-30">
     38            Remind me later
    3239            <action on="Press"><![CDATA[
    33             Engine.OpenURL("http://play0ad.com/fundraiser");
     40            Engine.PopGuiPage();
    3441            ]]></action>
    3542        </object>
    36         <object size="368 100%-52 100%-32 100%-24">
    37             <object size="0 0 100% 100%">
    38                 <object name="displaySplashScreenText" size="0 0 100%-32 100%" type="text" style="RightLabelText">Don't show this again</object>
    39                 <object name="displaySplashScreen" checked="false" size="100%-16 50%-8 100% 50%+8" type="checkbox" style="StoneCrossBox"/>
    40             </object>
     43        <object name="btnDisable" type="button" style="StoneButton" tooltip_style="snToolTip" size="360 100%-59 576 100%-30">
     44            Never show notifications
     45            <action on="Press"><![CDATA[
     46            Engine.SetSplashScreenEnabled(false);
     47            Engine.PopGuiPage();
     48            ]]></action>
    4149        </object>
    4250    </object>
    4351   
  • source/gui/scripting/ScriptFunctions.cpp

     
    530530{
    531531    bool splashScreenEnable = true;
    532532    CFG_GET_VAL("splashscreenenable", Bool, splashScreenEnable);
    533     return splashScreenEnable;
     533
     534    time_t splashScreenVersion = 0;
     535    CFileInfo splashFileInfo;
     536
     537    CFG_GET_VAL("splashscreenversion", Time, splashScreenVersion);
     538
     539    if(g_VFS->GetFileInfo("gui/splashscreen/splashscreen.txt", &splashFileInfo) == INFO::OK)
     540        return (splashScreenVersion != splashFileInfo.MTime() && splashScreenEnable);
     541    else
     542        return true;   
    534543}
    535544
     545void SynchroniseSplashScreen(void* UNUSED(cbdata))
     546{
     547    CFileInfo splashFileInfo;
     548    CStr val;
     549
     550    g_VFS->GetFileInfo("gui/splashscreen/splashscreen.txt", &splashFileInfo);
     551    val = CStr::FromInt64(splashFileInfo.MTime());
     552   
     553    g_ConfigDB.CreateValue(CFG_USER, "splashscreenversion")->m_String = val;   
     554    g_ConfigDB.WriteFile(CFG_USER);
     555}
     556
    536557void SetSplashScreenEnabled(void* UNUSED(cbdata), bool enabled)
    537558{
    538559    CStr val = (enabled ? "true" : "false");
     
    726747
    727748    // Splash screen functions
    728749    scriptInterface.RegisterFunction<bool, &IsSplashScreenEnabled>("IsSplashScreenEnabled");
     750    scriptInterface.RegisterFunction<void, &SynchroniseSplashScreen>("SynchroniseSplashScreen");
    729751    scriptInterface.RegisterFunction<void, bool, &SetSplashScreenEnabled>("SetSplashScreenEnabled");
    730752
    731753    // Development/debugging functions
  • source/ps/Parser.cpp

     
    224224FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedShort,  unsigned short)
    225225FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedInt,    unsigned int)
    226226FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedLong,   unsigned long)
     227FUNC_IMPL_CAST_GETDOUBLE(GetTime,           time_t)
    227228
    228229// CParserTaskTypeNode
    229230// ---------------------------------------------------------------------| Class
  • source/ps/Parser.h

     
    106106    bool GetUnsignedInt(unsigned int &ret);
    107107    bool GetUnsignedLong(unsigned long &ret);
    108108    bool GetFloat(float &ret);
     109    bool GetTime(time_t &time);
    109110    bool GetDouble(double &ret);
    110111
    111112    // Memory regardless if it's an int, real, string or whatever