diff --git a/ClientApp/ClientApp.csproj b/ClientApp/ClientApp.csproj
index d8ae036..7b0bcaf 100644
--- a/ClientApp/ClientApp.csproj
+++ b/ClientApp/ClientApp.csproj
@@ -1,23 +1,24 @@
-
- WinExe
- netcoreapp3.1
- true
-
+
+ WinExe
+ netcoreapp3.1
+ true
+ Images\Logo\icon1.ico
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
\ No newline at end of file
diff --git a/ClientApp/Images/Logo/icon1.ico b/ClientApp/Images/Logo/icon1.ico
new file mode 100644
index 0000000..95760d6
Binary files /dev/null and b/ClientApp/Images/Logo/icon1.ico differ
diff --git a/ClientApp/Images/gradient-geometric-shape-background_78532-374.jpg b/ClientApp/Images/gradient-geometric-shape-background_78532-374.jpg
new file mode 100644
index 0000000..b78d1da
Binary files /dev/null and b/ClientApp/Images/gradient-geometric-shape-background_78532-374.jpg differ
diff --git a/ClientApp/Images/re15.jpg b/ClientApp/Images/re15.jpg
new file mode 100644
index 0000000..34dc9f1
Binary files /dev/null and b/ClientApp/Images/re15.jpg differ
diff --git a/ClientApp/Images/stone.png b/ClientApp/Images/stone.png
new file mode 100644
index 0000000..5f4b1d0
Binary files /dev/null and b/ClientApp/Images/stone.png differ
diff --git a/ClientApp/Utils/Client.cs b/ClientApp/Utils/Client.cs
index 3d74c8b..d3f015c 100644
--- a/ClientApp/Utils/Client.cs
+++ b/ClientApp/Utils/Client.cs
@@ -265,10 +265,10 @@ namespace ClientApp.Utils
///
public void tryLogin(string username, string password)
{
- string hashUser = Hashing.Hasher.HashString(username);
+
string hashPassword = Hashing.Hasher.HashString(password);
- byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(hashUser, hashPassword));
+ byte[] message = DataParser.getJsonMessage(DataParser.GetLoginJson(username, hashPassword));
this.stream.BeginWrite(message, 0, message.Length, new AsyncCallback(OnWrite), null);
diff --git a/ClientApp/Utils/EngineConnection.cs b/ClientApp/Utils/EngineConnection.cs
index bc7781f..ea699a3 100644
--- a/ClientApp/Utils/EngineConnection.cs
+++ b/ClientApp/Utils/EngineConnection.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Text;
using RH_Engine;
using System.Net.Sockets;
+using Newtonsoft.Json.Linq;
+using System.Diagnostics;
+using LibNoise.Primitive;
namespace ClientApp.Utils
{
@@ -37,6 +40,8 @@ namespace ClientApp.Utils
private static string panelId = string.Empty;
private static string bikeId = string.Empty;
private static string headId = string.Empty;
+ private static string groundPlaneId = string.Empty;
+ private static string terrainId = string.Empty;
public float BikeSpeed { get; set; }
public float BikePower { get; set; }
@@ -191,8 +196,11 @@ namespace ClientApp.Utils
string headId = JSONParser.GetIdSceneInfoChild(message, "Head");
string handLeftId = JSONParser.GetIdSceneInfoChild(message, "LeftHand");
string handRightId = JSONParser.GetIdSceneInfoChild(message, "RightHand");
+ groundPlaneId = JSONParser.GetIdSceneInfoChild(message, "GroundPlane");
+ Write("--- Ground plane id is " + groundPlaneId);
});
// add the route and set the route id
+ CreateTerrain();
SendMessageAndOnResponse(mainCommand.RouteCommand("routeID"), "routeID", (message) => routeId = JSONParser.GetResponseUuid(message));
}
@@ -217,8 +225,45 @@ namespace ClientApp.Utils
while (cameraId == string.Empty) { }
SetFollowSpeed(5.0f);
+ WriteTextMessage(mainCommand.RoadCommand(routeId, "road"));
+ WriteTextMessage(mainCommand.ShowRoute("showRouteFalse", false));
});
});
+ setEnvironment();
+
+
+ }
+
+ private void setEnvironment()
+ {
+ Write("Setting environment");
+ WriteTextMessage(mainCommand.DeleteNode(groundPlaneId, "none"));
+
+ PlaceHouses();
+
+ WriteTextMessage(mainCommand.SkyboxCommand(DateTime.Now.Hour));
+ }
+
+ private void PlaceHouses()
+ {
+ PlaceHouse(2, new float[] { 10f, 1f, 30f }, 1);
+ PlaceHouse(1, new float[] { 42f, 1f, 22f }, new float[] { 0f, 90f, 0f }, 2);
+ PlaceHouse(11, new float[] { -20f, 1f, 0f }, new float[] { 0f, -35f, 0f }, 3);
+ PlaceHouse(7, new float[] { -15f, 1f, 50f }, new float[] { 0f, -50f, 0f }, 4);
+ PlaceHouse(24, new float[] { 40f, 1f, 40f }, new float[] { 0f, 75f, 0f }, 5);
+ PlaceHouse(22, new float[] { 34f, 1f, -20f }, 6);
+ PlaceHouse(14, new float[] { 0f, 1f, -20f }, new float[] { 0f, 210f, 0f }, 7);
+ }
+
+ private void PlaceHouse(int numberHousemodel, float[] position, int serialNumber)
+ {
+ PlaceHouse(numberHousemodel, position, new float[] { 0f, 0f, 0f }, serialNumber);
+ }
+
+ private void PlaceHouse(int numberHousemodel, float[] position, float[] rotation, int serialNumber)
+ {
+ string folderHouses = @"data\NetworkEngine\models\houses\set1\";
+ SendMessageAndOnResponse(mainCommand.AddModel("House1", "housePlacement" + serialNumber, folderHouses + "house" + numberHousemodel + ".obj", position, 4, rotation), "housePlacement" + serialNumber, (message) => Console.WriteLine(message));
}
public void UpdateInfoPanel()
@@ -264,6 +309,41 @@ namespace ClientApp.Utils
WriteTextMessage(mainCommand.RouteFollow(routeId, cameraId, speed));
}
+ public void CreateTerrain()
+ {
+ float x = 0f;
+ float[] height = new float[256 * 256];
+ ImprovedPerlin improvedPerlin = new ImprovedPerlin(0, LibNoise.NoiseQuality.Best);
+ for (int i = 0; i < 256 * 256; i++)
+ {
+ height[i] = improvedPerlin.GetValue(x /10, x / 10, x * 100) / 3.5f + 1;
+
+ //if (height[i] > 1.1f)
+ //{
+ // height[i] = height[i] * 0.8f;
+ //}
+ //else if (height[i] < 0.9f)
+ //{
+ // height[i] = height[i] * 1.2f;
+ //}
+ x += 0.001f;
+ }
+
+ SendMessageAndOnResponse(mainCommand.TerrainAdd(new int[] { 256, 256 }, height, "terrain"), "terrain",
+ (message) =>
+ {
+
+ SendMessageAndOnResponse(mainCommand.renderTerrain("renderTerrain"), "renderTerrain",
+ (message) =>
+ {
+ terrainId = JSONParser.GetTerrainID(message);
+ string addLayerMsg = mainCommand.AddLayer(terrainId, "addLayer");
+ SendMessageAndOnResponse(addLayerMsg, "addLayer", (message) => Console.WriteLine(""));
+
+ });
+ });
+ }
+
#endregion
#region message send/receive
@@ -315,7 +395,7 @@ namespace ClientApp.Utils
}
public void Write(string msg)
{
- Console.WriteLine("[ENGINECONNECT] " + msg);
+ Debug.WriteLine("[ENGINECONNECT] " + msg);
}
}
diff --git a/ClientApp/ViewModels/MainViewModel.cs b/ClientApp/ViewModels/MainViewModel.cs
index d609e9a..58252e1 100644
--- a/ClientApp/ViewModels/MainViewModel.cs
+++ b/ClientApp/ViewModels/MainViewModel.cs
@@ -1,6 +1,7 @@
using ClientApp.Models;
using ClientApp.Utils;
using GalaSoft.MvvmLight.Command;
+using System.Diagnostics;
using System.Windows.Input;
namespace ClientApp.ViewModels
@@ -8,7 +9,6 @@ namespace ClientApp.ViewModels
class MainViewModel : ObservableObject
{
public ICommand RetryServerCommand { get; set; }
- public ICommand RetryVREngineCommand { get; set; }
public MainWindowViewModel MainWindowViewModel { get; set; }
private Client client;
@@ -24,15 +24,6 @@ namespace ClientApp.ViewModels
//try connect server
this.MainWindowViewModel.InfoModel.ConnectedToServer = true;
});
- this.RetryVREngineCommand = new RelayCommand(() =>
- {
- //try connect vr-engine
-
- this.MainWindowViewModel.InfoModel.ConnectedToVREngine = true;
- this.MainWindowViewModel.InfoModel.CanConnectToVR = false;
- client.engineConnection.CreateConnection();
-
- });
}
private void retryEngineConnection()
diff --git a/ClientApp/Views/LoginView.xaml b/ClientApp/Views/LoginView.xaml
index 6db392f..472674d 100644
--- a/ClientApp/Views/LoginView.xaml
+++ b/ClientApp/Views/LoginView.xaml
@@ -1,4 +1,4 @@
-
-
+
+
-
-
+
+
-
+
diff --git a/ClientApp/Views/LoginView.xaml.cs b/ClientApp/Views/LoginView.xaml.cs
index f48d9de..a971aad 100644
--- a/ClientApp/Views/LoginView.xaml.cs
+++ b/ClientApp/Views/LoginView.xaml.cs
@@ -16,7 +16,7 @@ namespace ClientApp.Views
///
/// Interaction logic for LoginView.xaml
///
- public partial class LoginView : UserControl
+ public partial class LoginView : Page
{
public LoginView()
{
diff --git a/ClientApp/Views/MainView.xaml b/ClientApp/Views/MainView.xaml
index c0997f6..8657aa0 100644
--- a/ClientApp/Views/MainView.xaml
+++ b/ClientApp/Views/MainView.xaml
@@ -1,4 +1,4 @@
-
-
-
-
+
diff --git a/ClientApp/Views/MainView.xaml.cs b/ClientApp/Views/MainView.xaml.cs
index 94161b9..1b84ff5 100644
--- a/ClientApp/Views/MainView.xaml.cs
+++ b/ClientApp/Views/MainView.xaml.cs
@@ -17,7 +17,7 @@ namespace ClientApp.Views
///
/// Interaction logic for MainView.xaml
///
- public partial class MainView : UserControl
+ public partial class MainView : Page
{
public MainView()
{
diff --git a/ClientApp/Views/MainWindow.xaml b/ClientApp/Views/MainWindow.xaml
index 436c2a9..35c02a3 100644
--- a/ClientApp/Views/MainWindow.xaml
+++ b/ClientApp/Views/MainWindow.xaml
@@ -9,8 +9,8 @@
Title="Whaazzzzuuuuuuuup" Height="450" Width="800">
-
+
+
-
-
+
diff --git a/DoctorApp/DoctorApp.csproj b/DoctorApp/DoctorApp.csproj
index 516e849..1dd8012 100644
--- a/DoctorApp/DoctorApp.csproj
+++ b/DoctorApp/DoctorApp.csproj
@@ -13,7 +13,6 @@
-
diff --git a/ProftaakRH/ProftaakRH.sln b/ProftaakRH/ProftaakRH.sln
index 091dada..ce4248e 100644
--- a/ProftaakRH/ProftaakRH.sln
+++ b/ProftaakRH/ProftaakRH.sln
@@ -3,59 +3,46 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30413.136
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProftaakRH", "ProftaakRH.csproj", "{0F053CC5-D969-4970-9501-B3428EA3D777}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RH-Engine", "..\RH-Engine\RH-Engine.csproj", "{984E295E-47A2-41E7-90E5-50FDB9E67694}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{B1AB6F51-A20D-4162-9A7F-B3350B7510FD}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Message", "..\Message\Message.csproj", "{9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DokterApp", "..\DokterApp\DokterApp.csproj", "{B150F08B-13DA-4D17-BD96-7E89F52727C6}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp", "..\ClientApp\ClientApp.csproj", "{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Hashing", "..\Hashing\Hashing.shproj", "{70277749-D423-4871-B692-2EFC5A6ED932}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClientApp", "..\ClientApp\ClientApp.csproj", "{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProftaakRH", "ProftaakRH.csproj", "{C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RH-Engine", "..\RH-Engine\RH-Engine.csproj", "{BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server", "..\Server\Server.csproj", "{7D751284-17E8-434C-A7F6-2EB37572E7AE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DoctorApp", "..\DoctorApp\DoctorApp.csproj", "{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
..\Hashing\Hashing.projitems*{70277749-d423-4871-b692-2efc5a6ed932}*SharedItemsImports = 13
+ ..\Hashing\Hashing.projitems*{7d751284-17e8-434c-a7f6-2eb37572e7ae}*SharedItemsImports = 5
..\Hashing\Hashing.projitems*{7ef854c1-73eb-4099-a7d7-057cceee6f8f}*SharedItemsImports = 5
..\Hashing\Hashing.projitems*{a232f2d5-af98-4777-bf3a-fbddfbc02994}*SharedItemsImports = 5
- ..\Hashing\Hashing.projitems*{b150f08b-13da-4d17-bd96-7e89f52727c6}*SharedItemsImports = 5
- ..\Hashing\Hashing.projitems*{b1ab6f51-a20d-4162-9a7f-b3350b7510fd}*SharedItemsImports = 5
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {0F053CC5-D969-4970-9501-B3428EA3D777}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0F053CC5-D969-4970-9501-B3428EA3D777}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0F053CC5-D969-4970-9501-B3428EA3D777}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0F053CC5-D969-4970-9501-B3428EA3D777}.Release|Any CPU.Build.0 = Release|Any CPU
- {984E295E-47A2-41E7-90E5-50FDB9E67694}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {984E295E-47A2-41E7-90E5-50FDB9E67694}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {984E295E-47A2-41E7-90E5-50FDB9E67694}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {984E295E-47A2-41E7-90E5-50FDB9E67694}.Release|Any CPU.Build.0 = Release|Any CPU
- {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B1AB6F51-A20D-4162-9A7F-B3350B7510FD}.Release|Any CPU.Build.0 = Release|Any CPU
- {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9ED6832D-B0FB-4460-9BCD-FAA58863B0CE}.Release|Any CPU.Build.0 = Release|Any CPU
- {B150F08B-13DA-4D17-BD96-7E89F52727C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B150F08B-13DA-4D17-BD96-7E89F52727C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B150F08B-13DA-4D17-BD96-7E89F52727C6}.Release|Any CPU.Build.0 = Release|Any CPU
{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7EF854C1-73EB-4099-A7D7-057CCEEE6F8F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C1A3CCE4-5FBB-4655-BFE1-7AF2B7D58CA3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BECC2E56-E65C-42A0-AF80-DDE32DCD5E0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D751284-17E8-434C-A7F6-2EB37572E7AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D751284-17E8-434C-A7F6-2EB37572E7AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D751284-17E8-434C-A7F6-2EB37572E7AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D751284-17E8-434C-A7F6-2EB37572E7AE}.Release|Any CPU.Build.0 = Release|Any CPU
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A232F2D5-AF98-4777-BF3A-FBDDFBC02994}.Release|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/RH-Engine/JSONParser.cs b/RH-Engine/JSONParser.cs
index 19bf695..30d750a 100644
--- a/RH-Engine/JSONParser.cs
+++ b/RH-Engine/JSONParser.cs
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using System;
namespace RH_Engine
@@ -122,5 +123,19 @@ namespace RH_Engine
}
return null;
}
+
+ public static string GetChildUuid(string name, JArray children)
+ {
+ foreach (dynamic child in children)
+ {
+ if (child.name == name)
+ {
+ return child.uuid;
+ }
+ }
+ Console.WriteLine("Could not find id of " + name);
+ return null;
+ }
+
}
}
\ No newline at end of file
diff --git a/RH-Engine/Program.cs b/RH-Engine/Program.cs
index 4df6e5e..5eba099 100644
--- a/RH-Engine/Program.cs
+++ b/RH-Engine/Program.cs
@@ -19,9 +19,9 @@ namespace RH_Engine
//new PC("DESKTOP-M2CIH87", "Fabian"),
//new PC("T470S", "Shinichi"),
//new PC("DESKTOP-DHS478C", "semme"),
- //new PC("HP-ZBOOK-SEM", "Sem"),
+ new PC("HP-ZBOOK-SEM", "Sem"),
//new PC("DESKTOP-TV73FKO", "Wouter"),
- new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
+ //new PC("DESKTOP-SINMKT1", "Ralf van Aert"),
//new PC("NA", "Bart")
};
diff --git a/Server/Client.cs b/Server/Client.cs
index eb09707..ee32ef8 100644
--- a/Server/Client.cs
+++ b/Server/Client.cs
@@ -166,6 +166,7 @@ namespace Server
private bool verifyLogin(string username, string password)
{
+ Console.WriteLine($"Got username {username} and password {password}");
if (!File.Exists(fileName))
@@ -180,27 +181,23 @@ namespace Server
{
Console.WriteLine("file exists, located at " + Path.GetFullPath(fileName));
string[] usernamesPasswords = File.ReadAllLines(fileName);
- if (usernamesPasswords.Length == 0)
- {
- newUsers(username, password);
- return true;
- }
-
foreach (string s in usernamesPasswords)
{
string[] combo = s.Split(" ");
if (combo[0] == username)
{
- Console.WriteLine("correct info");
+ Console.WriteLine("username found in file");
return combo[1] == password;
}
}
- Console.WriteLine("combo was not found in file");
+ Console.WriteLine("username not found in file");
+ newUsers(username, password);
+ return true;
+
}
- Console.WriteLine("false");
- return false;
+
}