스토리 모드 작업
This commit is contained in:
parent
76865ddec2
commit
52e55e177f
|
|
@ -1,19 +1,87 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
public class StoryPlayUiCtrl : SingletonMonoBehaviour<StoryPlayUiCtrl>
|
public class StoryPlayUiCtrl : SingletonMonoBehaviour<StoryPlayUiCtrl>
|
||||||
{
|
{
|
||||||
List<ScriptData> scriptDatas = new List<ScriptData>();
|
List<ScriptData> scriptDatas = new List<ScriptData>();
|
||||||
bool isScript = false;
|
|
||||||
|
int index;
|
||||||
|
|
||||||
|
[SerializeField] GameObject iUnit;
|
||||||
|
[SerializeField] TMP_Text iUnitNickname;
|
||||||
|
[SerializeField] GameObject youUnit;
|
||||||
|
[SerializeField] TMP_Text youUnitNickname;
|
||||||
|
|
||||||
|
[SerializeField] TMP_Text scriptText;
|
||||||
|
|
||||||
protected override void OnAwake()
|
protected override void OnAwake()
|
||||||
{
|
{
|
||||||
//TODO game메니저를 확인해서 데이터가 있으면 true 없으면 바로 게임종료가 되도록 수정할것
|
//TODO game메니저를 확인해서 데이터가 있으면 true 없으면 바로 게임종료가 되도록 수정할것
|
||||||
isScript = true;
|
if (GameManager.Instance.chapterData != null)
|
||||||
gameObject.SetActive(true);
|
{
|
||||||
|
int chapter_id = GameManager.Instance.chapterData.index;
|
||||||
|
foreach (var item in Statics.excelDatas.scriptData)
|
||||||
|
{
|
||||||
|
if (item.Value.chapter_id == chapter_id)
|
||||||
|
{
|
||||||
|
scriptDatas.Add(item.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gameObject.SetActive(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStart()
|
||||||
|
{
|
||||||
|
Script();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectNextButton()
|
public void SelectNextButton()
|
||||||
{
|
{
|
||||||
|
if (scriptDatas.Count -1 == index)
|
||||||
|
{
|
||||||
|
GameManager.Instance.NextScene(GameManager.eScene.Game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scriptDatas[index].buttle)
|
||||||
|
{
|
||||||
|
PlayCtrl.Instance.isStop = false;
|
||||||
|
gameObject.SetActive (false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
Script();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndButtle()
|
||||||
|
{
|
||||||
|
gameObject.SetActive(true);
|
||||||
|
index++;
|
||||||
|
Script();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Script()
|
||||||
|
{
|
||||||
|
iUnit.SetActive(scriptDatas[index].position);
|
||||||
|
youUnit.SetActive(!scriptDatas[index].position);
|
||||||
|
if (scriptDatas[index].position)
|
||||||
|
{
|
||||||
|
iUnitNickname.text = Statics.intUnits[scriptDatas[index].unit_id].name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
youUnitNickname.text = Statics.intUnits[scriptDatas[index].unit_id].name;
|
||||||
|
}
|
||||||
|
scriptText.text = scriptDatas[index].text;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO 천천히 텍스트가 1개씩 생성되게 만들기
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,18 +45,18 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
money = 0;
|
money = 0;
|
||||||
moneyText.text = money.ToString();
|
moneyText.text = money.ToString();
|
||||||
isEndGame = false;
|
isEndGame = false;
|
||||||
isStop = false;
|
isStop = (GameManager.Instance.chapterData != null);
|
||||||
delay = 0.0f;
|
delay = 0.0f;
|
||||||
units = new UnitCtrl[9];
|
units = new UnitCtrl[9];
|
||||||
units[0] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit0_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[0] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit0_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[1] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit1_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[1] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit1_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[2] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit2_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[2] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit2_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[3] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit3_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[3] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit3_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[4] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit4_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[4] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit4_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[5] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit5_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[5] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit5_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[6] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit6_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[6] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit6_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[7] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit7_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[7] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit7_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
units[8] = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit8_id).unit_data_id].GetComponent<UnitCtrl>();
|
units[8] = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(Statics.deck_info[0].deck_unit8_id).unit_data_id].GetComponent<UnitCtrl>();
|
||||||
for (int n = 0; n < unitSpriteButton.Length; n++)
|
for (int n = 0; n < unitSpriteButton.Length; n++)
|
||||||
{
|
{
|
||||||
unitSpriteButton[n].sprite = units[n].unitSprite;
|
unitSpriteButton[n].sprite = units[n].unitSprite;
|
||||||
|
|
@ -89,7 +89,7 @@ public class PlayCtrl : SingletonMonoBehaviour<PlayCtrl>
|
||||||
if(delay > 3.0f)
|
if(delay > 3.0f)
|
||||||
{
|
{
|
||||||
//게임씬으로 이동
|
//게임씬으로 이동
|
||||||
GameManager.Instance.NextScene(GameManager.eScene.Game);
|
StoryPlayUiCtrl.Instance.EndButtle();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public class DeckPrefab : MonoBehaviour
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
img.sprite = Statics.longUnits[Statics.itemManager.box.FindDeckUnitInfo(unit_id).unit_data_id].GetComponent<UnitCtrl>().unitSprite;
|
img.sprite = Statics.intUnits[Statics.itemManager.box.FindDeckUnitInfo(unit_id).unit_data_id].GetComponent<UnitCtrl>().unitSprite;
|
||||||
img.color = Color.white;
|
img.color = Color.white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ public class ScriptData : Excel
|
||||||
public int chapter_id;
|
public int chapter_id;
|
||||||
public int unit_id;
|
public int unit_id;
|
||||||
public string text;
|
public string text;
|
||||||
|
public bool position;
|
||||||
public bool buttle;
|
public bool buttle;
|
||||||
public override void toJson()
|
public override void toJson()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ public class GameManager : DontDestroy<GameManager>
|
||||||
public eScene NowScene;
|
public eScene NowScene;
|
||||||
public bool Over;
|
public bool Over;
|
||||||
|
|
||||||
|
public ChapterData chapterData = null;
|
||||||
|
|
||||||
private CoroutineHandle corExcel;
|
private CoroutineHandle corExcel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -52,7 +54,7 @@ public class GameManager : DontDestroy<GameManager>
|
||||||
{
|
{
|
||||||
obj.GetComponent<UnitCtrl>().DataSet(data.Key);
|
obj.GetComponent<UnitCtrl>().DataSet(data.Key);
|
||||||
Statics.stringUnits.Add(data.Value.name, obj);
|
Statics.stringUnits.Add(data.Value.name, obj);
|
||||||
Statics.longUnits.Add(data.Value.index, obj);
|
Statics.intUnits.Add(data.Value.index, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//stringIcons
|
//stringIcons
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ public class Statics
|
||||||
public static ExcelDatas excelDatas;
|
public static ExcelDatas excelDatas;
|
||||||
|
|
||||||
public static Dictionary <string, GameObject> stringUnits = new Dictionary<string,GameObject>();
|
public static Dictionary <string, GameObject> stringUnits = new Dictionary<string,GameObject>();
|
||||||
public static Dictionary <long, GameObject> longUnits = new Dictionary<long, GameObject>();
|
public static Dictionary <int, GameObject> intUnits = new Dictionary<int, GameObject>();
|
||||||
|
|
||||||
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
|
public static Dictionary<string, Sprite> stringIcons = new Dictionary<string, Sprite>();
|
||||||
|
|
||||||
public static Dictionary<long, ShopItemData> shopItems = new Dictionary<long, ShopItemData>();
|
public static Dictionary<int, ShopItemData> shopItems = new Dictionary<int, ShopItemData>();
|
||||||
|
|
||||||
//서버에서 내려주는 데이터들
|
//서버에서 내려주는 데이터들
|
||||||
public static string uuid;
|
public static string uuid;
|
||||||
|
|
@ -28,8 +28,8 @@ public class Statics
|
||||||
|
|
||||||
//유저 기본 정보
|
//유저 기본 정보
|
||||||
public static string nickname;
|
public static string nickname;
|
||||||
public static ulong gold;
|
public static uint gold;
|
||||||
public static ulong cash;
|
public static uint cash;
|
||||||
public static ItemManager itemManager;
|
public static ItemManager itemManager;
|
||||||
//유저가 세팅한 덱 정보
|
//유저가 세팅한 덱 정보
|
||||||
public static List<DeckInfo> deck_info;
|
public static List<DeckInfo> deck_info;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue