diff --git a/Sledgemapper.Api/Controllers/SessionController.cs b/Sledgemapper.Api/Controllers/SessionController.cs index f625b46..d27d699 100644 --- a/Sledgemapper.Api/Controllers/SessionController.cs +++ b/Sledgemapper.Api/Controllers/SessionController.cs @@ -1,9 +1,7 @@ -using System.Net; using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Sledgemapper.Api.Commands; -using Sledgemapper.Api.Handlers; using Sledgemapper.Shared.Entities; using System.Threading.Tasks; diff --git a/Sledgemapper.Api/Data/MyDbContext.cs b/Sledgemapper.Api/Data/MyDbContext.cs index c2e5dce..aca62cd 100644 --- a/Sledgemapper.Api/Data/MyDbContext.cs +++ b/Sledgemapper.Api/Data/MyDbContext.cs @@ -1,8 +1,5 @@ -using System; -using System.Security.AccessControl; using Microsoft.EntityFrameworkCore; using Sledgemapper.Api.Models; -using System.Reflection; namespace Sledgemapper.Api.Data { public static class DbInitializer diff --git a/Sledgemapper.Api/Handlers/DeleteWallCommandHandler.cs b/Sledgemapper.Api/Handlers/DeleteWallCommandHandler.cs index 8142cbb..5fdb16a 100644 --- a/Sledgemapper.Api/Handlers/DeleteWallCommandHandler.cs +++ b/Sledgemapper.Api/Handlers/DeleteWallCommandHandler.cs @@ -1,10 +1,8 @@ using MediatR; -using Microsoft.AspNetCore.Http.Features; using Sledgemapper.Api.Data; using Sledgemapper.Api.Commands; using Sledgemapper.Api.Notifications; using Sledgemapper.Shared.Entities; -using System.Collections.Generic; using System.Linq; using System.Text.Json; using System.Threading; diff --git a/Sledgemapper.Api/Handlers/NewTileCommandHandler.cs b/Sledgemapper.Api/Handlers/NewTileCommandHandler.cs index 4c35841..3169384 100644 --- a/Sledgemapper.Api/Handlers/NewTileCommandHandler.cs +++ b/Sledgemapper.Api/Handlers/NewTileCommandHandler.cs @@ -4,9 +4,7 @@ using Sledgemapper.Api.Data; using System.Text.Json; using System.Threading; using System.Threading.Tasks; -using Sledgemapper.Api.Commands; using Sledgemapper.Api.Notifications; -using Sledgemapper.Api.Handlers; using System.Linq; using Sledgemapper.Shared.Entities; diff --git a/Sledgemapper.Api/Helpers/AppException.cs b/Sledgemapper.Api/Helpers/AppException.cs index bc2acc1..c9601e5 100644 --- a/Sledgemapper.Api/Helpers/AppException.cs +++ b/Sledgemapper.Api/Helpers/AppException.cs @@ -12,7 +12,7 @@ namespace Sledgemapper.Helpers public AppException(string message) : base(message) { } public AppException(string message, params object[] args) - : base(String.Format(CultureInfo.CurrentCulture, message, args)) + : base(string.Format(CultureInfo.CurrentCulture, message, args)) { } } diff --git a/Sledgemapper.Api/Hubs/SledgemapperHub.cs b/Sledgemapper.Api/Hubs/SledgemapperHub.cs index 6af2a02..ae25fd3 100644 --- a/Sledgemapper.Api/Hubs/SledgemapperHub.cs +++ b/Sledgemapper.Api/Hubs/SledgemapperHub.cs @@ -16,7 +16,7 @@ namespace SignalRChat.Hubs [Authorize] public class SledgemapperHub : Hub { - private static readonly ConcurrentDictionary UserColors = new ConcurrentDictionary(); + private static readonly ConcurrentDictionary UserColors = new(); private readonly MyDbContext _dbContext; private readonly DataContext _datacontext; @@ -29,7 +29,8 @@ namespace SignalRChat.Hubs // other colors // #cca300, #20f200, #004011, #00e6d6, #005c73, #0057d9, #d900ca, #660029, #d9003a // private static Dictionary _sessions = new Dictionary(); - public List Colors = new List{ + public List Colors = new() + { "#e6194B", "#f58231", "#3cb44b", diff --git a/Sledgemapper.Api/Migrations/SqlServerMigrations/20200102103423_InitialCreate.cs b/Sledgemapper.Api/Migrations/SqlServerMigrations/20200102103423_InitialCreate.cs index 8da30fd..4be075f 100644 --- a/Sledgemapper.Api/Migrations/SqlServerMigrations/20200102103423_InitialCreate.cs +++ b/Sledgemapper.Api/Migrations/SqlServerMigrations/20200102103423_InitialCreate.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace Sledgemapper.Migrations.SqlServerMigrations { diff --git a/Sledgemapper.Api/Migrations/SqliteMigrations/20200102102942_InitialCreate.cs b/Sledgemapper.Api/Migrations/SqliteMigrations/20200102102942_InitialCreate.cs index 53138eb..65b8fc1 100644 --- a/Sledgemapper.Api/Migrations/SqliteMigrations/20200102102942_InitialCreate.cs +++ b/Sledgemapper.Api/Migrations/SqliteMigrations/20200102102942_InitialCreate.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace Sledgemapper.Migrations.SqliteMigrations { diff --git a/Sledgemapper.Api/Models/MapLog.cs b/Sledgemapper.Api/Models/MapLog.cs index 30ecfa1..d519df8 100644 --- a/Sledgemapper.Api/Models/MapLog.cs +++ b/Sledgemapper.Api/Models/MapLog.cs @@ -1,4 +1,3 @@ -using System; using System.ComponentModel.DataAnnotations; namespace Sledgemapper.Api.Models diff --git a/Sledgemapper.Api/Models/Session.cs b/Sledgemapper.Api/Models/Session.cs index 3876fcc..ac1d57c 100644 --- a/Sledgemapper.Api/Models/Session.cs +++ b/Sledgemapper.Api/Models/Session.cs @@ -1,5 +1,3 @@ -using System.Data; -using System; using System.ComponentModel.DataAnnotations; namespace Sledgemapper.Api.Models diff --git a/Sledgemapper.Api/Models/SessionUser.cs b/Sledgemapper.Api/Models/SessionUser.cs index a91a67c..86ba520 100644 --- a/Sledgemapper.Api/Models/SessionUser.cs +++ b/Sledgemapper.Api/Models/SessionUser.cs @@ -1,5 +1,3 @@ -using System.Data; -using System; using System.ComponentModel.DataAnnotations; namespace Sledgemapper.Api.Models diff --git a/Sledgemapper.Api/Models/Snapshot.cs b/Sledgemapper.Api/Models/Snapshot.cs index 39d0721..31b5e55 100644 --- a/Sledgemapper.Api/Models/Snapshot.cs +++ b/Sledgemapper.Api/Models/Snapshot.cs @@ -1,4 +1,3 @@ -using System; using System.ComponentModel.DataAnnotations; namespace Sledgemapper.Api.Models diff --git a/Sledgemapper.Api/Models/UserConnection.cs b/Sledgemapper.Api/Models/UserConnection.cs index 4586c0d..ea32a9c 100644 --- a/Sledgemapper.Api/Models/UserConnection.cs +++ b/Sledgemapper.Api/Models/UserConnection.cs @@ -1,5 +1,3 @@ -using System.Data; -using System; using System.ComponentModel.DataAnnotations; namespace Sledgemapper.Api.Models diff --git a/Sledgemapper.Api/Notifications/BaseNotification.cs b/Sledgemapper.Api/Notifications/BaseNotification.cs index 4bbc027..30b075d 100644 --- a/Sledgemapper.Api/Notifications/BaseNotification.cs +++ b/Sledgemapper.Api/Notifications/BaseNotification.cs @@ -1,5 +1,4 @@ using MediatR; -using Sledgemapper.Shared.Entities; using System; namespace Sledgemapper.Api.Notifications diff --git a/Sledgemapper.Api/Notifications/NewTileNotification.cs b/Sledgemapper.Api/Notifications/NewTileNotification.cs index 6412bd8..0893d68 100644 --- a/Sledgemapper.Api/Notifications/NewTileNotification.cs +++ b/Sledgemapper.Api/Notifications/NewTileNotification.cs @@ -1,6 +1,3 @@ - - -using Sledgemapper.Api.Models; using Sledgemapper.Shared.Entities; namespace Sledgemapper.Api.Notifications diff --git a/Sledgemapper.Api/Program.cs b/Sledgemapper.Api/Program.cs index b7f86b8..8dca27d 100644 --- a/Sledgemapper.Api/Program.cs +++ b/Sledgemapper.Api/Program.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; diff --git a/Sledgemapper.Api/Startup.cs b/Sledgemapper.Api/Startup.cs index a86af33..68a0fd1 100644 --- a/Sledgemapper.Api/Startup.cs +++ b/Sledgemapper.Api/Startup.cs @@ -1,15 +1,12 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.HttpsPolicy; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using SignalRChat.Hubs; -using MediatR.Pipeline; using Sledgemapper.Api.Data; using Microsoft.EntityFrameworkCore; using MediatR; diff --git a/Sledgemapper.Shared/Clients/ISledgemapperClient.cs b/Sledgemapper.Shared/Clients/ISledgemapperClient.cs index bbaa8f4..eb2f426 100644 --- a/Sledgemapper.Shared/Clients/ISledgemapperClient.cs +++ b/Sledgemapper.Shared/Clients/ISledgemapperClient.cs @@ -1,5 +1,4 @@ using Sledgemapper.Shared.Entities; -using System; using System.Threading.Tasks; namespace Sledgemapper.Clients diff --git a/Sledgemapper.Shared/ExtensionMethods.cs b/Sledgemapper.Shared/ExtensionMethods.cs index 0764ea7..d363d92 100644 --- a/Sledgemapper.Shared/ExtensionMethods.cs +++ b/Sledgemapper.Shared/ExtensionMethods.cs @@ -5,7 +5,7 @@ namespace SignalRChat.Hubs { public static class ExtensionMethods { - private static Random rng = new Random(); + private static Random rng = new(); public static void Shuffle(this IList list) { diff --git a/Sledgemapper.sln b/Sledgemapper.sln index 77a1b49..2275483 100644 --- a/Sledgemapper.sln +++ b/Sledgemapper.sln @@ -9,8 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sledgemapper.Api", "Sledgem EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sledgemapper.Shared", "Sledgemapper.Shared\Sledgemapper.Shared.csproj", "{7194CFCC-AECB-494F-AA7D-2E0E286A5F34}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi", "Identity\WebApi.csproj", "{9479E33D-08EE-4B50-B6D0-218801A6E7AC}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,10 +27,6 @@ Global {7194CFCC-AECB-494F-AA7D-2E0E286A5F34}.Debug|Any CPU.Build.0 = Debug|Any CPU {7194CFCC-AECB-494F-AA7D-2E0E286A5F34}.Release|Any CPU.ActiveCfg = Release|Any CPU {7194CFCC-AECB-494F-AA7D-2E0E286A5F34}.Release|Any CPU.Build.0 = Release|Any CPU - {9479E33D-08EE-4B50-B6D0-218801A6E7AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9479E33D-08EE-4B50-B6D0-218801A6E7AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9479E33D-08EE-4B50-B6D0-218801A6E7AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9479E33D-08EE-4B50-B6D0-218801A6E7AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Sledgemapper/CommunicationManager.cs b/Sledgemapper/CommunicationManager.cs index 2eeb646..9eeae14 100644 --- a/Sledgemapper/CommunicationManager.cs +++ b/Sledgemapper/CommunicationManager.cs @@ -17,8 +17,8 @@ namespace Sledgemapper { public IMapApi Api { get; private set; } public HubConnection Connection { get; private set; } - public Session SessionData; - private ChannelsQueue Queue = new ChannelsQueue(); + public readonly Session SessionData; + private readonly ChannelsQueue Queue = new(); private AuthenticateResponse _authenticateResponse; public CommunicationManager(Session sessionData) diff --git a/Sledgemapper/ExtensionMethods.cs b/Sledgemapper/ExtensionMethods.cs index e3da5e2..e9d0ee1 100644 --- a/Sledgemapper/ExtensionMethods.cs +++ b/Sledgemapper/ExtensionMethods.cs @@ -1,6 +1,4 @@ -// using MonoGame.Extended; using System.Collections.Generic; -using System.Collections; using System.IO; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework; @@ -12,10 +10,10 @@ namespace Sledgemapper { public static Dictionary LoadContentFolder(this ContentManager contentManager, string contentFolder) { - DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory + "/" + contentFolder); + DirectoryInfo dir = new(contentManager.RootDirectory + "/" + contentFolder); if (!dir.Exists) throw new DirectoryNotFoundException(); - Dictionary result = new Dictionary(); + Dictionary result = new(); FileInfo[] files = dir.GetFiles("*.*"); foreach (FileInfo file in files) diff --git a/Sledgemapper/IIdentityApi.cs b/Sledgemapper/IIdentityApi.cs index 57fc5ff..ea50fdb 100644 --- a/Sledgemapper/IIdentityApi.cs +++ b/Sledgemapper/IIdentityApi.cs @@ -1,10 +1,6 @@ using Refit; using Sledgemapper.Shared.Entities; -using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; -using System.Text; using System.Threading.Tasks; namespace Sledgemapper diff --git a/Sledgemapper/IMapApi.cs b/Sledgemapper/IMapApi.cs index 43d6365..aa369d4 100644 --- a/Sledgemapper/IMapApi.cs +++ b/Sledgemapper/IMapApi.cs @@ -1,10 +1,6 @@ using Refit; using Sledgemapper.Shared.Entities; -using System; -using System.Collections.Generic; -using System.Linq; using System.Net.Http; -using System.Text; using System.Threading.Tasks; namespace Sledgemapper diff --git a/Sledgemapper/ObjectExtensions.cs b/Sledgemapper/ObjectExtensions.cs index f93d0f1..5749b10 100644 --- a/Sledgemapper/ObjectExtensions.cs +++ b/Sledgemapper/ObjectExtensions.cs @@ -6,19 +6,19 @@ namespace System { public static class ObjectExtensions { - private static readonly MethodInfo CloneMethod = typeof(Object).GetMethod("MemberwiseClone", BindingFlags.NonPublic | BindingFlags.Instance); + private static readonly MethodInfo CloneMethod = typeof(object).GetMethod("MemberwiseClone", BindingFlags.NonPublic | BindingFlags.Instance); public static bool IsPrimitive(this Type type) { - if (type == typeof(String)) return true; - return (type.IsValueType & type.IsPrimitive); + if (type == typeof(string)) return true; + return type.IsValueType && type.IsPrimitive; } - public static Object Copy(this Object originalObject) + public static object Copy(this object originalObject) { - return InternalCopy(originalObject, new Dictionary(new ReferenceEqualityComparer())); + return InternalCopy(originalObject, new Dictionary(new ReferenceEqualityComparer())); } - private static Object InternalCopy(Object originalObject, IDictionary visited) + private static object InternalCopy(object originalObject, IDictionary visited) { if (originalObject == null) return null; var typeToReflect = originalObject.GetType(); @@ -29,7 +29,7 @@ namespace System if (typeToReflect.IsArray) { var arrayType = typeToReflect.GetElementType(); - if (IsPrimitive(arrayType) == false) + if (!IsPrimitive(arrayType)) { Array clonedArray = (Array)cloneObject; clonedArray.ForEach((array, indices) => array.SetValue(InternalCopy(clonedArray.GetValue(indices), visited), indices)); @@ -55,7 +55,7 @@ namespace System { foreach (FieldInfo fieldInfo in typeToReflect.GetFields(bindingFlags)) { - if (filter != null && filter(fieldInfo) == false) continue; + if (filter != null && !filter(fieldInfo)) continue; if (IsPrimitive(fieldInfo.FieldType)) continue; var originalFieldValue = fieldInfo.GetValue(originalObject); var clonedFieldValue = InternalCopy(originalFieldValue, visited); @@ -64,11 +64,11 @@ namespace System } public static T Copy(this T original) { - return (T)Copy((Object)original); + return (T)Copy((object)original); } } - public class ReferenceEqualityComparer : EqualityComparer + public class ReferenceEqualityComparer : EqualityComparer { public override bool Equals(object x, object y) { @@ -88,7 +88,7 @@ namespace System public static void ForEach(this Array array, Action action) { if (array.LongLength == 0) return; - ArrayTraverse walker = new ArrayTraverse(array); + ArrayTraverse walker = new(array); do action(array, walker.Position); while (walker.Step()); } @@ -97,7 +97,7 @@ namespace System internal class ArrayTraverse { public int[] Position; - private int[] maxLengths; + private readonly int[] maxLengths; public ArrayTraverse(Array array) { diff --git a/Sledgemapper/Sledgemapper.cs b/Sledgemapper/Sledgemapper.cs index 5bb8a9b..70cea4b 100644 --- a/Sledgemapper/Sledgemapper.cs +++ b/Sledgemapper/Sledgemapper.cs @@ -1,4 +1,4 @@ -using Microsoft.AspNetCore.SignalR.Client; +using Microsoft.AspNetCore.SignalR.Client; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; @@ -7,16 +7,13 @@ using Myra.Graphics2D.Brushes; using Myra.Graphics2D.TextureAtlases; using Myra.Graphics2D.UI; using Myra.Graphics2D.UI.File; -using Myra.Graphics2D.UI.Properties; using Newtonsoft.Json; -using Refit; using Sledgemapper.Shared.Entities; using Sledgemapper.UI; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Net.Http; namespace Sledgemapper { @@ -29,9 +26,9 @@ namespace Sledgemapper private readonly Desktop _desktop; private KeyboardState oldState; private MouseState oldMouseState; - private Vector3 _viewportCenter = new Vector3(0, 0, 0); + private Vector3 _viewportCenter = new(0, 0, 0); private Dictionary _fonts; - private Session _sessionData; + private readonly Session _sessionData; private AuthenticateResponse _authResponse; private MainWidget _mainWidget; @@ -41,7 +38,6 @@ namespace Sledgemapper _graphics.GraphicsProfile = GraphicsProfile.Reach; _graphics.PreferMultiSampling = false; - //GraphicsDevice?.PresentationParameters.MultiSampleCount = 8; Content.RootDirectory = "Content"; _desktop = new Desktop(); @@ -114,7 +110,7 @@ namespace Sledgemapper { var mouseState = Mouse.GetState(); - var screenPosition = new Point((mouseState.Position.X - (int)_viewportCenter.X), (mouseState.Position.Y - (int)_viewportCenter.Y)); + var screenPosition = new Point(mouseState.Position.X - (int)_viewportCenter.X, mouseState.Position.Y - (int)_viewportCenter.Y); _state._hoveredTile.X = screenPosition.X / _state._tileSize; _state._hoveredTile.Y = screenPosition.Y / _state._tileSize; @@ -245,7 +241,6 @@ namespace Sledgemapper { return; } - //GraphicsDevice.Clear(new Color(24,118,157)); GraphicsDevice.Clear(Color.LightGray); var visibleTilesX = GraphicsDevice.Viewport.Width / _state._tileSize + 1; @@ -481,19 +476,13 @@ namespace Sledgemapper { var result = await _communicationManager.Api.NewSession(localContent.TxtSession.Text); - // var session = await _communicationManager.Connection?.InvokeAsync("NewSession", localContent.TxtSession.Text, _authResponse.Initials); if (result) { - //_sessionData; - _sessionData.SessionName = localContent.TxtSession.Text; - _sessionData.MapEntityAdded -= OnMapEntityAdded; _sessionData.MapEntityDeleted -= OnMapEntityDeleted; _sessionData.MapEntityAdded += OnMapEntityAdded; _sessionData.MapEntityDeleted += OnMapEntityDeleted; - // _sessionData.Players = session.Players; - } successful = result; var result2 = await _communicationManager.Connection?.InvokeAsync("JoinSession", localContent.TxtSession.Text); @@ -508,7 +497,10 @@ namespace Sledgemapper if (successful) { _sessionData.SessionName = localContent.TxtSession.Text; - _communicationManager.SessionData = _sessionData; + _communicationManager.SessionData.Map = _sessionData.Map; + _communicationManager.SessionData.Overlays = _sessionData.Overlays; + _communicationManager.SessionData.Walls = _sessionData.Walls; + localWindow.Close(); } } @@ -642,7 +634,7 @@ namespace Sledgemapper private void OnMenuConnectJoinSelected(object sender, EventArgs e) { - Window window = new Window + Window window = new() { Title = "Join mapping session" }; @@ -657,7 +649,7 @@ namespace Sledgemapper private void OnMenuConnectLoginSelected(object sender, EventArgs e) { - Window window = new Window + Window window = new() { Title = "Login" }; @@ -699,7 +691,6 @@ namespace Sledgemapper private async void OnMenuConnectSyncSelected(object sender, EventArgs e) { - // await _communicationManager.Connection?.InvokeAsync("Sync", _sessionData.SessionName, _sessionData); var serverMap = await _communicationManager.Api.Session(_sessionData.SessionName); _sessionData.Overlays = serverMap.Overlays; _sessionData.Map = serverMap.Map; @@ -709,14 +700,11 @@ namespace Sledgemapper private async void OnMenuConnectUploadSelected(object sender, EventArgs e) { await _communicationManager.Api.SaveSnapshot(_sessionData, _sessionData.SessionName); - // _sessionData.Overlays = serverMap.Overlays; - // _sessionData.Map = serverMap.Map; - // _sessionData.Walls = serverMap.Walls; } private void OnMenuConnectNewSelected(object sender, EventArgs e) { - Window window = new Window + Window window = new() { Title = "New mapping session" }; @@ -731,7 +719,7 @@ namespace Sledgemapper private void OnMenuFileSaveSelected(object sender, EventArgs e) { - FileDialog dialog = new FileDialog(FileDialogMode.SaveFile) + FileDialog dialog = new(FileDialogMode.SaveFile) { Filter = "*.map" }; @@ -744,7 +732,7 @@ namespace Sledgemapper } using StreamWriter file = File.CreateText(dialog.FilePath); - JsonSerializer serializer = new JsonSerializer(); + JsonSerializer serializer = new(); serializer.Serialize(file, _sessionData); }; @@ -765,7 +753,7 @@ namespace Sledgemapper return; } using StreamReader file = File.OpenText(dialog.FilePath); - JsonSerializer serializer = new JsonSerializer(); + JsonSerializer serializer = new(); var loadData = (Session)serializer.Deserialize(file, typeof(Session)); _sessionData.Map=loadData.Map; _sessionData.Overlays=loadData.Overlays; diff --git a/Sledgemapper/State.cs b/Sledgemapper/State.cs index c8e372c..a2179b2 100644 --- a/Sledgemapper/State.cs +++ b/Sledgemapper/State.cs @@ -6,10 +6,10 @@ namespace Sledgemapper { public class State { - public Tile _selectedTile = new Tile { X = 1, Y = 1 }; - public Tile _hoveredTile = new Tile { X = 1, Y = 1 }; - public Wall _selectedWall = new Wall { X = 1, Y = 1 }; - public Overlay _selectedOverlay = new Overlay { X = 1, Y = 1 }; + public Tile _selectedTile = new() { X = 1, Y = 1 }; + public Tile _hoveredTile = new() { X = 1, Y = 1 }; + public Wall _selectedWall = new() { X = 1, Y = 1 }; + public Overlay _selectedOverlay = new() { X = 1, Y = 1 }; public int _tileSize = 30; public string _currentTileId = ""; public string _currentWallId = ""; @@ -54,7 +54,7 @@ namespace Sledgemapper _selectedOverlay.X = _hoveredTile.X; _selectedOverlay.Y = _hoveredTile.Y; var q1 = Math.Pow(mousePosition.X - _hoveredTile.X * _tileSize, 2); - var q2 = Math.Pow((_hoveredTile.Y * _tileSize - mousePosition.Y), 2); + var q2 = Math.Pow(_hoveredTile.Y * _tileSize - mousePosition.Y, 2); var s = Math.Sqrt(q1 + q2); if (s < _tileSize / 3) @@ -73,7 +73,7 @@ namespace Sledgemapper } //q1 = System.Math.Pow(mousePosition.X - (_hoveredTile.X + 1) * _tileSize, 2); - q2 = Math.Pow(((_hoveredTile.Y + 1) * _tileSize - mousePosition.Y), 2); + q2 = Math.Pow((_hoveredTile.Y + 1) * _tileSize - mousePosition.Y, 2); s = Math.Sqrt(q1 + q2); if (s < _tileSize / 3) { @@ -84,7 +84,7 @@ namespace Sledgemapper } q1 = Math.Pow(mousePosition.X - _hoveredTile.X * _tileSize, 2); - q2 = Math.Pow(((_hoveredTile.Y + 1) * _tileSize - mousePosition.Y), 2); + q2 = Math.Pow((_hoveredTile.Y + 1) * _tileSize - mousePosition.Y, 2); s = Math.Sqrt(q1 + q2); if (s < _tileSize / 3) { diff --git a/Sledgemapper/Utils.cs b/Sledgemapper/Utils.cs index 36b8dd8..f12a917 100644 --- a/Sledgemapper/Utils.cs +++ b/Sledgemapper/Utils.cs @@ -1,6 +1,4 @@ using Microsoft.Xna.Framework; -using Sledgemapper.Shared.Entities; -using System; namespace Sledgemapper { @@ -14,7 +12,7 @@ namespace Sledgemapper b1 = Sign(pt, v1, v2) < 0.0f; b2 = Sign(pt, v2, v3) < 0.0f; b3 = Sign(pt, v3, v1) < 0.0f; - return ((b1 == b2) && (b2 == b3)); + return (b1 == b2) && (b2 == b3); } } } \ No newline at end of file