mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +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
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (--timeout > 0) {
|
if (--timeout > 0) {
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (updateDeckTask != null)
|
if (updateDeckTask != null)
|
||||||
updateDeckTask.cancel(true);
|
updateDeckTask.cancel(true);
|
||||||
setTimeout("0");
|
setTimeout(0);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
hideDeckEditor();
|
hideDeckEditor();
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
this.deckArea.showSideboard(false);
|
this.deckArea.showSideboard(false);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
this.timeout = time;
|
this.timeout = time;
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
if (timeout != 0) {
|
if (timeout != 0) {
|
||||||
countdown.start();
|
countdown.start();
|
||||||
if (updateDeckTask == null || updateDeckTask.isDone()) {
|
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);
|
this.txtTimeRemaining.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,10 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (--timeout > 0) {
|
if (--timeout > 0) {
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setTimeout("0");
|
setTimeout(0);
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,6 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||||
DraftPickView view = session.sendCardPick(draftId, source.getId());
|
DraftPickView view = session.sendCardPick(draftId, source.getId());
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
//draftBooster.loadBooster(view.getBooster(), bigCard);
|
|
||||||
draftBooster.loadBooster(emptyView, bigCard);
|
draftBooster.loadBooster(emptyView, bigCard);
|
||||||
draftPicks.loadCards(CardsViewUtil.convertSimple(view.getPicks()), bigCard, null);
|
draftPicks.loadCards(CardsViewUtil.convertSimple(view.getPicks()), bigCard, null);
|
||||||
Plugins.getInstance().getActionCallback().hidePopup();
|
Plugins.getInstance().getActionCallback().hidePopup();
|
||||||
|
@ -132,13 +131,26 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
setMessage("Pick a card");
|
setMessage("Pick a card");
|
||||||
countdown.stop();
|
countdown.stop();
|
||||||
this.timeout = draftPickView.getTimeout();
|
this.timeout = draftPickView.getTimeout();
|
||||||
setTimeout(Integer.toString(timeout));
|
setTimeout(timeout);
|
||||||
if (timeout != 0) {
|
if (timeout != 0) {
|
||||||
countdown.start();
|
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);
|
this.txtTimeRemaining.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue