From 5490b72e5d3b7f4b73277e02f9f57c217718cd38 Mon Sep 17 00:00:00 2001 From: MrUnknownDE Date: Fri, 10 Apr 2026 21:35:01 +0200 Subject: [PATCH] add ProTV Room Zone Script :D --- Editor/de.mrunknownde.gittool.Editor.asmdef | 16 -- ProTV/ProTVRoomZone.asset | 170 ++++++++++++++++++++ ProTV/ProTVRoomZone.cs | 56 +++++++ 3 files changed, 226 insertions(+), 16 deletions(-) delete mode 100644 Editor/de.mrunknownde.gittool.Editor.asmdef create mode 100644 ProTV/ProTVRoomZone.asset create mode 100644 ProTV/ProTVRoomZone.cs diff --git a/Editor/de.mrunknownde.gittool.Editor.asmdef b/Editor/de.mrunknownde.gittool.Editor.asmdef deleted file mode 100644 index 3247678..0000000 --- a/Editor/de.mrunknownde.gittool.Editor.asmdef +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "de.mrunknownde.gittool.Editor", - "rootNamespace": "", - "references": [], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/ProTV/ProTVRoomZone.asset b/ProTV/ProTVRoomZone.asset new file mode 100644 index 0000000..c6912ee --- /dev/null +++ b/ProTV/ProTVRoomZone.asset @@ -0,0 +1,170 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: ProTVRoomZone + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 7f1b25a7785724b4a80dabaacffcc775, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 48ee0805fb47e2e4494f694b970678c1, type: 3} + scriptVersion: 2 + compiledVersion: 2 + behaviourSyncMode: 0 + hasInteractEvent: 0 + scriptID: -2239841375030423733 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: localVideoPlayer + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: localVideoPlayer + - Name: k__BackingField + Entry: 7 + Data: 3|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.GameObject, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 3 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: true + - Name: _fieldAttributes + Entry: 7 + Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 5|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: "Der Videoplayer f\xFCr diesen Raum" + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: roomCollider + - Name: $v + Entry: 7 + Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: roomCollider + - Name: k__BackingField + Entry: 7 + Data: 7|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.BoxCollider, UnityEngine.PhysicsModule + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 9 + Data: 7 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/ProTV/ProTVRoomZone.cs b/ProTV/ProTVRoomZone.cs new file mode 100644 index 0000000..f426e6e --- /dev/null +++ b/ProTV/ProTVRoomZone.cs @@ -0,0 +1,56 @@ +/* + * ============================================================================ + * ProTV Room Zone Manager + * ============================================================================ + * Ein autarkes Trigger-Modul zur ressourcenschonenden Steuerung von + * ProTV / AVPro Instanzen in VRChat + * + * written by MrUnknownDE + * https://mrunknown.de + * ============================================================================ + */ + +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + +public class ProTVRoomZone : UdonSharpBehaviour +{ + [Header("Der Videoplayer für diesen Raum")] + public GameObject localVideoPlayer; + + private BoxCollider roomCollider; + + void Start() + { + roomCollider = GetComponent(); + SendCustomEventDelayedSeconds(nameof(CheckSpawnPosition), 2.0f); + } + + public void CheckSpawnPosition() + { + VRCPlayerApi player = Networking.LocalPlayer; + if (!Utilities.IsValid(player)) return; + if (roomCollider != null && roomCollider.bounds.Contains(player.GetPosition())) + { + if (localVideoPlayer != null) localVideoPlayer.SetActive(true); + } + else + { + if (localVideoPlayer != null) localVideoPlayer.SetActive(false); + } + } + + public override void OnPlayerTriggerEnter(VRCPlayerApi player) + { + if (!Utilities.IsValid(player) || !player.isLocal) return; + if (localVideoPlayer != null) localVideoPlayer.SetActive(true); + } + + public override void OnPlayerTriggerExit(VRCPlayerApi player) + { + if (!Utilities.IsValid(player) || !player.isLocal) return; + if (localVideoPlayer != null) localVideoPlayer.SetActive(false); + } +} \ No newline at end of file