Filing cabinet now properly opens and closes for all players without issue.

This commit is contained in:
2025-12-11 23:51:35 -05:00
parent c13f73903b
commit 4a43e50a8c
11 changed files with 123 additions and 62 deletions
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 12
Data: 13
- Name:
Entry: 7
Data:
@@ -608,19 +608,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ClueNotesCache
Data: _CachedDrawerIsOpen
- Name: $v
Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ClueNotesCache
Data: _CachedDrawerIsOpen
- Name: <UserType>k__BackingField
Entry: 9
Data: 26
Data: 38
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
Data: 38
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -656,19 +656,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ClueImagesCache
Data: _ClueNotesCache
- Name: $v
Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ClueImagesCache
Data: _ClueNotesCache
- Name: <UserType>k__BackingField
Entry: 9
Data: 30
Data: 26
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -704,19 +704,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _ClueImageScalesCache
Data: _ClueImagesCache
- Name: $v
Entry: 7
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ClueImageScalesCache
Data: _ClueImagesCache
- Name: <UserType>k__BackingField
Entry: 9
Data: 34
Data: 30
- Name: <SystemType>k__BackingField
Entry: 9
Data: 34
Data: 30
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -747,6 +747,54 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _ClueImageScalesCache
- Name: $v
Entry: 7
Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ClueImageScalesCache
- Name: <UserType>k__BackingField
Entry: 9
Data: 34
- Name: <SystemType>k__BackingField
Entry: 9
Data: 34
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 48|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:
@@ -21,6 +21,7 @@ public class FilingCabinet : UdonSharpBehaviour
[UdonSynced] public float[] ClueImageScales = new float[DRAWER_COUNT] { 1.0f, 1.0f, 1.0f, 1.0f };
[UdonSynced] private bool[] _DrawerIsOpen = new bool[DRAWER_COUNT] { false, false, false, false };
private bool[] _CachedDrawerIsOpen = new bool[DRAWER_COUNT] { false, false, false, false };
private string[] _ClueNotesCache = new string[DRAWER_COUNT];
private int[] _ClueImagesCache = new int[DRAWER_COUNT];
@@ -113,16 +114,18 @@ public class FilingCabinet : UdonSharpBehaviour
}
}
if (_DrawerIsOpen[Index])
if (_CachedDrawerIsOpen[Index] != _DrawerIsOpen[Index])
{
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
"PlaySFX", SFXEventType.FileCabinetOpen);
}
else
{
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All,
"PlaySFX", SFXEventType.FileCabinetClose);
if (_DrawerIsOpen[Index])
{
_AudioManager.PlaySFX(SFXEventType.FileCabinetOpen);
}
else
{
_AudioManager.PlaySFX(SFXEventType.FileCabinetClose);
}
}
_CachedDrawerIsOpen[Index] = _DrawerIsOpen[Index];
}
@@ -165,20 +168,24 @@ public class FilingCabinet : UdonSharpBehaviour
{
set
{
_Activate = value;
foreach(GameObject Trigger in _DrawerHandleTriggers)
if (_Activate != value)
{
Trigger.SetActive(_Activate);
}
_Activate = value;
if (!_Activate)
{
for (int i = 0; i < DRAWER_COUNT; i++)
foreach (GameObject Trigger in _DrawerHandleTriggers)
{
_DrawerIsOpen[i] = false;
ToggleDrawer(i);
Trigger.SetActive(_Activate);
}
if (!_Activate)
{
for (int i = 0; i < DRAWER_COUNT; i++)
{
_DrawerIsOpen[i] = false;
ToggleDrawer(i);
}
}
RequestSerialization();
}
}
@@ -31,30 +31,6 @@ public class FilingCabinetNoteDispenser : UdonSharpBehaviour
_ClueImageDownloader = new VRCImageDownloader();
}
public bool Activate
{
set
{
_Activate = value;
if (_Note != "") _Animator.SetBool("Spring Action", _Activate);
_ClueCard.localPosition = Vector3.zero;
_ClueCard.localRotation = Quaternion.identity;
_ImageCard.transform.localPosition = Vector3.zero;
_ImageCard.transform.localRotation = Quaternion.identity;
if (_Activate && Note != "")
{
_AudioManager.SendCustomNetworkEvent(NetworkEventTarget.All, "PlaySFX", SFXEventType.Boing2);
}
RequestSerialization();
}
get => _Activate;
}
private void LoadClueImage()
{
@@ -81,6 +57,35 @@ public class FilingCabinetNoteDispenser : UdonSharpBehaviour
}
public bool Activate
{
set
{
if (_Activate != value)
{
_Activate = value;
_ClueCard.localPosition = Vector3.zero;
_ClueCard.localRotation = Quaternion.identity;
_ImageCard.transform.localPosition = Vector3.zero;
_ImageCard.transform.localRotation = Quaternion.identity;
if (Note != "")
{
_Animator.SetBool("Spring Action", _Activate);
if (_Activate)
{
_AudioManager.PlaySFX(SFXEventType.Boing2);
}
}
RequestSerialization();
}
}
get => _Activate;
}
public string Note
{
set