Jamie Greunbaum 22a25b65d8 - Player podiums are claimed when teleported to.
- Fixed issue that caused screens to not reset after the final round.
- Fixed render target for videos so the aspect ratio is correct.
- Tweaked a bunch of textures and various unimportant things.
2025-08-03 19:26:50 -04:00

60 lines
1.8 KiB
C#

using UdonSharp;
using UnityEngine;
using VRC.SDK3.Data;
using VRC.SDKBase;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class PermissionsPanel : UdonSharpBehaviour
{
[SerializeField] private RectTransform _ListContainer;
[SerializeField] private GameObject _PlayerItemTemplate;
private DataDictionary PlayerData = new DataDictionary();
public override void OnPlayerJoined(VRCPlayerApi Player)
{
GameObject NewListItem = Instantiate<GameObject>(_PlayerItemTemplate, _ListContainer, false);
NewListItem.SetActive(true);
PermissionsPanelPlayerEntry PlayerListItem = NewListItem.GetComponent<PermissionsPanelPlayerEntry>();
PlayerListItem.PlayerNameUI.text = Player.displayName;
PlayerData[Player.displayName] = new DataDictionary();
PlayerData[Player.displayName].DataDictionary["Admin"] = Player.isInstanceOwner;
PlayerData[Player.displayName].DataDictionary["Host"] = Player.isInstanceOwner;
PlayerData[Player.displayName].DataDictionary["Camera"] = Player.isInstanceOwner;
if (Networking.LocalPlayer.isInstanceOwner)
{
PlayerListItem.AdminToggle.interactable = true;
PlayerListItem.HostToggle.interactable = true;
PlayerListItem.CameraToggle.interactable = true;
PlayerListItem.AdminToggle.SetIsOnWithoutNotify(true);
PlayerListItem.HostToggle.SetIsOnWithoutNotify(true);
PlayerListItem.CameraToggle.SetIsOnWithoutNotify(true);
}
base.OnPlayerJoined(Player);
}
public override void OnPlayerLeft(VRCPlayerApi player)
{
for (int i = 0; i < _ListContainer.childCount; i++)
{
GameObject Entry = _ListContainer.GetChild(i).gameObject;
PermissionsPanelPlayerEntry PlayerEntry = Entry.GetComponent<PermissionsPanelPlayerEntry>();
if (PlayerEntry != null && PlayerEntry.PlayerNameUI.text == player.displayName)
{
Destroy(Entry);
break;
}
}
base.OnPlayerLeft(player);
}
}