Skip to content

Commit 641b746

Browse files
Remote Version 1.1.0
Co-Authored-By: SamsidParty <business@samsidparty.com>
1 parent 3413378 commit 641b746

File tree

5 files changed

+98
-23
lines changed

5 files changed

+98
-23
lines changed

Oberon.Remote/Assets/Scripts/Oberon Remote Core/SocketServer.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Oberon.Remote.Core
1414
{
1515
public class SocketServer
1616
{
17+
Thread ServerThread;
1718
WebSocketServer Server;
1819

1920
SynchronizedCollection<CommanderClient> Connections = new SynchronizedCollection<CommanderClient>();
@@ -31,8 +32,8 @@ public static string GetListenIP()
3132

3233
public SocketServer()
3334
{
34-
var t = new Thread(Start);
35-
t.Start();
35+
ServerThread = new Thread(Start);
36+
ServerThread.Start();
3637
}
3738

3839
void Start()
@@ -64,5 +65,17 @@ void Start()
6465
socket.OnError = (_) => { };
6566
});
6667
}
68+
69+
70+
public void Stop()
71+
{
72+
if (ServerThread != null)
73+
{
74+
Server.Dispose();
75+
ServerThread.Abort();
76+
ServerThread = null;
77+
Server = null;
78+
}
79+
}
6780
}
6881
}

Oberon.Remote/Assets/Scripts/OberonUnity.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Oberon.Remote.Core;
2+
using System.Diagnostics;
23
using UnityEngine;
34
using UnityEngine.InputSystem;
45

@@ -24,4 +25,10 @@ private void Update()
2425
{
2526
InputModule.ProcessInput();
2627
}
28+
29+
private void OnDestroy()
30+
{
31+
OberonManager.SocketServer.Stop();
32+
Process.GetCurrentProcess().Kill();
33+
}
2734
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#if UNITY_STANDALONE_WIN
2+
3+
using System;
4+
using System.Runtime.InteropServices;
5+
using System.Text;
6+
using UnityEngine;
7+
using UnityEngine.SceneManagement;
8+
9+
public class WindowsTitlebar
10+
{
11+
[DllImport("dwmapi.dll")]
12+
public static extern int DwmSetWindowAttribute(IntPtr hwnd, int dwAttribute, int[] pvAttribute, int cbAttribute);
13+
14+
private const string UnityWindowClassName = "UnityWndClass";
15+
16+
[DllImport("kernel32.dll")]
17+
static extern uint GetCurrentThreadId();
18+
19+
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
20+
static extern int GetClassName(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
21+
22+
public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
23+
[DllImport("user32.dll")]
24+
[return: MarshalAs(UnmanagedType.Bool)]
25+
static extern bool EnumThreadWindows(uint dwThreadId, EnumWindowsProc lpEnumFunc, IntPtr lParam);
26+
27+
private static IntPtr windowHandle = IntPtr.Zero;
28+
29+
public static void SetTitlebarColor(IntPtr hwnd, int color)
30+
{
31+
DwmSetWindowAttribute(hwnd, 35, new int[] { color }, 4);
32+
}
33+
34+
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
35+
public static void Apply()
36+
{
37+
uint threadId = GetCurrentThreadId();
38+
EnumThreadWindows(threadId, (hWnd, lParam) =>
39+
{
40+
var classText = new StringBuilder(UnityWindowClassName.Length + 1);
41+
GetClassName(hWnd, classText, classText.Capacity);
42+
if (classText.ToString() == UnityWindowClassName)
43+
{
44+
windowHandle = hWnd;
45+
return false;
46+
}
47+
return true;
48+
}, IntPtr.Zero);
49+
50+
SetTitlebarColor(windowHandle, 0x211412);
51+
}
52+
}
53+
54+
#endif

Oberon.Remote/Assets/UniversalRenderPipelineGlobalSettings.asset

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ MonoBehaviour:
3535
m_List:
3636
- rid: 6559135769499795456
3737
- rid: 6559135769499795457
38-
- rid: 6559135772585754690
38+
- rid: 6559135777673183308
3939
- rid: 6559135769499795459
4040
- rid: 6559135769499795460
4141
- rid: 6559135769499795461
42-
- rid: 6559135772585754691
43-
- rid: 6559135772585754692
42+
- rid: 6559135777673183309
43+
- rid: 6559135777673183310
4444
- rid: 6559135769499795464
45-
- rid: 6559135772585754693
45+
- rid: 6559135777673183311
4646
- rid: 6559135769499795466
47-
- rid: 6559135772585754694
48-
- rid: 6559135772585754695
49-
- rid: 6559135772585754696
47+
- rid: 6559135777673183312
48+
- rid: 6559135777673183313
49+
- rid: 6559135777673183314
5050
- rid: 6559135769499795470
51-
- rid: 6559135772585754697
52-
- rid: 6559135772585754698
51+
- rid: 6559135777673183315
52+
- rid: 6559135777673183316
5353
- rid: 6559135769499795473
5454
- rid: 6559135769499795474
55-
- rid: 6559135772585754699
55+
- rid: 6559135777673183317
5656
- rid: 6559135769499795476
5757
m_RuntimeSettings:
5858
m_List:
@@ -166,30 +166,30 @@ MonoBehaviour:
166166
m_setupCS: {fileID: 7200000, guid: 33be2e9a5506b2843bdb2bdff9cad5e1, type: 3}
167167
m_preTaaCS: {fileID: 7200000, guid: a679dba8ec4d9ce45884a270b0e22dda, type: 3}
168168
m_taaCS: {fileID: 7200000, guid: 3923900e2b41b5e47bc25bfdcbcdc9e6, type: 3}
169-
- rid: 6559135772585754690
169+
- rid: 6559135777673183308
170170
type: {class: UniversalRendererResources, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
171171
data:
172172
m_Version: 0
173173
m_CopyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3}
174174
m_CameraMotionVector: {fileID: 4800000, guid: c56b7e0d4c7cb484e959caeeedae9bbf, type: 3}
175175
m_StencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3}
176176
m_DBufferClear: {fileID: 4800000, guid: f056d8bd2a1c7e44e9729144b4c70395, type: 3}
177-
- rid: 6559135772585754691
177+
- rid: 6559135777673183309
178178
type: {class: URPShaderStrippingSetting, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
179179
data:
180180
m_Version: 0
181181
m_StripUnusedPostProcessingVariants: 0
182182
m_StripUnusedVariants: 1
183183
m_StripScreenCoordOverrideVariants: 1
184-
- rid: 6559135772585754692
184+
- rid: 6559135777673183310
185185
type: {class: UniversalRenderPipelineEditorMaterials, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
186186
data:
187187
m_DefaultMaterial: {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
188188
m_DefaultParticleMaterial: {fileID: 2100000, guid: e823cd5b5d27c0f4b8256e7c12ee3e6d, type: 2}
189189
m_DefaultLineMaterial: {fileID: 2100000, guid: e823cd5b5d27c0f4b8256e7c12ee3e6d, type: 2}
190190
m_DefaultTerrainMaterial: {fileID: 2100000, guid: 594ea882c5a793440b60ff72d896021e, type: 2}
191191
m_DefaultDecalMaterial: {fileID: 2100000, guid: 31d0dcc6f2dd4e4408d18036a2c93862, type: 2}
192-
- rid: 6559135772585754693
192+
- rid: 6559135777673183311
193193
type: {class: UniversalRenderPipelineEditorShaders, ns: UnityEngine.Rendering.Universal, asm: Unity.RenderPipelines.Universal.Runtime}
194194
data:
195195
m_AutodeskInteractive: {fileID: 4800000, guid: 0e9d5a909a1f7e84882a534d0d11e49f, type: 3}
@@ -201,7 +201,7 @@ MonoBehaviour:
201201
m_DefaultSpeedTree7Shader: {fileID: 4800000, guid: 0f4122b9a743b744abe2fb6a0a88868b, type: 3}
202202
m_DefaultSpeedTree8Shader: {fileID: -6465566751694194690, guid: 9920c1f1781549a46ba081a2a15a16ec, type: 3}
203203
m_DefaultSpeedTree9Shader: {fileID: -6465566751694194690, guid: cbd3e1cc4ae141c42a30e33b4d666a61, type: 3}
204-
- rid: 6559135772585754694
204+
- rid: 6559135777673183312
205205
type: {class: GPUResidentDrawerResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.GPUDriven.Runtime}
206206
data:
207207
m_Version: 0
@@ -214,14 +214,14 @@ MonoBehaviour:
214214
m_OcclusionCullingDebugKernels: {fileID: 7200000, guid: b23e766bcf50ca4438ef186b174557df, type: 3}
215215
m_DebugOcclusionTestPS: {fileID: 4800000, guid: d3f0849180c2d0944bc71060693df100, type: 3}
216216
m_DebugOccluderPS: {fileID: 4800000, guid: b3c92426a88625841ab15ca6a7917248, type: 3}
217-
- rid: 6559135772585754695
217+
- rid: 6559135777673183313
218218
type: {class: ProbeVolumeRuntimeResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
219219
data:
220220
m_Version: 1
221221
probeVolumeBlendStatesCS: {fileID: 7200000, guid: a3f7b8c99de28a94684cb1daebeccf5d, type: 3}
222222
probeVolumeUploadDataCS: {fileID: 7200000, guid: 0951de5992461754fa73650732c4954c, type: 3}
223223
probeVolumeUploadDataL2CS: {fileID: 7200000, guid: 6196f34ed825db14b81fb3eb0ea8d931, type: 3}
224-
- rid: 6559135772585754696
224+
- rid: 6559135777673183314
225225
type: {class: ProbeVolumeDebugResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
226226
data:
227227
m_Version: 1
@@ -231,12 +231,12 @@ MonoBehaviour:
231231
probeVolumeOffsetDebugShader: {fileID: 4800000, guid: db8bd7436dc2c5f4c92655307d198381, type: 3}
232232
probeSamplingDebugMesh: {fileID: -3555484719484374845, guid: 20be25aac4e22ee49a7db76fb3df6de2, type: 3}
233233
numbersDisplayTex: {fileID: 2800000, guid: 73fe53b428c5b3440b7e87ee830b608a, type: 3}
234-
- rid: 6559135772585754697
234+
- rid: 6559135777673183315
235235
type: {class: ProbeVolumeGlobalSettings, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
236236
data:
237237
m_Version: 1
238238
m_ProbeVolumeDisableStreamingAssets: 0
239-
- rid: 6559135772585754698
239+
- rid: 6559135777673183316
240240
type: {class: ProbeVolumeBakingResources, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
241241
data:
242242
m_Version: 1
@@ -249,7 +249,7 @@ MonoBehaviour:
249249
skyOcclusionRT: {fileID: 4807578003741378534, guid: dfaf42b38dd001f49a72d8102b709f29, type: 3}
250250
renderingLayerCS: {fileID: 7200000, guid: a63c9cf933e3d8f41ae680a372784ebf, type: 3}
251251
renderingLayerRT: {fileID: 4807578003741378534, guid: c2be09c936362eb49a58f08aeb30627a, type: 3}
252-
- rid: 6559135772585754699
252+
- rid: 6559135777673183317
253253
type: {class: IncludeAdditionalRPAssets, ns: UnityEngine.Rendering, asm: Unity.RenderPipelines.Core.Runtime}
254254
data:
255255
m_version: 0

Oberon.Remote/ProjectSettings/ProjectSettings.asset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ PlayerSettings:
141141
visionOSBundleVersion: 1.0
142142
tvOSBundleVersion: 1.0
143143
bundleVersion: 1.1
144-
preloadedAssets: []
144+
preloadedAssets:
145+
- {fileID: 11400000, guid: 011a6bffdc31c2f45bca3f486bd5cab4, type: 2}
145146
metroInputSource: 0
146147
wsaTransparentSwapchain: 0
147148
m_HolographicPauseOnTrackingLoss: 1

0 commit comments

Comments
 (0)