File size: 2,510 Bytes
99b0de1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*:

-------------------------------------------------------------------------

@title Timer Pause

@author Hime --> HimeWorks (http://himeworks.com)

@date Nov 18, 2015

@filename HIME_TimerPause.js

@url http://himeworks.com/2015/11/timer-pause/



If you enjoy my work, consider supporting me on Patreon!



https://www.patreon.com/himeworks



If you have any questions or concerns, you can contact me at any of

the following sites:



Main Website: http://himeworks.com

Facebook: https://www.facebook.com/himeworkscom/

Twitter: https://twitter.com/HimeWorks

Youtube: https://www.youtube.com/c/HimeWorks

Tumblr: http://himeworks.tumblr.com/



-------------------------------------------------------------------------

@plugindesc Allows you to pause and resume the timer. When the timer is

paused, it will remain on the screen but it won't count down.

@help 

-------------------------------------------------------------------------

== Description ==



Do you need your timer to temporarily stop counting down, but you still

want it to show up on the screen?



This plugin provides you with two script calls that will allow you to

easily pause and resume the game timer!



== Terms of Use ==



- Free for use in non-commercial projects with credits

- Contact me for commercial use



== Change Log ==



Nov 18, 2015 -  initial release



== Usage ==



To pause the timer, use the script call



  $gameTimer.pause();

  

To resume the timer, use the script call



  $gameTimer.resume();

  

Note that this can be used on any Game_Timer object.



-------------------------------------------------------------------------

 */ 
var Imported = Imported || {} ;
var TH = TH || {};
Imported.TimerPause = 1;
TH.TimerPause = TH.TimerPause || {};

(function ($) {
  var TH_TimerPause_GameTimer_initialize = Game_Timer.prototype.initialize;
  Game_Timer.prototype.initialize = function() {
    TH_TimerPause_GameTimer_initialize.call(this);
    this._paused = false;
  };
  
  var TH_TimerPause_GameTimer_update = Game_Timer.prototype.update;
  Game_Timer.prototype.update = function(sceneActive) {
    if (this._paused) {
      return;
    }
    TH_TimerPause_GameTimer_update.call(this, sceneActive);
  };
  
  Game_Timer.prototype.isPaused = function() {
    return this._paused;
  };

  Game_Timer.prototype.pause = function() {
    this._paused = true;
  };
  
  Game_Timer.prototype.resume = function() {
    this._paused = false;
  };
})(TH.TimerPause);