using UdonSharp; using UnityEngine; using VRC.SDK3.Data; using VRC.SDK3.UdonNetworkCalling; using VRC.Udon.Common.Interfaces; using VRC.SDKBase; using VRC.SDK3.StringLoading; using VRC.SDK3.Components; using VRC.Udon.Common; [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] public class HostCardManager : UdonSharpBehaviour { [SerializeField] private GameManagerBase _GameManager; private bool _IsBeingHeld = false; private float _StoredJumpImpulse = 0.0f; [Header("UI")] [SerializeField] private HostCardBetweenRoundsInterface _BetweenRoundsInterface; [SerializeField] private HostCardMultipleChoiceInterface _MultipleChoiceInterface; [SerializeField] private HostCardLightningRoundInterface _LightningRoundInterface; [SerializeField] private HostCardTheChaseInterface _TheChaseInterface; [SerializeField] private HostCardFinalRoundInterface _FinalRoundInterface; [SerializeField] private HostCardRecoverTheLootExplainerInterface _RecoverTheLootExplainerInterface; [SerializeField] private HostCardRecoverTheLootInterface _RecoverTheLootInterface; [SerializeField] private HostPanelInterface _AdminPanelInterface; public override void OnPickup() { if (gameObject != null) { Networking.SetOwner(Networking.LocalPlayer, gameObject); _StoredJumpImpulse = Networking.LocalPlayer.GetJumpImpulse(); Networking.LocalPlayer.SetJumpImpulse(0.0f); _IsBeingHeld = true; } base.OnPickup(); } public override void OnDrop() { if (gameObject != null) { Networking.SetOwner(Networking.InstanceOwner, gameObject); Networking.LocalPlayer.SetJumpImpulse(_StoredJumpImpulse); _StoredJumpImpulse = 0.0f; _IsBeingHeld = false; } base.OnDrop(); } public override bool OnOwnershipRequest(VRCPlayerApi RequestingPlayer, VRCPlayerApi RequestedOwner) { Debug.LogError(RequestingPlayer.displayName + " is requesting that " + RequestedOwner.displayName + " become the new owner of the host card. No fucking way."); return false; } public override void OnOwnershipTransferred(VRCPlayerApi Player) { Debug.LogError("New owner is " + Player); } public override void InputJump(bool Value, UdonInputEventArgs Args) { if (Value && _IsBeingHeld) { _AdminPanelInterface.gameObject.SetActive(!_AdminPanelInterface.gameObject.activeSelf); } base.InputJump(Value, Args); } public override void OnPickupUseDown() { _GameManager.HostCardUseButtonDown(); base.OnPickupUseDown(); } public void SetNextInteractionText(string NextInteractionText) { DisableInteractive = false; VRCPickup Pickup = GetComponent(); if (Pickup != null) { Pickup.UseText = NextInteractionText; } } public void SetGameManager(GameManagerBase Manager) { _GameManager = Manager; } public HostCardInterfaceBase EnableHostCardDisplay(RoundType Game, RoundSegmentType Question) { _BetweenRoundsInterface.gameObject.SetActive(false); _MultipleChoiceInterface.gameObject.SetActive(false); _LightningRoundInterface.gameObject.SetActive(false); _TheChaseInterface.gameObject.SetActive(false); _FinalRoundInterface.gameObject.SetActive(false); _RecoverTheLootExplainerInterface.gameObject.SetActive(false); _RecoverTheLootInterface.gameObject.SetActive(false); switch (Game) { case RoundType.LocateTheCrook: { switch (Question) { case RoundSegmentType.MultipleChoice: _MultipleChoiceInterface.gameObject.SetActive(true); return _MultipleChoiceInterface; case RoundSegmentType.LightningRound: _LightningRoundInterface.gameObject.SetActive(true); return _LightningRoundInterface; case RoundSegmentType.DumpsterDive: break; case RoundSegmentType.TheChase: _TheChaseInterface.gameObject.SetActive(true); return _TheChaseInterface; case RoundSegmentType.FinalRound: _FinalRoundInterface.gameObject.SetActive(true); return _FinalRoundInterface; case RoundSegmentType.Tiebreaker: _BetweenRoundsInterface.gameObject.SetActive(true); return _BetweenRoundsInterface; } } break; case RoundType.RecoverTheLoot: { switch(Question) { case RoundSegmentType.RecoverTheLootExplainer: _RecoverTheLootExplainerInterface.gameObject.SetActive(true); return _RecoverTheLootExplainerInterface; case RoundSegmentType.RecoverTheLoot: _RecoverTheLootInterface.gameObject.SetActive(true); return _RecoverTheLootInterface; } } break; case RoundType.ChaseCarmen: { } break; default: _BetweenRoundsInterface.gameObject.SetActive(true); return _BetweenRoundsInterface; } _BetweenRoundsInterface.gameObject.SetActive(true); return _BetweenRoundsInterface; } }