You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|