Fixed a few more sync issues, particularly involving resets.

This commit is contained in:
2025-07-17 00:49:32 -04:00
parent cf2da70229
commit 47be4c1ba2
17 changed files with 458 additions and 196 deletions
@@ -704,19 +704,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _LocationSheetMaterialSelections
Data: _LootMaterial
- Name: $v
Entry: 7
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LocationSheetMaterialSelections
Data: _LootMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 46|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material[], UnityEngine.CoreModule
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -764,19 +764,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _Animator
Data: _LocationSheetMaterialSelections
- Name: $v
Entry: 7
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Animator
Data: _LocationSheetMaterialSelections
- Name: <UserType>k__BackingField
Entry: 7
Data: 50|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
Data: UnityEngine.Material[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -794,10 +794,70 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 52|UnityEngine.SerializeField, UnityEngine.CoreModule
- 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: _Animator
- Name: $v
Entry: 7
Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 54|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 54
- 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: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -821,13 +881,13 @@ MonoBehaviour:
Data: _LootImageDownloader
- Name: $v
Entry: 7
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootImageDownloader
- Name: <UserType>k__BackingField
Entry: 7
Data: 53|System.RuntimeType, mscorlib
Data: 57|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Image.VRCImageDownloader, VRCSDK3
@@ -836,7 +896,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 53
Data: 57
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -851,61 +911,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 54|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: 7
Data:
- Name: $k
Entry: 1
Data: _LootMaterial
- Name: $v
Entry: 7
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 56|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 56
- 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: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -929,7 +935,7 @@ MonoBehaviour:
Data: _ActiveSpinners
- Name: $v
Entry: 7
Data: 58|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ActiveSpinners
@@ -953,13 +959,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 60|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 61|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -983,13 +989,13 @@ MonoBehaviour:
Data: _OrderIsCorrect
- Name: $v
Entry: 7
Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _OrderIsCorrect
- Name: <UserType>k__BackingField
Entry: 7
Data: 62|System.RuntimeType, mscorlib
Data: 63|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean[], mscorlib
@@ -998,7 +1004,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 62
Data: 63
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1013,13 +1019,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 64|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 64|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 65|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1043,16 +1049,16 @@ MonoBehaviour:
Data: _HasBeenCheckedBefore
- Name: $v
Entry: 7
Data: 65|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _HasBeenCheckedBefore
- Name: <UserType>k__BackingField
Entry: 9
Data: 62
Data: 63
- Name: <SystemType>k__BackingField
Entry: 9
Data: 62
Data: 63
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1067,13 +1073,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 67|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 67|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 68|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1097,13 +1103,13 @@ MonoBehaviour:
Data: _RandomMaterialSettings
- Name: $v
Entry: 7
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 69|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _RandomMaterialSettings
- Name: <UserType>k__BackingField
Entry: 7
Data: 69|System.RuntimeType, mscorlib
Data: 70|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
@@ -1112,7 +1118,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 69
Data: 70
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1127,19 +1133,19 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 70|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 71|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 71|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 72|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 72|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 73|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1,5 +1,4 @@
using System.Linq;
using TMPro;
using UdonSharp;
using UnityEngine;
@@ -26,11 +25,11 @@ public class LocationBoard : UdonSharpBehaviour
[UdonSynced, FieldChangeCallback(nameof(WarrantLocation))] private int _WarrantLocation = 0;
[UdonSynced, FieldChangeCallback(nameof(CrookLocation))] private int _CrookLocation = 0;
[SerializeField] private Material _LootMaterial;
[SerializeField] private Material[] _LocationSheetMaterialSelections;
private Animator _Animator;
private VRCImageDownloader _LootImageDownloader;
private Material _LootMaterial;
[UdonSynced] private int _ActiveSpinners = 0;
[UdonSynced] private bool[] _OrderIsCorrect = new bool[3];
@@ -47,7 +46,7 @@ public class LocationBoard : UdonSharpBehaviour
MeshRenderer LootMesh;
if (LootMesh = _LocationPanelsLoot[0].GetComponent<MeshRenderer>())
{
_LootMaterial = LootMesh.sharedMaterial;
LootMesh.sharedMaterial = _LootMaterial;
}
}
@@ -68,16 +67,13 @@ public class LocationBoard : UdonSharpBehaviour
private void GetLootImage()
{
if (_LootMaterial)
{
TextureInfo AdditionalTextureInfo = new TextureInfo();
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
AdditionalTextureInfo.GenerateMipMaps = true;
_LootImageDownloader.DownloadImage(
_GameManager.GetLootImageURL(), _LootMaterial,
null, AdditionalTextureInfo);
}
TextureInfo AdditionalTextureInfo = new TextureInfo();
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
AdditionalTextureInfo.GenerateMipMaps = true;
_LootImageDownloader.DownloadImage(
_GameManager.GetLootImageURL(), _LootMaterial,
null, AdditionalTextureInfo);
}
@@ -289,16 +285,20 @@ public class LocationBoard : UdonSharpBehaviour
MaterialsArray[i] = RandomValue;
}
RandomMaterialSettings = MaterialsArray;
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(ApplyRandomMaterials), MaterialsArray);
}
private void ApplyRandomMaterials()
[NetworkCallable]
public void ApplyRandomMaterials(int[] NewMaterials)
{
for (int i = 0; i < RandomMaterialSettings.Length; i++)
for (int i = 0; i < NewMaterials.Length; i++)
{
Material[] Materials = _LocationPanelInfoSheets[i].materials;
Materials[1] = _LocationSheetMaterialSelections[RandomMaterialSettings[i]];
Materials[1] = _LocationSheetMaterialSelections[NewMaterials[i]];
_LocationPanelInfoSheets[i].materials = Materials;
}
_RandomMaterialSettings = NewMaterials;
}
private void PlaceEmpty(int Panel)
@@ -390,7 +390,7 @@ public class LocationBoard : UdonSharpBehaviour
set
{
_RandomMaterialSettings = value;
ApplyRandomMaterials();
ApplyRandomMaterials(value);
}
get => _RandomMaterialSettings;
}