Structure

This commit is contained in:
Mootfrost777 2022-07-06 18:45:56 +03:00
parent c0acfb2266
commit ec25bf6c03
46 changed files with 467 additions and 44 deletions

Binary file not shown.

12
MonogameLabel/Class1.cs Normal file
View file

@ -0,0 +1,12 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonogameLabel.Enums;
namespace MonogameLabel
{
public class Label
{
}
}

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")]

View file

@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MonogameLabel")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("MonogameLabel")]
[assembly: System.Reflection.AssemblyTitleAttribute("MonogameLabel")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild.

View file

@ -0,0 +1 @@
f3488a544923f5cf4ff627a8dd1187148f38bf5b

View file

@ -0,0 +1,3 @@
is_global = true
build_property.RootNamespace = MonogameLabel
build_property.ProjectDir = C:\Users\Semejkin_AV\Desktop\Pacman_refactored\MonogameLabel\

View file

@ -0,0 +1,68 @@
{
"format": 1,
"restore": {
"C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj": {}
},
"projects": {
"C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj",
"projectName": "MonogameLabel",
"projectPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj",
"packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\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",
"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"
}
}
}
}
}

View 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>

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View file

@ -0,0 +1,74 @@
{
"version": 3,
"targets": {
".NETCoreApp,Version=v3.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v3.1": []
},
"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\\MonogameLabel\\MonogameLabel.csproj",
"projectName": "MonogameLabel",
"projectPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj",
"packagesPath": "C:\\Users\\Semejkin_AV\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\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",
"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"
}
}
}
}

View file

@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "GuTjaNW1kyQRhs8Q1u1GRgtNGJfpTPHLcEAL+P1F2jjRV37oir+kqpfDQBZes3GQpvzr1fukhjH4xyH8JzhpAQ==",
"success": true,
"projectFilePath": "C:\\Users\\Semejkin_AV\\Desktop\\Pacman_refactored\\MonogameLabel\\MonogameLabel.csproj",
"expectedPackageFiles": [],
"logs": []
}

View file

@ -2,10 +2,10 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pacman_refactored.Classes.Interfaces;
using System.Runtime.CompilerServices;
using Pacman_refactored.Interfaces;
using Pacman_refactored.Enums;
namespace Pacman_refactored.Classes
namespace Pacman_refactored.Classes.Entity
{
public abstract class Entity : IMovable, IRotatable, IAnimate
{
@ -27,9 +27,10 @@ namespace Pacman_refactored.Classes
public abstract int TextureNumber { get; set; }
public abstract int TextureCount { get; set; }
public virtual void Update(GameTime gameTime)
{
Boundingbox = new Rectangle((int)Position.X, (int)Position.Y, (int)CellSize, (int)CellSize);
Boundingbox = new Rectangle((int)Position.X, (int)Position.Y, CellSize, CellSize);
IMovable.DirectionMove(Direction, Position, Speed, Game1.Map);
}

View file

@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Pacman_refactored.Classes.Interfaces;
namespace Pacman_refactored.Classes
using Pacman_refactored.Interfaces;
using Pacman_refactored.Enums;
namespace Pacman_refactored.Classes.Entity
{
public class Ghost : Entity, IAnimate, IMovable
{

View file

@ -1,9 +1,11 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pacman_refactored.Classes.Interfaces;
namespace Pacman_refactored.Classes
using Pacman_refactored.Interfaces;
using Pacman_refactored.Enums;
namespace Pacman_refactored.Classes.Entity
{
public class Pacman : Entity, IMovable, IRotatable, IAnimate, IControl
{

View file

@ -1,33 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes
{
public enum Direction
{
Up,
Down,
Left,
Right,
None
}
public enum GameState
{
Game,
Menu,
GameOver,
NextLevel,
HowToPlay,
Exit
}
public enum GhostType
{
Blinky,
Pinky,
Inky,
Clyde
}
}

View file

@ -0,0 +1,23 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes.Food
{
public class Dot : Food
{
public override Texture2D Texture { get; set; }
public override Vector2 Position { get; set; }
public override int Scale { get; set; }
public override int CellSize { get; set; }
public override Rectangle SourceRect { get; set; }
public override Rectangle Boundingbox { get; set; }
public override int Prize { get; set; }
public override bool IsAlive { get; set; }
}
}

View file

@ -0,0 +1,24 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Text;
using Pacman_refactored.Classes.Interfaces;
namespace Pacman_refactored.Classes.Food
{
public class Energizer : Food, IAnimate
{
public override Texture2D Texture { get; set; }
public override Vector2 Position { get; set; }
public override int Scale { get; set; }
public override int CellSize { get; set; }
public override Rectangle SourceRect { get; set; }
public override Rectangle Boundingbox { get; set; }
public override int Prize { get; set; }
public override bool IsAlive { get; set; }
}
}

View file

@ -0,0 +1,29 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Pacman_refactored.Classes.Food
{
public abstract class Food
{
public abstract Texture2D Texture { get; set; }
public abstract Vector2 Position { get; set; }
public abstract int Scale { get; set; }
public abstract int CellSize { get; set; }
public abstract Rectangle SourceRect { get; set; }
public abstract Rectangle Boundingbox { get; set; }
public abstract int Prize { get; set; }
public abstract bool IsAlive { get; set; }
public void Draw(SpriteBatch spriteBatch)
{
if (IsAlive)
{
spriteBatch.Draw(Texture, Position, SourceRect, Color.White, 0, new Vector2(CellSize / 2), (float)Scale, SpriteEffects.None, 0);
}
}
}
}

View file

@ -0,0 +1,23 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes.Food
{
public class Fruit : Food
{
public override Texture2D Texture { get; set; }
public override Vector2 Position { get; set; }
public override int Scale { get; set; }
public override int CellSize { get; set; }
public override Rectangle SourceRect { get; set; }
public override Rectangle Boundingbox { get; set; }
public override int Prize { get; set; }
public override bool IsAlive { get; set; }
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes.UI.Label.Enums
{
public enum HoriZontalAlignment
{
Top,
Center,
Right
}
}

View file

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes.UI.Label.Enums
{
public enum VerticalAlignment
{
Top,
Center,
Bottom
}
}

View file

@ -0,0 +1,30 @@
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;
}
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
using Pacman_refactored.Enums;
using Pacman_refactored.Interfaces;
namespace Pacman_refactored.Classes.UI
{
public abstract class Menu : IControl
{
public abstract string[] MenuItems { get; set; }
}
}

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Enums
{
public enum Direction
{
Up,
Down,
Left,
Right,
None
}
}

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Enums
{
public enum GameState
{
Game,
Menu,
GameOver,
NextLevel,
HowToPlay,
Exit
}
}

View file

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Enums
{
public enum GhostType
{
Blinky,
Pinky,
Inky,
Clyde
}
}

View file

@ -2,6 +2,8 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Pacman_refactored.Classes;
namespace Pacman_refactored
{
public class Game1 : Game
@ -9,11 +11,15 @@ namespace Pacman_refactored
private GraphicsDeviceManager _graphics;
private SpriteBatch _spriteBatch;
public static Map Map;
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
Map = new Map();
}
protected override void Initialize()

View file

@ -6,5 +6,11 @@ namespace Pacman_refactored.Classes.Interfaces
{
public interface IBoostable
{
int BoostCooldown { get; set; }
void OnBoost(Entity entity)
{
}
}
}

View file

@ -3,7 +3,9 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
namespace Pacman_refactored.Classes.Interfaces
using Pacman_refactored.Enums;
namespace Pacman_refactored.Interfaces
{
public interface IControl
{

View file

@ -3,7 +3,10 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.Collections.Generic;
namespace Pacman_refactored.Classes.Interfaces
using Pacman_refactored.Enums;
using Pacman_refactored.Classes;
namespace Pacman_refactored.Interfaces
{
public interface IMovable
{

View file

@ -2,7 +2,9 @@
using System.Collections.Generic;
using System.Text;
namespace Pacman_refactored.Classes.Interfaces
using Pacman_refactored.Enums;
namespace Pacman_refactored.Interfaces
{
public interface IRotatable
{