UI.tscript 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // The general flow of a gane - server's creation, loading and hosting clients, and then destruction is as follows:
  2. // First, a client will always create a server in the event that they want to host a single player
  3. // game. Torque3D treats even single player connections as a soft multiplayer game, with some stuff
  4. // in the networking short-circuited to sidestep around lag and packet transmission times.
  5. // initServer() is called, loading the default server scripts.
  6. // After that, if this is a dedicated server session, initDedicated() is called, otherwise initClient is called
  7. // to prep a playable client session.
  8. // When a local game is started - a listen server - via calling StartGame() a server is created and then the client is
  9. // connected to it via createAndConnectToLocalServer().
  10. function UI::onCreate( %this )
  11. {
  12. exec("./scripts/utility");
  13. // create and set as core a defaultTable LanguageTable for localization purposes
  14. // example usage for quick language appending
  15. // addLanguage("defaultTable","check","ch");
  16. // addLanguage("defaultTable","try","tr");
  17. createLangTable("defaultTable");
  18. setCoreLangTable("defaultTable");
  19. exec("./langs/languageMap");
  20. }
  21. function UI::onDestroy( %this )
  22. {
  23. }
  24. function UI::initServer(%this){}
  25. function UI::onCreateGameServer(%this){}
  26. function UI::onDestroyGameServer(%this){}
  27. function UI::initClient(%this)
  28. {
  29. //Load UI stuff
  30. //Profiles
  31. %this.queueExec("./scripts/profiles");
  32. %this.queueExec("./guis/mainMenu");
  33. %this.queueExec("./guis/mainMenu.gui");
  34. %this.queueExec("./guis/ChooseLevelMenu");
  35. %this.queueExec("./guis/ChooseLevelMenu.gui");
  36. %this.queueExec("./guis/joinServerMenu");
  37. %this.queueExec("./guis/joinServerMenu.gui");
  38. %this.queueExec("./guis/loadingGui.gui");
  39. %this.queueExec("./guis/optionsMenu");
  40. %this.queueExec("./guis/optionsMenu.gui");
  41. %this.queueExec("./guis/GameMenu");
  42. %this.queueExec("./guis/GameMenu.gui");
  43. %this.queueExec("./guis/remapDlg");
  44. %this.queueExec("./guis/remapDlg.gui");
  45. %this.queueExec("./guis/remapConfirmDlg.gui");
  46. %this.queueExec("./guis/profiler");
  47. %this.queueExec("./guis/profiler.gui");
  48. %this.queueExec("./guis/netGraphGui.gui");
  49. %this.queueExec("./guis/startupGui");
  50. %this.queueExec("./guis/startupGui.gui");
  51. %this.queueExec("./guis/messageBoxDlg");
  52. %this.queueExec("./guis/messageBoxDlg.gui");
  53. %this.queueExec("./guis/SystemMenu");
  54. %this.queueExec("./guis/SystemMenu.gui");
  55. //Load scripts
  56. %this.queueExec("./scripts/controlsMenu");
  57. %this.queueExec("./scripts/cursors");
  58. if(isToolBuild())
  59. %this.queueExec("./tools/creator.tscript");
  60. //GameMenu actionmap
  61. %this.queueExec("./scripts/defaultKeybinds.tscript");
  62. }
  63. function UI::onCreateClientConnection(%this)
  64. {
  65. GameMenuToggleActionMap.push();
  66. }
  67. function UI::onDestroyClientConnection(%this)
  68. {
  69. GameMenuToggleActionMap.pop();
  70. }
  71. function UI::registerGameMenus(%this, %menusArrayObj)
  72. {
  73. %menusArrayObj.add("System", SystemMenu);
  74. }