starOfWords/Assets/Scripts/PopupController.cs
portakal ecb1c9edea Initial commit: Star of Words Unity project
Snapshot of the existing Unity 6 language-learning word game before any
refactoring. Adds Unity .gitignore and .gitattributes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 15:31:20 +03:00

42 lines
1.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using UnityEngine;
using UnityEngine.UI;
public class PopupController_Auto : MonoBehaviour
{
private GameObject popupPanel;
private Button openButton;
private Button closeButton;
void Awake()
{
// Otomatik bulma
popupPanel = GameObject.Find("PopupPanel");
openButton = GameObject.Find("HelpButton").GetComponent<Button>();
closeButton = GameObject.Find("CloseButton").GetComponent<Button>();
if (popupPanel == null)
Debug.LogError("PopupPanel bulunamadı! İsmi tam olarak 'PopupPanel' olmalı.");
if (openButton == null)
Debug.LogError("HelpButton bulunamadı! İsmi tam olarak 'HelpButton' olmalı.");
if (closeButton == null)
Debug.LogError("CloseButton bulunamadı! İsmi tam olarak 'CloseButton' olmalı.");
popupPanel.SetActive(false);
// Eventleri otomatik bağlama
openButton.onClick.AddListener(OpenPopup);
closeButton.onClick.AddListener(ClosePopup);
}
void OpenPopup()
{
popupPanel.SetActive(true);
}
void ClosePopup()
{
popupPanel.SetActive(false);
}
}