Advertisement
Guest User

Untitled

a guest
Aug 24th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1.  
  2. $demo_lastTimeScale = 1;
  3.  
  4. function LoadDemoKeyBindings()
  5. {
  6. if($demoMode)
  7. {
  8. GlobalActionMap.bind(keyboard, "p", PausePlayDemo);
  9. GlobalActionMap.bind(keyboard, "pageup", SpeedUpDemo);
  10. GlobalActionMap.bind(keyboard, "pagedown", SlowDownDemo);
  11. }
  12. }
  13.  
  14. function GameHud::onWake(%this)
  15. {
  16. parent::onWake(%this);
  17.  
  18. LoadDemoKeyBindings();
  19. }
  20.  
  21. function PausePlayDemo(%val)
  22. {
  23. if (!%val)
  24. return;
  25.  
  26. if ($timeScale == 0)
  27. demoQuit.onClick();
  28. else
  29. demoPause.onClick();
  30. }
  31.  
  32. function SpeedUpDemo(%val)
  33. {
  34. if(!%val)
  35. return;
  36. else
  37. {
  38. demoSpeedText.setText(demoSpeedText.getText() + 1);
  39. demoSetSpeed.onClick();
  40. }
  41. }
  42.  
  43. function SlowDownDemo(%val)
  44. {
  45. if(!%val)
  46. return;
  47. else if(demoSpeedText.getText() >= 2)
  48. {
  49. demoSpeedText.setText(demoSpeedText.getText() - 1);
  50. demoSetSpeed.onClick();
  51. }
  52. else
  53. return;
  54. }
  55.  
  56. function demoPlay::onClick(%this)
  57. {
  58. $timeScale = $demo_lastTimeScale;
  59. }
  60.  
  61. function demoPause::onClick(%this)
  62. {
  63. $demo_lastTimeScale = $timeScale;
  64. $timeScale = 0;
  65. }
  66.  
  67. function demoQuit::onClick(%this)
  68. {
  69. $timeScale = 1;
  70. $demo_lastTimeScale = 1;
  71. ServerConnection.stopDemo();
  72. }
  73.  
  74. function demoSetSpeed::onClick(%this)
  75. {
  76. $timeScale = demoSpeedText.getText();
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement