diff --git a/.gitignore b/.gitignore index 4a27b2f..9c07f93 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -# Created by https://www.toptal.com/developers/gitignore/api/visualstudio -# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,rider,csharp,dotnetcore +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,rider,csharp,dotnetcore -### VisualStudio ### +### Csharp ### ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## @@ -357,4 +357,244 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ -# End of https://www.toptal.com/developers/gitignore/api/visualstudio \ No newline at end of file +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +# Common node modules locations +/node_modules +/wwwroot/node_modules + +### Rider ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### VisualStudio ### + +# User-specific files + +# User-specific files (MonoDevelop/Xamarin Studio) + +# Mono auto generated files + +# Build results + +# Visual Studio 2015/2017 cache/options directory +# Uncomment if you have tasks that create the project's static files in wwwroot + +# Visual Studio 2017 auto generated files + +# MSTest test Results + +# NUnit + +# Build Results of an ATL Project + +# Benchmark Results + +# .NET Core + +# StyleCop + +# Files built by Visual Studio + +# Chutzpah Test files + +# Visual C++ cache files + +# Visual Studio profiler + +# Visual Studio Trace Files + +# TFS 2012 Local Workspace + +# Guidance Automation Toolkit + +# ReSharper is a .NET coding add-in + +# TeamCity is a build add-in + +# DotCover is a Code Coverage Tool + +# AxoCover is a Code Coverage Tool + +# Coverlet is a free, cross platform Code Coverage Tool + +# Visual Studio code coverage results + +# NCrunch + +# MightyMoose + +# Web workbench (sass) + +# Installshield output folder + +# DocProject is a documentation generator add-in + +# Click-Once directory + +# Publish Web Output +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted + +# NuGet Packages +# NuGet Symbol Packages +# The packages folder can be ignored because of Package Restore +# except build/, which is used as an MSBuild target. +# Uncomment if necessary however generally it will be regenerated when needed +# NuGet v3's project.json files produces more ignorable files + +# Microsoft Azure Build Output + +# Microsoft Azure Emulator + +# Windows Store app package directories and files + +# Visual Studio cache files +# files ending in .cache can be ignored +# but keep track of directories ending in .cache + +# Others + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) + +# RIA/Silverlight projects + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) + +# SQL Server files + +# Business Intelligence projects + +# Microsoft Fakes + +# GhostDoc plugin setting file + +# Node.js Tools for Visual Studio + +# Visual Studio 6 build log + +# Visual Studio 6 workspace options file + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) + +# Visual Studio LightSwitch build output + +# Paket dependency manager + +# FAKE - F# Make + +# CodeRush personal settings + +# Python Tools for Visual Studio (PTVS) + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio + +# Telerik's JustMock configuration file + +# BizTalk build output + +# OpenCover UI analysis results + +# Azure Stream Analytics local run output + +# MSBuild Binary and Structured Log + +# NVidia Nsight GPU debugger configuration file + +# MFractors (Xamarin productivity tool) working folder + +# Local History for Visual Studio + +# BeatPulse healthcheck temp database + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 + +# Ionide (cross platform F# VS Code tools) working folder + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,rider,csharp,dotnetcore \ No newline at end of file diff --git a/.idea/.idea.NodeEditor.Core.dir/.idea/.name b/.idea/.idea.NodeEditor.Core.dir/.idea/.name new file mode 100644 index 0000000..ae2c028 --- /dev/null +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/.name @@ -0,0 +1 @@ +NodeEditor.Core \ No newline at end of file diff --git a/.idea/.idea.NodeEditor.Core.dir/.idea/encodings.xml b/.idea/.idea.NodeEditor.Core.dir/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor.Core.dir/.idea/indexLayout.xml b/.idea/.idea.NodeEditor.Core.dir/.idea/indexLayout.xml new file mode 100644 index 0000000..27ba142 --- /dev/null +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/modules.xml b/.idea/.idea.NodeEditor.Core.dir/.idea/modules.xml similarity index 62% rename from .idea/.idea.NodeEditor/.idea/modules.xml rename to .idea/.idea.NodeEditor.Core.dir/.idea/modules.xml index cb0411a..233ccee 100644 --- a/.idea/.idea.NodeEditor/.idea/modules.xml +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/modules.xml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/projectSettingsUpdater.xml b/.idea/.idea.NodeEditor.Core.dir/.idea/projectSettingsUpdater.xml similarity index 100% rename from .idea/.idea.NodeEditor/.idea/projectSettingsUpdater.xml rename to .idea/.idea.NodeEditor.Core.dir/.idea/projectSettingsUpdater.xml diff --git a/.idea/.idea.NodeEditor.Core.dir/.idea/riderModule.iml b/.idea/.idea.NodeEditor.Core.dir/.idea/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor.Core.dir/.idea/vcs.xml b/.idea/.idea.NodeEditor.Core.dir/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/.idea.NodeEditor.Core.dir/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/.gitignore b/.idea/.idea.NodeEditor/.idea/.gitignore new file mode 100644 index 0000000..391aacf --- /dev/null +++ b/.idea/.idea.NodeEditor/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +/.idea.NodeEditor.iml +# Datasource local storage ignored files +/../../../../../../../:\Users\Liam\NodeEditor\.idea\.idea.NodeEditor\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/.idea.NodeEditor/.idea/contentModel.xml b/.idea/.idea.NodeEditor/.idea/contentModel.xml deleted file mode 100644 index abfd5e9..0000000 --- a/.idea/.idea.NodeEditor/.idea/contentModel.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/misc.xml b/.idea/.idea.NodeEditor/.idea/misc.xml new file mode 100644 index 0000000..1d8c84d --- /dev/null +++ b/.idea/.idea.NodeEditor/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/.idea/workspace.xml b/.idea/.idea.NodeEditor/.idea/workspace.xml deleted file mode 100644 index 510e3c8..0000000 --- a/.idea/.idea.NodeEditor/.idea/workspace.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - NodeEditor.csproj - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1608418540783 - - - - - - - - - - \ No newline at end of file diff --git a/.idea/.idea.NodeEditor/riderModule.iml b/.idea/.idea.NodeEditor/riderModule.iml new file mode 100644 index 0000000..1a4e0d9 --- /dev/null +++ b/.idea/.idea.NodeEditor/riderModule.iml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/App.config b/App.config deleted file mode 100644 index 56efbc7..0000000 --- a/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/App.xaml b/App.xaml index e08e285..a7bdccb 100644 --- a/App.xaml +++ b/App.xaml @@ -5,14 +5,7 @@ xmlns:local="clr-namespace:NodeEditor" StartupUri="MainWindow.xaml"> - - - - - - - - + diff --git a/Controls/EditorCanvas.xaml b/Controls/EditorCanvas.xaml index 2318208..94225c5 100644 --- a/Controls/EditorCanvas.xaml +++ b/Controls/EditorCanvas.xaml @@ -1,18 +1,20 @@ - - + - + - + + - + - + \ No newline at end of file diff --git a/Controls/EditorCanvas.xaml.cs b/Controls/EditorCanvas.xaml.cs index 9f465c8..b487e0b 100644 --- a/Controls/EditorCanvas.xaml.cs +++ b/Controls/EditorCanvas.xaml.cs @@ -3,27 +3,23 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using System.Web.WebSockets; using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -using MahApps.Metro.Controls; using NodeEditor.Extensions; -namespace NodeEditor +namespace NodeEditor.Controls { /// /// Interaction logic for EditorCanvas.xaml /// public partial class EditorCanvas : UserControl { - Point? dragStart = null; + private Point? _dragStart = null; public EditorCanvas() { @@ -38,26 +34,25 @@ namespace NodeEditor { var element = (UIElement) sender; // dragStart = new Point(e.GetPosition(mapCanvas).X * st.ScaleX, e.GetPosition(mapCanvas).Y * st.ScaleY); - var transform = mapCanvas.RenderTransform as MatrixTransform; - dragStart = new Point(e.GetPosition(mapCanvas).X * transform.Value.M11, e.GetPosition(mapCanvas).Y * transform.Value.M22); + if (mapCanvas.RenderTransform is MatrixTransform transform) + _dragStart = new Point(e.GetPosition(mapCanvas).X * transform.Value.M11, + e.GetPosition(mapCanvas).Y * transform.Value.M22); element.CaptureMouse(); } private void MapCanvas_StopDrag(object sender, MouseEventArgs e) { var element = (UIElement)sender; - dragStart = null; + _dragStart = null; element.ReleaseMouseCapture(); } private void MapCanvas_Drag(object sender, MouseEventArgs e) { - if (dragStart != null && e.LeftButton == MouseButtonState.Pressed) - { - var newPoint = e.GetPosition(m_EditorCanvas); + if (_dragStart == null || e.LeftButton != MouseButtonState.Pressed) return; + var newPoint = e.GetPosition(m_EditorCanvas); - Canvas.SetLeft(mapCanvas, newPoint.X - dragStart.Value.X); - Canvas.SetTop(mapCanvas, newPoint.Y - dragStart.Value.Y); - } + Canvas.SetLeft(mapCanvas, newPoint.X - _dragStart.Value.X); + Canvas.SetTop(mapCanvas, newPoint.Y - _dragStart.Value.Y); } private void MapCanvas_OnScroll(object sender, MouseWheelEventArgs e) @@ -74,7 +69,7 @@ namespace NodeEditor // } var element = sender as UIElement; var position = e.GetPosition(element); - var transform = mapCanvas.RenderTransform as MatrixTransform; + if (!(mapCanvas.RenderTransform is MatrixTransform transform)) return; var matrix = transform.Matrix; var scale = e.Delta >= 0 ? 1.1 : (1.0 / 1.1); // choose appropriate scaling factor diff --git a/Controls/Node.xaml b/Controls/Node.xaml new file mode 100644 index 0000000..b52e9d9 --- /dev/null +++ b/Controls/Node.xaml @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/Controls/Node.xaml.cs b/Controls/Node.xaml.cs new file mode 100644 index 0000000..c1621c0 --- /dev/null +++ b/Controls/Node.xaml.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Media; + +namespace NodeEditor.Controls +{ + /// + /// Interaction logic for Node.xaml + /// + public partial class Node : UserControl + { + public static List Nodes { get; } = new List(); + public string Desc { get; set; } + + public Node() + { + Nodes.Add(this); + //Name = GetIndexOf(this).ToString(); + Desc = ""; + InitializeComponent(); + } + public Node(string name) + { + Nodes.Add(this); + Name = name; + Desc = ""; + InitializeComponent(); + } + public Node(string name, string desc) + { + Nodes.Add(this); + Name = name; + Desc = desc; + InitializeComponent(); + } + public static int GetIndexOf(Node node) + { + if (node != null) + return Nodes.IndexOf(node); + return -1; + } + + public void Destroy() + { + var parentObject = VisualTreeHelper.GetParent(this); + var parent = parentObject as Canvas; + + parent?.Children.Remove(this); + Nodes.Remove(this); + } + } +} diff --git a/Controls/Path.xaml b/Controls/Path.xaml new file mode 100644 index 0000000..752362a --- /dev/null +++ b/Controls/Path.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/Controls/Path.xaml.cs b/Controls/Path.xaml.cs new file mode 100644 index 0000000..5639972 --- /dev/null +++ b/Controls/Path.xaml.cs @@ -0,0 +1,106 @@ +using System.Collections.Generic; +using System.Windows.Controls; +using System.Windows.Media; +using NodeEditor.Extensions; + +namespace NodeEditor.Controls +{ + public partial class Path : UserControl + { + public static List Paths { get; } = new List(); + public int[] Difficulty { get; set; } + public double Distance { get; set; } + public int LvlRequired { get; set; } + public Modes Mode { get; set; } + public int Cost { get; set; } + + public Direction Direction { get; set; } + + public Path() + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = 0; + LvlRequired = 0; + Mode = Modes.Walk; + Cost = 0; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = Modes.Walk; + Cost = 0; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = mode; + Cost = 0; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = 0; + Mode = mode; + Cost = cost; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired) + { + Difficulty = new[] {1, 1, 1, 1, 1}; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired, int[] difficulty) + { + Difficulty = difficulty; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Direction = Direction.Both; + Paths.Add(this); + InitializeComponent(); + } + public Path(int distance, Modes mode, int cost, int lvlRequired, int[] difficulty, Direction direction) + { + Difficulty = difficulty; + Distance = distance; + LvlRequired = lvlRequired; + Mode = mode; + Cost = cost; + Direction = direction; + Paths.Add(this); + InitializeComponent(); + } + + public void Destroy() + { + var parentObject = VisualTreeHelper.GetParent(this); + var parent = parentObject as Canvas; + + parent?.Children.Remove(this); + Paths.Remove(this); + } + } +} \ No newline at end of file diff --git a/Extensions/Direction.cs b/Extensions/Direction.cs new file mode 100644 index 0000000..06d05a5 --- /dev/null +++ b/Extensions/Direction.cs @@ -0,0 +1,9 @@ +namespace NodeEditor.Extensions +{ + public enum Direction + { + Both, + TowardsA, + TowardsB + } +} \ No newline at end of file diff --git a/Extensions/Modes.cs b/Extensions/Modes.cs new file mode 100644 index 0000000..cfa34fc --- /dev/null +++ b/Extensions/Modes.cs @@ -0,0 +1,12 @@ +namespace NodeEditor.Extensions +{ + public enum Modes + { + Seaskipper, + MageIsland, + Skyship, + Tunnel, + Elevator, + Walk + } +} \ No newline at end of file diff --git a/Extensions/SeaskipperCosts.cs b/Extensions/SeaskipperCosts.cs new file mode 100644 index 0000000..6faf7c8 --- /dev/null +++ b/Extensions/SeaskipperCosts.cs @@ -0,0 +1,71 @@ +namespace NodeEditor.Extensions +{ + public enum SeaskipperCosts + { + NemractSelchar = 12, + NemractLlevigar = 42, + NemractRoosterIsland = 4, + NemractHalfMoonIsland = 8, + NemractMageIsland = 8, + NemractNodgujIsland = 14, + NemractZhightIsland = 16, + NemractDurumIsles = 4, + NemractBearZoo = 4, + SelcharLlevigar = 24, + SelcharNodgujIsland = 8, + SelcharSkiensIsland = 10, + SelcharVolcanicIsles = 18, + SelcharMaroPeaks = 12, + SelcharPirateCove = 16, + SelcharDeadIsland = 16, + SelcharGallionsGraveyard = 16, + LlevigarVolcanicIsles = 16, + LlevigarMaroPeaks = 18, + LlevigarPirateCove = 20, + LlevigarDeadIsland = 24, + LlevigarJofashDocks = 32, + LlevigarGallionsGraveyard = 16, + RoosterIslandNemract = 8, + RoosterIslandSelchar = 10, + RoosterIslandLlevigar = 38, + HalfMoonIslandNemract = 10, + HalfMoonIslandSelchar = 14, + HalfMoonIslandLlevigar = 40, + MageIslandNemract = 10, + MageIslandSelchar = 10, + MageIslandLlevigar = 40, + NodgujIslandNemract = 22, + NodgujIslandSelchar = 12, + NodgujIslandLlevigar = 32, + ZhightIslandNemract = 16, + ZhightIslandSelchar = 12, + ZhightIslandLlevigar = 30, + SkiensIslandNemract = 26, + SkiensIslandSelchar = 12, + SkiensIslandLlevigar = 30, + VolcanicIslesNemract = 34, + VolcanicIslesSelchar = 26, + VolcanicIslesLlevigar = 26, + MaroPeaksNemract = 28, + MaroPeaksSelchar = 20, + MaroPeaksLlevigar = 28, + PirateCoveNemract = 28, + PirateCoveSelchar = 14, + PirateCoveLlevigar = 28, + DeadIslandNemract = 32, + DeadIslandSelchar = 22, + DeadIslandLlevigar = 32, + JofashDocksNemract = 38, + JofashDocksSelchar = 26, + JofashDocksLlevigar = 38, + GallionsGraveyardNemract = 24, + GallionsGraveyardSelchar = 14, + GallionsGraveyardLlevigar = 28, + DurumIslesNemract = 8, + DurumIslesSelchar = 10, + DurumIslesLlevigar = 38, + BearZooNemract = 8, + BearZooSelchar = 10, + BearZooLlevigar = 38 + } +} \ No newline at end of file diff --git a/MainWindow.xaml b/MainWindow.xaml index b4d809f..2fe60da 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -5,6 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:NodeEditor" + xmlns:controls="clr-namespace:NodeEditor.Controls" mc:Ignorable="d" WindowStyle="ToolWindow" WindowStartupLocation="CenterScreen" @@ -64,8 +65,8 @@ - + - + diff --git a/NodeEditor.Core.csproj b/NodeEditor.Core.csproj new file mode 100644 index 0000000..934e46b --- /dev/null +++ b/NodeEditor.Core.csproj @@ -0,0 +1,31 @@ + + + WinExe + net5.0-windows10.0.19041.0 + true + NodeEditor + NodeEditor + 8 + false + 10.0 + 10.0.19041.0 + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + 12.0.3 + + + + + diff --git a/NodeEditor.Core.sln b/NodeEditor.Core.sln new file mode 100644 index 0000000..a0f3939 --- /dev/null +++ b/NodeEditor.Core.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30717.126 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NodeEditor.Core", "NodeEditor.Core.csproj", "{7128BB4E-70F6-499C-B0A8-D6775CE49B98}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7128BB4E-70F6-499C-B0A8-D6775CE49B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7128BB4E-70F6-499C-B0A8-D6775CE49B98}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7128BB4E-70F6-499C-B0A8-D6775CE49B98}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7128BB4E-70F6-499C-B0A8-D6775CE49B98}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E026FADA-21ED-4144-8336-A570FD7F4A2A} + EndGlobalSection +EndGlobal diff --git a/NodeEditor.csproj b/NodeEditor.csproj deleted file mode 100644 index 60d1a9c..0000000 --- a/NodeEditor.csproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - AnyCPU - {789876C7-6864-435A-A06B-1B51FE952783} - WinExe - NodeEditor - NodeEditor - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - EditorCanvas.xaml - - - - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - - - - 0.9.2 - - - 12.0.3 - - - - - \ No newline at end of file diff --git a/NodeEditor.sln b/NodeEditor.sln deleted file mode 100644 index 7016dde..0000000 --- a/NodeEditor.sln +++ /dev/null @@ -1,30 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30717.126 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NodeEditor", "NodeEditor.csproj", "{789876C7-6864-435A-A06B-1B51FE952783}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C46C4EE2-1291-47C9-BF82-29915DE75727}" - ProjectSection(SolutionItems) = preProject - .gitignore = .gitignore - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {789876C7-6864-435A-A06B-1B51FE952783}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {789876C7-6864-435A-A06B-1B51FE952783}.Debug|Any CPU.Build.0 = Debug|Any CPU - {789876C7-6864-435A-A06B-1B51FE952783}.Release|Any CPU.ActiveCfg = Release|Any CPU - {789876C7-6864-435A-A06B-1B51FE952783}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7946BFFB-A64F-4F59-8D29-20725D1A4D76} - EndGlobalSection -EndGlobal diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index 3d9859e..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NodeEditor")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NodeEditor")] -[assembly: AssemblyCopyright("Copyright © 2020")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/main-map.png b/assets/main-map_yellow.png similarity index 100% rename from main-map.png rename to assets/main-map_yellow.png diff --git a/schema/data.json b/schema/data.json new file mode 100644 index 0000000..9bdccbd --- /dev/null +++ b/schema/data.json @@ -0,0 +1,35 @@ +{ + "$schema": "./data.schema.json", + "A": { + "name": "Nemract", + "walk_connections": { + "B": { + "distance": 100, + "terrain_level": 10, + "weight": 1 + } + }, + "x": 100, + "y": 100, + "qt_connections": { + "C": { + "cost": 100, + "mode": "seaskipper", + "unlock_lvl": 10 + } + } + }, + "B":{ + "name": "Llevagar", + "description": "Description", + "x": 10, + "y": 111, + "walk_connections": { + "A": { + "distance": 111, + "terrain_level": 11, + "weight": 1 + } + } + } +} diff --git a/schema/data.schema.json b/schema/data.schema.json new file mode 100644 index 0000000..c47f6c8 --- /dev/null +++ b/schema/data.schema.json @@ -0,0 +1,99 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + + "additionalProperties": { + "$ref": "#/definitions/map_node" + }, + "propertyNames": { + "$ref": "#/definitions/node_name_regex" + }, + + "definitions": { + "node_name_regex": { + "type": "string", + "pattern": "[\\w]+" + }, + "map_node": { + "properties": { + "x": { + "description": "The x coordinate.", + "type": "integer" + }, + "y": { + "description": "The y coordinate.", + "type": "integer" + }, + "name": { + "description": "Human-readable name.", + "type": "string" + }, + "description": { + "description": "Description of node, if needed.", + "type": "string" + }, + "qt_connections": { + "description": "List of connected nodes", + "additionalProperties": { "$ref": "#/definitions/qt_connection" }, + "propertyNames": { + "$ref": "#/definitions/node_name_regex" + } + }, + "walk_connections": { + "description": "List of connected nodes", + "additionalProperties": { "$ref": "#/definitions/walk_connection" }, + "propertyNames": { + "$ref": "#/definitions/node_name_regex" + } + } + }, + "required": ["x", "y", "name", "walk_connections"], + "additionalItems": false + }, + "qt_connection": { + "$comment": "A quick-travel conenction between nodes that should be evaluated first.", + "properties": { + "mode": { + "description": "The mode of the fast travel method.", + "enum": ["mageisland", "seaskipper", "tunnels", "skyship", "elevator"] + }, + "cost": { + "description": "The cost in emeralds of this route", + "type": "integer", + "minimum": 0 + }, + "unlock_lvl": { + "description": "The level this fast travel is unlocked at", + "type": "integer", + "minimum": 0, + "maximum": 110 + } + }, + "required": ["mode", "cost", "unlock_lvl"], + "additionalItems": false + }, + "walk_connection": { + "$comment": "A walking connection between two nodes", + "properties": { + "distance": { + "description": "The better disnance between two nodes, not necisarily as the crow flies. Should be used in the a* calc for distance back.", + "type": "integer", + "minimum": 0 + }, + "weight": { + "description": "Weight value used to modulate the distance based on passability", + "type": "number", + "minimum": 0, + "default": 1 + }, + "terrain_level": { + "description": "The highest level of the terain this connection passes through", + "type": "integer", + "minimum": 0, + "maximum": 110 + } + }, + "required": ["distance", "weight", "terrain_level"], + "additionalItems": false + } + } +}