UI.tscript 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.gui");
  44. %this.queueExec("./guis/remapConfirmDlg.gui");
  45. %this.queueExec("./guis/profiler");
  46. %this.queueExec("./guis/profiler.gui");
  47. %this.queueExec("./guis/netGraphGui.gui");
  48. %this.queueExec("./guis/startupGui");
  49. %this.queueExec("./guis/startupGui.gui");
  50. %this.queueExec("./guis/messageBoxDlg");
  51. %this.queueExec("./guis/messageBoxDlg.gui");
  52. %this.queueExec("./guis/SystemMenu");
  53. %this.queueExec("./guis/SystemMenu.gui");
  54. //Load scripts
  55. %this.queueExec("./scripts/controlsMenu");
  56. %this.queueExec("./scripts/cursors");
  57. if(isToolBuild())
  58. %this.queueExec("./tools/creator.tscript");
  59. }
  60. function UI::onCreateClientConnection(%this){}
  61. function UI::onDestroyClientConnection(%this){}
  62. function UI::registerGameMenus(%this, %menusArrayObj)
  63. {
  64. %menusArrayObj.add("System", SystemMenu);
  65. }