Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
a89f92cdc3 | |||
9a12da874a | |||
055a2f3bda |
25
ProjectWarmlyShip/ProjectWarmlyShip.sln
Normal file
25
ProjectWarmlyShip/ProjectWarmlyShip.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33627.172
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProjectWarmlyShip", "ProjectWarmlyShip\ProjectWarmlyShip.csproj", "{D1F03A6D-14AA-406C-94BB-CB5E055E7830}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D1F03A6D-14AA-406C-94BB-CB5E055E7830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D1F03A6D-14AA-406C-94BB-CB5E055E7830}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D1F03A6D-14AA-406C-94BB-CB5E055E7830}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D1F03A6D-14AA-406C-94BB-CB5E055E7830}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {47092368-4841-45BC-8FA6-9653B7B37C6E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
74
ProjectWarmlyShip/ProjectWarmlyShip/AbstractStrategy.cs
Normal file
74
ProjectWarmlyShip/ProjectWarmlyShip/AbstractStrategy.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectWarmlyShip.DrawingObjects;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
private IMoveableObject? _movebleObject;
|
||||
private Status _state = Status.NotInit;
|
||||
protected int FieldWidth { get; private set; }
|
||||
protected int FieldHeight { get; private set; }
|
||||
public Status GetStatus() { return _state; }
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = Status.NotInit;
|
||||
return;
|
||||
}
|
||||
_state = Status.InProgress;
|
||||
_movebleObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (IsTargetDestination())
|
||||
{
|
||||
_state = Status.Finish;
|
||||
return;
|
||||
}
|
||||
MoveToTarget();
|
||||
}
|
||||
protected bool MoveLeft() => MoveTo(DirectionType.Left);
|
||||
protected bool MoveRight() => MoveTo(DirectionType.Right);
|
||||
protected bool MoveUp() => MoveTo(DirectionType.Up);
|
||||
protected bool MoveDown() => MoveTo(DirectionType.Down);
|
||||
|
||||
protected ObjectParametrs? GetObjectParametrs => _movebleObject?.GetObjectPosition;
|
||||
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _movebleObject?.GetStep;
|
||||
}
|
||||
protected abstract void MoveToTarget();
|
||||
protected abstract bool IsTargetDestination();
|
||||
private bool MoveTo(DirectionType directionType)
|
||||
{
|
||||
if (_state != Status.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_movebleObject?.CheckCanMove(directionType) ?? false)
|
||||
{
|
||||
_movebleObject.MoveObject(directionType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
16
ProjectWarmlyShip/ProjectWarmlyShip/DirectionType.cs
Normal file
16
ProjectWarmlyShip/ProjectWarmlyShip/DirectionType.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip
|
||||
{
|
||||
public enum DirectionType
|
||||
{
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
Right = 4,
|
||||
}
|
||||
}
|
36
ProjectWarmlyShip/ProjectWarmlyShip/DrawingObjectShip.cs
Normal file
36
ProjectWarmlyShip/ProjectWarmlyShip/DrawingObjectShip.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectWarmlyShip.DrawingObjects;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public class DrawingObjectShip : IMoveableObject
|
||||
{
|
||||
private readonly DrawingShip? _drawingShip = null;
|
||||
public DrawingObjectShip(DrawingShip drawingShip)
|
||||
{
|
||||
_drawingShip = drawingShip;
|
||||
}
|
||||
public ObjectParametrs? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_drawingShip == null || _drawingShip.EntityShip == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParametrs(_drawingShip.GetPosX,
|
||||
_drawingShip.GetPosY, _drawingShip.GetWidth,
|
||||
_drawingShip.GetHeight);
|
||||
}
|
||||
}
|
||||
public int GetStep => (int)(_drawingShip?.EntityShip?.Step ?? 0);
|
||||
public bool CheckCanMove(DirectionType direction) =>
|
||||
_drawingShip?.CanMove(direction) ?? false;
|
||||
public void MoveObject(DirectionType direction) =>
|
||||
_drawingShip?.MoveTransport(direction);
|
||||
}
|
||||
}
|
132
ProjectWarmlyShip/ProjectWarmlyShip/DrawingShip.cs
Normal file
132
ProjectWarmlyShip/ProjectWarmlyShip/DrawingShip.cs
Normal file
@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectWarmlyShip.Entities;
|
||||
|
||||
namespace ProjectWarmlyShip.DrawingObjects
|
||||
{
|
||||
public class DrawingShip
|
||||
{
|
||||
public EntityShip? EntityShip { get; protected set; }
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
protected int _startPosX;
|
||||
protected int _startPosY;
|
||||
protected readonly int _shipWidth = 100;
|
||||
protected readonly int _shipHeight = 30;
|
||||
|
||||
public DrawingShip(int speed, double weight, Color mainColor, int width, int heigth)
|
||||
{
|
||||
if (width <= _shipWidth || heigth <= _shipHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = heigth;
|
||||
EntityShip = new EntityShip(speed, weight, mainColor);
|
||||
}
|
||||
protected DrawingShip(int speed, double weight,
|
||||
Color mainColor, int width, int heigth,
|
||||
int shipWidth, int shipHeight)
|
||||
{
|
||||
if (width <= shipWidth || heigth <= shipHeight)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_pictureHeight = heigth;
|
||||
_pictureWidth = width;
|
||||
_shipHeight = shipHeight;
|
||||
_shipWidth = shipWidth;
|
||||
EntityShip = new EntityShip(speed, weight, mainColor);
|
||||
}
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (x < 0 || y < 0 || x + _shipWidth > _pictureWidth || y + _shipHeight > _pictureHeight)
|
||||
{
|
||||
x = 10;
|
||||
y = 10;
|
||||
}
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
public int GetPosX => _startPosX;
|
||||
public int GetPosY => _startPosY;
|
||||
public int GetWidth => _shipWidth;
|
||||
public int GetHeight => _shipHeight;
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityShip == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
DirectionType.Left => _startPosX - EntityShip.Step > 0,
|
||||
DirectionType.Up => _startPosY - EntityShip.Step > 0,
|
||||
DirectionType.Right => _startPosX + EntityShip.Step + _shipWidth <= _pictureWidth,
|
||||
DirectionType.Down => _startPosY + EntityShip.Step + _shipHeight <= _pictureHeight,
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
||||
public void MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
case DirectionType.Left:
|
||||
_startPosX -= (int)EntityShip.Step;
|
||||
break;
|
||||
case DirectionType.Up:
|
||||
_startPosY -= (int)EntityShip.Step;
|
||||
break;
|
||||
case DirectionType.Right:
|
||||
_startPosX += (int)EntityShip.Step;
|
||||
break;
|
||||
case DirectionType.Down:
|
||||
_startPosY += (int)EntityShip.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public virtual void DrawTrasport(Graphics g)
|
||||
{
|
||||
if (EntityShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush mainBrush = new SolidBrush(EntityShip.MainColor);
|
||||
//палуба
|
||||
g.FillRectangle(mainBrush, _startPosX + 30, _startPosY, 60, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 30, _startPosY, 60, 10);
|
||||
//корпус
|
||||
g.FillPolygon(mainBrush, new Point[]
|
||||
{
|
||||
new Point(_startPosX, _startPosY + 10),
|
||||
new Point(_startPosX + 100, _startPosY + 10),
|
||||
new Point(_startPosX + 90, _startPosY + 30),
|
||||
new Point(_startPosX + 20, _startPosY + 30),
|
||||
new Point(_startPosX, _startPosY + 10),
|
||||
}
|
||||
);
|
||||
g.DrawPolygon(pen, new Point[]
|
||||
{
|
||||
new Point(_startPosX, _startPosY + 10),
|
||||
new Point(_startPosX + 100, _startPosY + 10),
|
||||
new Point(_startPosX + 90, _startPosY + 30),
|
||||
new Point(_startPosX + 20, _startPosY + 30),
|
||||
new Point(_startPosX, _startPosY + 10),
|
||||
}
|
||||
);
|
||||
//якорь
|
||||
g.DrawLine(pen, _startPosX + 25, _startPosY + 15, _startPosX + 25, _startPosY + 25);
|
||||
g.DrawLine(pen, _startPosX + 20, _startPosY + 20, _startPosX + 30, _startPosY + 20);
|
||||
g.DrawLine(pen, _startPosX + 23, _startPosY + 25, _startPosX + 27, _startPosY + 25);
|
||||
}
|
||||
}
|
||||
}
|
48
ProjectWarmlyShip/ProjectWarmlyShip/DrawingWarmlyShip.cs
Normal file
48
ProjectWarmlyShip/ProjectWarmlyShip/DrawingWarmlyShip.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectWarmlyShip.Entities;
|
||||
|
||||
namespace ProjectWarmlyShip.DrawingObjects
|
||||
{
|
||||
public class DrawingWarmlyShip : DrawingShip
|
||||
{
|
||||
public DrawingWarmlyShip(int speed, double weight,
|
||||
Color mainColor, Color optionalColor, bool pipes,
|
||||
bool fuelCompartment, int width, int height) :
|
||||
base(speed, weight, mainColor, width, height, 100, 60)
|
||||
{
|
||||
if (EntityShip != null)
|
||||
{
|
||||
EntityShip = new EntityWarmlyShip(speed, weight, mainColor,
|
||||
optionalColor, pipes, fuelCompartment);
|
||||
}
|
||||
}
|
||||
public override void DrawTrasport(Graphics g)
|
||||
{
|
||||
if (EntityShip is not EntityWarmlyShip warmlyShip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush optionalBrush = new SolidBrush(warmlyShip.OptionalColor);
|
||||
if (warmlyShip.Pipes)
|
||||
{
|
||||
g.FillRectangle(optionalBrush, _startPosX + 70, _startPosY, 10, 30);
|
||||
g.FillRectangle(optionalBrush, _startPosX + 50, _startPosY + 10, 10, 20);
|
||||
g.DrawRectangle(pen, _startPosX + 50, _startPosY + 10, 10, 20);
|
||||
g.DrawRectangle(pen, _startPosX + 70, _startPosY, 10, 30);
|
||||
}
|
||||
if (warmlyShip.FuelCompartment)
|
||||
{
|
||||
g.FillRectangle(optionalBrush, _startPosX + 10, _startPosY + 30, 10, 10);
|
||||
g.DrawRectangle(pen, _startPosX + 10, _startPosY + 30, 10, 10);
|
||||
}
|
||||
_startPosY += 30;
|
||||
base.DrawTrasport(g);
|
||||
_startPosY -= 30;
|
||||
}
|
||||
}
|
||||
}
|
22
ProjectWarmlyShip/ProjectWarmlyShip/EntityShip.cs
Normal file
22
ProjectWarmlyShip/ProjectWarmlyShip/EntityShip.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.Entities
|
||||
{
|
||||
public class EntityShip
|
||||
{
|
||||
public int Speed { get; private set; }
|
||||
public double Weight { get; private set; }
|
||||
public Color MainColor { get; private set; }
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
public EntityShip(int speed, double weight, Color mainColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
MainColor = mainColor;
|
||||
}
|
||||
}
|
||||
}
|
23
ProjectWarmlyShip/ProjectWarmlyShip/EntityWarmlyShip.cs
Normal file
23
ProjectWarmlyShip/ProjectWarmlyShip/EntityWarmlyShip.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.Entities
|
||||
{
|
||||
public class EntityWarmlyShip : EntityShip
|
||||
{
|
||||
public Color OptionalColor { get; private set; }
|
||||
public bool Pipes { get; private set; }
|
||||
public bool FuelCompartment { get; private set; }
|
||||
public EntityWarmlyShip(int speed, double weight,
|
||||
Color mainColor, Color optionalColor,
|
||||
bool pipes, bool fuelCompartment) : base(speed, weight, mainColor)
|
||||
{
|
||||
OptionalColor = optionalColor;
|
||||
Pipes = pipes;
|
||||
FuelCompartment = fuelCompartment;
|
||||
}
|
||||
}
|
||||
}
|
178
ProjectWarmlyShip/ProjectWarmlyShip/Frame.Designer.cs
generated
Normal file
178
ProjectWarmlyShip/ProjectWarmlyShip/Frame.Designer.cs
generated
Normal file
@ -0,0 +1,178 @@
|
||||
namespace ProjectWarmlyShip
|
||||
{
|
||||
partial class WarmlyShipForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxWarmlyShip = new PictureBox();
|
||||
buttonCreate = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonRight = new Button();
|
||||
button1 = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyShip).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// pictureBoxWarmlyShip
|
||||
//
|
||||
pictureBoxWarmlyShip.Dock = DockStyle.Fill;
|
||||
pictureBoxWarmlyShip.Location = new Point(0, 0);
|
||||
pictureBoxWarmlyShip.Name = "pictureBoxWarmlyShip";
|
||||
pictureBoxWarmlyShip.Size = new Size(884, 461);
|
||||
pictureBoxWarmlyShip.SizeMode = PictureBoxSizeMode.AutoSize;
|
||||
pictureBoxWarmlyShip.TabIndex = 0;
|
||||
pictureBoxWarmlyShip.TabStop = false;
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreate.Location = new Point(12, 426);
|
||||
buttonCreate.Name = "buttonCreate";
|
||||
buttonCreate.Size = new Size(75, 23);
|
||||
buttonCreate.TabIndex = 1;
|
||||
buttonCreate.Text = "Create Ship";
|
||||
buttonCreate.UseVisualStyleBackColor = true;
|
||||
buttonCreate.Click += ButtonCreateShip_Click;
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonUp.BackgroundImage = Properties.Resources.ArrowUp;
|
||||
buttonUp.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonUp.Location = new Point(806, 383);
|
||||
buttonUp.Name = "buttonUp";
|
||||
buttonUp.Size = new Size(30, 30);
|
||||
buttonUp.TabIndex = 2;
|
||||
buttonUp.UseVisualStyleBackColor = true;
|
||||
buttonUp.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonDown.BackgroundImage = Properties.Resources.ArrowDown;
|
||||
buttonDown.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonDown.Location = new Point(806, 419);
|
||||
buttonDown.Name = "buttonDown";
|
||||
buttonDown.Size = new Size(30, 30);
|
||||
buttonDown.TabIndex = 3;
|
||||
buttonDown.UseVisualStyleBackColor = true;
|
||||
buttonDown.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonLeft.BackgroundImage = Properties.Resources.ArrowLeft;
|
||||
buttonLeft.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonLeft.Location = new Point(770, 419);
|
||||
buttonLeft.Name = "buttonLeft";
|
||||
buttonLeft.Size = new Size(30, 30);
|
||||
buttonLeft.TabIndex = 4;
|
||||
buttonLeft.UseVisualStyleBackColor = true;
|
||||
buttonLeft.Click += buttonMove_Click;
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
buttonRight.BackgroundImage = Properties.Resources.ArrowRight;
|
||||
buttonRight.BackgroundImageLayout = ImageLayout.Zoom;
|
||||
buttonRight.Location = new Point(842, 419);
|
||||
buttonRight.Name = "buttonRight";
|
||||
buttonRight.Size = new Size(30, 30);
|
||||
buttonRight.TabIndex = 5;
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += buttonMove_Click;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
button1.Location = new Point(93, 426);
|
||||
button1.Name = "button1";
|
||||
button1.Size = new Size(120, 23);
|
||||
button1.TabIndex = 6;
|
||||
button1.Text = "Create Warmly Ship";
|
||||
button1.UseVisualStyleBackColor = true;
|
||||
button1.Click += ButtonCreateWarmlyShip_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "Move to center", "Move to border" });
|
||||
comboBoxStrategy.Location = new Point(751, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(121, 23);
|
||||
comboBoxStrategy.TabIndex = 7;
|
||||
//
|
||||
// buttonStep
|
||||
//
|
||||
buttonStep.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
buttonStep.Location = new Point(797, 41);
|
||||
buttonStep.Name = "buttonStep";
|
||||
buttonStep.Size = new Size(75, 23);
|
||||
buttonStep.TabIndex = 8;
|
||||
buttonStep.Text = "Step";
|
||||
buttonStep.UseVisualStyleBackColor = true;
|
||||
buttonStep.Click += ButtonStep_Click;
|
||||
//
|
||||
// WarmlyShipForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(884, 461);
|
||||
Controls.Add(buttonStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonCreate);
|
||||
Controls.Add(pictureBoxWarmlyShip);
|
||||
Name = "WarmlyShipForm";
|
||||
StartPosition = FormStartPosition.CenterScreen;
|
||||
Text = "WarmlyShip";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxWarmlyShip).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxWarmlyShip;
|
||||
private Button buttonCreate;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonLeft;
|
||||
private Button buttonRight;
|
||||
private Button button1;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStep;
|
||||
}
|
||||
}
|
114
ProjectWarmlyShip/ProjectWarmlyShip/Frame.cs
Normal file
114
ProjectWarmlyShip/ProjectWarmlyShip/Frame.cs
Normal file
@ -0,0 +1,114 @@
|
||||
using ProjectWarmlyShip.DrawingObjects;
|
||||
using ProjectWarmlyShip.MovementStrategy;
|
||||
|
||||
namespace ProjectWarmlyShip
|
||||
{
|
||||
public partial class WarmlyShipForm : Form
|
||||
{
|
||||
private DrawingShip? _drawingShip;
|
||||
private AbstractStrategy? _abstractStrategy;
|
||||
public WarmlyShipForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawingShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Bitmap bmp = new(pictureBoxWarmlyShip.Width,
|
||||
pictureBoxWarmlyShip.Height);
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
_drawingShip.DrawTrasport(gr);
|
||||
pictureBoxWarmlyShip.Image = bmp;
|
||||
}
|
||||
private void ButtonCreateWarmlyShip_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_drawingShip = new DrawingWarmlyShip(
|
||||
random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
Convert.ToBoolean(random.Next(0, 2)),
|
||||
pictureBoxWarmlyShip.Width,
|
||||
pictureBoxWarmlyShip.Height);
|
||||
_drawingShip.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void ButtonCreateShip_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
_drawingShip = new DrawingShip(
|
||||
random.Next(100, 300),
|
||||
random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
pictureBoxWarmlyShip.Width,
|
||||
pictureBoxWarmlyShip.Height);
|
||||
_drawingShip.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
}
|
||||
private void buttonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
_drawingShip.MoveTransport(DirectionType.Up);
|
||||
break;
|
||||
case "buttonDown":
|
||||
_drawingShip.MoveTransport(DirectionType.Down);
|
||||
break;
|
||||
case "buttonLeft":
|
||||
_drawingShip.MoveTransport(DirectionType.Left);
|
||||
break;
|
||||
case "buttonRight":
|
||||
_drawingShip.MoveTransport(DirectionType.Right);
|
||||
break;
|
||||
}
|
||||
Draw();
|
||||
}
|
||||
private void ButtonStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawingShip == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_abstractStrategy = comboBoxStrategy.SelectedIndex
|
||||
switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToBorder(),
|
||||
_ => null,
|
||||
};
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.SetData(
|
||||
new DrawingObjectShip(_drawingShip),
|
||||
pictureBoxWarmlyShip.Width,
|
||||
pictureBoxWarmlyShip.Height);
|
||||
comboBoxStrategy.Enabled = false;
|
||||
}
|
||||
if (_abstractStrategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_abstractStrategy.MakeStep();
|
||||
Draw();
|
||||
if (_abstractStrategy.GetStatus() == Status.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_abstractStrategy = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
ProjectWarmlyShip/ProjectWarmlyShip/Frame.resx
Normal file
60
ProjectWarmlyShip/ProjectWarmlyShip/Frame.resx
Normal file
@ -0,0 +1,60 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
17
ProjectWarmlyShip/ProjectWarmlyShip/IMoveableObject.cs
Normal file
17
ProjectWarmlyShip/ProjectWarmlyShip/IMoveableObject.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ProjectWarmlyShip.DrawingObjects;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public interface IMoveableObject
|
||||
{
|
||||
ObjectParametrs? GetObjectPosition { get; }
|
||||
int GetStep { get; }
|
||||
bool CheckCanMove(DirectionType direction);
|
||||
void MoveObject(DirectionType direction);
|
||||
}
|
||||
}
|
42
ProjectWarmlyShip/ProjectWarmlyShip/MoveToBorder.cs
Normal file
42
ProjectWarmlyShip/ProjectWarmlyShip/MoveToBorder.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
internal class MoveToBorder : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
var objParams = GetObjectParametrs;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.RightBorder <= FieldWidth &&
|
||||
objParams.RightBorder + GetStep() >= FieldWidth &&
|
||||
objParams.DownBorder <= FieldHeight &&
|
||||
objParams.DownBorder + GetStep() >= FieldHeight;
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParametrs;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.RightBorder - FieldWidth;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
var diffY = objParams.DownBorder - FieldHeight;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
ProjectWarmlyShip/ProjectWarmlyShip/MoveToCenter.cs
Normal file
56
ProjectWarmlyShip/ProjectWarmlyShip/MoveToCenter.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestination()
|
||||
{
|
||||
var objParams = GetObjectParametrs;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return
|
||||
Math.Abs(objParams.ObjectMiddleHorizontal - FieldWidth / 2) <= GetStep()
|
||||
&&
|
||||
Math.Abs(objParams.ObjectMiddleVertical - FieldHeight / 2) <= GetStep();
|
||||
}
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
var objParams = GetObjectParametrs;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
var diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
ProjectWarmlyShip/ProjectWarmlyShip/ObjectParametrs.cs
Normal file
29
ProjectWarmlyShip/ProjectWarmlyShip/ObjectParametrs.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public class ObjectParametrs
|
||||
{
|
||||
private readonly int _x;
|
||||
private readonly int _y;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
public int LeftBorder => _x;
|
||||
public int TopBorder => _y;
|
||||
public int RightBorder => _x + _width;
|
||||
public int DownBorder => _y + _height;
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
public ObjectParametrs(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
}
|
17
ProjectWarmlyShip/ProjectWarmlyShip/Program.cs
Normal file
17
ProjectWarmlyShip/ProjectWarmlyShip/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
namespace ProjectWarmlyShip
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new WarmlyShipForm());
|
||||
}
|
||||
}
|
||||
}
|
26
ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj
Normal file
26
ProjectWarmlyShip/ProjectWarmlyShip/ProjectWarmlyShip.csproj
Normal file
@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
103
ProjectWarmlyShip/ProjectWarmlyShip/Properties/Resources.Designer.cs
generated
Normal file
103
ProjectWarmlyShip/ProjectWarmlyShip/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ProjectWarmlyShip.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||
/// </summary>
|
||||
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||
// с помощью такого средства, как ResGen или Visual Studio.
|
||||
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||
// с параметром /str или перестройте свой проект VS.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ProjectWarmlyShip.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowDown {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowDown", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowLeft {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowLeft", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowRight {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowRight", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Поиск локализованного ресурса типа System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ArrowUp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ArrowUp", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
133
ProjectWarmlyShip/ProjectWarmlyShip/Properties/Resources.resx
Normal file
133
ProjectWarmlyShip/ProjectWarmlyShip/Properties/Resources.resx
Normal file
@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ArrowDown" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowDown.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowRight" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowRight.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowLeft" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowLeft.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ArrowUp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ArrowUp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowDown.png
Normal file
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowDown.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowLeft.png
Normal file
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowLeft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowRight.png
Normal file
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowRight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowUp.png
Normal file
BIN
ProjectWarmlyShip/ProjectWarmlyShip/Resources/ArrowUp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
15
ProjectWarmlyShip/ProjectWarmlyShip/Status.cs
Normal file
15
ProjectWarmlyShip/ProjectWarmlyShip/Status.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectWarmlyShip.MovementStrategy
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
NotInit,
|
||||
InProgress,
|
||||
Finish
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user