home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 November
/
CDVD1105.ISO
/
Util
/
Winamp
/
Skins
/
Anime_Shogo.wal
/
scripts
/
timerscrpt.m
< prev
next >
Wrap
Text File
|
2004-08-09
|
2KB
|
88 lines
#include "../../../lib/std.mi"
Function String oldTimer(int CurPos);
Function ResetToolTips();
Global Text TimerTxt, Songticker;
Global Layer SwordTrap;
Global Timer PosTimer;
Global Boolean MinusisOn;
System.onScriptLoaded() {
Layout TimerGrp = getContainer("main").getLayout("Normal");
Layout SwordGrp = getContainer("main").getLayout("Sword");
Songticker = TimerGrp.findObject("Songticker");
TimerTxt = TimerGrp.findObject("Timer");
SwordTrap = SwordGrp.findObject("SwordTrap");
PosTimer = new Timer;
PosTimer.setDelay(20);
MinusisOn = getPrivateInt("Settings", "Minus", 0);
if (System.getStatus()==0) TimerTxt.setText("000:00");
else PosTimer.start();
ResetToolTips();
}
System.onScriptUnloading() {
PosTimer.stop();
delete PosTimer;
}
System.onPlay() {
PosTimer.start();
}
System.onStop() {
PosTimer.stop();
TimerTxt.setText("000:00");
}
PosTimer.onTimer() {
if (MinusIsOn) TimerTxt.setText(oldTimer(getPlayItemLength()-getPosition()));
else TimerTxt.setText(oldTimer(getPosition()));
}
TimerTxt.onLeftButtonDown(int x, int y) {
if (MinusisOn) MinusisOn=0;
else MinusisOn=1;
setPrivateInt("Settings","Minus", MinusisOn);
}
String oldTimer(int CurPos) {
String SpecTmr = integerToTime(CurPos);
String Temp = integerToString(CurPos);
int TempLen = strlen(Temp);
if (strlen(SpecTmr)==4) SpecTmr = "00" + SpecTmr;
else if (strlen(SpecTmr)==5) SpecTmr = "0" + SpecTmr;
if (MinusIsOn) SpecTmr = "-" + SpecTmr;
return SpecTmr;
}
ResetToolTips() {
string r = Songticker.GetText() + " (" + System.integerToTime(System.getPlayItemLength()) + ")";
Songticker.SetXmlParam("tooltip", r);
TimerTxt.SetXmlParam("tooltip", r);
SwordTrap.SetXmlParam("tooltip", r);
}
Songticker.OnEnterArea() {
ResetToolTips();
}
TimerTxt.OnEnterArea() {
ResetToolTips();
}
SwordTrap.OnEnterArea() {
ResetToolTips();
}