feat: 게임 인트로 화면 추가
This commit is contained in:
@@ -68,5 +68,18 @@ namespace TON
|
||||
{
|
||||
return LoadAsset<Sprite>($"UI/Ranking Paw/my_rank_box", out result);
|
||||
}
|
||||
|
||||
public bool LoadIntroBackgroundImage(int index, out Sprite result)
|
||||
{
|
||||
return LoadAsset<Sprite>($"UI/Story Background/intro_background_{index}", out result);
|
||||
}
|
||||
|
||||
public bool LoadIntroVillagerImage(out Sprite result)
|
||||
{
|
||||
return LoadAsset<Sprite>($"UI/Story Background/villagers", out result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,14 @@ namespace TON
|
||||
Main.Singleton.Initialize();
|
||||
|
||||
// TODO : Custom Order After System Load
|
||||
UIManager.Show<TitleUI>(UIList.TitleUI);
|
||||
// UIManager.Show<TitleUI>(UIList.TitleUI);
|
||||
UIManager.Show<IntroUI>(UIList.IntroUI);
|
||||
// UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
// UIManager.Show<LobbyUI>(UIList.LobbyUI);
|
||||
// UIManager.Show<IngameOptionUI>(UIList.IngameOptionUI);
|
||||
// UIManager.Show<SkillSettingUI>(UIList.SkillSettingUI);
|
||||
// PlayerDataManager.Singleton.SetCurrentUserData();
|
||||
PlayerDataManager.Singleton.Initalize();
|
||||
PlayerDataManager.Singleton.SetCurrentUserData();
|
||||
// UIManager.Show<ControllerUI>(UIList.ControllerUI);
|
||||
// ControllerUI.Instance.Initalize();
|
||||
// UIManager.Show<IngameUI>(UIList.IngameUI);
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace TON
|
||||
None,
|
||||
Empty,
|
||||
Title,
|
||||
Intro,
|
||||
Lobby,
|
||||
Stage,
|
||||
Shop,
|
||||
@@ -63,6 +64,9 @@ namespace TON
|
||||
case SceneType.Title:
|
||||
StartCoroutine(ChangeScene<TitleScene>(onSceneChangeCompletedCallback));
|
||||
break;
|
||||
case SceneType.Intro:
|
||||
StartCoroutine(ChangeScene<IntroScene>(onSceneChangeCompletedCallback));
|
||||
break;
|
||||
case SceneType.Lobby:
|
||||
StartCoroutine(ChangeScene<LobbyScene>(onSceneChangeCompletedCallback));
|
||||
break;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace TON
|
||||
PauseUI, // 일시중지 버튼 선택 시 노출되는 UI
|
||||
GoldPopup,
|
||||
GuideUI,
|
||||
IntroUI,
|
||||
|
||||
POPUP_END,
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ using UnityEngine;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class IntroStoryDataManager : MonoBehaviour
|
||||
public class IntroStoryDataManager
|
||||
{
|
||||
public List<IntroStoryData> introStories { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
public void Initialize()
|
||||
{
|
||||
LoadIntroStoryData();
|
||||
}
|
||||
|
||||
33
Gameton-06/Assets/Gameton/Scripts/Scenes/IntroScene.cs
Normal file
33
Gameton-06/Assets/Gameton/Scripts/Scenes/IntroScene.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class IntroScene : SceneBase
|
||||
{
|
||||
public override IEnumerator OnStart()
|
||||
{
|
||||
// Intro 씬을 비동기로 로드한다.
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync("Intro", LoadSceneMode.Single);
|
||||
|
||||
// 로드가 완료될 때 까지 yield return null 을 하면서 기다린다
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
UIManager.Show<IntroUI>(UIList.IntroUI);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override IEnumerator OnEnd()
|
||||
{
|
||||
yield return null;
|
||||
|
||||
UIManager.Hide<IntroUI>(UIList.IntroUI);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Gameton-06/Assets/Gameton/Scripts/Scenes/IntroScene.cs.meta
Normal file
11
Gameton-06/Assets/Gameton/Scripts/Scenes/IntroScene.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea9529b42ef9b7c47bef041f8d230f63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -69,7 +69,7 @@ namespace TON
|
||||
}
|
||||
|
||||
// 선택된 캐릭터 인덱스 정보를 저장 (다음 씬에서도 사용할 수 있도록)
|
||||
PlayerPrefs.SetInt("SelectedPlayerIndex", playerDatas.Count);
|
||||
PlayerPrefs.SetInt("SelectedPlayerIndex", 0);
|
||||
|
||||
// 캐릭터 이름 입력 모달 활성화
|
||||
characterCreateUI_Modal.SetActive(true);
|
||||
@@ -133,7 +133,7 @@ namespace TON
|
||||
// 씬 변경
|
||||
UIManager.Hide<CharaterCreateUI>(UIList.CharaterCreateUI);
|
||||
|
||||
Main.Singleton?.ChangeScene(SceneType.Lobby);
|
||||
Main.Singleton.ChangeScene(SceneType.Lobby);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -65,7 +65,8 @@ namespace TON
|
||||
|
||||
UIManager.Hide<CharaterSelectUI>(UIList.CharaterSelectUI);
|
||||
|
||||
Main.Singleton?.ChangeScene(SceneType.Lobby);
|
||||
// Main.Singleton.ChangeScene(SceneType.Lobby);
|
||||
Main.Singleton.ChangeScene(SceneType.Intro);
|
||||
}
|
||||
|
||||
public void OnClickCreateButton()
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
@@ -9,12 +11,85 @@ namespace TON
|
||||
public List<IntroStoryData> introStories = new List<IntroStoryData>();
|
||||
|
||||
private IntroStoryDataManager introStoryDataManager;
|
||||
private int index = 0;
|
||||
|
||||
[SerializeField] private Image backgroundImage;
|
||||
[SerializeField] private Image speakerImage;
|
||||
[SerializeField] private TextMeshProUGUI speakerText;
|
||||
[SerializeField] private TextMeshProUGUI content;
|
||||
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
index = 0;
|
||||
|
||||
introStoryDataManager = new IntroStoryDataManager();
|
||||
|
||||
introStoryDataManager.Initialize();
|
||||
introStories = introStoryDataManager.introStories;
|
||||
|
||||
SetStoryData();
|
||||
}
|
||||
|
||||
public void HandleClickScreen()
|
||||
{
|
||||
if (index == introStories.Count - 1)
|
||||
{
|
||||
Main.Singleton.ChangeScene(SceneType.Lobby);
|
||||
return;
|
||||
}
|
||||
|
||||
index++;
|
||||
SetStoryData();
|
||||
}
|
||||
|
||||
private void SetStoryData()
|
||||
{
|
||||
IntroStoryData storyData = introStories[index];
|
||||
|
||||
content.text = storyData.content;
|
||||
|
||||
if (AssetManager.Singleton.LoadIntroBackgroundImage(index, out Sprite background))
|
||||
{
|
||||
backgroundImage.sprite = background;
|
||||
}
|
||||
|
||||
LoadSpeaker(storyData.speaker);
|
||||
}
|
||||
|
||||
private void LoadSpeaker(string speaker)
|
||||
{
|
||||
PlayerData player = PlayerDataManager.Singleton.player;
|
||||
|
||||
Sprite loadImage = null;
|
||||
|
||||
switch (speaker)
|
||||
{
|
||||
case "me":
|
||||
AssetManager.Singleton.LoadPlayerIcon(player.type, FaceStatue.Idle, out loadImage);
|
||||
speakerText.text = $"{player.name}";
|
||||
break;
|
||||
case "villagers":
|
||||
AssetManager.Singleton.LoadIntroVillagerImage(out loadImage);
|
||||
speakerText.text = "마을 사람들";
|
||||
break;
|
||||
case "dragon":
|
||||
AssetManager.Singleton.LoadMonsterWaveIcon(10, out loadImage);
|
||||
speakerText.text = "사악한 드래곤";
|
||||
break;
|
||||
}
|
||||
|
||||
if (loadImage != null)
|
||||
{
|
||||
speakerImage.sprite = loadImage;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickSkipButton()
|
||||
{
|
||||
Main.Singleton.ChangeScene(SceneType.Lobby);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ namespace TON
|
||||
PlayerPrefs.SetInt("SelectedPlayerIndex", 0);
|
||||
PlayerDataManager.Singleton.SetCurrentUserData();
|
||||
HeartDataManager.Singleton.SetCurrentUserHeart();
|
||||
Main.Singleton?.ChangeScene(SceneType.Lobby);
|
||||
Main.Singleton.ChangeScene(SceneType.Lobby);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClickExitButton()
|
||||
{
|
||||
Main.Singleton?.SystemQuit();
|
||||
Main.Singleton.SystemQuit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user