CarmenSandiego/Assets/UdonSharp/Host Card Interfaces/HostCardRecoverTheLootInterface.cs
Jamie Greunbaum 9a630ecd1f - Added victory music to round 2.
- Host card buttons finally properly activate and deactivate during round 2.
- Added tags to camera controller errors in each round manager.
2026-03-16 17:27:28 -04:00

92 lines
2.3 KiB
C#

using System;
using TMPro;
using UdonSharp;
using UnityEngine;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class HostCardRecoverTheLootInterface : HostCardInterfaceBase
{
[SerializeField] private TextMeshProUGUI _CommentUI;
[Space]
public Color _ButtonColourEnabled = Color.white;
[Space]
public Color _ButtonColourLoot = new Color(0.0f, 1.0f, 1.0f);
public Color _ButtonColourWarrant = new Color(1.0f, 1.0f, 0.0f);
public Color _ButtonColourCrook = new Color(0.0f, 1.0f, 0.0f);
private int _LootButton = -1;
private int _WarrantButton = -1;
private int _CrookButton = -1;
private bool[] _DisabledButtons;
public void SetComment(string Comment, Color CommentColour)
{
_CommentUI.text = Comment;
_CommentUI.color = CommentColour;
}
public void AddLandmarkName(int ButtonIndex, string LandmarkName)
{
ChoiceUI[ButtonIndex].text = LandmarkName;
}
public void DisablePanelButton(int Panel)
{
int PanelIndex = Panel - 1;
ChoiceButtons[PanelIndex].enabled = false;
_DisabledButtons[PanelIndex] = true;
_SetActiveButtonColour(PanelIndex, _DisabledButtons[PanelIndex]);
}
public void ActivateAllPanelButtons(bool Activate, bool ResetAllDisabledButtons = false)
{
if (ResetAllDisabledButtons)
{
_DisabledButtons = new bool[ChoiceButtons.Length];
}
for (int i = 0; i < ChoiceButtons.Length; i++)
{
ChoiceButtons[i].enabled = !_DisabledButtons[i];
if (Activate)
_SetActiveButtonColour(i, _DisabledButtons[i]);
else
_SetActiveButtonColour(i, true);
}
}
public void SetLootButton(int Index)
{
_LootButton = (Index - 1) % ChoiceButtons.Length;
}
public void SetWarrantButton(int Index)
{
_WarrantButton = (Index - 1) % ChoiceButtons.Length;
}
public void SetCrookButton(int Index)
{
_CrookButton = (Index - 1) % ChoiceButtons.Length;
}
private void _SetActiveButtonColour(int ButtonIndex, bool Disabled)
{
if (ButtonIndex == _LootButton)
ChoiceButtonImages[ButtonIndex].color = _ButtonColourLoot * (Disabled ? 0.5f : 1.0f);
else if (ButtonIndex == _WarrantButton)
ChoiceButtonImages[ButtonIndex].color = _ButtonColourWarrant * (Disabled ? 0.5f : 1.0f);
else if (ButtonIndex == _CrookButton)
ChoiceButtonImages[ButtonIndex].color = _ButtonColourCrook * (Disabled ? 0.5f : 1.0f);
else
ChoiceButtonImages[ButtonIndex].color = _ButtonColourEnabled * (Disabled ? 0.5f : 1.0f);
}
}