UNITY/크레이지아케이드 모작

크아 모작 기본적인 버튼 구현

2zreal 2024. 6. 28. 18:42

방만들기 버튼

뒤로가기 버튼

 

 

 

종료하기 버튼

 

오늘은 간단한 버튼만 구현하였다.

 

using UnityEngine;

public class GameManager : MonoBehaviour
{
    public GameObject LoginPanel;
    public GameObject StartPanel;
    public GameObject MakeRoomPanel;
    public GameObject RoomPanel;
    public GameObject ExitPanel;

   public void Login()
    {
        LoginPanel.SetActive(false);
        StartPanel.SetActive(true);
    }

    public void MakeRoom()
    {
        MakeRoomPanel.SetActive(true);
    }

    public void 확인()
    {
        RoomPanel.SetActive(true);
        StartPanel.SetActive(false);
        MakeRoomPanel.SetActive(false);
    }

    public void 취소()
    {
        MakeRoomPanel.SetActive(false);
        ExitPanel.SetActive(false);
    }

    public void 뒤로가기1()
    {
        LoginPanel.SetActive(true);
        StartPanel.SetActive(false);
    }

    public void 뒤로가기2()
    {
        RoomPanel.SetActive(false);
        StartPanel.SetActive(true);
    }

    public void 종료()
    {
        ExitPanel.SetActive(true);
    }

    public void 종료하기()
    {
        Application.Quit();
    }
}

panel을 만들고 SetActive를 통해 구현하였다.

Canvas에 분산시켜야하나??

조금 더 효율적인 방법을 고민해봐야겠다.