This commit is contained in:
Abdul Mukheem Shaik 2024-05-17 15:46:49 +02:00
commit 227993c147
15 changed files with 189 additions and 2 deletions

17
Assets/NuGet.config Normal file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<disabledPackageSources />
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
<config>
<add key="packageInstallLocation" value="CustomWithinAssets" />
<add key="repositoryPath" value="./Packages" />
<add key="PackagesConfigDirectoryPath" value="." />
<add key="slimRestore" value="true" />
</config>
</configuration>

23
Assets/NuGet.config.meta Normal file

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 0c374ec05a7aff741a4a28d753ad5c33
labels:
- NuGetForUnity
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Packages.meta Normal file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b5064dc65cb4c6d439dc24832ceb4644
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 336259329b4664941877bd52f1a313a8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>WebSharp</id>
<version>1.0.4</version>
<authors>WebSharp</authors>
<owners>WebSharp</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework=".NETCoreApp3.1" />
</dependencies>
</metadata>
</package>

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 96fb84d8404da2040bb42f792c1de255
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -6,7 +6,7 @@ using System.Security.Cryptography;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
//https://github.com/GlitchEnzo/NuGetForUnity
// Creating the data structure according to the expected Json
[Serializable]
public class DataPoint

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
using System;
using WebSocketSharp;
public class WebSocketController : MonoBehaviour
{
String esp32IPAddress = "10.204.0.245";
String esp32WebsocketPort = "81";
// Websocket Service
public WebSocket ws;
// Serial Port to which Arduino is connected
SerialPort arduinoPort = new SerialPort("COM4", 115200);
public void Start(){
ConnectWithESP32();
//narrationController.GetComponent<NarrationController>();
}
// Update is called once per frame
void Update()
{
}
// Method to connect ESP32
public void ConnectWithESP32()
{
Debug.Log("Connecting Unity with ESP32 via Websockets...");
ws = new WebSocket("ws://" + esp32IPAddress + ":" + esp32WebsocketPort);
ws.OnOpen += (sender, e) =>
{
Debug.Log("WebSocket connected");
ws.Send("Hello from Unity!");
//ws.Send("Need input");
};
ws.OnMessage += (sender, e) =>
{
Debug.Log("Received message: " + e.Data);
if(e.Data.Equals("Start Narration", StringComparison.OrdinalIgnoreCase)){
// narrationControllerScript.startNarration = true;
}
};
ws.Connect();
Debug.Log("Websocket state - " + ws.ReadyState);
}
//Closing websocket upon application quit
void OnApplicationQuit()
{
ws.Close();
Debug.Log("WebSocket closed on application exit");
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c468066257183f4eb657f07381143b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

4
Assets/packages.config Normal file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="WebSharp" version="1.0.4" manuallyInstalled="true" />
</packages>

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: ea1ef82d46fbb1a43ae435b3d1e8a073
labels:
- NuGetForUnity
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

@ -1,5 +1,6 @@
{
"dependencies": {
"com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
"com.meta.xr.sdk.core": "63.0.0",
"com.meta.xr.sdk.interaction": "63.0.0",
"com.meta.xr.sdk.interaction.ovr": "63.0.0",

@ -1,5 +1,12 @@
{
"dependencies": {
"com.github-glitchenzo.nugetforunity": {
"version": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "12574c32f658fa23c194357141abc3fc157ea362"
},
"com.meta.xr.sdk.core": {
"version": "64.0.0",
"depth": 2,

@ -1201,7 +1201,7 @@ PlayerSettings:
luminVersion:
m_VersionCode: 1
m_VersionName:
apiCompatibilityLevel: 6
apiCompatibilityLevel: 3
activeInputHandler: 2
windowsGamepadBackendHint: 0
cloudProjectId: