CarmenSandiego/Assets/UdonSharp/MissingPoster.cs
Jamie Greunbaum b0995571c0 This is a big one:
- Added more camera switches to the end of round 3.
- Made round 3 camera animations reset more reliably.
- Added more decorations, including self-updating Wanted and Missing posters.
- Added a crook portrait for Carmen Sandiego as part of the above.
- Uncommented seemingly useless code in CaseVideoSyncPlayer; not so useless.
- RandomVideoPlayer now sets ownership properly on ownership transfer.
- Location board crook portraits no longer use a shared material.
- Lowered resolution of crook portraits.
- Paper materials now have their normal map on the detail UVs instead.
- Drew more of Robocrook's lower half, and filled out his portrait more.
2026-03-12 04:46:43 -04:00

66 lines
1.5 KiB
C#

using TMPro;
using UdonSharp;
using UnityEngine;
using VRC.SDK3.Image;
using VRC.SDKBase;
using VRC.Udon;
using VRC.Udon.Common;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class MissingPoster : UdonSharpBehaviour
{
[SerializeField] private TextMeshProUGUI _LootName;
[Space]
[SerializeField] private MeshRenderer _MissingPosterMesh;
[SerializeField] private Texture _DefaultPortrait;
[SerializeField] private string _DefaultLootName;
[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();
base.OnDeserialization(Result);
}
public void SetNewLoot(VRCUrl LootImage, string Name)
{
_LootImageURL = LootImage;
_Name = Name;
_ApplyNewConfiguration();
RequestSerialization();
}
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;
}
}