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,65 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
/// <summary>
/// Attach to a manager GameObject in host lobby.unity.
/// Reads radius from the "radius" slider/input and triggers CreateLobby.
/// Also wires the "vytvořit" button.
/// </summary>
public class HostLobbyUI : MonoBehaviour
{
[Header("Optional refs (auto-found by name if null)")]
public Slider radiusSlider;
public TMP_InputField radiusInput;
public Button createButton;
void Start()
{
if (radiusSlider == null)
{
var go = GameObject.Find("radius");
if (go != null) radiusSlider = go.GetComponent<Slider>();
}
if (radiusInput == null)
{
var go = GameObject.Find("radius");
if (go != null) radiusInput = go.GetComponent<TMP_InputField>();
}
if (createButton == null)
{
// Try all name variants used by the Art team
var go = GameObject.Find("stvo\u0159it") // stvořit
?? GameObject.Find("stvorit")
?? GameObject.Find("vytvo\u0159it") // vytvořit
?? GameObject.Find("vytvorit");
if (go != null)
{
createButton = go.GetComponent<Button>();
// Disable the Art team's direct scene-changer so only our
// wired OnCreateClicked fires (navigation is handled by
// HandleCreateLobbyResponse after the server confirms).
var sceneChanger = go.GetComponent<CudlikZmenaSceny>();
if (sceneChanger != null) sceneChanger.enabled = false;
}
}
if (createButton != null)
createButton.onClick.AddListener(OnCreateClicked);
}
private void OnCreateClicked()
{
var gm = GameManager.Instance;
if (gm == null) return;
// Read radius from slider or input field
if (radiusSlider != null)
gm.pendingRadius = radiusSlider.value;
else if (radiusInput != null && float.TryParse(radiusInput.text, out float r))
gm.pendingRadius = r;
gm.CreateLobbyButton();
}
}