Yang.공부방




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
32
33
34
35
36
37
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
 
public class Logo : MonoBehaviour
{
    public UILogo uiLogo;
 
    public void Init(Camera uiCamera)
    {
        this.uiLogo.Init(uiCamera);
        uiLogo.FadeIn();
        
        this.uiLogo.onFadeInCompleted = () =>
        {
            Debug.Log("Logo FadeIn완료");
            StartCoroutine(this.uiLogo.WaitForSeconds(3));
            uiLogo.onWaitForCecondsCompleted = () =>
            {
                uiLogo.FadeOut();
            };
        };
        this.uiLogo.onFadeOutCompleted = () =>
        {
            Debug.Log("Logo FadOut완료");
            var oper = SceneManager.LoadSceneAsync("Title");
            oper.completed += (asyncOper) =>
            {
                Debug.Log("Title로고씬 로드");
                var title = GameObject.FindObjectOfType<Title>();
                title.Init(uiCamera);
            };
        };
    }
}
 
cs
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
32
33
34
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
 
public class Title : MonoBehaviour
{
    public UITitle uiTitle;
    private bool isRead;
 
    public void Awake()
    {
        this.uiTitle.btn.onClick.AddListener(() =>
        {
            Debug.Log("버튼클릭함");
            this.uiTitle.FadeOut();
            //StartCoroutine(this.uiTitle.WaitForSeconds(3));
        });
    }
 
    public void Init(Camera uiCamera)
    {
        this.uiTitle.Init(uiCamera);
        this.uiTitle.FadeIn();
 
        this.uiTitle.onFadeInCompleted = () =>
         {
             Debug.Log("Title FadeIn 완료");
             
         };
    }
}
 
cs
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
32
33
34
35
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
 
namespace yangjaejoon.scenes
{
    public class App : MonoBehaviour
    {
        public Camera uiCamera;
 
        private void Awake()
        {
            //인스턴스가 로딩될 때 
            Object.DontDestroyOnLoad(this);
        }
 
        // Start is called before the first frame update
        void Start()
        {
            var oper = SceneManager.LoadSceneAsync("Logo");
            oper.completed += (asyncOper) =>
            {
                var logo = GameObject.FindObjectOfType<Logo>();
                logo.Init(this.uiCamera);
            };
        }
 
        // Update is called once per frame
        void Update()
        {
 
        }
    }
}
cs