1
1
/*
2
- * MegaMek - Copyright (c) 2020-2023 - The MegaMek Team. All Rights Reserved.
2
+ * MegaMek - Copyright (c) 2020-2024 - The MegaMek Team. All Rights Reserved.
3
3
*
4
4
* This program is free software; you can redistribute it and/or modify it under
5
5
* the terms of the GNU General Public License as published by the Free Software
13
13
*/
14
14
package mekhq .gui ;
15
15
16
+ import megamek .common .util .ImageUtil ;
17
+ import megamek .logging .MMLogger ;
18
+ import mekhq .MekHQ ;
19
+ import mekhq .campaign .Campaign ;
20
+ import mekhq .campaign .force .Force ;
21
+ import mekhq .campaign .mission .ScenarioForceTemplate .ForceAlignment ;
22
+ import mekhq .campaign .stratcon .*;
23
+ import mekhq .campaign .stratcon .StratconBiomeManifest .ImageType ;
24
+ import mekhq .gui .stratcon .StratconScenarioWizard ;
25
+ import mekhq .gui .stratcon .TrackForceAssignmentUI ;
26
+
27
+ import javax .imageio .ImageIO ;
28
+ import javax .swing .*;
16
29
import java .awt .*;
17
30
import java .awt .event .ActionEvent ;
18
31
import java .awt .event .ActionListener ;
27
40
import java .util .HashMap ;
28
41
import java .util .Map ;
29
42
30
- import javax .imageio .ImageIO ;
31
- import javax .swing .JCheckBoxMenuItem ;
32
- import javax .swing .JLabel ;
33
- import javax .swing .JMenu ;
34
- import javax .swing .JMenuItem ;
35
- import javax .swing .JPanel ;
36
- import javax .swing .JPopupMenu ;
37
- import javax .swing .SwingUtilities ;
38
-
39
- import megamek .common .util .ImageUtil ;
40
- import megamek .logging .MMLogger ;
41
- import mekhq .MekHQ ;
42
- import mekhq .campaign .Campaign ;
43
- import mekhq .campaign .force .Force ;
44
- import mekhq .campaign .mission .ScenarioForceTemplate .ForceAlignment ;
45
- import mekhq .campaign .stratcon .StratconBiomeManifest ;
46
- import mekhq .campaign .stratcon .StratconBiomeManifest .ImageType ;
47
- import mekhq .campaign .stratcon .StratconCampaignState ;
48
- import mekhq .campaign .stratcon .StratconCoords ;
49
- import mekhq .campaign .stratcon .StratconFacility ;
50
- import mekhq .campaign .stratcon .StratconFacilityFactory ;
51
- import mekhq .campaign .stratcon .StratconRulesManager ;
52
- import mekhq .campaign .stratcon .StratconScenario ;
53
- import mekhq .campaign .stratcon .StratconTrackState ;
54
- import mekhq .gui .stratcon .StratconScenarioWizard ;
55
- import mekhq .gui .stratcon .TrackForceAssignmentUI ;
56
-
57
43
/**
58
44
* This panel handles AtB-Stratcon GUI interactions with a specific scenario
59
45
* track.
60
- *
46
+ *
61
47
* @author NickAragua
62
48
*/
63
49
public class StratconPanel extends JPanel implements ActionListener {
@@ -209,7 +195,7 @@ private void buildRightClickMenu(StratconCoords coords) {
209
195
rightClickMenu .addSeparator ();
210
196
211
197
menuItemGMReveal = new JMenuItem ();
212
- menuItemGMReveal .setText (currentTrack .isGmRevealed () ? "Hide Track " : "Reveal Track " );
198
+ menuItemGMReveal .setText (currentTrack .isGmRevealed () ? "Hide Sector " : "Reveal Sector " );
213
199
menuItemGMReveal .setActionCommand (RCLICK_COMMAND_REVEAL_TRACK );
214
200
menuItemGMReveal .addActionListener (this );
215
201
rightClickMenu .add (menuItemGMReveal );
@@ -329,7 +315,7 @@ private Polygon generateGraphHex() {
329
315
* The point of it is to draw all the hexes for the board.
330
316
* If it's a "dry run", we don't actually draw the hexes, we just pretend to
331
317
* until we "draw" one that encompasses the clicked point.
332
- *
318
+ *
333
319
* @param g2D - graphics object on which to draw
334
320
* @param drawHexType - whether to draw the hex backgrounds, hex outlines or a
335
321
* dry run for click detection
@@ -522,7 +508,7 @@ private BufferedImage getImage(String imageKey, ImageType imageType) {
522
508
try {
523
509
image = ImageIO .read (biomeImageFile );
524
510
} catch (Exception e ) {
525
- logger .error ("Unable to load image: " + imageName + " with ID '" + imageKey + "'" );
511
+ logger .error ("Unable to load image: " + imageName + " with ID '" + imageKey + '\'' );
526
512
return null ;
527
513
}
528
514
@@ -742,7 +728,7 @@ private void drawTextEffect(Graphics2D g2D, Shape marker, String text, StratconC
742
728
/**
743
729
* Returns the translation that we need to make to render the "next downward"
744
730
* hex.
745
- *
731
+ *
746
732
* @return Two dimensional array with the first element being the x vector and
747
733
* the second being the y vector
748
734
*/
@@ -754,14 +740,14 @@ private int[] getDownwardYVector() {
754
740
* Returns the translation that we need to make to move from the bottom of a
755
741
* column to the top of the next
756
742
* column to the right.
757
- *
743
+ *
758
744
* @param evenColumn Whether the column we're currently in is odd or even
759
745
* @return Two dimensional array with the first element being the x vector and
760
746
* the second being the y vector
761
747
*/
762
748
private int [] getRightAndUpVector (boolean evenColumn ) {
763
- int yRadius = ( int ) ( HEX_Y_RADIUS ) ;
764
- int xRadius = ( int ) ( HEX_X_RADIUS ) ;
749
+ int yRadius = HEX_Y_RADIUS ;
750
+ int xRadius = HEX_X_RADIUS ;
765
751
766
752
int yTranslation = currentTrack .getHeight () * yRadius * 2 ;
767
753
if (evenColumn ) {
@@ -777,7 +763,7 @@ private int[] getRightAndUpVector(boolean evenColumn) {
777
763
* Go to the origin of the hex board and reset the scaling.
778
764
*/
779
765
private void performInitialTransform (Graphics2D g2D ) {
780
- g2D .translate (0 , 0 + HEX_Y_RADIUS );
766
+ g2D .translate (0 , HEX_Y_RADIUS );
781
767
g2D .scale (scale , scale );
782
768
}
783
769
@@ -789,7 +775,7 @@ private void performInitialTransform(Graphics2D g2D) {
789
775
* for this class.
790
776
*
791
777
* Side effects: the dry run sets the boardState clicked hex coordinates.
792
- *
778
+ *
793
779
* @return Whether or not the clicked point was found on the hex board
794
780
*/
795
781
private boolean detectClickedHex () {
0 commit comments