mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
GUI, preferences: reworked size settings:
- added size settings for player's panel size (closes #12455, closes #12451, closes #5605); - size settings can be edit by slider or by text edit; - size settings for fonts has preview button with real text sample; - improved some tabs and hints for better UX; - improved GUI rendering performance;
This commit is contained in:
parent
921e656e3c
commit
1f3fad6594
15 changed files with 3224 additions and 5913 deletions
|
|
@ -7,7 +7,9 @@ import javax.swing.JPanel;
|
|||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JViewport;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
/**
|
||||
* GUI component: JPanel with background image
|
||||
*/
|
||||
public class ImagePanel extends JPanel {
|
||||
|
||||
|
||||
|
|
@ -24,6 +26,8 @@ public class ImagePanel extends JPanel {
|
|||
this.image = image;
|
||||
this.style = style;
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
setOpaque(true);
|
||||
}
|
||||
|
||||
public void setImageAlignmentX(float alignmentX) {
|
||||
|
|
@ -56,7 +60,6 @@ public class ImagePanel extends JPanel {
|
|||
super.add(component, constraints);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@ public class PlayerView implements Serializable {
|
|||
private final List<CommandObjectView> commandList = new ArrayList<>();
|
||||
private final List<UUID> attachments = new ArrayList<>();
|
||||
private final int statesSavedSize;
|
||||
private final int priorityTimeLeft;
|
||||
private final long priorityTimeSavedTimeMs;
|
||||
private final int priorityTimeLeftSecs;
|
||||
private final int bufferTimeLeft;
|
||||
private final boolean passedTurn; // F4
|
||||
private final boolean passedUntilEndOfTurn; // F5
|
||||
|
|
@ -71,7 +72,8 @@ public class PlayerView implements Serializable {
|
|||
this.manaPool = new ManaPoolView(player.getManaPool());
|
||||
this.isActive = (player.getId().equals(state.getActivePlayerId()));
|
||||
this.hasPriority = player.getId().equals(state.getPriorityPlayerId());
|
||||
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
||||
this.priorityTimeLeftSecs = player.getPriorityTimeLeft();
|
||||
this.priorityTimeSavedTimeMs = System.currentTimeMillis();
|
||||
this.bufferTimeLeft = player.getBufferTimeLeft();
|
||||
this.timerActive = (this.hasPriority && player.isGameUnderControl())
|
||||
|| (player.getPlayersUnderYourControl().contains(state.getPriorityPlayerId()))
|
||||
|
|
@ -270,8 +272,10 @@ public class PlayerView implements Serializable {
|
|||
return statesSavedSize;
|
||||
}
|
||||
|
||||
public int getPriorityTimeLeft() {
|
||||
return priorityTimeLeft;
|
||||
public int getPriorityTimeLeftSecs() {
|
||||
// workaround to find real time
|
||||
int secsAfterUpdate = (int) ((System.currentTimeMillis() - this.priorityTimeSavedTimeMs) / 1000);
|
||||
return Math.max(0, this.priorityTimeLeftSecs - secsAfterUpdate);
|
||||
}
|
||||
|
||||
public int getBufferTimeLeft() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue