diff --git a/.vs/Pacman_refactored/DesignTimeBuild/.dtbcache.v2 b/.vs/Pacman_refactored/DesignTimeBuild/.dtbcache.v2 index 129aa72..b553d43 100644 Binary files a/.vs/Pacman_refactored/DesignTimeBuild/.dtbcache.v2 and b/.vs/Pacman_refactored/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/Pacman_refactored/FileContentIndex/05de5e12-1bc0-45e9-a7bc-3d423ac15619.vsidx b/.vs/Pacman_refactored/FileContentIndex/05de5e12-1bc0-45e9-a7bc-3d423ac15619.vsidx new file mode 100644 index 0000000..574f5d6 Binary files /dev/null and b/.vs/Pacman_refactored/FileContentIndex/05de5e12-1bc0-45e9-a7bc-3d423ac15619.vsidx differ diff --git a/.vs/Pacman_refactored/FileContentIndex/269565db-9a45-40e0-8f9d-e1ffed185708.vsidx b/.vs/Pacman_refactored/FileContentIndex/269565db-9a45-40e0-8f9d-e1ffed185708.vsidx deleted file mode 100644 index dd65017..0000000 Binary files a/.vs/Pacman_refactored/FileContentIndex/269565db-9a45-40e0-8f9d-e1ffed185708.vsidx and /dev/null differ diff --git a/.vs/Pacman_refactored/FileContentIndex/37693621-a472-4bc5-9110-8c443659911d.vsidx b/.vs/Pacman_refactored/FileContentIndex/37693621-a472-4bc5-9110-8c443659911d.vsidx new file mode 100644 index 0000000..fffde8c Binary files /dev/null and b/.vs/Pacman_refactored/FileContentIndex/37693621-a472-4bc5-9110-8c443659911d.vsidx differ diff --git a/.vs/Pacman_refactored/FileContentIndex/6484866e-eea5-4265-89f6-bab82cfa38b3.vsidx b/.vs/Pacman_refactored/FileContentIndex/6484866e-eea5-4265-89f6-bab82cfa38b3.vsidx deleted file mode 100644 index 3dfbd59..0000000 Binary files a/.vs/Pacman_refactored/FileContentIndex/6484866e-eea5-4265-89f6-bab82cfa38b3.vsidx and /dev/null differ diff --git a/.vs/Pacman_refactored/FileContentIndex/9a445599-fff2-462a-8a11-72fb76731c7a.vsidx b/.vs/Pacman_refactored/FileContentIndex/9a445599-fff2-462a-8a11-72fb76731c7a.vsidx new file mode 100644 index 0000000..a241524 Binary files /dev/null and b/.vs/Pacman_refactored/FileContentIndex/9a445599-fff2-462a-8a11-72fb76731c7a.vsidx differ diff --git a/.vs/Pacman_refactored/FileContentIndex/b991bb2c-ab85-4986-a4e0-cec7ed18a46b.vsidx b/.vs/Pacman_refactored/FileContentIndex/b991bb2c-ab85-4986-a4e0-cec7ed18a46b.vsidx new file mode 100644 index 0000000..3e0b5b1 Binary files /dev/null and b/.vs/Pacman_refactored/FileContentIndex/b991bb2c-ab85-4986-a4e0-cec7ed18a46b.vsidx differ diff --git a/.vs/Pacman_refactored/FileContentIndex/cd81d398-8a1c-41e6-9655-d1d1f678060c.vsidx b/.vs/Pacman_refactored/FileContentIndex/cd81d398-8a1c-41e6-9655-d1d1f678060c.vsidx deleted file mode 100644 index 5786d78..0000000 Binary files a/.vs/Pacman_refactored/FileContentIndex/cd81d398-8a1c-41e6-9655-d1d1f678060c.vsidx and /dev/null differ diff --git a/.vs/Pacman_refactored/FileContentIndex/ef1bb82f-f1a8-4637-ba07-23eda1c362ca.vsidx b/.vs/Pacman_refactored/FileContentIndex/ef1bb82f-f1a8-4637-ba07-23eda1c362ca.vsidx deleted file mode 100644 index dda7d3c..0000000 Binary files a/.vs/Pacman_refactored/FileContentIndex/ef1bb82f-f1a8-4637-ba07-23eda1c362ca.vsidx and /dev/null differ diff --git a/.vs/Pacman_refactored/v17/.suo b/.vs/Pacman_refactored/v17/.suo index 0430e47..0c9dc09 100644 Binary files a/.vs/Pacman_refactored/v17/.suo and b/.vs/Pacman_refactored/v17/.suo differ diff --git a/.vs/ProjectEvaluation/pacman_refactored.metadata.v3 b/.vs/ProjectEvaluation/pacman_refactored.metadata.v3 index 290f68e..92c4598 100644 Binary files a/.vs/ProjectEvaluation/pacman_refactored.metadata.v3 and b/.vs/ProjectEvaluation/pacman_refactored.metadata.v3 differ diff --git a/.vs/ProjectEvaluation/pacman_refactored.projects.v3 b/.vs/ProjectEvaluation/pacman_refactored.projects.v3 index adf014b..7f747bf 100644 Binary files a/.vs/ProjectEvaluation/pacman_refactored.projects.v3 and b/.vs/ProjectEvaluation/pacman_refactored.projects.v3 differ diff --git a/LabelMonoGame/Label.cs b/LabelMonoGame/Label.cs new file mode 100644 index 0000000..c5446bc --- /dev/null +++ b/LabelMonoGame/Label.cs @@ -0,0 +1,137 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +using Mootfrost.Monogame.Label.Properties; + +namespace Mootfrost.Monogame.Label +{ + public class Label + { + public Vector2 Position { get; set; } + public Vector2 EndPosition { get; set; } + + public SpriteFont SpriteFont { get; set; } + public Color Color { get; set; } + + public string Text { get; set; } + + public float Scale { get; set; } = 1; + public float Rotation { get; set; } = 0; + + public HorizontalAlignment HorizontalAlignment { get; set; } = HorizontalAlignment.Left; + public VerticalAlignment VerticalAlignment { get; set; } = VerticalAlignment.Top; + + public Label() + { + Position = new Vector2(0); + EndPosition = new Vector2(200); + + Text = "Label"; + Color = Color.White; + } + + /// + /// + /// + /// + /// + /// + /// Right side of label. Needed for alignments. Can be screen size. + /// + public Label(SpriteFont sprteFont, string text, Vector2 position, Vector2 endPosition, Color color) + { + SpriteFont = sprteFont; + Text = text; + Position = position; + EndPosition = endPosition; + Color = color; + } + + /// + /// + /// + /// + /// + /// + /// Right side of label. Needed for alignments. Can be screen size. + /// Needed for scaling font. You can use multiple spritefonts instead. + /// + public Label(SpriteFont sprteFont, string text, Vector2 position, Vector2 endPosition, float scale, Color color) + { + SpriteFont = sprteFont; + Text = text; + Position = position; + EndPosition = endPosition; + Scale = scale; + Color = color; + } + + /// + /// + /// + /// + /// + /// + /// Right side of label. Needed for alignments. Can be screen size. + /// Needed for scaling font. You can use multiple spritefonts instead. + /// Label rotation in radians. + /// + public Label(SpriteFont sprteFont, string text, Vector2 position, Vector2 endPosition, float scale, float rotation, Color color) + { + SpriteFont = sprteFont; + Text = text; + Position = position; + EndPosition = endPosition; + Scale = scale; + Rotation = rotation; + Color = color; + } + + private float SetHorizontalAlignment() + { + float x = Position.X; + switch (HorizontalAlignment) + { + case HorizontalAlignment.Left: + x = Position.X; + break; + case HorizontalAlignment.Center: + x = Position.X + EndPosition.X / 2 - SpriteFont.MeasureString(Text).X / 2; + break; + case HorizontalAlignment.Right: + x = EndPosition.X - SpriteFont.MeasureString(Text).X; + break; + } + return x; + } + + private float SetVericalAlignment() + { + float y = Position.Y; + switch (VerticalAlignment) + { + case VerticalAlignment.Top: + y = Position.Y; + break; + case VerticalAlignment.Center: + y = Position.Y + EndPosition.Y / 2 - SpriteFont.MeasureString(Text).Y / 2; + break; + case VerticalAlignment.Bottom: + y = EndPosition.Y - SpriteFont.MeasureString(Text).Y; + break; + } + return y; + } + + public void Draw(SpriteBatch spriteBatch) + { + Vector2 position = new Vector2(SetHorizontalAlignment(), + SetVericalAlignment()); + + spriteBatch.DrawString(SpriteFont, Text, position, + Color, Rotation, new Vector2(SpriteFont.MeasureString(Text).X / 2, + SpriteFont.MeasureString(Text).Y / 2), + Scale, SpriteEffects.None, 0); + } + } +} diff --git a/LabelMonoGame/LabelMonoGame.csproj b/LabelMonoGame/LabelMonoGame.csproj new file mode 100644 index 0000000..f2f3813 --- /dev/null +++ b/LabelMonoGame/LabelMonoGame.csproj @@ -0,0 +1,11 @@ + + + + netcoreapp3.1 + + + + + + + diff --git a/Pacman_refactored/Classes/UI/Label/Enums/HorizontalAlignment.cs b/LabelMonoGame/Properties/HorizontalAlignment.cs similarity index 53% rename from Pacman_refactored/Classes/UI/Label/Enums/HorizontalAlignment.cs rename to LabelMonoGame/Properties/HorizontalAlignment.cs index 1186494..5bbbeee 100644 --- a/Pacman_refactored/Classes/UI/Label/Enums/HorizontalAlignment.cs +++ b/LabelMonoGame/Properties/HorizontalAlignment.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using System.Text; -namespace Pacman_refactored.Classes.UI.Label.Enums +namespace Mootfrost.Monogame.Label.Properties { - public enum HoriZontalAlignment + public enum HorizontalAlignment { - Top, + Left, Center, Right } diff --git a/Pacman_refactored/Classes/UI/Label/Enums/VerticalAlignment.cs b/LabelMonoGame/Properties/VerticalAlignment.cs similarity index 76% rename from Pacman_refactored/Classes/UI/Label/Enums/VerticalAlignment.cs rename to LabelMonoGame/Properties/VerticalAlignment.cs index b6f0991..9602cff 100644 --- a/Pacman_refactored/Classes/UI/Label/Enums/VerticalAlignment.cs +++ b/LabelMonoGame/Properties/VerticalAlignment.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace Pacman_refactored.Classes.UI.Label.Enums +namespace Mootfrost.Monogame.Label.Properties { public enum VerticalAlignment { diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs b/LabelMonoGame/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs new file mode 100644 index 0000000..ad8dfe1 --- /dev/null +++ b/LabelMonoGame/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfo.cs b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfo.cs new file mode 100644 index 0000000..d1292e1 --- /dev/null +++ b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfo.cs @@ -0,0 +1,23 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("LabelMonoGame")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] +[assembly: System.Reflection.AssemblyProductAttribute("LabelMonoGame")] +[assembly: System.Reflection.AssemblyTitleAttribute("LabelMonoGame")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Создано классом WriteCodeFragment MSBuild. + diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfoInputs.cache b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfoInputs.cache new file mode 100644 index 0000000..83a487c --- /dev/null +++ b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +eb281257258394298fc3abb5f80064e36f68fb0c diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.GeneratedMSBuildEditorConfig.editorconfig b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..c371ad3 --- /dev/null +++ b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,3 @@ +is_global = true +build_property.RootNamespace = LabelMonoGame +build_property.ProjectDir = C:\Users\Semejkin_AV\Desktop\Pacman_refactored\LabelMonoGame\ diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.assets.cache b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.assets.cache new file mode 100644 index 0000000..f75d661 Binary files /dev/null and b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.assets.cache differ diff --git a/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.csproj.AssemblyReference.cache b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.csproj.AssemblyReference.cache new file mode 100644 index 0000000..39d745c Binary files /dev/null and b/LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.csproj.AssemblyReference.cache differ diff --git a/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.dgspec.json b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.dgspec.json new file mode 100644 index 0000000..6763975 --- /dev/null +++ b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.dgspec.json @@ -0,0 +1,74 @@ +{ + "format": 1, + "restore": { + "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj": {} + }, + "projects": { + "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj", + "projectName": "LabelMonoGame", + "projectPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj", + "packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\Semejkin_AV\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "C:\\Program Files\\dotnet\\library-packs": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "targetAlias": "netcoreapp3.1", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "targetAlias": "netcoreapp3.1", + "dependencies": { + "MonoGame.Framework.DesktopGL": { + "target": "Package", + "version": "[3.8.0.1641, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400-preview.22301.10\\RuntimeIdentifierGraph.json" + } + } + } + } +} \ No newline at end of file diff --git a/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.props b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.props new file mode 100644 index 0000000..97558c5 --- /dev/null +++ b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.props @@ -0,0 +1,16 @@ + + + + True + NuGet + $(MSBuildThisFileDirectory)project.assets.json + $(UserProfile)\.nuget\packages\ + C:\Users\Semejkin_AV\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages + PackageReference + 6.3.0 + + + + + + \ No newline at end of file diff --git a/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.targets b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.targets new file mode 100644 index 0000000..3d2bae3 --- /dev/null +++ b/LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.targets @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/LabelMonoGame/obj/project.assets.json b/LabelMonoGame/obj/project.assets.json new file mode 100644 index 0000000..d208ce7 --- /dev/null +++ b/LabelMonoGame/obj/project.assets.json @@ -0,0 +1,155 @@ +{ + "version": 3, + "targets": { + ".NETCoreApp,Version=v3.1": { + "MonoGame.Framework.DesktopGL/3.8.0.1641": { + "type": "package", + "compile": { + "lib/netstandard2.0/MonoGame.Framework.dll": {} + }, + "runtime": { + "lib/netstandard2.0/MonoGame.Framework.dll": {} + }, + "build": { + "build/MonoGame.Framework.DesktopGL.targets": {} + }, + "runtimeTargets": { + "runtimes/linux-x64/native/libSDL2-2.0.so.0": { + "assetType": "native", + "rid": "linux-x64" + }, + "runtimes/linux-x64/native/libopenal.so.1": { + "assetType": "native", + "rid": "linux-x64" + }, + "runtimes/osx/native/libSDL2-2.0.0.dylib": { + "assetType": "native", + "rid": "osx" + }, + "runtimes/osx/native/libopenal.1.dylib": { + "assetType": "native", + "rid": "osx" + }, + "runtimes/win-x64/native/SDL2.dll": { + "assetType": "native", + "rid": "win-x64" + }, + "runtimes/win-x64/native/soft_oal.dll": { + "assetType": "native", + "rid": "win-x64" + }, + "runtimes/win-x86/native/SDL2.dll": { + "assetType": "native", + "rid": "win-x86" + }, + "runtimes/win-x86/native/soft_oal.dll": { + "assetType": "native", + "rid": "win-x86" + } + } + } + } + }, + "libraries": { + "MonoGame.Framework.DesktopGL/3.8.0.1641": { + "sha512": "rJQlrlHQbnOECYV6EcQ8GlGRQ2lzPTroXQcyyOZ0ki+BQRSJEN2zVBm9skqLiXya348aGAfTSSGTaSKjAy9NaA==", + "type": "package", + "path": "monogame.framework.desktopgl/3.8.0.1641", + "files": [ + ".nupkg.metadata", + ".signature.p7s", + "Icon.png", + "build/MonoGame.Framework.DesktopGL.targets", + "lib/net452/MonoGame.Framework.dll", + "lib/net452/MonoGame.Framework.xml", + "lib/netstandard2.0/MonoGame.Framework.dll", + "lib/netstandard2.0/MonoGame.Framework.xml", + "monogame.framework.desktopgl.3.8.0.1641.nupkg.sha512", + "monogame.framework.desktopgl.nuspec", + "runtimes/linux-x64/native/libSDL2-2.0.so.0", + "runtimes/linux-x64/native/libopenal.so.1", + "runtimes/osx/native/libSDL2-2.0.0.dylib", + "runtimes/osx/native/libopenal.1.dylib", + "runtimes/win-x64/native/SDL2.dll", + "runtimes/win-x64/native/soft_oal.dll", + "runtimes/win-x86/native/SDL2.dll", + "runtimes/win-x86/native/soft_oal.dll" + ] + } + }, + "projectFileDependencyGroups": { + ".NETCoreApp,Version=v3.1": [ + "MonoGame.Framework.DesktopGL >= 3.8.0.1641" + ] + }, + "packageFolders": { + "C:\\Users\\Semejkin_AV\\.nuget\\packages\\": {}, + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} + }, + "project": { + "version": "1.0.0", + "restore": { + "projectUniqueName": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj", + "projectName": "LabelMonoGame", + "projectPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj", + "packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\", + "outputPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\obj\\", + "projectStyle": "PackageReference", + "fallbackFolders": [ + "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" + ], + "configFilePaths": [ + "C:\\Users\\Semejkin_AV\\AppData\\Roaming\\NuGet\\NuGet.Config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", + "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" + ], + "originalTargetFrameworks": [ + "netcoreapp3.1" + ], + "sources": { + "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, + "C:\\Program Files\\dotnet\\library-packs": {}, + "https://api.nuget.org/v3/index.json": {} + }, + "frameworks": { + "netcoreapp3.1": { + "targetAlias": "netcoreapp3.1", + "projectReferences": {} + } + }, + "warningProperties": { + "warnAsError": [ + "NU1605" + ] + } + }, + "frameworks": { + "netcoreapp3.1": { + "targetAlias": "netcoreapp3.1", + "dependencies": { + "MonoGame.Framework.DesktopGL": { + "target": "Package", + "version": "[3.8.0.1641, )" + } + }, + "imports": [ + "net461", + "net462", + "net47", + "net471", + "net472", + "net48", + "net481" + ], + "assetTargetFallback": true, + "warn": true, + "frameworkReferences": { + "Microsoft.NETCore.App": { + "privateAssets": "all" + } + }, + "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400-preview.22301.10\\RuntimeIdentifierGraph.json" + } + } + } +} \ No newline at end of file diff --git a/LabelMonoGame/obj/project.nuget.cache b/LabelMonoGame/obj/project.nuget.cache new file mode 100644 index 0000000..6d1ef47 --- /dev/null +++ b/LabelMonoGame/obj/project.nuget.cache @@ -0,0 +1,10 @@ +{ + "version": 2, + "dgSpecHash": "4CtLDvXCle59fdKhx18wrAPDRQzHxMWYsNhseQIGFpDdg6o4LqPUDbE0X2onB+aUibcM5JoqNJ3vl6ZIaTxvJA==", + "success": true, + "projectFilePath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\LabelMonoGame\\LabelMonoGame.csproj", + "expectedPackageFiles": [ + "C:\\Users\\Semejkin_AV\\.nuget\\packages\\monogame.framework.desktopgl\\3.8.0.1641\\monogame.framework.desktopgl.3.8.0.1641.nupkg.sha512" + ], + "logs": [] +} \ No newline at end of file diff --git a/Pacman_refactored.sln b/Pacman_refactored.sln index e7a55bd..3da6361 100644 --- a/Pacman_refactored.sln +++ b/Pacman_refactored.sln @@ -1,9 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32413.511 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32611.2 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pacman_refactored", "Pacman_refactored\Pacman_refactored.csproj", "{8C511935-ED5F-4850-8EF4-32058A50A89E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pacman_refactored", "Pacman_refactored\Pacman_refactored.csproj", "{8C511935-ED5F-4850-8EF4-32058A50A89E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LabelMonoGame", "LabelMonoGame\LabelMonoGame.csproj", "{70F40C9C-E4A8-4199-8B94-F5E5A97C25A1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {8C511935-ED5F-4850-8EF4-32058A50A89E}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C511935-ED5F-4850-8EF4-32058A50A89E}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C511935-ED5F-4850-8EF4-32058A50A89E}.Release|Any CPU.Build.0 = Release|Any CPU + {70F40C9C-E4A8-4199-8B94-F5E5A97C25A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70F40C9C-E4A8-4199-8B94-F5E5A97C25A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70F40C9C-E4A8-4199-8B94-F5E5A97C25A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70F40C9C-E4A8-4199-8B94-F5E5A97C25A1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Pacman_refactored/Classes/Entity/Ghost.cs b/Pacman_refactored/Classes/Entity/Ghost.cs index 89ed33a..7458cb0 100644 --- a/Pacman_refactored/Classes/Entity/Ghost.cs +++ b/Pacman_refactored/Classes/Entity/Ghost.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Pacman_refactored.Interfaces; diff --git a/Pacman_refactored/Classes/Food/Energizer.cs b/Pacman_refactored/Classes/Food/Energizer.cs index 7720112..a7397ca 100644 --- a/Pacman_refactored/Classes/Food/Energizer.cs +++ b/Pacman_refactored/Classes/Food/Energizer.cs @@ -1,9 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Text; -using Pacman_refactored.Classes.Interfaces; + +using Pacman_refactored.Interfaces; namespace Pacman_refactored.Classes.Food { diff --git a/Pacman_refactored/Classes/Food/Fruit.cs b/Pacman_refactored/Classes/Food/Fruit.cs index 8fe7ca8..862bd6f 100644 --- a/Pacman_refactored/Classes/Food/Fruit.cs +++ b/Pacman_refactored/Classes/Food/Fruit.cs @@ -1,8 +1,5 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Text; namespace Pacman_refactored.Classes.Food { diff --git a/Pacman_refactored/Classes/UI/GameOverMenu.cs b/Pacman_refactored/Classes/UI/GameOverMenu.cs new file mode 100644 index 0000000..26f3912 --- /dev/null +++ b/Pacman_refactored/Classes/UI/GameOverMenu.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Pacman_refactored.Classes.UI +{ + public class GameOverMenu : Menu + { + } +} diff --git a/Pacman_refactored/Classes/UI/Label/Label.cs b/Pacman_refactored/Classes/UI/Label/Label.cs deleted file mode 100644 index 7b57902..0000000 --- a/Pacman_refactored/Classes/UI/Label/Label.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; - -namespace Pacman_refactored.Classes.UI.Label -{ - public class Label - { - public Vector2 Position { get; set; } - - public SpriteFont SpriteFont { get; set; } - public Color Color { get; set; } - - public string Text { get; set; } - - public Label() - { - Position = new Vector2(0, 0); - Text = "Label"; - Color = Color.White; - } - - public Label(SpriteFont sprteFont, string text, Vector2 position, Color color) - { - SpriteFont = sprteFont; - Text = text; - Position = position; - Color = color; - } - } -} diff --git a/Pacman_refactored/Classes/UI/MainMenu.cs b/Pacman_refactored/Classes/UI/MainMenu.cs new file mode 100644 index 0000000..23632f5 --- /dev/null +++ b/Pacman_refactored/Classes/UI/MainMenu.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Pacman_refactored.Classes.UI +{ + public class MainMenu : Menu + { + } +} diff --git a/Pacman_refactored/Classes/UI/Menu.cs b/Pacman_refactored/Classes/UI/Menu.cs index 829c8f3..576e893 100644 --- a/Pacman_refactored/Classes/UI/Menu.cs +++ b/Pacman_refactored/Classes/UI/Menu.cs @@ -1,14 +1,56 @@ -using System; -using System.Collections.Generic; -using System.Text; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Pacman_refactored.Enums; using Pacman_refactored.Interfaces; +using Mootfrost.Monogame.Label; +using Mootfrost.Monogame.Label.Properties; namespace Pacman_refactored.Classes.UI { public abstract class Menu : IControl { + public abstract SpriteFont SpriteFont { get; set; } + + public abstract Vector2 Position { get; set; } + public abstract Vector2 ScreenSize { get; set; } + public abstract string[] MenuItems { get; set; } + public abstract int SelectedItem { get; set; } + + public abstract Direction PrevDirection { get; set; } + + public virtual void Update(GameTime gameTime) + { + Direction direction = IControl.GetDirection(); + if (direction != PrevDirection) + { + if (direction == Direction.Up && SelectedItem > 0) + { + SelectedItem--; + } + else if (direction == Direction.Down && SelectedItem < MenuItems.Length - 1) + { + SelectedItem++; + } + } + PrevDirection = direction; + } + + public virtual void Draw(SpriteBatch spriteBatch) + { + for (int i = 0; i < MenuItems.Length; i++) + { + string element = MenuItems[i]; + if (SelectedItem == i) + { + element = $">{element}<"; + } + Label label = new Label(SpriteFont, element, Position, ScreenSize, Color.White); + label.HorizontalAlignment = HorizontalAlignment.Center; + + label.Draw(spriteBatch); + } + } } } diff --git a/Pacman_refactored/Interfaces/IAnimate.cs b/Pacman_refactored/Interfaces/IAnimate.cs index c59450d..4b3eedf 100644 --- a/Pacman_refactored/Interfaces/IAnimate.cs +++ b/Pacman_refactored/Interfaces/IAnimate.cs @@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Input; using System.Collections.Generic; using System; -namespace Pacman_refactored.Classes.Interfaces +namespace Pacman_refactored.Interfaces { public interface IAnimate { diff --git a/Pacman_refactored/Interfaces/IBoostable.cs b/Pacman_refactored/Interfaces/IBoostable.cs index 710f391..855e54d 100644 --- a/Pacman_refactored/Interfaces/IBoostable.cs +++ b/Pacman_refactored/Interfaces/IBoostable.cs @@ -2,15 +2,10 @@ using System.Collections.Generic; using System.Text; -namespace Pacman_refactored.Classes.Interfaces +namespace Pacman_refactored.Interfaces { public interface IBoostable { int BoostCooldown { get; set; } - - void OnBoost(Entity entity) - { - - } } } diff --git a/Pacman_refactored/Pacman_refactored.csproj b/Pacman_refactored/Pacman_refactored.csproj index d05bbcf..b37106c 100644 --- a/Pacman_refactored/Pacman_refactored.csproj +++ b/Pacman_refactored/Pacman_refactored.csproj @@ -28,6 +28,6 @@ - + \ No newline at end of file