Last active
July 20, 2017 07:17
-
-
Save amuhororo/1264572a241a27e3a5051e99c3683ec8 to your computer and use it in GitHub Desktop.
playtime_disp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;プレイ時間表示用ptext | |
[ptext layer=2 name="playtime" y=640 x=20 color=0xFFFFFF text="0"] | |
[iscript] | |
f.playtime = 0; | |
f.playtime_disp = 0; | |
TG.stat.is_counting=false; | |
setInterval(function(){ | |
if(TG.stat.is_counting==true){ | |
++f.playtime; | |
hour = parseInt(f.playtime / 3600); | |
min = parseInt((f.playtime / 60) % 60); | |
sec = f.playtime % 60; | |
//ここは2桁表示に拘らなければ不要 | |
if(hour < 10) { hour = "0" + hour; } | |
if(min < 10) { min = "0" + min; } | |
if(sec < 10) { sec = "0" + sec; } | |
//不要ここまで | |
f.playtime_disp = hour + ':' + min + ':' + sec; | |
$(".playtime").text(f.playtime_disp); | |
} | |
}, 1000); | |
[endscript] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment