This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Changeset 10165 for ps


Ignore:
Timestamp:
09/02/11 02:33:19 (13 years ago)
Author:
brian
Message:

Fix squished menu background and make clicking on background hide the submenu

Location:
ps/trunk/binaries/data/mods/public/gui/pregame
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.js

    r10155 r10165  
    11var userReportEnabledText; // contains the original version with "$status" placeholder
    2 var currentSubmenu; // contains placeholder submenu
    3 const MARGIN = 4;
     2var currentSubmenuType; // contains submenu type
     3const MARGIN = 4; // menu border size
    44
    55function init()
     
    1010
    1111    userReportEnabledText = getGUIObjectByName("userReportEnabledText").caption;
    12         currentSubmenu = "submenuSinglePlayer";
     12
     13        // initialize currentSubmenuType with placeholder to avoid null
     14        currentSubmenuType = "submenuSinglePlayer";
    1315}
    1416
     
    3335    var left = screen.right - w * (1 + Math.ceil(screen.right / w));
    3436    layer1.size = new GUISize(left + off1, screen.top, screen.right + off1, screen.bottom);
    35 
    36     layer2.size = new GUISize(screen.right - h + off2, screen.top, screen.right + off2, screen.bottom);
     37    layer2.size = new GUISize(screen.right/2 - h + off2, screen.top, screen.right/2 + h + off2, screen.bottom);
    3738    layer3.size = new GUISize(screen.right - h + off3, screen.top, screen.right + off3, screen.bottom);
    3839}
     
    144145
    145146        // switch to new submenu type
    146         currentSubmenu = newSubmenu;
    147         getGUIObjectByName(currentSubmenu).hidden = false;
     147        currentSubmenuType = newSubmenu;
     148        getGUIObjectByName(currentSubmenuType).hidden = false;
    148149
    149150        // set position of new submenu
     
    156157        blendSubmenuIntoMain(top, bottom);
    157158
    158         // prepare to hide the submenu when the mouse moves off of the submenu
     159        // Reveal submenu
    159160        getGUIObjectByName("submenu").hidden = false;
     161
     162        // prepare to hide the submenu when the user clicks on the background
     163        getGUIObjectByName("submenuScreen").hidden = false;
    160164}
    161165
     
    164168{
    165169        // remove old submenu type
    166         getGUIObjectByName(currentSubmenu).hidden = true;
    167 
    168         // hide submenu
    169         getGUIObjectByName("submenu").hidden = true;
    170 
    171         // reset submenu position
    172         getGUIObjectByName("submenu").size = getGUIObjectByName("mainMenu").size;
     170        getGUIObjectByName(currentSubmenuType).hidden = true;
     171
     172        // hide submenu and reset position
     173        var submenu = getGUIObjectByName("submenu");
     174        submenu.hidden = true;
     175        submenu.size = getGUIObjectByName("mainMenu").size;
    173176
    174177        // reset main menu panel right border
    175178        getGUIObjectByName("MainMenuPanelRightBorderTop").size = "100%-2 0 100% 100%";
     179
     180        // hide submenu screen
     181        getGUIObjectByName("submenuScreen").hidden = false;
     182        console.write(getGUIObjectByName("submenuScreen").hidden);
    176183}
    177184
  • ps/trunk/binaries/data/mods/public/gui/pregame/mainmenu.xml

    r10158 r10165  
    147147        </object>
    148148
     149
    149150                <!--
    150151        ==========================================
     
    152153        ==========================================
    153154        -->
     155
     156                <!-- submenu screen (hides submenu when clicked -->
     157                <object name="submenuScreen"
     158                        type="button"
     159                        size="0 0 100% 100%"
     160                        hidden="true"
     161                >
     162                        <action on="Press">
     163                                closeMenu();
     164                        </action>
     165                </object>
    154166
    155167                <!-- submenu -->
Note: See TracChangeset for help on using the changeset viewer.