сделанная работа
This commit is contained in:
parent
702e485daa
commit
cece533ed5
@ -89,16 +89,9 @@ public class DrawningAbstractCompany extends JComponent {
|
|||||||
if (boat == null) {
|
if (boat == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
|
||||||
JFrame frame = new JFrame("Катамаран");
|
|
||||||
FormCatamaran formCatamaran = new FormCatamaran();
|
FormCatamaran formCatamaran = new FormCatamaran();
|
||||||
frame.setContentPane(formCatamaran.PanelWrapper);
|
formCatamaran.setDrawningBoat(boat);
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
formCatamaran.OpenFrame();
|
||||||
frame.setLocation(500, 200);
|
|
||||||
formCatamaran.setBoat(boat);
|
|
||||||
frame.pack();
|
|
||||||
frame.setSize(1000, 725);
|
|
||||||
frame.setVisible(true);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ public class DrawningBoat {
|
|||||||
protected Integer _startPosY;
|
protected Integer _startPosY;
|
||||||
private int _drawingBoatWidth = 107;
|
private int _drawingBoatWidth = 107;
|
||||||
private int _drawingBoatHeight = 80;
|
private int _drawingBoatHeight = 80;
|
||||||
public int GetPosX(){return _startPosX;}
|
public Integer GetPosX(){return _startPosX;}
|
||||||
public int GetPosY(){return _startPosY;}
|
public Integer GetPosY(){return _startPosY;}
|
||||||
public int GetWidth(){return _drawingBoatWidth;}
|
public int GetWidth(){return _drawingBoatWidth;}
|
||||||
public int GetHeight(){return _drawingBoatHeight;}
|
public int GetHeight(){return _drawingBoatHeight;}
|
||||||
public IDrawPaddles drawPaddles;
|
public IDrawPaddles drawPaddles;
|
||||||
|
71
ProjectCatamaran/src/Drawnings/DrawningFormCatamaran.java
Normal file
71
ProjectCatamaran/src/Drawnings/DrawningFormCatamaran.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package Drawnings;
|
||||||
|
|
||||||
|
import MovementStrategy.*;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class DrawningFormCatamaran extends JComponent {
|
||||||
|
DrawningBoat drawningBoat;
|
||||||
|
|
||||||
|
private int _pictureHeight = -1;
|
||||||
|
private int _pictureWidth = -1;
|
||||||
|
private AbstractStrategy _strategy;
|
||||||
|
public void setDrawningBoat(DrawningBoat drawningBoat) {
|
||||||
|
this.drawningBoat = drawningBoat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setPictureSize(int width, int height) {
|
||||||
|
if (drawningBoat.GetHeight() > height || drawningBoat.GetWidth() > width)
|
||||||
|
return false;
|
||||||
|
_pictureHeight = height;
|
||||||
|
_pictureWidth = width;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public void buttonStrategyStep(JComboBox<String> comboBox) {
|
||||||
|
if (drawningBoat == null)
|
||||||
|
return;
|
||||||
|
if (comboBox.isEnabled()) {
|
||||||
|
switch (comboBox.getSelectedIndex()) {
|
||||||
|
case 0:
|
||||||
|
_strategy = new MoveToCenter();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_strategy = new MoveToBorder();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
_strategy = null;
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (_strategy == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_strategy.SetData(new MoveableBoat(drawningBoat), _pictureWidth, _pictureHeight);
|
||||||
|
}
|
||||||
|
if (_strategy == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
comboBox.setEnabled(false);
|
||||||
|
_strategy.MakeStep();
|
||||||
|
if (_strategy.GetStatus() == StrategyStatus.Finish) {
|
||||||
|
comboBox.setEnabled(true);
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void MoveButtonsAction(MovementDirection direction) {
|
||||||
|
if (drawningBoat == null)
|
||||||
|
return;
|
||||||
|
drawningBoat.moveTransport(direction);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void paintComponent(Graphics g) {
|
||||||
|
super.paintComponent(g);
|
||||||
|
if (drawningBoat == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
drawningBoat.drawBoat(g);
|
||||||
|
}
|
||||||
|
}
|
@ -1,107 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="Forms.FormCatamaran">
|
|
||||||
<grid id="27dc6" binding="PanelWrapper" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<xy x="20" y="20" width="599" height="476"/>
|
|
||||||
</constraints>
|
|
||||||
<properties/>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<grid id="1ff9a" binding="PictureBox" layout-manager="GridLayoutManager" row-count="6" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
|
||||||
<margin top="0" left="0" bottom="0" right="0"/>
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<toolTipText value=""/>
|
|
||||||
</properties>
|
|
||||||
<border type="none"/>
|
|
||||||
<children>
|
|
||||||
<vspacer id="7b40c">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
|
||||||
<preferred-size width="88" height="14"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
</vspacer>
|
|
||||||
<hspacer id="e0b21">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
</hspacer>
|
|
||||||
<component id="fe25b" class="javax.swing.JButton" binding="buttonLeft">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<minimum-size width="30" height="30"/>
|
|
||||||
<preferred-size width="30" height="30"/>
|
|
||||||
<maximum-size width="30" height="30"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<icon value="30px_arrow_left.png"/>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="3eabd" class="javax.swing.JButton" binding="buttonStrategyStep">
|
|
||||||
<constraints>
|
|
||||||
<grid row="1" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<text value="Шаг"/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="86d84" class="javax.swing.JButton" binding="buttonRight">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<minimum-size width="30" height="30"/>
|
|
||||||
<preferred-size width="30" height="30"/>
|
|
||||||
<maximum-size width="30" height="30"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<icon value="30px_arrow_right.png"/>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="3dc0" class="javax.swing.JButton" binding="buttonDown">
|
|
||||||
<constraints>
|
|
||||||
<grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<minimum-size width="30" height="30"/>
|
|
||||||
<preferred-size width="30" height="30"/>
|
|
||||||
<maximum-size width="30" height="30"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<icon value="30px_arrow_down.png"/>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="ccb2a" class="javax.swing.JButton" binding="buttonUp">
|
|
||||||
<constraints>
|
|
||||||
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
|
||||||
<minimum-size width="30" height="30"/>
|
|
||||||
<preferred-size width="30" height="30"/>
|
|
||||||
<maximum-size width="30" height="30"/>
|
|
||||||
</grid>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<icon value="30px_arrow_up.png"/>
|
|
||||||
<text value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
<component id="988c8" class="javax.swing.JComboBox" binding="comboBoxStrategy">
|
|
||||||
<constraints>
|
|
||||||
<grid row="0" column="2" row-span="1" col-span="3" vsize-policy="0" hsize-policy="2" anchor="9" fill="1" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
|
||||||
<properties>
|
|
||||||
<actionCommand value=""/>
|
|
||||||
<doubleBuffered value="false"/>
|
|
||||||
<toolTipText value=""/>
|
|
||||||
</properties>
|
|
||||||
</component>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</children>
|
|
||||||
</grid>
|
|
||||||
</form>
|
|
@ -4,154 +4,110 @@ import Drawnings.*;
|
|||||||
import MovementStrategy.*;
|
import MovementStrategy.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FormCatamaran extends JFrame {
|
public class FormCatamaran extends JFrame {
|
||||||
protected DrawningBoat _drawningBoat;
|
final private JFrame JFrameCatamaran = new JFrame();
|
||||||
public JPanel PanelWrapper;
|
final private JButton buttonRight = new JButton(new ImageIcon("ProjectCatamaran\\Resources\\30px_arrow_right.png"));
|
||||||
private JPanel PictureBox;
|
final private JPanel RightPanel = new JPanel();
|
||||||
private JButton buttonRight;
|
final private JButton buttonDown = new JButton(new ImageIcon("ProjectCatamaran\\Resources\\30px_arrow_down.png"));
|
||||||
private JButton buttonDown;
|
final private JPanel DownPanel = new JPanel();
|
||||||
private JButton buttonLeft;
|
final private JButton buttonLeft = new JButton(new ImageIcon("ProjectCatamaran\\Resources\\30px_arrow_left.png"));
|
||||||
private JButton buttonUp;
|
final private JPanel LeftPanel = new JPanel();
|
||||||
private JComboBox comboBoxStrategy;
|
final private JButton buttonUp = new JButton(new ImageIcon("ProjectCatamaran\\Resources\\30px_arrow_up.png"));
|
||||||
private JButton buttonStrategyStep;
|
|
||||||
private AbstractStrategy _strategy;
|
|
||||||
|
|
||||||
private List<JComponent> controls;
|
final private JPanel UpPanel = new JPanel();
|
||||||
public FormCatamaran() {
|
final private String [] itemsComboBox = {
|
||||||
buttonUp.setName("buttonUp");
|
|
||||||
buttonDown.setName("buttonDown");
|
|
||||||
buttonLeft.setName("buttonLeft");
|
|
||||||
buttonRight.setName("buttonRight");
|
|
||||||
_strategy = null;
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
InitializeControlsRepaintList();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ActionListener buttonMoveClickedListener = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
String buttonName = ((JButton) e.getSource()).getName();
|
|
||||||
boolean result = false;
|
|
||||||
|
|
||||||
switch (buttonName) {
|
|
||||||
case "buttonUp": {
|
|
||||||
result = _drawningBoat.moveTransport(MovementDirection.Up);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "buttonDown": {
|
|
||||||
result = _drawningBoat.moveTransport(MovementDirection.Down);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "buttonLeft": {
|
|
||||||
result = _drawningBoat.moveTransport(MovementDirection.Left);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "buttonRight": {
|
|
||||||
result = _drawningBoat.moveTransport(MovementDirection.Right);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
if (result)
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
buttonRight.addActionListener(buttonMoveClickedListener);
|
|
||||||
buttonDown.addActionListener(buttonMoveClickedListener);
|
|
||||||
buttonLeft.addActionListener(buttonMoveClickedListener);
|
|
||||||
buttonUp.addActionListener(buttonMoveClickedListener);
|
|
||||||
|
|
||||||
String[] itemsComboBox = {
|
|
||||||
"К центру",
|
"К центру",
|
||||||
"К краю"
|
"К краю"
|
||||||
};
|
};
|
||||||
for (String item: itemsComboBox) {
|
final private JComboBox<String> comboBoxStrategy =new JComboBox<>(itemsComboBox);
|
||||||
comboBoxStrategy.addItem(item);
|
final private JButton buttonStrategyStep = new JButton("Шаг");
|
||||||
}
|
final private JPanel StrategyPanel = new JPanel(new BorderLayout());
|
||||||
buttonStrategyStep.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
if (_drawningBoat == null)
|
|
||||||
return;
|
|
||||||
if (comboBoxStrategy.isEnabled()) {
|
|
||||||
switch (comboBoxStrategy.getSelectedIndex()) {
|
|
||||||
case 0:
|
|
||||||
_strategy = new MoveToCenter();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
_strategy = new MoveToBorder();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
final private DrawningFormCatamaran form = new DrawningFormCatamaran();
|
||||||
_strategy = null;
|
public void setDrawningBoat(DrawningBoat boat) {form.setDrawningBoat(boat);}
|
||||||
break;
|
public void OpenFrame() {
|
||||||
|
JFrameCatamaran.setVisible(true);
|
||||||
|
Toolkit tolls = Toolkit.getDefaultToolkit();
|
||||||
|
Dimension dimension = tolls.getScreenSize();
|
||||||
|
JFrameCatamaran.setBounds(dimension.width / 2 - 250, dimension.height / 2 - 250,
|
||||||
|
970, 700);
|
||||||
|
JFrameCatamaran.setTitle("Катамаран");
|
||||||
|
|
||||||
|
comboBoxStrategy.setPreferredSize(new Dimension(100, 35));
|
||||||
|
buttonStrategyStep.setPreferredSize(new Dimension(100, 35));
|
||||||
|
StrategyPanel.setSize(100, 70);
|
||||||
|
StrategyPanel.add(comboBoxStrategy, BorderLayout.NORTH);
|
||||||
|
StrategyPanel.add(buttonStrategyStep, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
|
||||||
|
UpPanel.setSize(30, 30);
|
||||||
|
buttonUp.setPreferredSize(new Dimension(30, 30));
|
||||||
|
UpPanel.add(buttonUp, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
DownPanel.setSize(30, 30);
|
||||||
|
buttonDown.setPreferredSize(new Dimension(30, 30));
|
||||||
|
DownPanel.add(buttonDown, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
RightPanel.setSize(30, 30);
|
||||||
|
buttonRight.setPreferredSize(new Dimension(30, 30));
|
||||||
|
RightPanel.add(buttonRight, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
LeftPanel.setSize(30, 30);
|
||||||
|
buttonLeft.setPreferredSize(new Dimension(30, 30));
|
||||||
|
LeftPanel.add(buttonLeft, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
JFrameCatamaran.add(StrategyPanel);
|
||||||
|
JFrameCatamaran.add(UpPanel);
|
||||||
|
JFrameCatamaran.add(DownPanel);
|
||||||
|
JFrameCatamaran.add(RightPanel);
|
||||||
|
JFrameCatamaran.add(LeftPanel);
|
||||||
|
JFrameCatamaran.add(form);
|
||||||
|
|
||||||
|
JFrameCatamaran.addComponentListener(new ComponentAdapter() {
|
||||||
|
public void componentResized(ComponentEvent e) {
|
||||||
|
StrategyPanel.setLocation(JFrameCatamaran.getWidth() - 100, 0);
|
||||||
|
UpPanel.setLocation(JFrameCatamaran.getWidth() - 80, JFrameCatamaran.getHeight()-100);
|
||||||
|
DownPanel.setLocation(JFrameCatamaran.getWidth() - 80, JFrameCatamaran.getHeight()-70);
|
||||||
|
RightPanel.setLocation(JFrameCatamaran.getWidth() - 45, JFrameCatamaran.getHeight()-70);
|
||||||
|
LeftPanel.setLocation(JFrameCatamaran.getWidth() - 115, JFrameCatamaran.getHeight()-70);
|
||||||
|
|
||||||
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
|
JFrameCatamaran.repaint();
|
||||||
|
|
||||||
}
|
}
|
||||||
if (_strategy == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_strategy.SetData(new MoveableBoat(_drawningBoat), PictureBox.getWidth(), PictureBox.getHeight());
|
|
||||||
}
|
|
||||||
if (_strategy == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
comboBoxStrategy.setEnabled(false);
|
|
||||||
_strategy.MakeStep();
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
if (_strategy.GetStatus() == StrategyStatus.Finish) {
|
|
||||||
comboBoxStrategy.setEnabled(true);
|
|
||||||
_strategy = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw() {
|
buttonUp.addActionListener(e -> {
|
||||||
if (_drawningBoat == null)
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
return;
|
form.MoveButtonsAction(MovementDirection.Up);
|
||||||
if (PictureBox.getWidth() == 0 || PictureBox.getHeight() == 0) {
|
JFrameCatamaran.repaint();
|
||||||
return;
|
});
|
||||||
}
|
|
||||||
Graphics g = PictureBox.getGraphics();
|
|
||||||
g.setColor(PictureBox.getBackground());
|
|
||||||
g.fillRect(0,0, PictureBox.getWidth(), PictureBox.getHeight());
|
|
||||||
_drawningBoat.drawBoat(g);
|
|
||||||
|
|
||||||
RepaintControls();
|
buttonDown.addActionListener(e -> {
|
||||||
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
|
form.MoveButtonsAction(MovementDirection.Down);
|
||||||
|
JFrameCatamaran.repaint();
|
||||||
|
});
|
||||||
|
buttonLeft.addActionListener(e -> {
|
||||||
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
|
form.MoveButtonsAction(MovementDirection.Left);
|
||||||
|
JFrameCatamaran.repaint();
|
||||||
|
});
|
||||||
|
buttonRight.addActionListener(e -> {
|
||||||
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
|
form.MoveButtonsAction(MovementDirection.Right);
|
||||||
|
JFrameCatamaran.repaint();
|
||||||
|
});
|
||||||
|
buttonStrategyStep.addActionListener(e -> {
|
||||||
|
form.setPictureSize(JFrameCatamaran.getWidth(), JFrameCatamaran.getHeight());
|
||||||
|
form.buttonStrategyStep(comboBoxStrategy);
|
||||||
|
JFrameCatamaran.repaint();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
public void setBoat(DrawningBoat boat) {
|
|
||||||
_drawningBoat = boat;
|
|
||||||
_drawningBoat.setPictureSize(PictureBox.getWidth(), PictureBox.getHeight());
|
|
||||||
comboBoxStrategy.setEnabled(true);
|
|
||||||
_strategy = null;
|
|
||||||
PictureBox.repaint();
|
|
||||||
|
|
||||||
Draw();
|
|
||||||
|
|
||||||
}
|
|
||||||
private void RepaintControls() {
|
|
||||||
for (JComponent control : controls) {
|
|
||||||
control.repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeControlsRepaintList() {
|
|
||||||
controls = new LinkedList<>();
|
|
||||||
controls.add(buttonUp);
|
|
||||||
controls.add(buttonDown);
|
|
||||||
controls.add(buttonLeft);
|
|
||||||
controls.add(buttonRight);
|
|
||||||
controls.add(comboBoxStrategy);
|
|
||||||
controls.add(buttonStrategyStep);
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -8,8 +8,8 @@ public class MoveToBorder extends AbstractStrategy {
|
|||||||
if (objParams == null) {
|
if (objParams == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return objParams.RightBorder() + GetStep() >= FieldWidth - GetStep() &&
|
return objParams.RightBorder() + GetStep() >= FieldWidth &&
|
||||||
objParams.DownBorder() + GetStep() >= FieldHeight - GetStep();
|
objParams.DownBorder() + GetStep() >= FieldHeight;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void MoveToTarget()
|
protected void MoveToTarget()
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user