Merge branch 'core_test' into Gitea/main

main
Julie 5 years ago
commit e31375310c
Signed by: cobular
GPG Key ID: 8CAB39FC9A8F13FB

248
.gitignore vendored

@ -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
### 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

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

@ -2,7 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.NodeEditor/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.NodeEditor/.idea/riderModule.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.NodeEditor.Core.dir/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.NodeEditor.Core.dir/.idea/riderModule.iml" />
</modules>
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -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/

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelStore">
<e p="C:\Users\jdc10\AppData\Local\JetBrains\Rider2020.3\extResources" t="IncludeRecursive" />
<e p="C:\Users\jdc10\AppData\Local\JetBrains\Rider2020.3\resharper-host\Local\Transient\Rider\v203\SolutionCaches\_NodeEditor.784521688.00" t="ExcludeRecursive" />
<e p="C:\Users\jdc10\Downloads\NodeEditor" t="IncludeRecursive">
<e p=".gitignore" t="Include" />
<e p="App.config" t="Include" />
<e p="App.xaml" t="Include" />
<e p="App.xaml.cs" t="Include" />
<e p="bin" t="ExcludeRecursive" />
<e p="Controls" t="Include">
<e p="EditorCanvas.xaml" t="Include" />
<e p="EditorCanvas.xaml.cs" t="Include" />
</e>
<e p="Extensions" t="Include">
<e p="MathExtensions.cs" t="Include" />
<e p="MouseExtensions.cs" t="Include" />
<e p="ReadJSON.cs" t="Include" />
</e>
<e p="main-map.png" t="Include" />
<e p="MainWindow.xaml" t="Include" />
<e p="MainWindow.xaml.cs" t="Include" />
<e p="NodeEditor.csproj" t="IncludeRecursive" />
<e p="NodeEditor.sln" t="IncludeFlat" />
<e p="obj" t="ExcludeRecursive">
<e p="Debug" t="Include">
<e p="App.g.cs" t="Include" />
<e p="Controls" t="Include">
<e p="EditorCanvas.g.cs" t="Include" />
</e>
<e p="GeneratedInternalTypeHelper.g.cs" t="Include" />
<e p="MainWindow.g.cs" t="Include" />
</e>
</e>
<e p="packages" t="ExcludeRecursive" />
<e p="Properties" t="Include">
<e p="AssemblyInfo.cs" t="Include" />
<e p="Resources.Designer.cs" t="Include" />
<e p="Resources.resx" t="Include" />
<e p="Settings.Designer.cs" t="Include" />
<e p="Settings.settings" t="Include" />
</e>
<e p="Solution Items" t="Include" />
</e>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="com.jetbrains.rider.android.RiderAndroidMiscFileCreationComponent">
<option name="ENSURE_MISC_FILE_EXISTS" value="true" />
</component>
</project>

@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoGeneratedRunConfigurationManager">
<projectFile>NodeEditor.csproj</projectFile>
</component>
<component name="ChangeListManager">
<list default="true" id="8d840f1a-4000-4390-ab3f-2383ed6434d5" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/Controls/EditorCanvas.xaml" beforeDir="false" afterPath="$PROJECT_DIR$/Controls/EditorCanvas.xaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Controls/EditorCanvas.xaml.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Controls/EditorCanvas.xaml.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main-map.png" beforeDir="false" afterPath="$PROJECT_DIR$/main-map.png" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1ltZq4ji537vQS7B5Q2SkaWibqc" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.tslint" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RunManager">
<configuration name="NodeEditor" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/NodeEditor.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
<option name="PROJECT_KIND" value="Console" />
<option name="PROJECT_TFM" value="" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="8d840f1a-4000-4390-ab3f-2383ed6434d5" name="Default Changelist" comment="" />
<created>1608418540783</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1608418540783</updated>
<workItem from="1608418548513" duration="1911000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityProjectConfiguration" hasMinimizedUI="null" />
<component name="UnityUnitTestConfiguration" currentTestLauncher="NUnit" />
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
</project>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RIDER_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../.." />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

@ -5,14 +5,7 @@
xmlns:local="clr-namespace:NodeEditor"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemeResources />
<ui:XamlControlsResources />
<!-- Other merged dictionaries here -->
</ResourceDictionary.MergedDictionaries>
<!-- Other app resources here -->
</ResourceDictionary>
</Application.Resources>
</Application>

@ -1,18 +1,20 @@
<UserControl x:Class="NodeEditor.EditorCanvas"
<UserControl x:Class="NodeEditor.Controls.EditorCanvas"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:controls="clr-namespace:NodeEditor.Controls"
xmlns:local="clr-namespace:NodeEditor"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Canvas Name="m_EditorCanvas" Background="Green">
<Canvas Name="mapCanvas" Background="Blue">
<Canvas Name="mapCanvas" Background="Blue" Width="100" Height="100">
<Canvas.RenderTransform>
<MatrixTransform />
</Canvas.RenderTransform>
<Image Name="map" Source="../main-map.png"></Image>
<Image Name="map" Source="../assets/main-map.png" />
<controls:Node />
</Canvas>
<TextBox Name="test"></TextBox>
<TextBox Name="test" />
</Canvas>
</UserControl>

@ -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
{
/// <summary>
/// Interaction logic for EditorCanvas.xaml
/// </summary>
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)
{
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

@ -0,0 +1,36 @@
<UserControl x:Class="NodeEditor.Controls.Node"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:NodeEditor.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Button Height="7" Width="7"
HorizontalAlignment="Left"
VerticalAlignment="Top">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse Stroke="Black"
StrokeThickness="0">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Offset="0" Color="Red"/>
<GradientStop Offset="1" Color="Red"/>
<GradientStop Offset="1" Color="DarkRed"/>
<RadialGradientBrush.Transform>
<TransformGroup>
<ScaleTransform ScaleY="0.65"/>
</TransformGroup>
</RadialGradientBrush.Transform>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
</ControlTemplate>
</Button.Template>
</Button>
</UserControl>

@ -0,0 +1,52 @@
using System.Collections.Generic;
using System.Windows.Controls;
using System.Windows.Media;
namespace NodeEditor.Controls
{
/// <summary>
/// Interaction logic for Node.xaml
/// </summary>
public partial class Node : UserControl
{
public static List<Node> Nodes { get; } = new List<Node>();
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);
}
}
}

@ -0,0 +1,12 @@
<UserControl x:Class="NodeEditor.Controls.Path"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:NodeEditor.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
</Grid>
</UserControl>

@ -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<Path> Paths { get; } = new List<Path>();
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);
}
}
}

@ -0,0 +1,9 @@
namespace NodeEditor.Extensions
{
public enum Direction
{
Both,
TowardsA,
TowardsB
}
}

@ -0,0 +1,12 @@
namespace NodeEditor.Extensions
{
public enum Modes
{
Seaskipper,
MageIsland,
Skyship,
Tunnel,
Elevator,
Walk
}
}

@ -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
}
}

@ -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 @@
<!-- ~1~ </Canvas> @1@ -->
<!-- -->
<!-- </Grid> -->
<local:EditorCanvas Background="Black" Margin="20,20,20,20">
<controls:EditorCanvas Background="Black" Margin="20,20,20,20">
</local:EditorCanvas>
</controls:EditorCanvas>
</Window>

@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net5.0-windows10.0.19041.0</TargetFrameworks>
<UseWPF>true</UseWPF>
<RootNamespace>NodeEditor</RootNamespace>
<AssemblyName>NodeEditor</AssemblyName>
<LangVersion>8</LangVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformMinVersion>10.0.19041.0</WindowsTargetPlatformMinVersion>
</PropertyGroup>
<ItemGroup>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="./assets/main-map.png"/>
<Resource Include="./assets/main-map_yellow.png"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.19041.1"/>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.Windows.CsWinRT" Version="1.1.0"/>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.0"/>
</ItemGroup>
</Project>

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

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{789876C7-6864-435A-A06B-1B51FE952783}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>NodeEditor</RootNamespace>
<AssemblyName>NodeEditor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="netstandard" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Controls\EditorCanvas.xaml.cs">
<DependentUpon>EditorCanvas.xaml</DependentUpon>
</Compile>
<Compile Include="Extensions\MathExtensions.cs" />
<Compile Include="Extensions\MouseExtensions.cs" />
<Compile Include="Extensions\ReadJSON.cs" />
<Page Include="Controls\EditorCanvas.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="main-map.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ModernWpfUI.MahApps">
<Version>0.9.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

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

@ -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
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> 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")]

@ -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
}
}
}
}

@ -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
}
}
}
Loading…
Cancel
Save