Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show game board in all the game phases #4030

Merged
merged 52 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2fd0a02
show game board in all the game phases
kuronekochomusuke Dec 9, 2022
308b55a
show game board in all the game phases 2
kuronekochomusuke Dec 10, 2022
d0165cc
show game board in all the game phases 3
kuronekochomusuke Dec 10, 2022
f41c9b0
show game board in all the game phases 4
kuronekochomusuke Dec 10, 2022
3cb284b
show game board in all the game phases 5
kuronekochomusuke Dec 10, 2022
5dbc13b
show game board in all the game phases 6
kuronekochomusuke Dec 10, 2022
35b95b8
show game board in all the game phases 7
kuronekochomusuke Dec 10, 2022
1590d6a
show game board in all the game phases 8
kuronekochomusuke Dec 10, 2022
951ca7b
show game board in all the game phases 9
kuronekochomusuke Dec 12, 2022
887067f
show game board in all the game phases 10
kuronekochomusuke Dec 12, 2022
9d62d49
show game board in all the game phases 11
kuronekochomusuke Dec 12, 2022
93acf9c
show game board in all the game phases 12
kuronekochomusuke Dec 12, 2022
c8de748
show game board in all the game phases 13
kuronekochomusuke Dec 12, 2022
f44a241
show game board in all the game phases 14
kuronekochomusuke Dec 13, 2022
213f97a
show game board in all the game phases 15
kuronekochomusuke Dec 13, 2022
5fc9056
show game board in all the game phases 16
kuronekochomusuke Dec 13, 2022
f0fe438
show game board in all the game phases 17
kuronekochomusuke Dec 14, 2022
cd1cf19
show game board in all the game phases 18
kuronekochomusuke Dec 14, 2022
5899fcd
show game board in all the game phases 19
kuronekochomusuke Dec 14, 2022
03cc9e3
Merge branch 'master' into boardAllTheTime
kuronekochomusuke Dec 22, 2022
f7d6708
show game board in all the game phases
kuronekochomusuke Dec 22, 2022
66e4705
Merge branch 'master' into boardAllTheTime
kuronekochomusuke Dec 22, 2022
adc12ee
show game board in all the game phases 21
kuronekochomusuke Dec 23, 2022
b8d8806
show game board in all the game phases 22
kuronekochomusuke Dec 23, 2022
59cd52b
show game board in all the game phases 23
kuronekochomusuke Dec 24, 2022
5e216c2
show game board in all the game phases 24
kuronekochomusuke Dec 24, 2022
859475c
show game board in all the game phases 25
kuronekochomusuke Dec 24, 2022
47a9d34
show game board in all the game phases 26
kuronekochomusuke Dec 24, 2022
b882530
show game board in all the game phases 27
kuronekochomusuke Dec 24, 2022
4f6339a
show game board in all the game phases 28
kuronekochomusuke Dec 25, 2022
b92c7f7
show game board in all the game phases 29
kuronekochomusuke Dec 25, 2022
5ee4a51
show game board in all the game phases 30
kuronekochomusuke Dec 25, 2022
a0b5a15
show game board in all the game phases 31
kuronekochomusuke Dec 26, 2022
b14b132
show game board in all the game phasee 32
kuronekochomusuke Dec 26, 2022
1f6b3dd
show game board in all the game phasee 33
kuronekochomusuke Dec 26, 2022
a2a3523
show game board in all the game phasee 34
kuronekochomusuke Dec 26, 2022
3dfde33
show game board in all the game phasee 35
kuronekochomusuke Dec 26, 2022
ceb08e1
show game board in all the game phasee 36
kuronekochomusuke Dec 27, 2022
5dc380e
show game board in all the game phasee 37
kuronekochomusuke Dec 27, 2022
a80f96f
show game board in all the game phasee 38
kuronekochomusuke Dec 27, 2022
f42d22e
show game board in all the game phasee 39
kuronekochomusuke Dec 27, 2022
2a2a95f
show game board in all the game phasee 40
kuronekochomusuke Dec 27, 2022
b17e7a2
show game board in all the game phasee 41
kuronekochomusuke Dec 28, 2022
f8c9686
show game board in all the game phasee 42
kuronekochomusuke Jan 6, 2023
60fda01
show game board in all the game phasee 43
kuronekochomusuke Jan 6, 2023
9e93a1a
show game board in all the game phasee 44
kuronekochomusuke Jan 6, 2023
510e174
Merge branch 'master' into boardAllTheTime
kuronekochomusuke Jan 10, 2023
fb6bdfa
show game board in all the game phases 45
kuronekochomusuke Jan 10, 2023
1b46626
show game board in all the game phases 46
kuronekochomusuke Jan 10, 2023
6174a7e
Merge branch 'master' into boardAllTheTime
kuronekochomusuke Jan 12, 2023
14605bf
show game boarad in all game phases 47
kuronekochomusuke Jan 12, 2023
da5523a
Merge branch 'master' into boardAllTheTime
kuronekochomusuke Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ AdvancedOptions.PlanetaryConditionsShowLabels.name=Planetary Conditions Show Lab
AdvancedOptions.PlanetaryConditionsShowValues.name=Planetary Conditions Show Values
AdvancedOptions.PlanetaryConditionsShowIndicators.name=Planetary Conditions Show Indicators
AdvancedOptions.UnitToolTipSeenByResolution.name=UnitToolTip - Seen By Resolution [1=Someone,2=Team,3=Player]
AdvancedOptions.DockOnLeft.name=Dock on left side of the board
AdvancedOptions.DockMultipleOnYAxis.name=Dock multiple panels using the y axis

#Board Editor
BoardEditor.BridgeBuildingElevError=Bridge/Building Elevation is an offset from the surface of a hex and hence must be a positive value!
Expand Down Expand Up @@ -708,6 +710,7 @@ ChatLounge.SearchlightToggleOff=Remove searchlight(s)
ChatLounge.SearchlightToggleOn=Add searchlight(s)
ChatLounge.SelectBo=Please select a bot you control from the player list.
ChatLounge.SelectBotOrPlayer=Please select a bot you control or your player from the player list.
ChatLounge.map.SetupXMLfiles=Map Setup XML files
ChatLounge.SPACE=SPACE
ChatLounge.spaceMap=Space Map
ChatLounge.TechLevel=Tech Level:
Expand Down Expand Up @@ -785,6 +788,7 @@ ClientGUI.errorLoadingFile=Error Loading File
ClientGUI.errorOpeningFileToSave=Error opening file to save!
ClientGUI.errorSavingFile=Error Saving File
ClientGUI.errorSelectingPlayer=Error selecting player
ClientGUI.failedToLoadAudioFile=Failed to load audio file named
ClientGUI.FatalError.message=Could not initialise:\n
ClientGUI.FatalError.message1=Could not initialise minimap:\n
ClientGUI.FatalError.title=Fatal Error
Expand All @@ -793,6 +797,8 @@ ClientGUI.FileSaveServerDialog.title=Select file to save to...
ClientGUI.FileSaveServerDialog.message=Please enter the filename under which the game will be saved to in the server's savegames directory.
ClientGUI.gameSaveDialogMessage=Do you want to save the game before quitting MegaMek?
ClientGUI.gameSaveFirst=Save First?
ClientGUI.Hide=Hide
ClientGUI.Manual=Manual
ClientGUI.MechDisplay=Mech Display
ClientGUI.mechSelectorDialog=Mech Selector Dialog
ClientGUI.Minimap=Minimap
Expand All @@ -809,6 +815,7 @@ ClientGUI.selectMenuItem=Select
ClientGUI.skinningHelpPath=docs/help/en/skinning/skinningHowTo.html
ClientGUI.skinningHelpPath.title=How To: Skinning
ClientGUI.StartingScenario=Starting scenario...
ClientGUI.Show=Show
ClientGUI.targetMenuItem=Target
ClientGUI.title=MegaMek Client
ClientGUI.TransmittingData=Transmitting game data...
Expand Down Expand Up @@ -1092,7 +1099,15 @@ CommonSettingsDialog.useSoftCenter=Use smooth transitioning when selecting units
CommonSettingsDialog.useSoftCenterTip=Instead of an instant snap, the view is smoothly transitioned
CommonSettingsDialog.showIPAddressesInChat=Show IP Addresses in Chat (WARNING: Security Sensitive)
CommonSettingsDialog.showIPAddressesInChat.tooltip=<html>If enabled, all server and client IP addresses will be logged in the public chat box.<br>Enabling this can allow information disclosure, such as private IP addresses of the server.</html>

CommonSettingsDialog.Main=Main
CommonSettingsDialog.Graphics=Graphics
CommonSettingsDialog.KeyBinds=Key Binds
CommonSettingsDialog.ButtonOrder=Button Order
CommonSettingsDialog.UnitDisplayOrder=Unit Display Order
CommonSettingsDialog.AutoDisplay=Auto Display
CommonSettingsDialog.Advanced=Advanced
CommonSettingsDialog.ReportPhases=Report Phases
CommonSettingsDialog.NonReportPhases=Non-Report Phases
#Nag Suppression Dialog
ConfirmDialog.dontBother=Do not bother me again

Expand Down Expand Up @@ -1964,6 +1979,7 @@ MiniReportDisplay.Round=Round
MiniReportDisplay.Phase=Phase
MiniReportDisplay.ArrowUp=\u25B2
MiniReportDisplay.ArrowDown=\u25BC
MiniReportDisplay.SwitchLocation=switch location

#Assorted Movement Phase Display Text for buttons, nags, dialogs...
MovementDisplay.AbandonDialog.message=Do you want to abandon this unit?
Expand Down Expand Up @@ -3025,11 +3041,10 @@ RandomNameDialog.lblHistoricalEthnicity.toolTipText=This will generate a random

#Report Display
ReportDisplay.Done=Done
ReportDisplay.Reroll=Reroll
ReportDisplay.Details=Details
ReportDisplay.Round=Round
ReportDisplay.Phase=Phase

ReportDisplay.reportReport=Report
ReportDisplay.reportPlayerList=Player List
ReportDisplay.reportRerollInitiative=Reroll Initiative
ReportDisplay.reportRerollInitiative.tooltip=Pilot with Tactical Genius can reroll initiative in the Initiative Phase
#Ruler
Ruler.Close=Close
Ruler.Distance=Distance:
Expand Down Expand Up @@ -3093,6 +3108,9 @@ TriggerBPodDialog.title=Trigger ABA Pods
TriggerBPodDialog.ChooseTargetDialog.message=Hex {0} contains the following targets.\n\nWhich target do you want to attack?"
TriggerBPodDialog.ChooseTargetDialog.title=Choose Target

UnitDisplay.SwitchLocation=switch location
UnitDisplay.SwitchView=switch view

#Unit Editor Dialog
UnitEditorDialog.avionics=Avionics
UnitEditorDialog.bayCrit=%s Bay # %d
Expand Down
2 changes: 1 addition & 1 deletion megamek/src/megamek/client/bot/BotClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ private void toggleStealth() {
*/
public void doAlertDialog(String title, String message) {
JTextPane textArea = new JTextPane();
ReportDisplay.setupStylesheet(textArea);
Report.setupStylesheet(textArea);

textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea,
Expand Down
89 changes: 89 additions & 0 deletions megamek/src/megamek/client/ui/dialogs/MiniReportDisplayDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2022 - The MegaMek Team. All Rights Reserved.
*
* This file is part of MegaMek.
*
* MegaMek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* MegaMek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MegaMek. If not, see <http://www.gnu.org/licenses/>.
*/
package megamek.client.ui.dialogs;

import megamek.client.ui.Messages;
import megamek.client.ui.swing.ClientGUI;
import megamek.client.ui.swing.GUIPreferences;
import megamek.client.ui.swing.util.UIUtil;

import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class MiniReportDisplayDialog extends JDialog {
//region Variable Declarations
private final ClientGUI clientGUI;
private static final GUIPreferences GUIP = GUIPreferences.getInstance();
private static final String MSG_TITLE = Messages.getString("MiniReportDisplay.title");
//endregion Variable Declarations

//region Constructors
public MiniReportDisplayDialog(final JFrame frame, final ClientGUI clientGUI) {
super(frame, "", false);
this.setTitle(MSG_TITLE);

this.setLocation(GUIP.getMiniReportPosX(), GUIP.getMiniReportPosY());
this.setSize(GUIP.getMiniReportSizeWidth(), GUIP.getMiniReportSizeHeight());

UIUtil.updateWindowBounds(this);
this.setResizable(true);
this.setFocusable(false);
this.setFocusableWindowState(false);

addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
GUIP.setMiniReportEnabled(false);
}
});

this.clientGUI = clientGUI;
}
//endregion Constructors

@Override
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if ((e.getID() == WindowEvent.WINDOW_DEACTIVATED) || (e.getID() == WindowEvent.WINDOW_CLOSING)) {
kuronekochomusuke marked this conversation as resolved.
Show resolved Hide resolved
GUIP.setMiniReportSizeWidth(getSize().width);
GUIP.setMiniReportSizeHeight(getSize().height);
GUIP.setMiniReportPosX(getLocation().x);
GUIP.setMiniReportPosY(getLocation().y);
}
}

/**
* In addition to the default Dialog processKeyEvent, this method
* dispatches a KeyEvent to the client gui.
* This enables all the gui hotkeys.
*/
@Override
protected void processKeyEvent(KeyEvent evt) {
evt.setSource(clientGUI);
clientGUI.getMenuBar().dispatchEvent(evt);
// Make the source be the ClientGUI and not the dialog
// This prevents a ClassCastException in ToolTipManager
clientGUI.getCurrentPanel().dispatchEvent(evt);
if (!evt.isConsumed()) {
super.processKeyEvent(evt);
}
}
}
64 changes: 50 additions & 14 deletions megamek/src/megamek/client/ui/dialogs/UnitDisplayDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,72 @@

import megamek.client.ui.Messages;
import megamek.client.ui.swing.ClientGUI;
import megamek.client.ui.swing.GUIPreferences;
import megamek.client.ui.swing.unitDisplay.UnitDisplay;
import megamek.client.ui.swing.util.UIUtil;

import javax.swing.*;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class UnitDisplayDialog extends JDialog {
//region Variable Declarations
private UnitDisplay unitDisplay;

private final ClientGUI clientGUI;
private static final String MSG_TITLE = Messages.getString("ClientGUI.MechDisplay");
private static final GUIPreferences GUIP = GUIPreferences.getInstance();
//endregion Variable Declarations

//region Constructors
public UnitDisplayDialog(final JFrame frame, final UnitDisplay unitDisplay,
final ClientGUI clientGUI) {
super(frame, Messages.getString("ClientGUI.MechDisplay"), false);
setUnitDisplay(unitDisplay);
public UnitDisplayDialog(final JFrame frame, final ClientGUI clientGUI) {
super(frame, "", false);
this.setTitle(MSG_TITLE);

if (GUIP.getUnitDisplayStartTabbed()) {
this.setLocation(GUIP.getUnitDisplayPosX(), GUIP.getUnitDisplayPosY());
this.setSize(GUIP.getUnitDisplaySizeWidth(), GUIP.getUnitDisplaySizeHeight());
}
else {
this.setLocation(GUIP.getUnitDisplayNontabbedPosX(), GUIP.getUnitDisplayNontabbedPosY());
this.setSize(GUIP.getUnitDisplayNonTabbedSizeWidth(), GUIP.getUnitDisplayNonTabbedSizeHeight());
}

UIUtil.updateWindowBounds(this);
this.setResizable(true);
this.setFocusable(false);
this.setFocusableWindowState(false);

addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
GUIP.setUnitDisplayEnabled(false);
}
});

this.clientGUI = clientGUI;
}
//endregion Constructors

//region Getters/Setters
public UnitDisplay getUnitDisplay() {
return unitDisplay;
}

public void setUnitDisplay(final UnitDisplay unitDisplay) {
this.unitDisplay = unitDisplay;
@Override
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if ((e.getID() == WindowEvent.WINDOW_DEACTIVATED) || (e.getID() == WindowEvent.WINDOW_CLOSING)) {
if ((getSize().width * getSize().height) > 0) {
if (GUIP.getUnitDisplayStartTabbed()) {
GUIP.setUnitDisplayPosX(getLocation().x);
GUIP.setUnitDisplayPosY(getLocation().y);
GUIP.setUnitDisplaySizeWidth(getSize().width);
GUIP.setUnitDisplaySizeHeight(getSize().height);
} else {
GUIP.setUnitDisplayNontabbedPosX(getLocation().x);
GUIP.setUnitDisplayNontabbedPosY(getLocation().y);
GUIP.setUnitDisplayNonTabbedSizeWidth(getSize().width);
GUIP.setUnitDisplayNonTabbedSizeHeight(getSize().height);
clientGUI.getUnitDisplay().saveSplitterLoc();
}
}
}
}
//endregion Getters/Setters

/**
* In addition to the default Dialog processKeyEvent, this method
Expand Down
5 changes: 3 additions & 2 deletions megamek/src/megamek/client/ui/swing/AbstractPhaseDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ public void actionPerformed(ActionEvent e) {
if (isIgnoringEvents()) {
return;
}
if (clientgui.getClient().isMyTurn()
|| (clientgui.getClient().getGame().getTurn() == null)) {
if ((clientgui.getClient().isMyTurn())
|| (clientgui.getClient().getGame().getTurn() == null)
|| (clientgui.getClient().getGame().getPhase().isReport())) {
ready();
// When the turn is ended, we could miss a key release
// event
Expand Down
31 changes: 25 additions & 6 deletions megamek/src/megamek/client/ui/swing/ChatterBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,44 @@ public ChatterBox(ClientGUI clientgui) {
@Override
public void gamePlayerChat(GamePlayerChatEvent e) {
chatArea.append('\n' + e.getMessage());
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}
moveToEnd();
}

@Override
public void gamePlayerChange(GamePlayerChangeEvent e) {
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}
}

@Override
public void gameTurnChange(GameTurnChangeEvent e) {
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}
}

@Override
public void gamePhaseChange(GamePhaseChangeEvent e) {
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}
}

@Override
public void gameEntityNew(GameEntityNewEvent e) {
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}

if (PreferenceManager.getClientPreferences()
.getPrintEntityChange()) {
systemMessage(e.getNumberOfEntities() + " " + MSG_ENTITIESADDED);
Expand All @@ -90,7 +106,10 @@ public void gameEntityNew(GameEntityNewEvent e) {

@Override
public void gameEntityRemove(GameEntityRemoveEvent e) {
PlayerListDialog.refreshPlayerList(playerList, client);
PlayerListDialog pld = clientgui.getPlayerListDialog();
if (pld != null) {
pld.refreshPlayerList(playerList, client);
}
}

@Override
Expand Down
Loading