Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Archives
Today
Total
관리 메뉴

행복한 개구리

Unity UI 21.04.19.수업내용 본문

Unity/수업내용

Unity UI 21.04.19.수업내용

HappyFrog 2021. 4. 19. 18:20

좌 / UI Title

우 / UI Login

 

이런식으로 정리를 했다.

UI타이틀에서는 버튼 / 재산보유상황 / 로그인버튼 / 친구추가버튼 / 프로필 로 나누어서 묶었고

 

UI로그인은 버튼별로 묶어놓았다.

 

 

 

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIPopupLogin : MonoBehaviour
{
    public Button signUp;
    public Button signIn;
    public Button exit;
    public Button remember;
    public Button forgot;
   /* public Button email;
    public Button password;*/
    public InputField emailBlock;
    public InputField pwBlock;
    // Start is called before the first frame update
    void Start()
    {   
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UITitle : MonoBehaviour
{
    public Button btnFb;
    public Button btnFriend;

    public UIProfile uiProfile;
    public UIBudget[] arrBudgets;
    public UIMenuButton[] arrMenuButtons;    

    public void Init()
    {

    }
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Title : MonoBehaviour
{
    public UITitle uiTitle;
    public UIPopupLogin login;
    // Start is called before the first frame update
    void Start()
    {
        Init();
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void Init()
    {
        this.uiTitle.btnFb.onClick.AddListener(() =>
        {
            this.login.gameObject.SetActive(true);
            this.login.emailBlock.text = "";
            this.login.pwBlock.text = "";
            Debug.Log("Fb");
        });
        
        this.login.exit.onClick.AddListener(() =>
        {
            this.login.gameObject.SetActive(false);
            Debug.Log("Exit");
        });

        this.login.signUp.onClick.AddListener(() =>
        {
            Debug.Log("SignUp");
        });

        this.login.remember.onClick.AddListener(() => 
        {
            Debug.Log("Remember");
        });

        this.login.forgot.onClick.AddListener(() =>
        {
            Debug.Log("Forgot");
        });

        this.login.signIn.onClick.AddListener(() =>
        {
            Debug.Log("SignIn");
        });
    }
}

 

 

 

 

 

사실상의 기능은 Title, UITitle, UILogin에서 모두 처리하는데, 그 중에서 Title에서 가장 중심적으로 처리를한다.

처리는 event를 사용했으며 로그인창이 켜지고 꺼지는 것과 로그인칸과 비밀번호 칸에 입력을 하는 것 까지 구현했다.

'Unity > 수업내용' 카테고리의 다른 글

Unity GUI 21.04.21.수업내용  (0) 2021.04.21
Unity 21.04.20. UI구현  (0) 2021.04.20
Unity 3D 21.04.16.수업내용  (0) 2021.04.16
Unity 3D 21.04.15.수업내용  (0) 2021.04.15
Unity 21.04.14.수업내용  (0) 2021.04.14