Zabiju je

This commit is contained in:
2026-04-26 13:30:33 +02:00
parent 208696487e
commit 700e6bfbfc
143 changed files with 11027 additions and 1298 deletions

View File

@@ -0,0 +1,49 @@
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
/// <summary>
/// Attach to a manager GameObject in "are u sure.unity".
/// "yes" = confirm leave lobby and go to main menu.
/// "no" = go back to previous lobby scene.
/// </summary>
public class ConfirmLeaveUI : MonoBehaviour
{
[Header("Optional refs (auto-found by name if null)")]
public Button yesButton;
public Button noButton;
[Tooltip("Scene to load after leaving lobby")]
public string mainMenuScene = "main menu asi idk lol";
[Tooltip("Scene to go back to when player presses No")]
public string previousScene = "create";
void Start()
{
if (yesButton == null)
{
var go = GameObject.Find("yes");
if (go != null) yesButton = go.GetComponent<Button>();
}
if (noButton == null)
{
var go = GameObject.Find("no");
if (go != null) noButton = go.GetComponent<Button>();
}
if (yesButton != null) yesButton.onClick.AddListener(OnYesClicked);
if (noButton != null) noButton.onClick.AddListener(OnNoClicked);
}
private void OnYesClicked()
{
GameManager.Instance?.LeaveLobbyButton();
SceneManager.LoadScene(mainMenuScene, LoadSceneMode.Single);
}
private void OnNoClicked()
{
SceneManager.LoadScene(previousScene, LoadSceneMode.Single);
}
}