feat: 게임 인트로 화면 추가
This commit is contained in:
@@ -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