Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $demo_lastTimeScale = 1;
- function LoadDemoKeyBindings()
- {
- if($demoMode)
- {
- GlobalActionMap.bind(keyboard, "p", PausePlayDemo);
- GlobalActionMap.bind(keyboard, "pageup", SpeedUpDemo);
- GlobalActionMap.bind(keyboard, "pagedown", SlowDownDemo);
- }
- }
- function GameHud::onWake(%this)
- {
- parent::onWake(%this);
- LoadDemoKeyBindings();
- }
- function PausePlayDemo(%val)
- {
- if (!%val)
- return;
- if ($timeScale == 0)
- demoQuit.onClick();
- else
- demoPause.onClick();
- }
- function SpeedUpDemo(%val)
- {
- if(!%val)
- return;
- else
- {
- demoSpeedText.setText(demoSpeedText.getText() + 1);
- demoSetSpeed.onClick();
- }
- }
- function SlowDownDemo(%val)
- {
- if(!%val)
- return;
- else if(demoSpeedText.getText() >= 2)
- {
- demoSpeedText.setText(demoSpeedText.getText() - 1);
- demoSetSpeed.onClick();
- }
- else
- return;
- }
- function demoPlay::onClick(%this)
- {
- $timeScale = $demo_lastTimeScale;
- }
- function demoPause::onClick(%this)
- {
- $demo_lastTimeScale = $timeScale;
- $timeScale = 0;
- }
- function demoQuit::onClick(%this)
- {
- $timeScale = 1;
- $demo_lastTimeScale = 1;
- ServerConnection.stopDemo();
- }
- function demoSetSpeed::onClick(%this)
- {
- $timeScale = demoSpeedText.getText();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement