SystemMenu.tscript 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. function SystemMenu::onWake(%this)
  2. {
  3. $MenuList = SystemMenuButtonList;
  4. $MenuList.listPosition = 0;
  5. $MenuList.syncGui();
  6. }
  7. function SystemMenu::onSleep(%this)
  8. {
  9. }
  10. function systemMenuExitToMenu()
  11. {
  12. MessageBoxOKCancel("Exit?", "Do you wish to exit to the Main Menu?", "escapeFromGame();", "");
  13. }
  14. function systemMenuExitToDesktop()
  15. {
  16. MessageBoxOKCancel("Exit?", "Do you wish to exit to the desktop?", "quit();", "");
  17. }
  18. function SystemMenuButton::onHighlighted(%this, %highlighted)
  19. {
  20. if(%highlighted)
  21. $MenuList.listPosition = $MenuList.getObjectIndex(%this);
  22. }
  23. function SystemMenuButtonList::syncGUI(%this)
  24. {
  25. %btn = %this.getObject(%this.listPosition);
  26. %btn.setHighlighted(true);
  27. //
  28. //Update the button imagery to comply to the last input device we'd used
  29. %device = Canvas.getLastInputDevice();
  30. if(%device $= "mouse")
  31. %device = "keyboard";
  32. //We'll call back to the GameMenu parent just to be sure everything's on the same page
  33. GameMenu.syncGui();
  34. }