64 lines
1.8 KiB
Mason
64 lines
1.8 KiB
Mason
import Toybox.Lang;
|
|
import Toybox.WatchUi;
|
|
import Toybox.Time;
|
|
import Toybox.Timer;
|
|
import Toybox.System;
|
|
|
|
public class Card {
|
|
public var team as enTeam;
|
|
public var card as enCard;
|
|
public var player as Number;
|
|
public var remaining as Number;
|
|
public var isActive as Boolean;
|
|
|
|
private var start as Number?;
|
|
private var end as Number?;
|
|
private var duration as Number?;
|
|
private var _datetime as Number?;
|
|
|
|
// public var display as String?;
|
|
|
|
function initialize(tm as enTeam, cd as enCard, pl as Number, dn as Number, st as Number){
|
|
team = tm;
|
|
card = cd;
|
|
start = st;
|
|
duration = dn * 60;
|
|
remaining = duration;
|
|
end = start + duration;
|
|
player = pl;
|
|
isActive = true;
|
|
_datetime = Time.now().value();
|
|
|
|
// display = Lang.format("T:$1$-P:$2$-C:G",[_team, _player]);
|
|
|
|
}
|
|
|
|
// public function timeRemaining(el as Number) as Number{
|
|
// return end - el;
|
|
// }
|
|
|
|
public function dummy(q as Boolean) as Void{}
|
|
|
|
public function update(el as Number) as Void{
|
|
remaining = end - el;
|
|
|
|
if(end - el == 0){
|
|
// WatchUi.pushView(new menuConfirmationDelegate(Lang.format("Card: $1$ Over",[player.format("%02d")]), false), new ConfirmationDelegate(method(:dummy)), WatchUi.SLIDE_LEFT);
|
|
System.println(Lang.format("Card: $1$ Over",[player.format("%02d")]));
|
|
isActive = false;
|
|
}
|
|
}
|
|
|
|
function toDict() as Dictionary {
|
|
return {
|
|
"team" => team,
|
|
"start" => start,
|
|
"end" => end,
|
|
"card" => card,
|
|
"player" => player,
|
|
"duration" => duration,
|
|
"datetime" => _datetime
|
|
};
|
|
}
|
|
}
|