mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Merge pull request #247 from Noahsark/master
Transfer timeout counter to clock format
This commit is contained in:
commit
5f6398952a
2 changed files with 35 additions and 10 deletions
|
@ -102,12 +102,12 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(Integer.toString(timeout));
|
||||
setTimeout(timeout);
|
||||
}
|
||||
else {
|
||||
if (updateDeckTask != null)
|
||||
updateDeckTask.cancel(true);
|
||||
setTimeout("0");
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
hideDeckEditor();
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.deckArea.showSideboard(false);
|
||||
countdown.stop();
|
||||
this.timeout = time;
|
||||
setTimeout(Integer.toString(timeout));
|
||||
setTimeout(timeout);
|
||||
if (timeout != 0) {
|
||||
countdown.start();
|
||||
if (updateDeckTask == null || updateDeckTask.isDone()) {
|
||||
|
@ -308,7 +308,20 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
private void setTimeout(String text) {
|
||||
private void setTimeout(int s){
|
||||
int minute = s/60;
|
||||
int second = s - (minute*60);
|
||||
String text;
|
||||
if(minute < 10){
|
||||
text = "0" + Integer.toString(minute) + ":";
|
||||
}else{
|
||||
text = Integer.toString(minute) + ":";
|
||||
}
|
||||
if(second < 10){
|
||||
text = text + "0" + Integer.toString(second);
|
||||
}else{
|
||||
text = text + Integer.toString(second);
|
||||
}
|
||||
this.txtTimeRemaining.setText(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,10 +78,10 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(Integer.toString(timeout));
|
||||
setTimeout(timeout);
|
||||
}
|
||||
else {
|
||||
setTimeout("0");
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,6 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||
DraftPickView view = session.sendCardPick(draftId, source.getId());
|
||||
if (view != null) {
|
||||
//draftBooster.loadBooster(view.getBooster(), bigCard);
|
||||
draftBooster.loadBooster(emptyView, bigCard);
|
||||
draftPicks.loadCards(CardsViewUtil.convertSimple(view.getPicks()), bigCard, null);
|
||||
Plugins.getInstance().getActionCallback().hidePopup();
|
||||
|
@ -132,13 +131,26 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
setMessage("Pick a card");
|
||||
countdown.stop();
|
||||
this.timeout = draftPickView.getTimeout();
|
||||
setTimeout(Integer.toString(timeout));
|
||||
setTimeout(timeout);
|
||||
if (timeout != 0) {
|
||||
countdown.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void setTimeout(String text) {
|
||||
|
||||
private void setTimeout(int s){
|
||||
int minute = s/60;
|
||||
int second = s - (minute*60);
|
||||
String text;
|
||||
if(minute < 10){
|
||||
text = "0" + Integer.toString(minute) + ":";
|
||||
}else{
|
||||
text = Integer.toString(minute) + ":";
|
||||
}
|
||||
if(second < 10){
|
||||
text = text + "0" + Integer.toString(second);
|
||||
}else{
|
||||
text = text + Integer.toString(second);
|
||||
}
|
||||
this.txtTimeRemaining.setText(text);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue