LabWork03 #3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,28 +3,44 @@
|
||||
"WorkspaceRootPath": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\drawingliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\drawingliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\formliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\formliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\formliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\formliner.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\formliner.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\formliner.designer.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\projectliner\\directiontype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\directiontype.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\drawnings\\drawningbetterliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\drawnings\\drawningbetterliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\drawnings\\drawningliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\drawnings\\drawningliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\entities\\entitybetterliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\entities\\entitybetterliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\entities\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\entities\\entityliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\movementstrategy\\movetocorner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\movementstrategy\\movetocorner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\movementstrategy\\movetocenter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\movementstrategy\\movetocenter.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\movementstrategy\\moveableliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\movementstrategy\\moveableliner.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|c:\\somegitstuff\\isebd-11_khatypov_k.r_fundamental\\projectliner\\projectliner\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{7FB62E78-175F-490A-B5F2-2FF676947033}|ProjectLiner\\ProjectLiner.csproj|solutionrelative:projectliner\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
@ -34,35 +50,128 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 4,
|
||||
"SelectedChildIndex": 1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "FormLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\FormLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\FormLiner.cs",
|
||||
"ViewState": "AQIAAA8AAAAAAAAAAIA0wBcAAAAHAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:29.961Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "FormLiner.Designer.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.Designer.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\FormLiner.Designer.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.Designer.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\FormLiner.Designer.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"ViewState": "AQIAACoAAAAAAAAAAAAewDMAAAAhAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:26.829Z"
|
||||
"WhenOpened": "2024-04-24T06:50:50.101Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "FormLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\FormLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\FormLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\FormLiner.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABMAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-24T06:44:12.266Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "DrawningBetterLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningBetterLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\Drawnings\\DrawningBetterLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningBetterLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\Drawnings\\DrawningBetterLiner.cs",
|
||||
"ViewState": "AQIAAAMAAAAAAAAAAAAAABAAAAAeAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-24T06:24:10.949Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 4,
|
||||
"Title": "EntityBetterLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityBetterLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\Entities\\EntityBetterLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityBetterLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\Entities\\EntityBetterLiner.cs",
|
||||
"ViewState": "AQIAAA4AAAAAAAAAAAD4vxwAAABBAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-24T06:26:19.536Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "EntityLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\Entities\\EntityLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Entities\\EntityLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\Entities\\EntityLiner.cs",
|
||||
"ViewState": "AQIAAA0AAAAAAAAAAAAQwAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-24T06:25:44.938Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 7,
|
||||
"Title": "MoveToCenter.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveToCenter.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\MovementStrategy\\MoveToCenter.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveToCenter.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\MovementStrategy\\MoveToCenter.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABkAAAADAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-23T15:59:24.952Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 6,
|
||||
"Title": "MoveToCorner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveToCorner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\MovementStrategy\\MoveToCorner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveToCorner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\MovementStrategy\\MoveToCorner.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAABcAAAAXAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-23T15:58:58.074Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "DrawningLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\Drawnings\\DrawningLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Drawnings\\DrawningLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\Drawnings\\DrawningLiner.cs",
|
||||
"ViewState": "AQIAALwAAAAAAAAAAAASwMcAAAB5AAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-23T15:54:39.654Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 8,
|
||||
"Title": "MoveableLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveableLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\MovementStrategy\\MoveableLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\MovementStrategy\\MoveableLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\MovementStrategy\\MoveableLiner.cs",
|
||||
"ViewState": "AQIAAA4AAAAAAAAAAAAAwAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-23T15:54:19.94Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 9,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\Program.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\Program.cs",
|
||||
@ -70,44 +179,8 @@
|
||||
"RelativeToolTip": "ProjectLiner\\Program.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:23.139Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"Title": "EntityLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\EntityLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\EntityLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\EntityLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\EntityLiner.cs",
|
||||
"ViewState": "AQIAACEAAAAAAAAAAAAowAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:21.909Z"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "DrawingLiner.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\DrawingLiner.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\DrawingLiner.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\DrawingLiner.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\DrawingLiner.cs",
|
||||
"ViewState": "AQIAAEcAAAAAAAAAAAAgwE0AAAA0AAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:20.684Z",
|
||||
"WhenOpened": "2024-04-23T15:50:13.098Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 5,
|
||||
"Title": "DirectionType.cs",
|
||||
"DocumentMoniker": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\DirectionType.cs",
|
||||
"RelativeDocumentMoniker": "ProjectLiner\\DirectionType.cs",
|
||||
"ToolTip": "C:\\SomeGitStuff\\ISEbd-11_Khatypov_K.R_fundamental\\ProjectLiner\\ProjectLiner\\DirectionType.cs",
|
||||
"RelativeToolTip": "ProjectLiner\\DirectionType.cs",
|
||||
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-04-20T11:09:18.889Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
32
ProjectLiner/ProjectLiner/Drawnings/DirectionType.cs
Normal file
32
ProjectLiner/ProjectLiner/Drawnings/DirectionType.cs
Normal file
@ -0,0 +1,32 @@
|
||||
namespace ProjectLiner.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Направление перемещения
|
||||
/// </summary>
|
||||
public enum DirectionType
|
||||
{
|
||||
/// <summary>
|
||||
/// Неизвестное направление
|
||||
/// </summary>
|
||||
Unknow = -1,
|
||||
|
||||
/// <summary>
|
||||
/// Вверх
|
||||
/// </summary>
|
||||
Up = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Вниз
|
||||
/// </summary>
|
||||
Down = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Влево
|
||||
/// </summary>
|
||||
Left = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Вправо
|
||||
/// </summary>
|
||||
Right = 4
|
||||
}
|
64
ProjectLiner/ProjectLiner/Drawnings/DrawningBetterLiner.cs
Normal file
64
ProjectLiner/ProjectLiner/Drawnings/DrawningBetterLiner.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ProjectLiner.Entities;
|
||||
|
||||
namespace ProjectLiner.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningBetterLiner : DrawningLiner
|
||||
{
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
public DrawningBetterLiner(int speed, double weight, Color bodyColor, Color additionalColor, bool hasMark, bool hasDecoration) : base(110, 60)
|
||||
{
|
||||
EntityLiner = new EntityBetterLiner(speed, weight, bodyColor, additionalColor, hasMark, hasDecoration);
|
||||
}
|
||||
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityLiner == null || EntityLiner is not EntityBetterLiner betterLiner || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(betterLiner.AdditionalColor);
|
||||
|
||||
base.DrawTransport(g);
|
||||
|
||||
//Марка на борту
|
||||
if (((EntityBetterLiner)EntityLiner).HasMark)
|
||||
{
|
||||
g.FillRectangles(additionalBrush, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+15,_startPosY.Value+38,17,3),
|
||||
new(_startPosX.Value+22,_startPosY.Value+32,3,16)
|
||||
});
|
||||
}
|
||||
|
||||
//Декорации
|
||||
if (((EntityBetterLiner)EntityLiner).HasDecoratins)
|
||||
{
|
||||
g.FillRectangles(additionalBrush, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+8,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+26,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+44,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+62,_startPosY.Value+0,10,20),
|
||||
});
|
||||
g.DrawRectangles(pen, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+8,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+26,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+44,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+62,_startPosY.Value+0,10,20),
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
namespace ProjectLiner;
|
||||
using ProjectLiner.Entities;
|
||||
|
||||
namespace ProjectLiner.Drawnings;
|
||||
|
||||
/// <summary>
|
||||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||||
/// Класс, отвечающий за прорисовку и перемещение базового объекта-сущности
|
||||
/// </summary>
|
||||
public class DrawningLiner
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityLiner? EntityLiner { get; private set; }
|
||||
public EntityLiner? EntityLiner { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ширина окна
|
||||
@ -23,40 +25,76 @@ public class DrawningLiner
|
||||
/// <summary>
|
||||
/// Левая координата прорисовки автомобиля
|
||||
/// </summary>
|
||||
private int? _startPosX;
|
||||
protected int? _startPosX;
|
||||
|
||||
/// <summary>
|
||||
/// Верхняя кооридната прорисовки автомобиля
|
||||
/// </summary>
|
||||
private int? _startPosY;
|
||||
protected int? _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _drawingLinerWidth = 80;
|
||||
private readonly int _drawningLinerWidth = 80;
|
||||
|
||||
/// <summary>
|
||||
/// Высота прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _drawingLinerHeight = 60;
|
||||
private readonly int _drawningLinerHeight = 50;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// Координата X объекта
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool hasMark, bool hasDecoratins)
|
||||
{
|
||||
EntityLiner = new EntityLiner();
|
||||
EntityLiner.Init(speed, weight, bodyColor, additionalColor, hasMark, hasDecoratins);
|
||||
public int? GetPosX => _startPosX;
|
||||
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int? GetPosY => _startPosY;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _drawningLinerWidth;
|
||||
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _drawningLinerHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Пустой конструктор
|
||||
/// </summary>
|
||||
private DrawningLiner()
|
||||
{
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
_startPosX = null;
|
||||
_startPosY = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public DrawningLiner(int speed, double weight, Color bodyColor) : this()
|
||||
{
|
||||
EntityLiner = new EntityLiner(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор для наследников
|
||||
/// </summary>
|
||||
/// <param name="drawningLinerWidth">Ширина прорисовки лайнера</param>
|
||||
/// <param name="drawningLinerHeight">Высота прорисовки лайнера</param>
|
||||
protected DrawningLiner(int drawningLinerWidth, int drawningLinerHeight) : this()
|
||||
{
|
||||
_drawningLinerWidth = drawningLinerWidth;
|
||||
_pictureHeight = drawningLinerHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка границ поля
|
||||
/// </summary>
|
||||
@ -65,23 +103,20 @@ public class DrawningLiner
|
||||
/// <returns>true - границы заданы, false - проверка не пройдена, нельзя разместить объект в этих размерах</returns>
|
||||
public bool SetPictureSize(int width, int height)
|
||||
{
|
||||
// TODO проверка, что объект "влезает" в размеры поля
|
||||
// если влезает, сохраняем границы и корректируем позицию объекта, если она была уже установлена
|
||||
if (_drawingLinerWidth > width || _drawingLinerHeight > height)
|
||||
return false;
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
if (_pictureWidth - _drawingLinerWidth < _startPosX)
|
||||
_startPosX = _pictureWidth - _drawingLinerWidth;
|
||||
if (_pictureHeight - _drawingLinerHeight < _startPosY)
|
||||
_startPosY = _pictureHeight - _drawingLinerHeight;
|
||||
if (_drawningLinerWidth > width || _drawningLinerHeight > height)
|
||||
return false;
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
if (_pictureWidth - _drawningLinerWidth < _startPosX)
|
||||
_startPosX = _pictureWidth - _drawningLinerWidth;
|
||||
if (_pictureHeight - _drawningLinerHeight < _startPosY)
|
||||
_startPosY = _pictureHeight - _drawningLinerHeight;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
@ -90,21 +125,22 @@ public class DrawningLiner
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_startPosX = _pictureWidth - _drawningLinerWidth < x ? _pictureWidth - _drawningLinerWidth : x;
|
||||
_startPosY = _pictureHeight - _drawningLinerHeight < y ? _pictureHeight - _drawningLinerHeight : y;
|
||||
|
||||
_startPosX = _pictureWidth - _drawingLinerWidth < x ? _pictureWidth - _drawingLinerWidth : x;
|
||||
_startPosY = _pictureHeight - _drawingLinerHeight < y ? _pictureHeight - _drawingLinerHeight : y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - перемещене выполнено, false - перемещение невозможно</returns>
|
||||
public bool MoveTransport(DirectionType direction)
|
||||
{
|
||||
if (EntityLiner == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
@ -126,58 +162,43 @@ public class DrawningLiner
|
||||
{
|
||||
_startPosY -= (int)EntityLiner.Step;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
if(_startPosX.Value + EntityLiner.Step < _pictureWidth-_drawingLinerWidth)
|
||||
{
|
||||
_startPosX += (int)EntityLiner.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityLiner.Step < _pictureHeight-_drawingLinerHeight)
|
||||
case DirectionType.Right:
|
||||
if (_startPosX.Value + EntityLiner.Step < _pictureWidth - _drawningLinerWidth)
|
||||
{
|
||||
_startPosX += (int)EntityLiner.Step;
|
||||
}
|
||||
return true;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY.Value + EntityLiner.Step < _pictureHeight - _drawningLinerHeight)
|
||||
{
|
||||
_startPosY += (int)EntityLiner.Step;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void FormChanged(object sender, EventArgs e)
|
||||
{
|
||||
_pictureWidth = (sender as FormLiner).Size.Width;
|
||||
_pictureHeight = (sender as FormLiner).Size.Height;
|
||||
if (_startPosX.HasValue && _startPosY.HasValue)
|
||||
{
|
||||
if (_pictureWidth - _drawingLinerWidth < _startPosX)
|
||||
_startPosX = _pictureWidth - _drawingLinerWidth;
|
||||
if (_pictureHeight - _drawingLinerHeight < _startPosY)
|
||||
_startPosY = _pictureHeight - _drawingLinerHeight;
|
||||
(sender as FormLiner).Draw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public void DrawTransport(Graphics g)
|
||||
/// <summary>
|
||||
/// Прорисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (EntityLiner == null || !_startPosX.HasValue || !_startPosY.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pen pen = new Pen(Color.Black);
|
||||
|
||||
Pen pen = new(Color.Black);
|
||||
|
||||
Brush mainBrush = new SolidBrush(EntityLiner.BodyColor);
|
||||
Brush additionalBrush = new SolidBrush(EntityLiner.AdditionalColor);
|
||||
|
||||
g.DrawRectangle(pen, new(_startPosX.Value, _startPosY.Value, 80, 60));
|
||||
Brush negativeMainBrush = new SolidBrush(Color.FromArgb(255-EntityLiner.BodyColor.R, 255 - EntityLiner.BodyColor.G, 255 - EntityLiner.BodyColor.B));
|
||||
|
||||
//Рисуем тело
|
||||
g.FillPolygon(mainBrush, new Point[] {
|
||||
new(_startPosX.Value+0, _startPosY.Value + 30),
|
||||
new(_startPosX.Value+15,_startPosY.Value+50),
|
||||
@ -199,8 +220,7 @@ public class DrawningLiner
|
||||
new(_startPosX.Value+80, _startPosY.Value+30)
|
||||
});
|
||||
|
||||
//Рисуем окна
|
||||
g.FillRectangles(additionalBrush, new Rectangle[]{
|
||||
g.FillRectangles(negativeMainBrush, new Rectangle[]{
|
||||
new(_startPosX.Value+5,_startPosY.Value+22,10,6),
|
||||
new(_startPosX.Value+20,_startPosY.Value+22,10,6),
|
||||
new(_startPosX.Value+35,_startPosY.Value+22,10,6),
|
||||
@ -215,33 +235,5 @@ public class DrawningLiner
|
||||
new(_startPosX.Value+65,_startPosY.Value+22,10,6),
|
||||
});
|
||||
|
||||
//Марка на борту
|
||||
if (EntityLiner.HasMark)
|
||||
{
|
||||
g.FillRectangles(additionalBrush, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+15,_startPosY.Value+38,17,3),
|
||||
new(_startPosX.Value+22,_startPosY.Value+32,3,16)
|
||||
});
|
||||
}
|
||||
|
||||
//Декорации
|
||||
if (EntityLiner.HasDecoratins)
|
||||
{
|
||||
g.FillRectangles(additionalBrush, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+8,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+26,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+44,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+62,_startPosY.Value+0,10,20),
|
||||
});
|
||||
g.DrawRectangles(pen, new Rectangle[]
|
||||
{
|
||||
new(_startPosX.Value+8,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+26,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+44,_startPosY.Value+0,10,20),
|
||||
new(_startPosX.Value+62,_startPosY.Value+0,10,20),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
38
ProjectLiner/ProjectLiner/Entities/EntityBetterLiner.cs
Normal file
38
ProjectLiner/ProjectLiner/Entities/EntityBetterLiner.cs
Normal file
@ -0,0 +1,38 @@
|
||||
namespace ProjectLiner.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Спортивный автомобиль"
|
||||
/// </summary>
|
||||
public class EntityBetterLiner : EntityLiner
|
||||
{/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имеет марку на боку
|
||||
/// </summary>
|
||||
public bool HasMark { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имеет декорации сверху
|
||||
/// </summary>
|
||||
public bool HasDecoratins { get; private set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="hasMark">Присутствие марки</param>
|
||||
/// <param name="hasDecoratins">Присутствие декораций</param>
|
||||
public EntityBetterLiner(int speed, double weight, Color bodyColor, Color additionalColor, bool hasMark, bool hasDecoratins) : base(speed, weight, bodyColor)
|
||||
{
|
||||
AdditionalColor = additionalColor;
|
||||
HasMark = hasMark;
|
||||
HasDecoratins = hasDecoratins;
|
||||
}
|
||||
}
|
40
ProjectLiner/ProjectLiner/Entities/EntityLiner.cs
Normal file
40
ProjectLiner/ProjectLiner/Entities/EntityLiner.cs
Normal file
@ -0,0 +1,40 @@
|
||||
namespace ProjectLiner.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Автомобиль"
|
||||
/// </summary>
|
||||
public class EntityLiner
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор сущности
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
public EntityLiner(int speed, double weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
namespace ProjectLiner;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-сущность "Спортивный автомобиль"
|
||||
/// </summary>
|
||||
public class EntityLiner
|
||||
{
|
||||
/// <summary>
|
||||
/// Скорость
|
||||
/// </summary>
|
||||
public int Speed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вес
|
||||
/// </summary>
|
||||
public double Weight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Основной цвет
|
||||
/// </summary>
|
||||
public Color BodyColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Дополнительный цвет (для опциональных элементов)
|
||||
/// </summary>
|
||||
public Color AdditionalColor { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имеет марку на боку
|
||||
/// </summary>
|
||||
public bool HasMark { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Имеет декорации сверху
|
||||
/// </summary>
|
||||
public bool HasDecoratins { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// </summary>
|
||||
public double Step => Speed * 100 / Weight;
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="hasMark">Имеет значёк на куове</param>
|
||||
/// <param name="hasDecoratins">Имеет декорации сверху</param>
|
||||
///
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool hasMark, bool hasDecoratins)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
HasMark = hasMark;
|
||||
HasDecoratins = hasDecoratins;
|
||||
}
|
||||
}
|
74
ProjectLiner/ProjectLiner/FormLiner.Designer.cs
generated
74
ProjectLiner/ProjectLiner/FormLiner.Designer.cs
generated
@ -29,11 +29,14 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
pictureBoxLiner = new PictureBox();
|
||||
buttonCreateLiner = new Button();
|
||||
buttonCreateBetterLiner = new Button();
|
||||
buttonLeft = new Button();
|
||||
buttonUp = new Button();
|
||||
buttonDown = new Button();
|
||||
buttonRight = new Button();
|
||||
buttonCreateLiner = new Button();
|
||||
comboBoxStrategy = new ComboBox();
|
||||
buttonStrategyStep = new Button();
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -45,17 +48,17 @@
|
||||
pictureBoxLiner.Size = new Size(923, 597);
|
||||
pictureBoxLiner.TabIndex = 0;
|
||||
pictureBoxLiner.TabStop = false;
|
||||
//
|
||||
// buttonCreateLiner
|
||||
//
|
||||
buttonCreateLiner.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateLiner.Location = new Point(12, 562);
|
||||
buttonCreateLiner.Name = "buttonCreateLiner";
|
||||
buttonCreateLiner.Size = new Size(75, 23);
|
||||
buttonCreateLiner.TabIndex = 1;
|
||||
buttonCreateLiner.Text = "Создать";
|
||||
buttonCreateLiner.UseVisualStyleBackColor = true;
|
||||
buttonCreateLiner.Click += ButtonCreateLiner_Click;
|
||||
//
|
||||
// buttonCreateBetterLiner
|
||||
//
|
||||
buttonCreateBetterLiner.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateBetterLiner.Location = new Point(12, 562);
|
||||
buttonCreateBetterLiner.Name = "buttonCreateBetterLiner";
|
||||
buttonCreateBetterLiner.Size = new Size(223, 23);
|
||||
buttonCreateBetterLiner.TabIndex = 1;
|
||||
buttonCreateBetterLiner.Text = "Создать крутой лайнер";
|
||||
buttonCreateBetterLiner.UseVisualStyleBackColor = true;
|
||||
buttonCreateBetterLiner.Click += ButtonCreateBetterLiner_Click;
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
@ -105,30 +108,67 @@
|
||||
buttonRight.UseVisualStyleBackColor = true;
|
||||
buttonRight.Click += ButtonMove_Click;
|
||||
//
|
||||
// buttonCreateLiner
|
||||
//
|
||||
buttonCreateLiner.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
||||
buttonCreateLiner.Location = new Point(250, 562);
|
||||
buttonCreateLiner.Name = "buttonCreateLiner";
|
||||
buttonCreateLiner.Size = new Size(223, 23);
|
||||
buttonCreateLiner.TabIndex = 6;
|
||||
buttonCreateLiner.Text = "Создать лайнер";
|
||||
buttonCreateLiner.UseVisualStyleBackColor = true;
|
||||
buttonCreateLiner.Click += ButtonCreateLiner_Click;
|
||||
//
|
||||
// comboBoxStrategy
|
||||
//
|
||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStrategy.FormattingEnabled = true;
|
||||
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
|
||||
comboBoxStrategy.Location = new Point(790, 12);
|
||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||
comboBoxStrategy.Size = new Size(121, 23);
|
||||
comboBoxStrategy.TabIndex = 7;
|
||||
//
|
||||
// buttonStrategyStep
|
||||
//
|
||||
buttonStrategyStep.Location = new Point(836, 41);
|
||||
buttonStrategyStep.Name = "buttonStrategyStep";
|
||||
buttonStrategyStep.Size = new Size(75, 23);
|
||||
buttonStrategyStep.TabIndex = 8;
|
||||
buttonStrategyStep.Text = "Шаг";
|
||||
buttonStrategyStep.UseVisualStyleBackColor = true;
|
||||
buttonStrategyStep.Click += ButtonStrategyStep_Click;
|
||||
//
|
||||
// FormLiner
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(923, 597);
|
||||
Controls.Add(buttonStrategyStep);
|
||||
Controls.Add(comboBoxStrategy);
|
||||
Controls.Add(buttonCreateLiner);
|
||||
Controls.Add(buttonRight);
|
||||
Controls.Add(buttonDown);
|
||||
Controls.Add(buttonUp);
|
||||
Controls.Add(buttonLeft);
|
||||
Controls.Add(buttonCreateLiner);
|
||||
Controls.Add(buttonCreateBetterLiner);
|
||||
Controls.Add(pictureBoxLiner);
|
||||
Name = "FormLiner";
|
||||
Text = "Пассажирский лайнер";
|
||||
Text = "Лайнер";
|
||||
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
private PictureBox pictureBoxLiner;
|
||||
private Button buttonCreateLiner;
|
||||
private PictureBox pictureBoxLiner;
|
||||
private Button buttonCreateBetterLiner;
|
||||
private Button buttonLeft;
|
||||
private Button buttonUp;
|
||||
private Button buttonDown;
|
||||
private Button buttonRight;
|
||||
private Button buttonCreateLiner;
|
||||
private ComboBox comboBoxStrategy;
|
||||
private Button buttonStrategyStep;
|
||||
}
|
||||
}
|
@ -1,4 +1,7 @@
|
||||
namespace ProjectLiner;
|
||||
using ProjectLiner.Drawnings;
|
||||
using ProjectLiner.MovementStrategy;
|
||||
|
||||
namespace ProjectLiner;
|
||||
|
||||
/// <summary>
|
||||
/// Форма работы с объектом "Спортивный автомобиль"
|
||||
@ -10,18 +13,24 @@ public partial class FormLiner : Form
|
||||
/// </summary>
|
||||
private DrawningLiner? _drawningLiner;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения
|
||||
/// </summary>
|
||||
private AbstractStrategy? _strategy;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор формы
|
||||
/// </summary>
|
||||
public FormLiner()
|
||||
{
|
||||
InitializeComponent();
|
||||
_strategy = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод прорисовки машины
|
||||
/// </summary>
|
||||
public void Draw()
|
||||
private void Draw()
|
||||
{
|
||||
if (_drawningLiner == null)
|
||||
{
|
||||
@ -35,25 +44,48 @@ public partial class FormLiner : Form
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать"
|
||||
/// Создание объекта класса-перемещения
|
||||
/// </summary>
|
||||
/// <param name="type">Тип создаваемого объекта</param>
|
||||
private void CreateObject(string type)
|
||||
{
|
||||
Random random = new();
|
||||
switch (type)
|
||||
{
|
||||
case nameof(DrawningLiner):
|
||||
_drawningLiner = new DrawningLiner(random.Next(100, 300), random.Next(1000, 3000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
break;
|
||||
case nameof(DrawningBetterLiner):
|
||||
_drawningLiner = new DrawningBetterLiner(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)));
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
_drawningLiner.SetPictureSize(pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||
_drawningLiner.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
_strategy = null;
|
||||
comboBoxStrategy.Enabled = true;
|
||||
Draw();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать спортивный автомобиль"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreateLiner_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningLiner != null)
|
||||
ResizeEnd -= _drawningLiner.FormChanged;
|
||||
Random random = new();
|
||||
_drawningLiner = new DrawningLiner();
|
||||
_drawningLiner.Init(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)));
|
||||
_drawningLiner.SetPictureSize(pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||
_drawningLiner.SetPosition(random.Next(10, 100), random.Next(10, 100));
|
||||
Draw();
|
||||
ResizeEnd += _drawningLiner.FormChanged;
|
||||
}
|
||||
private void ButtonCreateBetterLiner_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBetterLiner));
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать автомобиль"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreateLiner_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLiner));
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение объекта по форме (нажатие кнопок навигации)
|
||||
@ -90,4 +122,47 @@ public partial class FormLiner : Form
|
||||
Draw();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Шаг"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonStrategyStep_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_drawningLiner == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (comboBoxStrategy.Enabled)
|
||||
{
|
||||
_strategy = comboBoxStrategy.SelectedIndex switch
|
||||
{
|
||||
0 => new MoveToCenter(),
|
||||
1 => new MoveToCorner(),
|
||||
_ => null,
|
||||
};
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_strategy.SetData(new MoveableLiner(_drawningLiner), pictureBoxLiner.Width, pictureBoxLiner.Height);
|
||||
}
|
||||
|
||||
if (_strategy == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
comboBoxStrategy.Enabled = false;
|
||||
_strategy.MakeStep();
|
||||
Draw();
|
||||
|
||||
if (_strategy.GetStatus() == StrategyStatus.Finish)
|
||||
{
|
||||
comboBoxStrategy.Enabled = true;
|
||||
_strategy = null;
|
||||
}
|
||||
}
|
||||
}
|
139
ProjectLiner/ProjectLiner/MovementStrategy/AbstractStrategy.cs
Normal file
139
ProjectLiner/ProjectLiner/MovementStrategy/AbstractStrategy.cs
Normal file
@ -0,0 +1,139 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-стратегия перемещения объекта
|
||||
/// </summary>
|
||||
public abstract class AbstractStrategy
|
||||
{
|
||||
/// <summary>
|
||||
/// Перемещаемый объект
|
||||
/// </summary>
|
||||
private IMoveableObject? _moveableObject;
|
||||
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина поля
|
||||
/// </summary>
|
||||
protected int FieldWidth { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Высота поля
|
||||
/// </summary>
|
||||
protected int FieldHeight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Статус перемещения
|
||||
/// </summary>
|
||||
public StrategyStatus GetStatus() { return _state; }
|
||||
|
||||
/// <summary>
|
||||
/// Установка данных
|
||||
/// </summary>
|
||||
/// <param name="moveableObject">Перемещаемый объект</param>
|
||||
/// <param name="width">Ширина поля</param>
|
||||
/// <param name="height">Высота поля</param>
|
||||
public void SetData(IMoveableObject moveableObject, int width, int height)
|
||||
{
|
||||
if (moveableObject == null)
|
||||
{
|
||||
_state = StrategyStatus.NotInit;
|
||||
return;
|
||||
}
|
||||
|
||||
_state = StrategyStatus.InProgress;
|
||||
_moveableObject = moveableObject;
|
||||
FieldWidth = width;
|
||||
FieldHeight = height;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Шаг перемещения
|
||||
/// </summary>
|
||||
public void MakeStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsTargetDestinaion())
|
||||
{
|
||||
_state = StrategyStatus.Finish;
|
||||
return;
|
||||
}
|
||||
|
||||
MoveToTarget();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение влево
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveLeft() => MoveTo(MovementDirection.Left);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вправо
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveRight() => MoveTo(MovementDirection.Right);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вверх
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveUp() => MoveTo(MovementDirection.Up);
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение вниз
|
||||
/// </summary>
|
||||
/// <returns>Результат перемещения (true - удалось переместиться, false - неудача)</returns>
|
||||
protected bool MoveDown() => MoveTo(MovementDirection.Down);
|
||||
|
||||
/// <summary>
|
||||
/// Параметры объекта
|
||||
/// </summary>
|
||||
protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
|
||||
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected int? GetStep()
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _moveableObject?.GetStep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Перемещение к цели
|
||||
/// </summary>
|
||||
protected abstract void MoveToTarget();
|
||||
|
||||
/// <summary>
|
||||
/// Достигнута ли цель
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected abstract bool IsTargetDestinaion();
|
||||
|
||||
/// <summary>
|
||||
/// Попытка перемещения в требуемом направлении
|
||||
/// </summary>
|
||||
/// <param name="movementDirection">Направление</param>
|
||||
/// <returns>Результат попытки (true - удалось переместиться, false - неудача)</returns>
|
||||
private bool MoveTo(MovementDirection movementDirection)
|
||||
{
|
||||
if (_state != StrategyStatus.InProgress)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _moveableObject?.TryMoveObject(movementDirection) ?? false;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Интерфейс для работы с перемещаемым объектом
|
||||
/// </summary>
|
||||
public interface IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Получение координаты объекта
|
||||
/// </summary>
|
||||
ObjectParameters? GetObjectPosition { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Шаг объекта
|
||||
/// </summary>
|
||||
int GetStep { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Попытка переместить объект в указанном направлении
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - объект перемещен, false - перемещение невозможно</returns>
|
||||
bool TryMoveObject(MovementDirection direction);
|
||||
}
|
54
ProjectLiner/ProjectLiner/MovementStrategy/MoveToCenter.cs
Normal file
54
ProjectLiner/ProjectLiner/MovementStrategy/MoveToCenter.cs
Normal file
@ -0,0 +1,54 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Стратегия перемещения объекта в центр экрана
|
||||
/// </summary>
|
||||
public class MoveToCenter : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
|
||||
if (Math.Abs(diffX) > GetStep())
|
||||
{
|
||||
if (diffX > 0)
|
||||
{
|
||||
MoveLeft();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveRight();
|
||||
}
|
||||
}
|
||||
|
||||
int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
|
||||
if (Math.Abs(diffY) > GetStep())
|
||||
{
|
||||
if (diffY > 0)
|
||||
{
|
||||
MoveUp();
|
||||
}
|
||||
else
|
||||
{
|
||||
MoveDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
ProjectLiner/ProjectLiner/MovementStrategy/MoveToCorner.cs
Normal file
26
ProjectLiner/ProjectLiner/MovementStrategy/MoveToCorner.cs
Normal file
@ -0,0 +1,26 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
public class MoveToCorner : AbstractStrategy
|
||||
{
|
||||
protected override bool IsTargetDestinaion()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return objParams.LeftBorder - GetStep() <= 0 || objParams.RightBorder + GetStep() >= FieldWidth || objParams.TopBorder - GetStep() <= 0 || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight;
|
||||
|
||||
}
|
||||
|
||||
protected override void MoveToTarget()
|
||||
{
|
||||
ObjectParameters? objParams = GetObjectParameters;
|
||||
if (objParams == null)
|
||||
return;
|
||||
if (objParams.RightBorder + GetStep() < FieldWidth)
|
||||
MoveRight();
|
||||
if (objParams.DownBorder + GetStep() < FieldHeight)
|
||||
MoveDown();
|
||||
}
|
||||
}
|
64
ProjectLiner/ProjectLiner/MovementStrategy/MoveableLiner.cs
Normal file
64
ProjectLiner/ProjectLiner/MovementStrategy/MoveableLiner.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using ProjectLiner.Drawnings;
|
||||
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Класс-реализация IMoveableObject с использованием DrawningLiner
|
||||
/// </summary>
|
||||
public class MoveableLiner : IMoveableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Поле-объект класса DrawningLiner или его наследника
|
||||
/// </summary>
|
||||
private readonly DrawningLiner? _liner = null;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="liner">Объект класса DrawningLiner</param>
|
||||
public MoveableLiner(DrawningLiner liner)
|
||||
{
|
||||
_liner = liner;
|
||||
}
|
||||
|
||||
public ObjectParameters? GetObjectPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_liner == null || _liner.EntityLiner == null || !_liner.GetPosX.HasValue || !_liner.GetPosY.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new ObjectParameters(_liner.GetPosX.Value, _liner.GetPosY.Value, _liner.GetWidth, _liner.GetHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public int GetStep => (int)(_liner?.EntityLiner?.Step ?? 0);
|
||||
|
||||
public bool TryMoveObject(MovementDirection direction)
|
||||
{
|
||||
if (_liner == null || _liner.EntityLiner == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _liner.MoveTransport(GetDirectionType(direction));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Конвертация из MovementDirection в DirectionType
|
||||
/// </summary>
|
||||
/// <param name="direction">MovementDirection</param>
|
||||
/// <returns>DirectionType</returns>
|
||||
private static DirectionType GetDirectionType(MovementDirection direction)
|
||||
{
|
||||
return direction switch
|
||||
{
|
||||
MovementDirection.Left => DirectionType.Left,
|
||||
MovementDirection.Right => DirectionType.Right,
|
||||
MovementDirection.Up => DirectionType.Up,
|
||||
MovementDirection.Down => DirectionType.Down,
|
||||
_ => DirectionType.Unknow,
|
||||
};
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
namespace ProjectLiner;
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Направление перемещения
|
||||
/// </summary>
|
||||
public enum DirectionType
|
||||
public enum MovementDirection
|
||||
{
|
||||
/// <summary>
|
||||
/// Вверх
|
@ -0,0 +1,72 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Параметры-координаты объекта
|
||||
/// </summary>
|
||||
public class ObjectParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// Координата X
|
||||
/// </summary>
|
||||
private readonly int _x;
|
||||
|
||||
/// <summary>
|
||||
/// Координата Y
|
||||
/// </summary>
|
||||
private readonly int _y;
|
||||
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
private readonly int _width;
|
||||
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
private readonly int _height;
|
||||
|
||||
/// <summary>
|
||||
/// Левая граница
|
||||
/// </summary>
|
||||
public int LeftBorder => _x;
|
||||
|
||||
/// <summary>
|
||||
/// Верхняя граница
|
||||
/// </summary>
|
||||
public int TopBorder => _y;
|
||||
|
||||
/// <summary>
|
||||
/// Правая граница
|
||||
/// </summary>
|
||||
public int RightBorder => _x + _width;
|
||||
|
||||
/// <summary>
|
||||
/// Нижняя граница
|
||||
/// </summary>
|
||||
public int DownBorder => _y + _height;
|
||||
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleHorizontal => _x + _width / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Середина объекта
|
||||
/// </summary>
|
||||
public int ObjectMiddleVertical => _y + _height / 2;
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина объекта</param>
|
||||
/// <param name="height">Высота объекта</param>
|
||||
public ObjectParameters(int x, int y, int width, int height)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_width = width;
|
||||
_height = height;
|
||||
}
|
||||
}
|
22
ProjectLiner/ProjectLiner/MovementStrategy/StrategyStatus.cs
Normal file
22
ProjectLiner/ProjectLiner/MovementStrategy/StrategyStatus.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace ProjectLiner.MovementStrategy;
|
||||
|
||||
/// <summary>
|
||||
/// Статус выполнения операции перемещения
|
||||
/// </summary>
|
||||
public enum StrategyStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// Все готово к началу
|
||||
/// </summary>
|
||||
NotInit,
|
||||
|
||||
/// <summary>
|
||||
/// Выполняется
|
||||
/// </summary>
|
||||
InProgress,
|
||||
|
||||
/// <summary>
|
||||
/// Завершено
|
||||
/// </summary>
|
||||
Finish
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user