Menu structure. Simple label lib.
This commit is contained in:
parent
ec25bf6c03
commit
11fe1d18e9
38 changed files with 524 additions and 59 deletions
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
137
LabelMonoGame/Label.cs
Normal file
137
LabelMonoGame/Label.cs
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sprteFont"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <param name="endPosition">Right side of label. Needed for alignments. Can be screen size.</param>
|
||||||
|
/// <param name="color"></param>
|
||||||
|
public Label(SpriteFont sprteFont, string text, Vector2 position, Vector2 endPosition, Color color)
|
||||||
|
{
|
||||||
|
SpriteFont = sprteFont;
|
||||||
|
Text = text;
|
||||||
|
Position = position;
|
||||||
|
EndPosition = endPosition;
|
||||||
|
Color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sprteFont"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <param name="endPosition">Right side of label. Needed for alignments. Can be screen size.</param>
|
||||||
|
/// <param name="scale">Needed for scaling font. You can use multiple spritefonts instead.</param>
|
||||||
|
/// <param name="color"></param>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sprteFont"></param>
|
||||||
|
/// <param name="text"></param>
|
||||||
|
/// <param name="position"></param>
|
||||||
|
/// <param name="endPosition">Right side of label. Needed for alignments. Can be screen size.</param>
|
||||||
|
/// <param name="scale">Needed for scaling font. You can use multiple spritefonts instead.</param>
|
||||||
|
/// <param name="rotation">Label rotation in radians.</param>
|
||||||
|
/// <param name="color"></param>
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
LabelMonoGame/LabelMonoGame.csproj
Normal file
11
LabelMonoGame/LabelMonoGame.csproj
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -2,11 +2,11 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.UI.Label.Enums
|
namespace Mootfrost.Monogame.Label.Properties
|
||||||
{
|
{
|
||||||
public enum HoriZontalAlignment
|
public enum HorizontalAlignment
|
||||||
{
|
{
|
||||||
Top,
|
Left,
|
||||||
Center,
|
Center,
|
||||||
Right
|
Right
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.UI.Label.Enums
|
namespace Mootfrost.Monogame.Label.Properties
|
||||||
{
|
{
|
||||||
public enum VerticalAlignment
|
public enum VerticalAlignment
|
||||||
{
|
{
|
|
@ -0,0 +1,4 @@
|
||||||
|
// <autogenerated />
|
||||||
|
using System;
|
||||||
|
using System.Reflection;
|
||||||
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]
|
|
@ -0,0 +1,23 @@
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
eb281257258394298fc3abb5f80064e36f68fb0c
|
|
@ -0,0 +1,3 @@
|
||||||
|
is_global = true
|
||||||
|
build_property.RootNamespace = LabelMonoGame
|
||||||
|
build_property.ProjectDir = C:\Users\Semejkin_AV\Desktop\Pacman_refactored\LabelMonoGame\
|
BIN
LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.assets.cache
Normal file
BIN
LabelMonoGame/obj/Debug/netcoreapp3.1/LabelMonoGame.assets.cache
Normal file
Binary file not shown.
Binary file not shown.
74
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.dgspec.json
Normal file
74
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.dgspec.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.props
Normal file
16
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.props
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||||
|
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||||
|
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||||
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||||
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Semejkin_AV\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||||
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<SourceRoot Include="C:\Users\Semejkin_AV\.nuget\packages\" />
|
||||||
|
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
6
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.targets
Normal file
6
LabelMonoGame/obj/LabelMonoGame.csproj.nuget.g.targets
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
|
<Import Project="$(NuGetPackageRoot)monogame.framework.desktopgl\3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('$(NuGetPackageRoot)monogame.framework.desktopgl\3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets')" />
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
155
LabelMonoGame/obj/project.assets.json
Normal file
155
LabelMonoGame/obj/project.assets.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
10
LabelMonoGame/obj/project.nuget.cache
Normal file
10
LabelMonoGame/obj/project.nuget.cache
Normal file
|
@ -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": []
|
||||||
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.32413.511
|
VisualStudioVersion = 17.3.32611.2
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{8C511935-ED5F-4850-8EF4-32058A50A89E}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
using Pacman_refactored.Interfaces;
|
using Pacman_refactored.Interfaces;
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using Pacman_refactored.Interfaces;
|
||||||
using System.Text;
|
|
||||||
using Pacman_refactored.Classes.Interfaces;
|
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.Food
|
namespace Pacman_refactored.Classes.Food
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.Food
|
namespace Pacman_refactored.Classes.Food
|
||||||
{
|
{
|
||||||
|
|
10
Pacman_refactored/Classes/UI/GameOverMenu.cs
Normal file
10
Pacman_refactored/Classes/UI/GameOverMenu.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Pacman_refactored.Classes.UI
|
||||||
|
{
|
||||||
|
public class GameOverMenu : Menu
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
10
Pacman_refactored/Classes/UI/MainMenu.cs
Normal file
10
Pacman_refactored/Classes/UI/MainMenu.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Pacman_refactored.Classes.UI
|
||||||
|
{
|
||||||
|
public class MainMenu : Menu
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,56 @@
|
||||||
using System;
|
using Microsoft.Xna.Framework;
|
||||||
using System.Collections.Generic;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
using Pacman_refactored.Enums;
|
using Pacman_refactored.Enums;
|
||||||
using Pacman_refactored.Interfaces;
|
using Pacman_refactored.Interfaces;
|
||||||
|
using Mootfrost.Monogame.Label;
|
||||||
|
using Mootfrost.Monogame.Label.Properties;
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.UI
|
namespace Pacman_refactored.Classes.UI
|
||||||
{
|
{
|
||||||
public abstract class Menu : IControl
|
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 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ using Microsoft.Xna.Framework.Input;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.Interfaces
|
namespace Pacman_refactored.Interfaces
|
||||||
{
|
{
|
||||||
public interface IAnimate
|
public interface IAnimate
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,15 +2,10 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Pacman_refactored.Classes.Interfaces
|
namespace Pacman_refactored.Interfaces
|
||||||
{
|
{
|
||||||
public interface IBoostable
|
public interface IBoostable
|
||||||
{
|
{
|
||||||
int BoostCooldown { get; set; }
|
int BoostCooldown { get; set; }
|
||||||
|
|
||||||
void OnBoost(Entity entity)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@
|
||||||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
|
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Classes\UI\" />
|
<ProjectReference Include="..\LabelMonoGame\LabelMonoGame.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Add table
Reference in a new issue