Compare commits
29 Commits
master
...
zhouhao_br
Author | SHA1 | Date |
---|---|---|
![]() |
44d87863dd | |
![]() |
9c491cce5a | |
![]() |
9ed847689b | |
![]() |
8842b8e022 | |
![]() |
8ffa10f081 | |
![]() |
e227349b86 | |
![]() |
c2814171d7 | |
![]() |
3e3b1a3b61 | |
![]() |
6535d7a68c | |
![]() |
fee03c29a3 | |
![]() |
ba3fa230c7 | |
![]() |
1dd9d8f203 | |
![]() |
952f32f70a | |
![]() |
744a227181 | |
![]() |
de9067fb5a | |
![]() |
3a1168b886 | |
![]() |
75d297de4d | |
![]() |
a8fa9e2565 | |
![]() |
999cb13278 | |
![]() |
faaeaed173 | |
![]() |
b13522bf24 | |
![]() |
6becba7725 | |
![]() |
6da5fb7ebf | |
![]() |
27aaff2824 | |
![]() |
2789fa05ee | |
![]() |
c121136564 | |
![]() |
593270f371 | |
![]() |
85ddb39aaa | |
![]() |
1136dec32a |
|
@ -103,38 +103,38 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
*
|
||||
* @see #fieldWidth
|
||||
*/
|
||||
public int fieldWidth;
|
||||
public static final int fieldWidth;
|
||||
|
||||
/**
|
||||
* Contains the height of the battlefield.
|
||||
*
|
||||
* @see #fieldWidth
|
||||
*/
|
||||
public int fieldHeight;
|
||||
public static final int fieldHeight;
|
||||
|
||||
/**
|
||||
* Current number of other robots on the battle field.
|
||||
*/
|
||||
public int others;
|
||||
public static final int others;
|
||||
|
||||
/**
|
||||
* Current energy of this robot, where 100 means full energy and 0 means no energy (dead).
|
||||
*/
|
||||
public int energy;
|
||||
public static final int energy;
|
||||
|
||||
/**
|
||||
* Current horizontal location of this robot (in pixels).
|
||||
*
|
||||
* @see #robotY
|
||||
*/
|
||||
public int robotX;
|
||||
public static final int robotX;
|
||||
|
||||
/**
|
||||
* Current vertical location of this robot (in pixels).
|
||||
*
|
||||
* @see #robotX
|
||||
*/
|
||||
public int robotY;
|
||||
public static final int robotY;
|
||||
|
||||
/**
|
||||
* Current heading angle of this robot (in degrees).
|
||||
|
@ -147,7 +147,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnBackLeft(int, int)
|
||||
* @see #turnBackRight(int, int)
|
||||
*/
|
||||
public int heading;
|
||||
public static final int heading;
|
||||
|
||||
/**
|
||||
* Current gun heading angle of this robot (in degrees).
|
||||
|
@ -158,7 +158,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnGunTo(int)
|
||||
* @see #bearGunTo(int)
|
||||
*/
|
||||
public int gunHeading;
|
||||
public static final int gunHeading;
|
||||
|
||||
/**
|
||||
* Current gun heading angle of this robot compared to its body (in degrees).
|
||||
|
@ -169,7 +169,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #turnGunTo(int)
|
||||
* @see #bearGunTo(int)
|
||||
*/
|
||||
public int gunBearing;
|
||||
public static final int gunBearing;
|
||||
|
||||
/**
|
||||
* Flag specifying if the gun is ready to fire, i.e. gun heat <= 0.
|
||||
|
@ -179,7 +179,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #fire()
|
||||
* @see #fire(double)
|
||||
*/
|
||||
public boolean gunReady;
|
||||
public static final boolean gunReady;
|
||||
|
||||
/**
|
||||
* Current distance to the scanned nearest other robot (in pixels).
|
||||
|
@ -193,7 +193,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public int scannedDistance = -1;
|
||||
public static final int scannedDistance = -1;
|
||||
|
||||
/**
|
||||
* Current angle to the scanned nearest other robot (in degrees).
|
||||
|
@ -207,7 +207,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public int scannedAngle = -1;
|
||||
public static final int scannedAngle = -1;
|
||||
|
||||
/**
|
||||
* Current angle to the scanned nearest other robot (in degrees) compared to
|
||||
|
@ -222,7 +222,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedVelocity
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public int scannedBearing = -1;
|
||||
public static final int scannedBearing = -1;
|
||||
|
||||
/**
|
||||
* Current velocity of the scanned nearest other robot.
|
||||
|
@ -239,7 +239,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedEnergy
|
||||
* @see #scannedHeading
|
||||
*/
|
||||
public int scannedVelocity = -99;
|
||||
public static final int scannedVelocity = -99;
|
||||
|
||||
/**
|
||||
* Current heading of the scanned nearest other robot (in degrees).
|
||||
|
@ -253,7 +253,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedEnergy
|
||||
* @see #scannedVelocity
|
||||
*/
|
||||
public int scannedHeading = -1;
|
||||
public static final int scannedHeading = -1;
|
||||
|
||||
/**
|
||||
* Current energy of scanned nearest other robot.
|
||||
|
@ -266,7 +266,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #scannedBearing
|
||||
* @see #scannedVelocity
|
||||
*/
|
||||
public int scannedEnergy = -1;
|
||||
public static final int scannedEnergy = -1;
|
||||
|
||||
/**
|
||||
* Latest angle from where this robot was hit by a bullet (in degrees).
|
||||
|
@ -276,7 +276,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitByBullet()
|
||||
* @see #hitByBulletBearing
|
||||
*/
|
||||
public int hitByBulletAngle = -1;
|
||||
public static final int hitByBulletAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle from where this robot was hit by a bullet (in degrees)
|
||||
|
@ -287,7 +287,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitByBullet()
|
||||
* @see #hitByBulletAngle
|
||||
*/
|
||||
public int hitByBulletBearing = -1;
|
||||
public static final int hitByBulletBearing = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit another robot (in degrees).
|
||||
|
@ -297,7 +297,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitRobot()
|
||||
* @see #hitRobotBearing
|
||||
*/
|
||||
public int hitRobotAngle = -1;
|
||||
public static final int hitRobotAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit another robot (in degrees)
|
||||
|
@ -308,7 +308,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitRobot()
|
||||
* @see #hitRobotAngle
|
||||
*/
|
||||
public int hitRobotBearing = -1;
|
||||
public static final int hitRobotBearing = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit a wall (in degrees).
|
||||
|
@ -318,7 +318,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitWall()
|
||||
* @see #hitWallBearing
|
||||
*/
|
||||
public int hitWallAngle = -1;
|
||||
public static final int hitWallAngle = -1;
|
||||
|
||||
/**
|
||||
* Latest angle where this robot has hit a wall (in degrees)
|
||||
|
@ -329,7 +329,7 @@ public class JuniorRobot extends _RobotBase implements IJuniorRobot {
|
|||
* @see #onHitWall()
|
||||
* @see #hitWallAngle
|
||||
*/
|
||||
public int hitWallBearing = -1;
|
||||
public static final int hitWallBearing = -1;
|
||||
|
||||
/**
|
||||
* The robot event handler for this robot.
|
||||
|
|
|
@ -28,14 +28,6 @@ import java.awt.event.InputEvent;
|
|||
import java.awt.event.KeyEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Handles menu display and interaction for Robocode.
|
||||
*
|
||||
* @author Mathew A. Nelson (original)
|
||||
* @author Flemming N. Larsen (contributor)
|
||||
* @author Matthew Reeder (contributor)
|
||||
* @author Luis Crespo (contributor)
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class MenuBar extends JMenuBar {
|
||||
|
||||
|
|
|
@ -16,9 +16,7 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
/**
|
||||
* @author Flemming N. Larsen (original)
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PreferencesCommonOptionsTab extends WizardPanel {
|
||||
|
||||
|
|
|
@ -20,11 +20,6 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
/**
|
||||
* @author Mathew A. Nelson (original)
|
||||
* @author Flemming N. Larsen (contributor)
|
||||
* @author Ruben Moreno Montoliu (contributor)
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class PreferencesDevelopmentOptionsTab extends WizardPanel {
|
||||
|
||||
|
|
|
@ -17,11 +17,7 @@ import java.awt.*;
|
|||
import java.awt.event.KeyEvent;
|
||||
|
||||
|
||||
/**
|
||||
* @author Mathew A. Nelson (original)
|
||||
* @author Flemming N. Larsen (contributor)
|
||||
* @author Matthew Reeder (contributor)
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PreferencesDialog extends JDialog implements WizardListener {
|
||||
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
/**
|
||||
* Copyright (c) 2001-2016 Mathew A. Nelson and Robocode contributors
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://robocode.sourceforge.net/license/epl-v10.html
|
||||
*/
|
||||
|
||||
package net.sf.robocode.ui.dialog;
|
||||
|
||||
|
||||
|
@ -19,11 +13,7 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
|
||||
|
||||
/**
|
||||
* @author Mathew A. Nelson (original)
|
||||
* @author Flemming N. Larsen (contributor)
|
||||
* @author Matthew Reeder (contributor)
|
||||
*/
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class PreferencesViewOptionsTab extends WizardPanel {
|
||||
|
||||
|
@ -36,7 +26,7 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
|
||||
private JCheckBox visibleRobotEnergyCheckBox;
|
||||
private JCheckBox visibleRobotNameCheckBox;
|
||||
private JCheckBox visibleScanArcsCheckBox;
|
||||
private JCheckBox visibleScanArcsCheckBox; //
|
||||
private JCheckBox visibleExplosionsCheckBox;
|
||||
private JCheckBox visibleGroundCheckBox;
|
||||
private JCheckBox visibleExplosionDebrisCheckBox;
|
||||
|
@ -67,19 +57,32 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
public void actionPerformed(ActionEvent e) {
|
||||
Object src = e.getSource();
|
||||
|
||||
if (src == enableAllViewOptionsButton) {
|
||||
if (src == enableAllViewOptionsButton)
|
||||
{
|
||||
setAllViewOptionsButtonsEnabled(true);
|
||||
} else if (src == disableAllViewOptionsButton) {
|
||||
}
|
||||
else if (src == disableAllViewOptionsButton)
|
||||
{
|
||||
setAllViewOptionsButtonsEnabled(false);
|
||||
} else if (src == defaultViewOptionsButton) {
|
||||
}
|
||||
else if (src == defaultViewOptionsButton)
|
||||
{
|
||||
defaultViewOptionsButtonActionPerformed();
|
||||
} else if (src == defaultTpsButton) {
|
||||
}
|
||||
else if (src == defaultTpsButton)
|
||||
{
|
||||
defaultTpsButtonActionPerformed();
|
||||
} else if (src == minTpsButton) {
|
||||
}
|
||||
else if (src == minTpsButton)
|
||||
{
|
||||
minTpsButtonActionPerformed();
|
||||
} else if (src == fastTpsButton) {
|
||||
}
|
||||
else if (src == fastTpsButton)
|
||||
{
|
||||
fastTpsButtonActionPerformed();
|
||||
} else if (src == maxTpsButton) {
|
||||
}
|
||||
else if (src == maxTpsButton)
|
||||
{
|
||||
maxTpsButtonActionPerformed();
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +106,8 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
initialize();
|
||||
}
|
||||
|
||||
|
||||
//设置默认的设置
|
||||
private void defaultViewOptionsButtonActionPerformed() {
|
||||
setAllViewOptionsButtonsEnabled(true);
|
||||
getVisibleScanArcsCheckBox().setSelected(false);
|
||||
|
@ -326,12 +331,13 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
c.weightx = 1;
|
||||
|
||||
visibleOptionsPanel.add(getVisibleRobotEnergyCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleRobotNameCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleScanArcsCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleExplosionsCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleGroundCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleExplosionDebrisCheckBox(), c);
|
||||
visibleOptionsPanel.add(getVisibleSentryBorderCheckBox(), c);
|
||||
//将扫描线复选框添加到嵌入板中
|
||||
visibleOptionsPanel.add(getVisibleRobotNameCheckBox(), c);
|
||||
|
||||
c.insets = new Insets(10, 0, 0, 10);
|
||||
c.gridwidth = 1;
|
||||
|
@ -430,7 +436,6 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
getDisplayTpsCheckBox().setSelected(robocodeProperties.getOptionsViewTPS());
|
||||
getVisibleRobotNameCheckBox().setSelected(robocodeProperties.getOptionsViewRobotNames());
|
||||
getVisibleRobotEnergyCheckBox().setSelected(robocodeProperties.getOptionsViewRobotEnergy());
|
||||
getVisibleScanArcsCheckBox().setSelected(robocodeProperties.getOptionsViewScanArcs());
|
||||
getVisibleExplosionsCheckBox().setSelected(robocodeProperties.getOptionsViewExplosions());
|
||||
getVisibleGroundCheckBox().setSelected(robocodeProperties.getOptionsViewGround());
|
||||
getVisibleExplosionDebrisCheckBox().setSelected(robocodeProperties.getOptionsViewExplosionDebris());
|
||||
|
@ -438,6 +443,9 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
getDesiredTpsTextField().setText("" + robocodeProperties.getOptionsBattleDesiredTPS());
|
||||
getPreventSpeedupWhenMinimizedCheckBox().setSelected(
|
||||
robocodeProperties.getOptionsViewPreventSpeedupWhenMinimized());
|
||||
|
||||
//根据传入的参数设置扫描线是否可见
|
||||
getVisibleScanArcsCheckBox().setSelected(robocodeProperties.getOptionsViewScanArcs());
|
||||
}
|
||||
|
||||
public void storePreferences() {
|
||||
|
@ -447,13 +455,15 @@ public class PreferencesViewOptionsTab extends WizardPanel {
|
|||
props.setOptionsViewTPS(getDisplayTpsCheckBox().isSelected());
|
||||
props.setOptionsViewRobotNames(getVisibleRobotNameCheckBox().isSelected());
|
||||
props.setOptionsViewRobotEnergy(getVisibleRobotEnergyCheckBox().isSelected());
|
||||
props.setOptionsViewScanArcs(getVisibleScanArcsCheckBox().isSelected());
|
||||
props.setOptionsViewExplosions(getVisibleExplosionsCheckBox().isSelected());
|
||||
props.setOptionsViewGround(getVisibleGroundCheckBox().isSelected());
|
||||
props.setOptionsViewExplosionDebris(getVisibleExplosionDebrisCheckBox().isSelected());
|
||||
props.setOptionsViewSentryBorder(getVisibleSentryBorderCheckBox().isSelected());
|
||||
props.setOptionsBattleDesiredTPS(Integer.parseInt(getDesiredTpsTextField().getText()));
|
||||
props.setOptionsViewPreventSpeedupWhenMinimized(getPreventSpeedupWhenMinimizedCheckBox().isSelected());
|
||||
//根据参数设置扫描线是否可见
|
||||
props.setOptionsViewScanArcs(getVisibleScanArcsCheckBox().isSelected());
|
||||
////////////////////
|
||||
properties.saveProperties();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package net.sf.robocode.ui.dialog;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class PreferencesViewOptionsTabTest {
|
||||
|
||||
private static PreferencesViewOptionsTab preferencesViewOptionsTab = new PreferencesViewOptionsTab(null);
|
||||
|
||||
@Test
|
||||
public void testDefaultViewOptionsButtonActionPerformed() {
|
||||
preferencesViewOptionsTab.defaultViewOptionsButtonActionPerformed();
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleExplosionDebrisCheckBox());
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleExplosionsCheckBox());
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleGroundCheckBox());
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleRobotEnergyCheckBox());
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleRobotNameCheckBox());
|
||||
assertEquals(true, preferencesViewOptionsTab.getVisibleSentryBorderCheckBox());
|
||||
assertEquals(false, preferencesViewOptionsTab.getVisibleScanArcsCheckBox());
|
||||
}
|
||||
|
||||
}
|
|
@ -108,15 +108,13 @@ public class TeamCreatorOptionsPanel extends WizardPanel {
|
|||
getWebpageField().setText(u.toString());
|
||||
}
|
||||
|
||||
getVersionLabel().setVisible(true);
|
||||
getVersionField().setVisible(true);
|
||||
getAuthorLabel().setVisible(true);
|
||||
getAuthorField().setVisible(true);
|
||||
getWebpageLabel().setVisible(true);
|
||||
getWebpageField().setVisible(true);
|
||||
getVersionLabel().setVisible(true);//设置版本标签可见
|
||||
getVersionField().setVisible(true);//设置版本文本框可见
|
||||
getAuthorLabel().setVisible(true);//设置作者标签可见
|
||||
getAuthorField().setVisible(true);//设置作者文本框可见
|
||||
getWebpageHelpLabel().setVisible(true);
|
||||
getDescriptionLabel().setText(
|
||||
"Please enter a short description of this team (up to 3 lines of 72 chars each).");
|
||||
"请输入一段简短的描述.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 609 KiB After Width: | Height: | Size: 42 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue