- Created static Wanted posters for all crooks, including Carmen Sandiego.

- Tweaked font SDF maps to be much smaller in size while still looking good.
- Loot image downloading is now handled globally by CaseManager.
- LocationBoard and MissingPoster now get their loot image from CaseManager.
- Recompressed a lot of textures to try to save space.
- Enabled streaming mipmaps on all textures, and texture streaming globally.
- Updated occlusion culling data for the first time in a while.
This commit is contained in:
2026-03-13 03:59:44 -04:00
parent b0995571c0
commit bf24828b41
105 changed files with 11092 additions and 7937 deletions
File diff suppressed because it is too large Load Diff
+80 -12
View File
@@ -3,7 +3,9 @@ using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDK3.Data;
using VRC.SDK3.Image;
using VRC.SDK3.StringLoading;
using VRC.SDK3.UdonNetworkCalling;
using VRC.SDKBase;
using VRC.Udon.Common.Interfaces;
@@ -31,22 +33,21 @@ public class CaseManager : UdonSharpBehaviour
[Header("Global Case Assets")]
[SerializeField] private Texture[] CrookPortraits;
[Space, Header("Managers")]
[Space, Header("Management Classes")]
[SerializeField] private PermissionsPanel _PermissionsPanel;
[SerializeField] private GameManagerRound1 _Round1Manager;
[SerializeField] private GameManagerRound2 _Round2Manager;
[SerializeField] private GameManagerRound3 _Round3Manager;
[Space]
[SerializeField] private MultiRoundVideoPlayer _MultiRoundVideoPlayer;
[Space, Header("Updateable Objects")]
[SerializeField] private LiveIndicator _LiveIndicator;
[SerializeField] private HostCardManager _HostCard;
[Space]
[SerializeField] private CaseManagerListView _CaseManagerList;
[SerializeField] private Button _HostTeleportButton;
[Space]
[SerializeField] private MultiRoundVideoPlayer _MultiRoundVideoPlayer;
[SerializeField] private WantedPoster[] _WantedPosters;
[SerializeField] private MissingPoster[] _MissingPosters;
[Space]
[SerializeField] private LiveIndicator _LiveIndicator;
[SerializeField] private LocationBoard _LocationBoard;
[Space, Header("Host UI")]
[SerializeField] private CaseManagerListView _CaseManagerList;
[SerializeField] private Button _HostTeleportButton;
[UdonSynced] private VRCUrl _CaseFileCluesURL;
[UdonSynced] private VRCUrl _CaseFileLootImage;
@@ -68,6 +69,20 @@ public class CaseManager : UdonSharpBehaviour
private DataDictionary _CaseFileDictionary;
private VRCImageDownloader _LootImageDownloader;
private Texture2D _LootImageTexture = null;
private void Start()
{
_LootImageDownloader = new VRCImageDownloader();
}
void OnDestroy()
{
_LootImageDownloader.Dispose();
}
public override void OnPlayerJoined(VRCPlayerApi Player)
{
@@ -216,16 +231,69 @@ public class CaseManager : UdonSharpBehaviour
Debug.LogError("[CaseManager] Malformed case file. " + ErrorString);
}
_InitialiseUpdateables();
RequestSerialization();
}
private void _InitialiseUpdateables()
{
foreach (WantedPoster Poster in _WantedPosters)
{
Poster.SetNewCrook(_AccusedCrook, GetCrookName());
}
foreach (MissingPoster Poster in _MissingPosters)
SendCustomNetworkEvent(NetworkEventTarget.All, nameof(DownloadLootImage), _CaseFileLootImage);
}
[NetworkCallable]
public void DownloadLootImage(VRCUrl LootURL)
{
TextureInfo AdditionalTextureInfo = new TextureInfo();
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
AdditionalTextureInfo.GenerateMipMaps = true;
_LootImageDownloader.DownloadImage(LootURL, null,
(IUdonEventReceiver)this, AdditionalTextureInfo);
}
public override void OnImageLoadSuccess(IVRCImageDownload Result)
{
_LootImageTexture = Result.Result;
if (_LootImageTexture != null)
{
Poster.SetNewLoot(_CaseFileLootImage, _StolenLoot);
foreach (MissingPoster Poster in _MissingPosters)
{
Poster.ApplyLootImage(_LootImageTexture);
Poster.SetNewLootName(_StolenLoot);
}
_LocationBoard.SetLootImage(_LootImageTexture);
}
RequestSerialization();
base.OnImageLoadSuccess(Result);
}
public override void OnImageLoadError(IVRCImageDownload Result)
{
string DownloadError = "[CaseManager] Could not retrieve loot image: " + Result.ErrorMessage;
//switch (Result.Error)
//{
// case VRCImageDownloadError.Unknown:
// break;
// case VRCImageDownloadError.InvalidURL:
// break;
// case VRCImageDownloadError.AccessDenied:
// break;
// case VRCImageDownloadError.DownloadError:
// break;
// case VRCImageDownloadError.InvalidImage:
// break;
// case VRCImageDownloadError.TooManyRequests:
// break;
//}
Debug.LogError(DownloadError);
base.OnImageLoadError(Result);
}
@@ -63,7 +63,6 @@ public class GameManagerRound2 : GameManagerBase
_StageIndex = 0;
InitialiseLocationBoard();
_LocationBoard.SetLootImageURL(_CaseManager.GetLootImage());
_JailChain.Initialise();
_JailPhone.Initialise();
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 22
Data: 20
- Name:
Entry: 7
Data:
@@ -704,19 +704,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _LootImageURL
Data: _Landmarks
- Name: $v
Entry: 7
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootImageURL
Data: _Landmarks
- Name: <UserType>k__BackingField
Entry: 7
Data: 46|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCUrl, VRCSDKBase
Data: System.String[], mscorlib
- Name:
Entry: 8
Data:
@@ -770,19 +770,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _Landmarks
Data: _RandomMaterialSettings
- Name: $v
Entry: 7
Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Landmarks
Data: _RandomMaterialSettings
- Name: <UserType>k__BackingField
Entry: 7
Data: 51|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String[], mscorlib
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
@@ -836,25 +836,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _RandomMaterialSettings
Data: _RevealedPanel
- Name: $v
Entry: 7
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _RandomMaterialSettings
Data: _RevealedPanel
- Name: <UserType>k__BackingField
Entry: 7
Data: 56|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32[], mscorlib
- Name:
Entry: 8
Data:
Entry: 9
Data: 33
- Name: <SystemType>k__BackingField
Entry: 9
Data: 56
Data: 33
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -869,19 +863,19 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 57|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 58|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 57|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 59|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 58|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -902,19 +896,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _RevealedPanel
Data: _OrderIsCorrect
- Name: $v
Entry: 7
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _RevealedPanel
Data: _OrderIsCorrect
- Name: <UserType>k__BackingField
Entry: 9
Data: 33
Entry: 7
Data: 60|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 33
Data: 60
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -932,79 +932,13 @@ MonoBehaviour:
Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
Data: 1
- Name:
Entry: 7
Data: 62|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 63|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- 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: _OrderIsCorrect
- Name: $v
Entry: 7
Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _OrderIsCorrect
- Name: <UserType>k__BackingField
Entry: 7
Data: 65|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 65
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 3
Data: 1
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 66|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 67|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -1025,16 +959,16 @@ MonoBehaviour:
Data: _HasBeenCheckedBefore
- Name: $v
Entry: 7
Data: 68|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 63|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _HasBeenCheckedBefore
- Name: <UserType>k__BackingField
Entry: 9
Data: 65
Data: 60
- Name: <SystemType>k__BackingField
Entry: 9
Data: 65
Data: 60
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1049,13 +983,13 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 69|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: 70|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 65|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1079,13 +1013,13 @@ MonoBehaviour:
Data: _LootMaterial
- Name: $v
Entry: 7
Data: 71|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 66|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 72|System.RuntimeType, mscorlib
Data: 67|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material, UnityEngine.CoreModule
@@ -1094,7 +1028,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 72
Data: 67
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1109,13 +1043,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 73|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 68|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 74|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 69|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1139,13 +1073,13 @@ MonoBehaviour:
Data: _LocationSheetMaterialSelections
- Name: $v
Entry: 7
Data: 75|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 70|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LocationSheetMaterialSelections
- Name: <UserType>k__BackingField
Entry: 7
Data: 76|System.RuntimeType, mscorlib
Data: 71|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material[], UnityEngine.CoreModule
@@ -1154,7 +1088,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 76
Data: 71
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1169,13 +1103,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 77|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 72|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 78|UnityEngine.SerializeField, UnityEngine.CoreModule
Data: 73|UnityEngine.SerializeField, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -1199,13 +1133,13 @@ MonoBehaviour:
Data: _Animator
- Name: $v
Entry: 7
Data: 79|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 74|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _Animator
- Name: <UserType>k__BackingField
Entry: 7
Data: 80|System.RuntimeType, mscorlib
Data: 75|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Animator, UnityEngine.AnimationModule
@@ -1214,7 +1148,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 80
Data: 75
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1229,61 +1163,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 81|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: _LootImageDownloader
- Name: $v
Entry: 7
Data: 82|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootImageDownloader
- Name: <UserType>k__BackingField
Entry: 7
Data: 83|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Image.VRCImageDownloader, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 83
- 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: 84|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 76|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -1307,7 +1187,7 @@ MonoBehaviour:
Data: _ActiveSpinners
- Name: $v
Entry: 7
Data: 85|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 77|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _ActiveSpinners
@@ -1331,7 +1211,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 86|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 78|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -25,8 +25,6 @@ public class LocationBoard : UdonSharpBehaviour
[UdonSynced, FieldChangeCallback(nameof(WarrantLocation))] private int _WarrantLocation = 0;
[UdonSynced, FieldChangeCallback(nameof(CrookLocation))] private int _CrookLocation = 0;
[UdonSynced, FieldChangeCallback(nameof(LootImageURL))] private VRCUrl _LootImageURL;
[UdonSynced, FieldChangeCallback(nameof(Landmarks))] private string[] _Landmarks;
[UdonSynced, FieldChangeCallback(nameof(RandomMaterialSettings))] private int[] _RandomMaterialSettings;
@@ -39,7 +37,6 @@ public class LocationBoard : UdonSharpBehaviour
[SerializeField] private Material[] _LocationSheetMaterialSelections;
private Animator _Animator;
private VRCImageDownloader _LootImageDownloader;
private int _ActiveSpinners = 0;
@@ -47,7 +44,6 @@ public class LocationBoard : UdonSharpBehaviour
void Start()
{
_Animator = GetComponent<Animator>();
_LootImageDownloader = new VRCImageDownloader();
_HasBeenCheckedBefore = new bool[_LocationPanelsEmpty.Length];
MeshRenderer LootMesh;
@@ -57,11 +53,6 @@ public class LocationBoard : UdonSharpBehaviour
}
}
void OnDestroy()
{
_LootImageDownloader.Dispose();
}
[NetworkCallable]
public void PopulateLandmarks(string[] NewLandmarks)
{
@@ -72,21 +63,9 @@ public class LocationBoard : UdonSharpBehaviour
_Landmarks = NewLandmarks;
}
public void SetLootImageURL(VRCUrl URL)
public void SetLootImage(Texture2D LootTexture)
{
LootImageURL = URL;
RequestSerialization();
}
private void DownloadLootImage()
{
TextureInfo AdditionalTextureInfo = new TextureInfo();
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
AdditionalTextureInfo.GenerateMipMaps = true;
_LootImageDownloader.DownloadImage(
LootImageURL, _LootMaterial,
null, AdditionalTextureInfo);
_LootMaterial.SetTexture("_MainTex", LootTexture);
}
@@ -409,16 +388,6 @@ public class LocationBoard : UdonSharpBehaviour
get => _CrookLocation;
}
public VRCUrl LootImageURL
{
set
{
_LootImageURL = value;
DownloadLootImage();
}
get => _LootImageURL;
}
public string[] Landmarks
{
set
+4 -58
View File
@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 8
Data: 7
- Name:
Entry: 7
Data:
@@ -413,19 +413,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _LootImageDownloader
Data: _PortraitMaterial
- Name: $v
Entry: 7
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _LootImageDownloader
Data: _PortraitMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 27|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Image.VRCImageDownloader, VRCSDK3
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -462,60 +462,6 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _PortraitMaterial
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _PortraitMaterial
- Name: <UserType>k__BackingField
Entry: 7
Data: 30|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Material, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
- 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: 31|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:
+6 -18
View File
@@ -4,7 +4,6 @@ using UdonSharp;
using UnityEngine;
using VRC.SDK3.Image;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common;
@@ -20,21 +19,14 @@ public class MissingPoster : UdonSharpBehaviour
[UdonSynced] private VRCUrl _LootImageURL;
[UdonSynced] private string _Name = "";
private VRCImageDownloader _LootImageDownloader;
private Material _PortraitMaterial = null;
private void Start()
{
_LootImageDownloader = new VRCImageDownloader();
_PortraitMaterial = _MissingPosterMesh.materials[2];
}
void OnDestroy()
{
_LootImageDownloader.Dispose();
}
public override void OnDeserialization(DeserializationResult Result)
{
_ApplyNewConfiguration();
@@ -42,24 +34,20 @@ public class MissingPoster : UdonSharpBehaviour
}
public void SetNewLoot(VRCUrl LootImage, string Name)
public void SetNewLootName(string Name)
{
_LootImageURL = LootImage;
_Name = Name;
_ApplyNewConfiguration();
RequestSerialization();
}
public void ApplyLootImage(Texture2D Loot)
{
_PortraitMaterial.SetTexture("_MainTex", Loot);
}
private void _ApplyNewConfiguration()
{
TextureInfo AdditionalTextureInfo = new TextureInfo();
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
AdditionalTextureInfo.GenerateMipMaps = true;
_LootImageDownloader.DownloadImage(
_LootImageURL, _PortraitMaterial,
null, AdditionalTextureInfo);
_LootName.text = _Name;
}
}