- Added SFX for opening and closing file cabinets, and an extra boing sound. - Filing cabinet animations improved. - Filing cabinet code made more efficient, relying less on copy-paste code. - Cleaned up unused sound effects. - Improved compression of used sound effects. - Improved Wonder Rat's portrait. - Double Trouble's portrait now matches the resolution of other portraits. - Added missing credit information for Cody, Wyoming stock photo. - Edited Patty Larceny's Africa jail call to match her other lines' takes.
114 lines
2.6 KiB
C#
114 lines
2.6 KiB
C#
|
|
using TMPro;
|
|
using UdonSharp;
|
|
using UnityEngine;
|
|
using VRC.SDK3.Image;
|
|
using VRC.Udon.Common.Interfaces;
|
|
|
|
|
|
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
|
|
public class FilingCabinetNoteDispenser : UdonSharpBehaviour
|
|
{
|
|
[SerializeField] private GameManagerRound1 _GameManager;
|
|
[SerializeField] private AudioManager _AudioManager;
|
|
|
|
[SerializeField] private Animator _Animator;
|
|
[SerializeField] private Transform _ClueCard;
|
|
[SerializeField] private TextMeshProUGUI _ClueCardText;
|
|
[SerializeField] private MeshRenderer _ImageCard;
|
|
|
|
[UdonSynced, FieldChangeCallback(nameof(Activate))] private bool _Activate = false;
|
|
|
|
[UdonSynced, FieldChangeCallback(nameof(Note))] private string _Note = "";
|
|
[UdonSynced, FieldChangeCallback(nameof(Image))] private int _Image = -1;
|
|
[UdonSynced, FieldChangeCallback(nameof(ImageScale))] private float _ImageScale = 1.0f;
|
|
|
|
private VRCImageDownloader _ClueImageDownloader;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
_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()
|
|
{
|
|
if (_Image >= 0)
|
|
{
|
|
TextureInfo AdditionalTextureInfo = new TextureInfo();
|
|
AdditionalTextureInfo.WrapModeU = TextureWrapMode.Clamp;
|
|
AdditionalTextureInfo.WrapModeV = TextureWrapMode.Clamp;
|
|
AdditionalTextureInfo.GenerateMipMaps = true;
|
|
_ClueImageDownloader.DownloadImage(
|
|
_GameManager.GetClueImageURL(_Image), null,
|
|
(IUdonEventReceiver)this, AdditionalTextureInfo);
|
|
}
|
|
else
|
|
{
|
|
_ImageCard.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
public override void OnImageLoadSuccess(IVRCImageDownload Result)
|
|
{
|
|
_ImageCard.material.SetTexture("_MainTex", Result.Result);
|
|
_ImageCard.gameObject.SetActive(true);
|
|
base.OnImageLoadSuccess(Result);
|
|
}
|
|
|
|
|
|
public string Note
|
|
{
|
|
set
|
|
{
|
|
_Note = value;
|
|
_ClueCardText.text = _Note;
|
|
}
|
|
get => _Note;
|
|
}
|
|
|
|
public int Image
|
|
{
|
|
set
|
|
{
|
|
_Image = value;
|
|
LoadClueImage();
|
|
}
|
|
get => _Image;
|
|
}
|
|
|
|
public float ImageScale
|
|
{
|
|
set
|
|
{
|
|
_ImageScale = value;
|
|
_ImageCard.transform.localScale = new Vector3(_ImageScale, _ImageScale, _ImageScale);
|
|
}
|
|
get => _ImageScale;
|
|
}
|
|
}
|