home *** CD-ROM | disk | FTP | other *** search
/ 3D Game Programming All in One / 3D Game Programming All in One Disc.iso / 3D2E / demo / client / scripts / game.cs < prev    next >
Encoding:
Text File  |  2005-11-23  |  1.8 KB  |  54 lines

  1. //-----------------------------------------------------------------------------
  2. // Torque Game Engine 
  3. // Copyright (C) GarageGames.com, Inc.
  4. //-----------------------------------------------------------------------------
  5.  
  6.  
  7. //----------------------------------------------------------------------------
  8. // Game start / end events sent from the server
  9. //----------------------------------------------------------------------------
  10.  
  11. function clientCmdGameStart(%seq)
  12. {
  13.    PlayerListGui.zeroScores();
  14. }
  15.  
  16. function clientCmdGameEnd(%seq)
  17. {
  18.    // Stop local activity... the game will be destroyed on the server
  19.    alxStopAll();
  20.  
  21.    // Copy the current scores from the player list into the
  22.    // end game gui (bit of a hack for now).
  23.    EndGameGuiList.clear();
  24.    for (%i = 0; %i < PlayerListGuiList.rowCount(); %i++) {
  25.       %text = PlayerListGuiList.getRowText(%i);
  26.       %id = PlayerListGuiList.getRowId(%i);
  27.       EndGameGuiList.addRow(%id,%text);
  28.    }
  29.    EndGameGuiList.sortNumerical(1,false);
  30.  
  31.    // Display the end-game screen
  32.    Canvas.setContent(EndGameGui);
  33. }
  34.  
  35. //----------------------------------------------------------------------------
  36. // Game gui
  37. //----------------------------------------------------------------------------
  38.  
  39. // Initialize GameGUI to the default gui screen.
  40. $Client::GameGUI = "PlayGUI";
  41.  
  42. function clientCmdSetGameGui(%gui)
  43. {
  44.    // The GameGUI isn't loaded here directly. Game gui is normally loaded
  45.    // when the client first recieves a control object from the server. (This is
  46.    // handled by the GameConnection scripts, located in serverConnection.cs)
  47.    // But if we aren't in the editor and the game is currently in progress,
  48.    // then we probably should load the gui...
  49.    $Client::GameGUI = %gui; 
  50. }
  51.  
  52.  
  53.  
  54.