Build TravelRun intro and tutorial flow
This commit is contained in:
@@ -4,10 +4,14 @@ using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
#endif
|
||||
|
||||
public class GameFlowManager : MonoBehaviour {
|
||||
public enum FlowScreen {
|
||||
Intro,
|
||||
OpeningStory,
|
||||
Game,
|
||||
Result,
|
||||
DutyFreeShop,
|
||||
@@ -39,6 +43,11 @@ public class GameFlowManager : MonoBehaviour {
|
||||
private const int LunchboxCost = 80;
|
||||
private const int SpeedShoesCost = 140;
|
||||
private const int MileageCardCost = 160;
|
||||
private static readonly string[] OpeningStoryPageAssetPaths = {
|
||||
"Assets/ConceptArt/Opening/opening_cutscene_comic_jj_03.png",
|
||||
"Assets/ConceptArt/Opening/opening_cutscene_comic_jj_04_prepare.png",
|
||||
"Assets/ConceptArt/Opening/opening_cutscene_final_departure_jj_06_street_strict_stylematch.png"
|
||||
};
|
||||
|
||||
private GameSaveData saveData;
|
||||
private MapDefinition currentMap;
|
||||
@@ -51,9 +60,12 @@ public class GameFlowManager : MonoBehaviour {
|
||||
private int lastResultMileage = 0;
|
||||
private float lastResultTime = 0f;
|
||||
private float lastResultDistance = 0f;
|
||||
private int openingStoryPageIndex = 0;
|
||||
|
||||
private Canvas overlayCanvas;
|
||||
private RectTransform overlayRoot;
|
||||
private Image overlayBackground;
|
||||
private Camera flowCamera;
|
||||
private TMP_FontAsset runtimeFont;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
@@ -165,7 +177,8 @@ public class GameFlowManager : MonoBehaviour {
|
||||
saveData = GameSaveManager.ResetSave();
|
||||
currentMap = MapDatabase.GetMapByIndex(saveData.currentMapIndex);
|
||||
completedMap = null;
|
||||
ShowMapPreview();
|
||||
openingStoryPageIndex = 0;
|
||||
ShowOpeningStory();
|
||||
}
|
||||
|
||||
private void ContinueJourney() {
|
||||
@@ -206,10 +219,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
currentScreen = FlowScreen.Game;
|
||||
gameplayActive = true;
|
||||
|
||||
if(overlayCanvas != null)
|
||||
{
|
||||
overlayCanvas.gameObject.SetActive(false);
|
||||
}
|
||||
SetOverlayVisible(false);
|
||||
|
||||
if(GameManager.instance != null)
|
||||
{
|
||||
@@ -217,6 +227,23 @@ public class GameFlowManager : MonoBehaviour {
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowOpeningStory() {
|
||||
currentScreen = FlowScreen.OpeningStory;
|
||||
gameplayActive = false;
|
||||
pendingStartGameplay = false;
|
||||
|
||||
if(TryLoadFlowScene(IntroSceneName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EnsureOverlay();
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
|
||||
BuildOpeningStoryScreen();
|
||||
}
|
||||
|
||||
private void ShowIntro() {
|
||||
currentScreen = FlowScreen.Intro;
|
||||
gameplayActive = false;
|
||||
@@ -232,12 +259,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
|
||||
AddTitle("Uni-Run");
|
||||
AddBody("여권을 챙기고 공항으로 출발합니다.\n진행도는 자동 저장됩니다.");
|
||||
AddBody("현재 경로: " + currentMap.displayName + "\n해금: " + MapDatabase.GetMapByIndex(saveData.unlockedMapIndex).displayName + "\n마일리지: " + saveData.totalMileage);
|
||||
AddButton("이어하기", ContinueJourney);
|
||||
AddButton("새 여행", StartNewJourney);
|
||||
AddButton("저장 초기화", ResetAndStayIntro);
|
||||
BuildIntroScreen();
|
||||
}
|
||||
|
||||
private void ShowResult() {
|
||||
@@ -249,6 +271,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
EnsureOverlay();
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
SetDefaultOverlayBackground();
|
||||
|
||||
string title = lastResultCleared ? "맵 클리어" : "일정 실패";
|
||||
string body = completedMap.displayName
|
||||
@@ -290,6 +313,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
EnsureOverlay();
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
SetDefaultOverlayBackground();
|
||||
|
||||
AddTitle("면세점");
|
||||
AddBody("보유 마일리지: " + saveData.totalMileage
|
||||
@@ -327,6 +351,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
EnsureOverlay();
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
SetDefaultOverlayBackground();
|
||||
|
||||
AddTitle("다음 경로");
|
||||
AddBody(currentMap.displayName
|
||||
@@ -356,6 +381,9 @@ public class GameFlowManager : MonoBehaviour {
|
||||
case FlowScreen.MapPreview:
|
||||
ShowMapPreview();
|
||||
break;
|
||||
case FlowScreen.OpeningStory:
|
||||
ShowOpeningStory();
|
||||
break;
|
||||
case FlowScreen.Intro:
|
||||
default:
|
||||
ShowIntro();
|
||||
@@ -423,6 +451,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
EnsureOverlay();
|
||||
ClearOverlay();
|
||||
SetOverlayVisible(true);
|
||||
SetDefaultOverlayBackground();
|
||||
AddTitle(title);
|
||||
AddBody(body);
|
||||
}
|
||||
@@ -444,19 +473,21 @@ public class GameFlowManager : MonoBehaviour {
|
||||
}
|
||||
|
||||
private void EnsureOverlay() {
|
||||
EnsureEventSystem();
|
||||
|
||||
if(overlayCanvas != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EnsureEventSystem();
|
||||
|
||||
GameObject canvasObject = new GameObject("Flow Overlay", typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster));
|
||||
DontDestroyOnLoad(canvasObject);
|
||||
|
||||
overlayCanvas = canvasObject.GetComponent<Canvas>();
|
||||
overlayCanvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
overlayCanvas.worldCamera = null;
|
||||
overlayCanvas.sortingOrder = 100;
|
||||
SetUiLayer(canvasObject);
|
||||
|
||||
CanvasScaler scaler = canvasObject.GetComponent<CanvasScaler>();
|
||||
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
||||
@@ -465,6 +496,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
|
||||
GameObject rootObject = new GameObject("Flow Overlay Root", typeof(RectTransform), typeof(CanvasRenderer), typeof(Image));
|
||||
rootObject.transform.SetParent(canvasObject.transform, false);
|
||||
SetUiLayer(rootObject);
|
||||
|
||||
overlayRoot = rootObject.GetComponent<RectTransform>();
|
||||
overlayRoot.anchorMin = Vector2.zero;
|
||||
@@ -473,15 +505,765 @@ public class GameFlowManager : MonoBehaviour {
|
||||
overlayRoot.offsetMax = Vector2.zero;
|
||||
|
||||
Image background = rootObject.GetComponent<Image>();
|
||||
overlayBackground = background;
|
||||
background.color = new Color(0.02f, 0.035f, 0.045f, 0.92f);
|
||||
background.raycastTarget = true;
|
||||
|
||||
runtimeFont = CreateKoreanFontAsset();
|
||||
}
|
||||
|
||||
private void SetDefaultOverlayBackground() {
|
||||
if(overlayBackground != null)
|
||||
{
|
||||
overlayBackground.color = new Color(0.02f, 0.035f, 0.045f, 0.92f);
|
||||
}
|
||||
|
||||
if(flowCamera != null)
|
||||
{
|
||||
flowCamera.backgroundColor = new Color(0.02f, 0.035f, 0.045f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildIntroScreen() {
|
||||
if(overlayBackground != null)
|
||||
{
|
||||
overlayBackground.color = Color.clear;
|
||||
}
|
||||
|
||||
if(flowCamera != null)
|
||||
{
|
||||
flowCamera.backgroundColor = new Color(0.006f, 0.022f, 0.035f, 1f);
|
||||
}
|
||||
|
||||
RectTransform mapRect = AddIntroWorldMap();
|
||||
Vector2[] routePoints = GetIntroRoutePoints();
|
||||
AddIntroRoute(mapRect, routePoints);
|
||||
AddIntroPlane(mapRect, routePoints);
|
||||
AddIntroPassportAndPhone();
|
||||
AddIntroTitlePanel();
|
||||
AddIntroButtonDock();
|
||||
}
|
||||
|
||||
private void BuildOpeningStoryScreen() {
|
||||
if(overlayBackground != null)
|
||||
{
|
||||
overlayBackground.color = new Color(0.012f, 0.018f, 0.024f, 0.96f);
|
||||
}
|
||||
|
||||
if(flowCamera != null)
|
||||
{
|
||||
flowCamera.backgroundColor = new Color(0.012f, 0.018f, 0.024f, 1f);
|
||||
}
|
||||
|
||||
openingStoryPageIndex = Mathf.Clamp(openingStoryPageIndex, 0, OpeningStoryPageAssetPaths.Length - 1);
|
||||
AddOpeningStoryPage();
|
||||
AddOpeningStoryProgressDots();
|
||||
AddOpeningStoryControls();
|
||||
}
|
||||
|
||||
private void AddOpeningStoryPage() {
|
||||
GameObject shadowObject = CreateUiObject("Opening Story Shadow", overlayRoot, typeof(Image));
|
||||
RectTransform shadowRect = shadowObject.GetComponent<RectTransform>();
|
||||
shadowRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
shadowRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
shadowRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
shadowRect.anchoredPosition = new Vector2(7f, 18f);
|
||||
shadowRect.sizeDelta = new Vector2(1132f, 637f);
|
||||
|
||||
Image shadowImage = shadowObject.GetComponent<Image>();
|
||||
shadowImage.color = new Color(0f, 0f, 0f, 0.34f);
|
||||
shadowImage.raycastTarget = false;
|
||||
|
||||
GameObject pageObject = CreateUiObject("Opening Story Page", overlayRoot, typeof(Image), typeof(Button));
|
||||
RectTransform pageRect = pageObject.GetComponent<RectTransform>();
|
||||
pageRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
pageRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
pageRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
pageRect.anchoredPosition = new Vector2(0f, 24f);
|
||||
pageRect.sizeDelta = new Vector2(1120f, 630f);
|
||||
|
||||
Image pageImage = pageObject.GetComponent<Image>();
|
||||
pageImage.sprite = LoadUiTextureSprite(OpeningStoryPageAssetPaths[openingStoryPageIndex]);
|
||||
pageImage.color = pageImage.sprite != null
|
||||
? Color.white
|
||||
: new Color(0.91f, 0.87f, 0.78f, 1f);
|
||||
pageImage.preserveAspect = true;
|
||||
|
||||
Button pageButton = pageObject.GetComponent<Button>();
|
||||
pageButton.transition = Selectable.Transition.None;
|
||||
pageButton.onClick.AddListener(AdvanceOpeningStory);
|
||||
}
|
||||
|
||||
private void AddOpeningStoryProgressDots() {
|
||||
float startX = -((OpeningStoryPageAssetPaths.Length - 1) * 18f) * 0.5f;
|
||||
|
||||
for(int i = 0; i < OpeningStoryPageAssetPaths.Length; i++)
|
||||
{
|
||||
GameObject dotObject = CreateUiObject("Opening Story Dot " + (i + 1), overlayRoot, typeof(Image));
|
||||
RectTransform dotRect = dotObject.GetComponent<RectTransform>();
|
||||
dotRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
dotRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
dotRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
dotRect.anchoredPosition = new Vector2(startX + (i * 18f), -324f);
|
||||
dotRect.sizeDelta = i == openingStoryPageIndex ? new Vector2(12f, 12f) : new Vector2(8f, 8f);
|
||||
|
||||
Image dotImage = dotObject.GetComponent<Image>();
|
||||
dotImage.color = i == openingStoryPageIndex
|
||||
? new Color(1f, 0.86f, 0.28f, 0.95f)
|
||||
: new Color(0.72f, 0.84f, 0.88f, 0.5f);
|
||||
dotImage.raycastTarget = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddOpeningStoryControls() {
|
||||
if(openingStoryPageIndex > 0)
|
||||
{
|
||||
AddOpeningStoryButton("이전", new Vector2(-450f, -324f), PreviousOpeningStoryPage);
|
||||
}
|
||||
|
||||
string nextLabel = openingStoryPageIndex >= OpeningStoryPageAssetPaths.Length - 1 ? "게임 시작" : "다음";
|
||||
AddOpeningStoryButton(nextLabel, new Vector2(450f, -324f), AdvanceOpeningStory);
|
||||
}
|
||||
|
||||
private void AddOpeningStoryButton(string label, Vector2 position, UnityEngine.Events.UnityAction action) {
|
||||
GameObject buttonObject = CreateUiObject("Opening Story Button " + label, overlayRoot, typeof(Image), typeof(Button));
|
||||
RectTransform buttonRect = buttonObject.GetComponent<RectTransform>();
|
||||
buttonRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
buttonRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
buttonRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
buttonRect.anchoredPosition = position;
|
||||
buttonRect.sizeDelta = label == "게임 시작" ? new Vector2(178f, 44f) : new Vector2(126f, 42f);
|
||||
|
||||
Image buttonImage = buttonObject.GetComponent<Image>();
|
||||
buttonImage.color = label == "게임 시작"
|
||||
? new Color(1f, 0.86f, 0.34f, 0.96f)
|
||||
: new Color(0.88f, 0.96f, 1f, 0.88f);
|
||||
|
||||
Button button = buttonObject.GetComponent<Button>();
|
||||
button.onClick.AddListener(action);
|
||||
|
||||
TextMeshProUGUI buttonText = AddTextTo(buttonObject.transform, "Label", label, label == "게임 시작" ? 17f : 15f, FontStyles.Bold);
|
||||
RectTransform textRect = buttonText.rectTransform;
|
||||
textRect.anchorMin = Vector2.zero;
|
||||
textRect.anchorMax = Vector2.one;
|
||||
textRect.offsetMin = Vector2.zero;
|
||||
textRect.offsetMax = Vector2.zero;
|
||||
buttonText.color = new Color(0.035f, 0.065f, 0.08f, 1f);
|
||||
}
|
||||
|
||||
private void AdvanceOpeningStory() {
|
||||
if(openingStoryPageIndex >= OpeningStoryPageAssetPaths.Length - 1)
|
||||
{
|
||||
LoadGameSceneForCurrentMap();
|
||||
return;
|
||||
}
|
||||
|
||||
openingStoryPageIndex++;
|
||||
ShowOpeningStory();
|
||||
}
|
||||
|
||||
private void PreviousOpeningStoryPage() {
|
||||
if(openingStoryPageIndex <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
openingStoryPageIndex--;
|
||||
ShowOpeningStory();
|
||||
}
|
||||
|
||||
private RectTransform AddIntroWorldMap() {
|
||||
GameObject mapObject = CreateUiObject("Intro World Map", overlayRoot, typeof(Image));
|
||||
RectTransform mapRect = mapObject.GetComponent<RectTransform>();
|
||||
mapRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
mapRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
mapRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
mapRect.anchoredPosition = Vector2.zero;
|
||||
mapRect.sizeDelta = new Vector2(1280f, 720f);
|
||||
|
||||
Image mapImage = mapObject.GetComponent<Image>();
|
||||
mapImage.sprite = LoadUiSprite("", "Assets/ConceptArt/Intro/intro_world_map_clean_01.png");
|
||||
mapImage.color = mapImage.sprite != null
|
||||
? Color.white
|
||||
: new Color(0.015f, 0.078f, 0.112f, 0.76f);
|
||||
mapImage.preserveAspect = true;
|
||||
mapImage.raycastTarget = false;
|
||||
|
||||
GameObject vignetteObject = CreateUiObject("Intro Map Vignette", overlayRoot, typeof(Image));
|
||||
RectTransform vignetteRect = vignetteObject.GetComponent<RectTransform>();
|
||||
vignetteRect.anchorMin = Vector2.zero;
|
||||
vignetteRect.anchorMax = Vector2.one;
|
||||
vignetteRect.offsetMin = Vector2.zero;
|
||||
vignetteRect.offsetMax = Vector2.zero;
|
||||
|
||||
Image vignetteImage = vignetteObject.GetComponent<Image>();
|
||||
vignetteImage.color = new Color(0f, 0.006f, 0.012f, 0.08f);
|
||||
vignetteImage.raycastTarget = false;
|
||||
|
||||
return mapRect;
|
||||
}
|
||||
|
||||
private void AddIntroMapGrid(RectTransform mapRect) {
|
||||
Color gridColor = new Color(0.46f, 0.86f, 1f, 0.12f);
|
||||
|
||||
for(int i = -5; i <= 5; i++)
|
||||
{
|
||||
GameObject lineObject = CreateUiObject("Intro Map Longitude " + i, mapRect, typeof(Image));
|
||||
RectTransform lineRect = lineObject.GetComponent<RectTransform>();
|
||||
lineRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
lineRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
lineRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
lineRect.anchoredPosition = new Vector2(i * 92f, 0f);
|
||||
lineRect.sizeDelta = new Vector2(2f, 610f);
|
||||
|
||||
Image lineImage = lineObject.GetComponent<Image>();
|
||||
lineImage.color = gridColor;
|
||||
lineImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
for(int i = -3; i <= 3; i++)
|
||||
{
|
||||
GameObject lineObject = CreateUiObject("Intro Map Latitude " + i, mapRect, typeof(Image));
|
||||
RectTransform lineRect = lineObject.GetComponent<RectTransform>();
|
||||
lineRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
lineRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
lineRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
lineRect.anchoredPosition = new Vector2(0f, i * 74f);
|
||||
lineRect.sizeDelta = new Vector2(1110f, 2f);
|
||||
|
||||
Image lineImage = lineObject.GetComponent<Image>();
|
||||
lineImage.color = gridColor;
|
||||
lineImage.raycastTarget = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void AddIntroLandMass(RectTransform mapRect, string objectName, Vector2 position, Vector2 size, float rotation) {
|
||||
GameObject landObject = CreateUiObject(objectName, mapRect, typeof(Image));
|
||||
RectTransform landRect = landObject.GetComponent<RectTransform>();
|
||||
landRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
landRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
landRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
landRect.anchoredPosition = position;
|
||||
landRect.sizeDelta = size;
|
||||
landRect.localRotation = Quaternion.Euler(0f, 0f, rotation);
|
||||
|
||||
Image landImage = landObject.GetComponent<Image>();
|
||||
landImage.color = new Color(0.24f, 0.72f, 0.59f, 0.22f);
|
||||
landImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
private Vector2[] GetIntroRoutePoints() {
|
||||
return new Vector2[] {
|
||||
new Vector2(356f, 50f),
|
||||
new Vector2(405f, 58f),
|
||||
new Vector2(316f, 42f),
|
||||
new Vector2(-450f, 94f)
|
||||
};
|
||||
}
|
||||
|
||||
private void AddIntroRoute(RectTransform mapRect, Vector2[] routePoints) {
|
||||
Color routeColor = new Color(1f, 0.86f, 0.28f, 0.82f);
|
||||
|
||||
for(int i = 0; i < routePoints.Length - 1; i++)
|
||||
{
|
||||
AddIntroRouteSegment(mapRect, routePoints[i], routePoints[i + 1], routeColor, 4f);
|
||||
}
|
||||
|
||||
AddIntroRouteMarker(mapRect, routePoints[0], "INCHEON", true, 0f, new Vector2(-4f, -25f));
|
||||
AddIntroRouteMarker(mapRect, routePoints[1], "JAPAN", false, 0.4f, new Vector2(28f, -20f));
|
||||
AddIntroRouteMarker(mapRect, routePoints[2], "CHINA", false, 0.8f, new Vector2(-18f, -24f));
|
||||
AddIntroRouteMarker(mapRect, routePoints[3], "AMERICA", false, 1.2f, new Vector2(0f, -25f));
|
||||
}
|
||||
|
||||
private void AddIntroRouteSegment(RectTransform mapRect, Vector2 from, Vector2 to, Color color, float thickness) {
|
||||
GameObject segmentObject = CreateUiObject("Intro Route Segment", mapRect, typeof(Image));
|
||||
RectTransform segmentRect = segmentObject.GetComponent<RectTransform>();
|
||||
Vector2 delta = to - from;
|
||||
segmentRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
segmentRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
segmentRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
segmentRect.anchoredPosition = from + (delta * 0.5f);
|
||||
segmentRect.sizeDelta = new Vector2(delta.magnitude, thickness);
|
||||
segmentRect.localRotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(delta.y, delta.x) * Mathf.Rad2Deg);
|
||||
|
||||
Image segmentImage = segmentObject.GetComponent<Image>();
|
||||
segmentImage.color = color;
|
||||
segmentImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
private void AddIntroRouteMarker(RectTransform mapRect, Vector2 position, string label, bool current, float phase, Vector2 labelOffset) {
|
||||
GameObject markerObject = CreateUiObject("Intro Route Marker " + label, mapRect, typeof(Image));
|
||||
RectTransform markerRect = markerObject.GetComponent<RectTransform>();
|
||||
markerRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
markerRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
markerRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
markerRect.anchoredPosition = position;
|
||||
markerRect.sizeDelta = current ? new Vector2(23f, 23f) : new Vector2(17f, 17f);
|
||||
|
||||
Image markerImage = markerObject.GetComponent<Image>();
|
||||
markerImage.color = current
|
||||
? new Color(1f, 0.92f, 0.22f, 0.95f)
|
||||
: new Color(0.78f, 0.96f, 1f, 0.86f);
|
||||
markerImage.raycastTarget = false;
|
||||
|
||||
FlowIntroFloatMotion markerMotion = markerObject.AddComponent<FlowIntroFloatMotion>();
|
||||
markerMotion.scalePulse = current ? 0.18f : 0.09f;
|
||||
markerMotion.frequency = new Vector2(0f, 0.72f);
|
||||
markerMotion.phase = phase;
|
||||
|
||||
TextMeshProUGUI labelText = AddIntroMapLabel(mapRect, "Intro Marker Label " + label, label, position + labelOffset, new Vector2(84f, 20f), 9.5f);
|
||||
labelText.color = current
|
||||
? new Color(1f, 0.94f, 0.44f, 0.92f)
|
||||
: new Color(0.78f, 0.94f, 1f, 0.72f);
|
||||
}
|
||||
|
||||
private TextMeshProUGUI AddIntroMapLabel(RectTransform parent, string objectName, string text, Vector2 position, Vector2 size, float fontSize) {
|
||||
GameObject textObject = CreateUiObject(objectName, parent);
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
textRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
textRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
textRect.anchoredPosition = position;
|
||||
textRect.sizeDelta = size;
|
||||
|
||||
TextMeshProUGUI textComponent = textObject.AddComponent<TextMeshProUGUI>();
|
||||
textComponent.text = text;
|
||||
textComponent.font = runtimeFont != null ? runtimeFont : textComponent.font;
|
||||
textComponent.fontSize = fontSize;
|
||||
textComponent.fontStyle = FontStyles.Bold;
|
||||
textComponent.alignment = TextAlignmentOptions.Center;
|
||||
textComponent.raycastTarget = false;
|
||||
textComponent.textWrappingMode = TextWrappingModes.NoWrap;
|
||||
return textComponent;
|
||||
}
|
||||
|
||||
private void AddIntroPlane(RectTransform mapRect, Vector2[] routePoints) {
|
||||
Sprite planeSprite = LoadUiSprite("", "Assets/Sprites/UIIcons/UI_AirplaneTravel.png");
|
||||
GameObject planeObject = CreateUiObject("Intro Airplane", overlayRoot, typeof(Image));
|
||||
RectTransform rectTransform = planeObject.GetComponent<RectTransform>();
|
||||
rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
rectTransform.pivot = new Vector2(0.5f, 0.5f);
|
||||
rectTransform.anchoredPosition = routePoints[0] + mapRect.anchoredPosition;
|
||||
rectTransform.sizeDelta = new Vector2(58f, 58f);
|
||||
|
||||
Image image = planeObject.GetComponent<Image>();
|
||||
image.sprite = planeSprite;
|
||||
image.color = planeSprite != null
|
||||
? new Color(1f, 1f, 1f, 0.95f)
|
||||
: new Color(0.9f, 0.97f, 1f, 0.88f);
|
||||
image.preserveAspect = true;
|
||||
image.raycastTarget = false;
|
||||
|
||||
FlowIntroRouteMotion motion = planeObject.AddComponent<FlowIntroRouteMotion>();
|
||||
motion.points = routePoints;
|
||||
motion.offset = mapRect.anchoredPosition;
|
||||
motion.duration = 7.5f;
|
||||
}
|
||||
|
||||
private void AddIntroPassportAndPhone() {
|
||||
AddIntroPassportCover();
|
||||
AddIntroSmartPhone();
|
||||
}
|
||||
|
||||
private void AddIntroPassportCover() {
|
||||
GameObject passportObject = CreateUiObject("Intro Passport Cover", overlayRoot, typeof(Image));
|
||||
RectTransform passportRect = passportObject.GetComponent<RectTransform>();
|
||||
passportRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
passportRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
passportRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
passportRect.anchoredPosition = new Vector2(424f, -242f);
|
||||
passportRect.sizeDelta = new Vector2(270f, 300f);
|
||||
passportRect.localRotation = Quaternion.Euler(0f, 0f, -24f);
|
||||
|
||||
Image passportImage = passportObject.GetComponent<Image>();
|
||||
passportImage.sprite = LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_passport_clean.png");
|
||||
passportImage.color = passportImage.sprite != null
|
||||
? new Color(1f, 1f, 1f, 0.98f)
|
||||
: new Color(0.034f, 0.18f, 0.22f, 0.96f);
|
||||
passportImage.preserveAspect = true;
|
||||
passportImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
private void AddIntroSmartPhone() {
|
||||
GameObject phoneObject = CreateUiObject("Intro Smart Phone", overlayRoot, typeof(Image));
|
||||
RectTransform phoneRect = phoneObject.GetComponent<RectTransform>();
|
||||
phoneRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
phoneRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
phoneRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
phoneRect.anchoredPosition = new Vector2(558f, -218f);
|
||||
phoneRect.sizeDelta = new Vector2(132f, 252f);
|
||||
phoneRect.localRotation = Quaternion.Euler(0f, 0f, 10f);
|
||||
|
||||
Image phoneImage = phoneObject.GetComponent<Image>();
|
||||
phoneImage.sprite = LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_phone_clean.png");
|
||||
phoneImage.color = phoneImage.sprite != null
|
||||
? new Color(1f, 1f, 1f, 0.98f)
|
||||
: new Color(0.015f, 0.018f, 0.022f, 0.98f);
|
||||
phoneImage.preserveAspect = true;
|
||||
phoneImage.raycastTarget = false;
|
||||
|
||||
FlowIntroFloatMotion phoneMotion = phoneObject.AddComponent<FlowIntroFloatMotion>();
|
||||
phoneMotion.amplitude = new Vector2(0f, 5f);
|
||||
phoneMotion.frequency = new Vector2(0f, 0.45f);
|
||||
phoneMotion.phase = 0.6f;
|
||||
}
|
||||
|
||||
private void AddIntroTitlePanel() {
|
||||
GameObject titleObject = CreateUiObject("Intro Title Lockup", overlayRoot, typeof(Image));
|
||||
RectTransform titleRect = titleObject.GetComponent<RectTransform>();
|
||||
titleRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
titleRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
titleRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
titleRect.anchoredPosition = new Vector2(-364f, 196f);
|
||||
titleRect.sizeDelta = new Vector2(448f, 166f);
|
||||
|
||||
Image titleImage = titleObject.GetComponent<Image>();
|
||||
titleImage.sprite = LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_title_lockup.png");
|
||||
titleImage.color = titleImage.sprite != null
|
||||
? Color.white
|
||||
: new Color(0.86f, 0.98f, 1f, 0.94f);
|
||||
titleImage.preserveAspect = true;
|
||||
titleImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
private void AddIntroButtonDock() {
|
||||
GameObject dockObject = CreateUiObject("Intro Button Dock", overlayRoot);
|
||||
RectTransform dockRect = dockObject.GetComponent<RectTransform>();
|
||||
dockRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
dockRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
dockRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
dockRect.anchoredPosition = new Vector2(0f, -224f);
|
||||
dockRect.sizeDelta = new Vector2(424f, 136f);
|
||||
|
||||
AddIntroButton(dockRect, "게임 시작", new Vector2(45f, 0f), StartNewJourney, true, 0);
|
||||
AddIntroButton(dockRect, "이어하기", new Vector2(0f, -76f), ContinueJourney, false, 1);
|
||||
AddIntroButton(dockRect, "설정", new Vector2(220f, -76f), ShowIntroSettingsPlaceholder, false, 2);
|
||||
}
|
||||
|
||||
private void AddIntroButton(RectTransform parent, string label, Vector2 position, UnityEngine.Events.UnityAction action, bool primary, int buttonStyle) {
|
||||
GameObject buttonObject = CreateUiObject("Button " + label, parent, typeof(Image), typeof(Button));
|
||||
RectTransform buttonRect = buttonObject.GetComponent<RectTransform>();
|
||||
buttonRect.anchorMin = new Vector2(0f, 1f);
|
||||
buttonRect.anchorMax = new Vector2(0f, 1f);
|
||||
buttonRect.pivot = new Vector2(0f, 1f);
|
||||
buttonRect.anchoredPosition = position;
|
||||
buttonRect.sizeDelta = primary ? new Vector2(334f, 74f) : new Vector2(204f, 58f);
|
||||
|
||||
Image buttonImage = buttonObject.GetComponent<Image>();
|
||||
buttonImage.sprite = GetIntroButtonSprite(primary, buttonStyle);
|
||||
buttonImage.color = buttonImage.sprite != null
|
||||
? Color.white
|
||||
: primary
|
||||
? new Color(0.98f, 0.88f, 0.38f, 0.96f)
|
||||
: new Color(0.88f, 0.96f, 1f, 0.9f);
|
||||
buttonImage.preserveAspect = true;
|
||||
buttonImage.raycastTarget = true;
|
||||
|
||||
Button button = buttonObject.GetComponent<Button>();
|
||||
button.targetGraphic = buttonImage;
|
||||
button.navigation = new Navigation {
|
||||
mode = Navigation.Mode.None
|
||||
};
|
||||
|
||||
GameObject stampObject = CreateUiObject("Departure Stamp", buttonObject.transform, typeof(Image));
|
||||
RectTransform stampRect = stampObject.GetComponent<RectTransform>();
|
||||
stampRect.anchorMin = new Vector2(1f, 0.5f);
|
||||
stampRect.anchorMax = new Vector2(1f, 0.5f);
|
||||
stampRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
stampRect.anchoredPosition = new Vector2(primary ? -47f : -28f, primary ? 1f : 0f);
|
||||
stampRect.sizeDelta = primary ? new Vector2(58f, 58f) : new Vector2(44f, 44f);
|
||||
stampRect.localRotation = Quaternion.Euler(0f, 0f, -12f);
|
||||
|
||||
Image stampImage = stampObject.GetComponent<Image>();
|
||||
stampImage.sprite = LoadUiSpriteRegion("Assets/ConceptArt/Intro/intro_stamps_01.png", new Rect(54f, 48f, 790f, 790f));
|
||||
stampImage.color = stampImage.sprite != null
|
||||
? new Color(1f, 1f, 1f, 0.94f)
|
||||
: new Color(0.76f, 0.08f, 0.06f, 0.96f);
|
||||
stampImage.preserveAspect = true;
|
||||
stampImage.raycastTarget = false;
|
||||
|
||||
TextMeshProUGUI stampText = AddTextTo(stampObject.transform, "Stamp Label", "출국", primary ? 13f : 11f, FontStyles.Bold);
|
||||
RectTransform stampTextRect = stampText.rectTransform;
|
||||
stampTextRect.anchorMin = Vector2.zero;
|
||||
stampTextRect.anchorMax = Vector2.one;
|
||||
stampTextRect.offsetMin = Vector2.zero;
|
||||
stampTextRect.offsetMax = Vector2.zero;
|
||||
stampText.color = new Color(0.74f, 0.04f, 0.03f, 0.98f);
|
||||
stampObject.SetActive(false);
|
||||
|
||||
button.onClick.AddListener(delegate {
|
||||
button.interactable = false;
|
||||
stampObject.SetActive(true);
|
||||
FlowIntroStampMotion stampMotion = stampObject.GetComponent<FlowIntroStampMotion>();
|
||||
if(stampMotion == null)
|
||||
{
|
||||
stampMotion = stampObject.AddComponent<FlowIntroStampMotion>();
|
||||
}
|
||||
|
||||
stampMotion.Play();
|
||||
StartCoroutine(InvokeIntroActionAfterStamp(action));
|
||||
});
|
||||
|
||||
if(primary)
|
||||
{
|
||||
FlowIntroFloatMotion motion = buttonObject.AddComponent<FlowIntroFloatMotion>();
|
||||
motion.scalePulse = 0.018f;
|
||||
motion.frequency = new Vector2(0f, 0.55f);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddIntroButtonIcon(Transform parent, int buttonStyle) {
|
||||
GameObject iconObject = CreateUiObject("Button Icon", parent, typeof(Image));
|
||||
RectTransform iconRect = iconObject.GetComponent<RectTransform>();
|
||||
iconRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
iconRect.anchorMax = new Vector2(0.5f, 0.5f);
|
||||
iconRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
iconRect.anchoredPosition = new Vector2(-38f, 0f);
|
||||
iconRect.sizeDelta = new Vector2(30f, 30f);
|
||||
|
||||
Image iconImage = iconObject.GetComponent<Image>();
|
||||
iconImage.sprite = GetIntroButtonIconSprite(buttonStyle);
|
||||
iconImage.color = iconImage.sprite != null
|
||||
? new Color(1f, 1f, 1f, 0.96f)
|
||||
: new Color(0.94f, 0.98f, 1f, 0.92f);
|
||||
iconImage.preserveAspect = true;
|
||||
iconImage.raycastTarget = false;
|
||||
}
|
||||
|
||||
private Sprite GetIntroButtonSprite(bool primary, int buttonStyle) {
|
||||
if(primary)
|
||||
{
|
||||
return LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_button_start.png");
|
||||
}
|
||||
|
||||
if(buttonStyle == 2)
|
||||
{
|
||||
return LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_button_settings.png");
|
||||
}
|
||||
|
||||
return LoadUiTextureSprite("Assets/ConceptArt/Intro/UI/intro_button_continue.png");
|
||||
}
|
||||
|
||||
private Sprite GetIntroButtonIconSprite(int buttonStyle) {
|
||||
if(buttonStyle == 2)
|
||||
{
|
||||
return LoadUiTextureSprite("Assets/ConceptArt/Intro/Cutouts/intro_icon_settings.png");
|
||||
}
|
||||
|
||||
return LoadUiTextureSprite("Assets/ConceptArt/Intro/Cutouts/intro_icon_continue.png");
|
||||
}
|
||||
|
||||
private void ShowIntroSettingsPlaceholder() {
|
||||
ShowIntro();
|
||||
}
|
||||
|
||||
private IEnumerator InvokeIntroActionAfterStamp(UnityEngine.Events.UnityAction action) {
|
||||
yield return new WaitForSecondsRealtime(0.32f);
|
||||
|
||||
if(action != null)
|
||||
{
|
||||
action.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private TextMeshProUGUI AddTextToPanel(RectTransform parent, string objectName, string text, Vector2 position, Vector2 size, float fontSize, FontStyles fontStyle, TextAlignmentOptions alignment) {
|
||||
GameObject textObject = CreateUiObject(objectName, parent);
|
||||
RectTransform textRect = textObject.GetComponent<RectTransform>();
|
||||
textRect.anchorMin = new Vector2(0f, 1f);
|
||||
textRect.anchorMax = new Vector2(0f, 1f);
|
||||
textRect.pivot = new Vector2(0f, 1f);
|
||||
textRect.anchoredPosition = position;
|
||||
textRect.sizeDelta = size;
|
||||
|
||||
TextMeshProUGUI textComponent = textObject.AddComponent<TextMeshProUGUI>();
|
||||
textComponent.text = text;
|
||||
textComponent.font = runtimeFont != null ? runtimeFont : textComponent.font;
|
||||
textComponent.fontSize = fontSize;
|
||||
textComponent.fontStyle = fontStyle;
|
||||
textComponent.alignment = alignment;
|
||||
textComponent.color = new Color(0.95f, 0.98f, 1f, 0.96f);
|
||||
textComponent.raycastTarget = false;
|
||||
textComponent.textWrappingMode = TextWrappingModes.Normal;
|
||||
return textComponent;
|
||||
}
|
||||
|
||||
private GameObject CreateUiObject(string objectName, Transform parent, params System.Type[] components) {
|
||||
System.Type[] finalComponents;
|
||||
if(components == null || components.Length == 0)
|
||||
{
|
||||
finalComponents = new System.Type[] {
|
||||
typeof(RectTransform),
|
||||
typeof(CanvasRenderer)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
finalComponents = new System.Type[components.Length + 2];
|
||||
finalComponents[0] = typeof(RectTransform);
|
||||
finalComponents[1] = typeof(CanvasRenderer);
|
||||
for(int i = 0; i < components.Length; i++)
|
||||
{
|
||||
finalComponents[i + 2] = components[i];
|
||||
}
|
||||
}
|
||||
|
||||
GameObject gameObject = new GameObject(objectName, finalComponents);
|
||||
gameObject.transform.SetParent(parent, false);
|
||||
SetUiLayer(gameObject);
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
private void SetUiLayer(GameObject gameObject) {
|
||||
if(gameObject != null)
|
||||
{
|
||||
gameObject.layer = GetUiLayer();
|
||||
}
|
||||
}
|
||||
|
||||
private int GetUiLayer() {
|
||||
int uiLayer = LayerMask.NameToLayer("UI");
|
||||
return uiLayer >= 0 ? uiLayer : 0;
|
||||
}
|
||||
|
||||
private Sprite LoadUiSprite(string resourcePath, string assetPath) {
|
||||
if(!string.IsNullOrEmpty(resourcePath))
|
||||
{
|
||||
Sprite resourceSprite = Resources.Load<Sprite>(resourcePath);
|
||||
if(resourceSprite != null)
|
||||
{
|
||||
return resourceSprite;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
if(!string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
Object[] assets = AssetDatabase.LoadAllAssetRepresentationsAtPath(assetPath);
|
||||
if(assets != null)
|
||||
{
|
||||
for(int i = 0; i < assets.Length; i++)
|
||||
{
|
||||
Sprite sprite = assets[i] as Sprite;
|
||||
if(sprite != null)
|
||||
{
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Sprite directSprite = AssetDatabase.LoadAssetAtPath<Sprite>(assetPath);
|
||||
if(directSprite != null)
|
||||
{
|
||||
return directSprite;
|
||||
}
|
||||
|
||||
Texture2D texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
if(texture == null)
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
}
|
||||
|
||||
if(texture != null)
|
||||
{
|
||||
return Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Sprite LoadUiTextureSprite(string assetPath) {
|
||||
#if UNITY_EDITOR
|
||||
if(string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Texture2D texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
if(texture == null)
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
}
|
||||
|
||||
if(texture == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100f);
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
private Sprite LoadUiSpriteRegion(string assetPath, Rect pixelRect) {
|
||||
#if UNITY_EDITOR
|
||||
if(string.IsNullOrEmpty(assetPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Texture2D texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
if(texture == null)
|
||||
{
|
||||
AssetDatabase.Refresh();
|
||||
texture = AssetDatabase.LoadAssetAtPath<Texture2D>(assetPath);
|
||||
}
|
||||
|
||||
if(texture == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Rect safeRect = ClampSpriteRect(pixelRect, texture.width, texture.height);
|
||||
if(safeRect.width <= 0f || safeRect.height <= 0f)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Sprite.Create(texture, safeRect, new Vector2(0.5f, 0.5f), 100f);
|
||||
#else
|
||||
return null;
|
||||
#endif
|
||||
}
|
||||
|
||||
private Rect ClampSpriteRect(Rect pixelRect, int textureWidth, int textureHeight) {
|
||||
float xMin = Mathf.Clamp(pixelRect.xMin, 0f, textureWidth);
|
||||
float yMin = Mathf.Clamp(pixelRect.yMin, 0f, textureHeight);
|
||||
float xMax = Mathf.Clamp(pixelRect.xMax, 0f, textureWidth);
|
||||
float yMax = Mathf.Clamp(pixelRect.yMax, 0f, textureHeight);
|
||||
|
||||
if(xMax < xMin)
|
||||
{
|
||||
xMax = xMin;
|
||||
}
|
||||
|
||||
if(yMax < yMin)
|
||||
{
|
||||
yMax = yMin;
|
||||
}
|
||||
|
||||
return Rect.MinMaxRect(xMin, yMin, xMax, yMax);
|
||||
}
|
||||
|
||||
private void EnsureEventSystem() {
|
||||
if(EventSystem.current != null)
|
||||
{
|
||||
EventSystem.current.enabled = true;
|
||||
EventSystem.current.gameObject.SetActive(true);
|
||||
|
||||
StandaloneInputModule inputModule = EventSystem.current.GetComponent<StandaloneInputModule>();
|
||||
if(inputModule == null)
|
||||
{
|
||||
inputModule = EventSystem.current.gameObject.AddComponent<StandaloneInputModule>();
|
||||
}
|
||||
|
||||
inputModule.enabled = true;
|
||||
DontDestroyOnLoad(EventSystem.current.gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -489,6 +1271,25 @@ public class GameFlowManager : MonoBehaviour {
|
||||
DontDestroyOnLoad(eventSystemObject);
|
||||
}
|
||||
|
||||
private void EnsureFlowCamera() {
|
||||
if(flowCamera != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject cameraObject = new GameObject("Flow UI Camera", typeof(Camera));
|
||||
DontDestroyOnLoad(cameraObject);
|
||||
|
||||
flowCamera = cameraObject.GetComponent<Camera>();
|
||||
flowCamera.transform.position = new Vector3(640f, 360f, -10f);
|
||||
flowCamera.clearFlags = CameraClearFlags.SolidColor;
|
||||
flowCamera.backgroundColor = new Color(0.006f, 0.022f, 0.035f, 1f);
|
||||
flowCamera.cullingMask = 1 << GetUiLayer();
|
||||
flowCamera.depth = 100f;
|
||||
flowCamera.orthographic = true;
|
||||
flowCamera.orthographicSize = 360f;
|
||||
}
|
||||
|
||||
private void ClearOverlay() {
|
||||
if(overlayRoot == null)
|
||||
{
|
||||
@@ -506,6 +1307,11 @@ public class GameFlowManager : MonoBehaviour {
|
||||
{
|
||||
overlayCanvas.gameObject.SetActive(visible);
|
||||
}
|
||||
|
||||
if(flowCamera != null)
|
||||
{
|
||||
flowCamera.gameObject.SetActive(visible);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTitle(string text) {
|
||||
@@ -527,6 +1333,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
|
||||
GameObject buttonObject = new GameObject("Button " + label, typeof(RectTransform), typeof(CanvasRenderer), typeof(Image), typeof(Button));
|
||||
buttonObject.transform.SetParent(overlayRoot, false);
|
||||
SetUiLayer(buttonObject);
|
||||
|
||||
RectTransform buttonRect = buttonObject.GetComponent<RectTransform>();
|
||||
buttonRect.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
@@ -581,6 +1388,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
private TextMeshProUGUI AddText(string objectName, string text, float fontSize, FontStyles fontStyle) {
|
||||
GameObject textObject = new GameObject(objectName + " " + GetBodyCount(), typeof(RectTransform), typeof(CanvasRenderer));
|
||||
textObject.transform.SetParent(overlayRoot, false);
|
||||
SetUiLayer(textObject);
|
||||
|
||||
RectTransform rectTransform = textObject.GetComponent<RectTransform>();
|
||||
rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
|
||||
@@ -602,6 +1410,7 @@ public class GameFlowManager : MonoBehaviour {
|
||||
private TextMeshProUGUI AddTextTo(Transform parent, string objectName, string text, float fontSize, FontStyles fontStyle) {
|
||||
GameObject textObject = new GameObject(objectName, typeof(RectTransform), typeof(CanvasRenderer));
|
||||
textObject.transform.SetParent(parent, false);
|
||||
SetUiLayer(textObject);
|
||||
TextMeshProUGUI label = textObject.AddComponent<TextMeshProUGUI>();
|
||||
label.text = text;
|
||||
label.font = runtimeFont != null ? runtimeFont : label.font;
|
||||
|
||||
Reference in New Issue
Block a user