using System.Collections; using System.Collections.Generic; using Unity.BossRoom.Gameplay.GameplayObjects.Character; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; public class SwapConfirmationPanel : MonoBehaviour { [SerializeField] private GameObject confirmationPanel; private ServerCharacter associatedCharacter; // Reference to the correct ServerCharacter instance public void ShowPanel(ServerCharacter character) { associatedCharacter = character; // Set the associated character confirmationPanel.SetActive(true); } public void OnAcceptButtonPressed() { SendDecisionToServer(true); } public void OnDeclineButtonPressed() { SendDecisionToServer(false); } private void SendDecisionToServer(bool isAccepted) { if (associatedCharacter != null) { associatedCharacter.NotifySwapDecisionRpc(isAccepted); } else { Debug.LogError("No associated ServerCharacter found for this swap decision!"); } confirmationPanel.SetActive(false); } }