Commit 858e1e0c authored by 18신대성's avatar 18신대성

stageN-N꼴로 고쳤음.

이 브랜치의 스테이지는 테스트용이니 그냥 머지하지 말것
parent b75e4a05
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &999376283059227703
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2315775531611611820}
- component: {fileID: 7753881810612009116}
- component: {fileID: 9021165401424447018}
m_Layer: 5
m_Name: TutorialText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2315775531611611820
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999376283059227703}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6319119020231470429}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -714, y: 265}
m_SizeDelta: {x: 281.8, y: 49.87}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7753881810612009116
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999376283059227703}
m_CullTransparentMesh: 0
--- !u!114 &9021165401424447018
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 999376283059227703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9686275, g: 0.91372555, b: 0.043137256, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 43
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 49
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: TUTORIALS
--- !u!1 &2563396311851419604
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2049151199407770320}
- component: {fileID: 609813467550696739}
- component: {fileID: 3753360324218557324}
m_Layer: 5
m_Name: MainStageText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2049151199407770320
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2563396311851419604}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 6319119020231470429}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -739, y: -138}
m_SizeDelta: {x: 308.31, y: 54.6}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &609813467550696739
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2563396311851419604}
m_CullTransparentMesh: 0
--- !u!114 &3753360324218557324
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2563396311851419604}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19215688, g: 1, b: 0.38431376, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 43
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 49
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: MAIN STAGES
--- !u!1 &6319119020231470417
GameObject:
m_ObjectHideFlags: 0
......@@ -190,8 +32,6 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 6571899118798978036}
- {fileID: 2315775531611611820}
- {fileID: 2049151199407770320}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -273,8 +113,17 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
stage: []
categoryCounts: 05000000070000000400000002000000
categoryTitles:
- NORMAL
- HARD
- V. HARD
- EXTREME
stageIdxs: []
stageIdx: 0
buttonUI: {fileID: 3762876622413059634, guid: 8939d9dd74b1afb498ab8705da6054b8,
type: 3}
titleUI: {fileID: 3639753312110483396, guid: 6fa93e6bbf1778345878a82ff80f64da, type: 3}
tutorialFalse: {fileID: 21300000, guid: cc47e4099b832634f94d1b0c3b9a2ffc, type: 3}
tutorialFalseColor: {r: 1, g: 0.9921569, b: 0.8666667, a: 1}
tutorialTrue: {fileID: 21300000, guid: 2a36a1d7af1567c4c8e6f56cddfa5181, type: 3}
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3639753312110483396
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2269311352316623199}
- component: {fileID: 6108619807487402863}
- component: {fileID: 4786447995860508121}
m_Layer: 5
m_Name: StageNameText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2269311352316623199
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3639753312110483396}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -770, y: 265}
m_SizeDelta: {x: 344.1, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6108619807487402863
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3639753312110483396}
m_CullTransparentMesh: 0
--- !u!114 &4786447995860508121
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3639753312110483396}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.9686275, g: 0.91372555, b: 0.043137256, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 43
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 49
m_Alignment: 5
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: STAGE NAME
fileFormatVersion: 2
guid: 6fa93e6bbf1778345878a82ff80f64da
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -477,25 +477,5 @@ PrefabInstance:
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6319119020849879011, guid: 8115fd4d1a1025b4fb05e45fc5fa6578,
type: 3}
propertyPath: m_Color.r
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6319119020849879011, guid: 8115fd4d1a1025b4fb05e45fc5fa6578,
type: 3}
propertyPath: m_Color.g
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6319119020849879011, guid: 8115fd4d1a1025b4fb05e45fc5fa6578,
type: 3}
propertyPath: m_Color.b
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6319119020849879011, guid: 8115fd4d1a1025b4fb05e45fc5fa6578,
type: 3}
propertyPath: m_Text
value: 'Stage : 1'
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8115fd4d1a1025b4fb05e45fc5fa6578, type: 3}
......@@ -11,7 +11,7 @@ public class GameManager : SingletonBehaviour<GameManager>
/// The index of the current stage.
/// </summary>
public TextAsset currentStage;
public int stageIdx;
public string stageStrIdx;
[Header("UIs in Scene")]
public ClearUIGenerator uiGenerator;
......@@ -88,7 +88,7 @@ public class GameManager : SingletonBehaviour<GameManager>
public IEnumerator ClearStage()
{
if (isPlayerShooting) Camera.main.gameObject.GetComponent<CameraController>().ZoomOutFromPlayer(PlayerController.inst.currentPlayer);
if (isPlayerShooting) yield return StartCoroutine(Camera.main.gameObject.GetComponent<CameraController>().ZoomOutFromPlayer(PlayerController.inst.currentPlayer));
yield return null;
clearUI.SetActive(true);
Debug.Log("Stage Clear!");
......@@ -97,13 +97,13 @@ public class GameManager : SingletonBehaviour<GameManager>
Cursor.lockState = CursorLockMode.None;
isGameOver = true;
StageSelector.inst.SaveClearData(stageIdx, true);
StageSelector.inst.SaveClearData(stageStrIdx, true);
}
public void GameOver(bool onlyRestart = false)
{
if (!onlyRestart) Debug.Log("Game Over!");
StageSelector.inst.SaveClearData(stageIdx, onlyRestart);
StageSelector.inst.SaveClearData(stageStrIdx, onlyRestart);
isGameOver = true;
StopAllCoroutines();
uiGenerator.ResetAllClearUIs();
......@@ -126,7 +126,7 @@ public class GameManager : SingletonBehaviour<GameManager>
public void LoadNextStage()
{
StageSelector.selectedStage = StageSelector.nextStage;
StageSelector.nextStage++;
StageSelector.nextStage = (StageSelector.inst.stageIdxs.Count > StageSelector.inst.stageIdx + 1) ? StageSelector.inst.stageIdxs[StageSelector.inst.stageIdx + 1] : "0-0" ;
StartCoroutine(RestartStage());
}
......@@ -137,8 +137,8 @@ public class GameManager : SingletonBehaviour<GameManager>
if (!MapManager.inst.isMapEditingOn)
{
isGameOver = false;
stageIdx = StageSelector.selectedStage + 1;
currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + (StageSelector.selectedStage + 1));
stageStrIdx = StageSelector.selectedStage;
currentStage = Resources.Load<TextAsset>("Stages/" + "stage" + StageSelector.selectedStage);
if (MapManager.inst.emptyMap != null) StartStage();
//Destroy(FindObjectOfType<StageSelector>().gameObject);
}
......
......@@ -8,14 +8,21 @@ using Newtonsoft.Json;
public class StageSelector : SingletonBehaviour<StageSelector>
{
public static int selectedStage;
public static int nextStage;
public static string selectedStage;
public static string nextStage;
public TextAsset[] stage;
public List<string> stageIdxs = new List<string>();
public int stageIdx;
[Header("맵 추가시 반드시 바꿔줘야하는 값.각 카테고리마다의 스테이지 수")]
public int[] categoryCounts; // 맵 추가시 반드시 바꿔줘야하는 값. 각 카테고리마다의 스테이지 수
public string[] categoryTitles; // 카테고리 추가시 추가해줘야하는 값, Length가 위의 Length와 같아야함.
public ClearData playerData;
[Header("UI Settings")]
public GameObject buttonUI;
public GameObject titleUI;
public Sprite tutorialFalse;
public Color tutorialFalseColor = new Color(1f, 0.9921569f, 0.8666667f);
public Sprite tutorialTrue;
......@@ -24,86 +31,89 @@ public class StageSelector : SingletonBehaviour<StageSelector>
public Color mainFalseColor = Color.white;
public Sprite mainTrue;
public Color mainTrueColor = new Color(0.1921569f, 1f, 0.3843138f);
int tutorialCount = 12;
int maxRow = 8; // y-=155
Vector3 tutorialPoint = new Vector3(-470, 265); // x+=160
Vector3 mainPoint = new Vector3(-470, -138);
List<Button> buttons = new List<Button>();
private Vector3 generatePoint = new Vector3(-470, 265); // x+=160
private Vector3 titleGeneratePoint = new Vector3(-770, 265);
public void GenerateStageUI()
{
int rowCount = 0;
for (int i = 0; i < tutorialCount; i++)
int isColorSel = 1;
int stageIdxCounter = 0;
for (int i = 0; i < categoryCounts.Length; i++) // "Stagei-j"
{
var uiInst = Instantiate(buttonUI, transform);
var uiText = uiInst.GetComponentInChildren<Text>();
buttons.Add(uiInst.GetComponent<Button>());
uiInst.transform.localPosition = tutorialPoint;
uiText.text = (i + 1).ToString();
if (playerData.isCleared.ContainsKey(i + 1) && playerData.isCleared[i + 1])
{
uiInst.GetComponent<Image>().sprite = tutorialTrue;
uiText.color = tutorialTrueColor;
}
else
{
uiInst.GetComponent<Image>().sprite = tutorialFalse;
uiText.color = tutorialFalseColor;
}
var nameInst = Instantiate(titleUI, transform);
nameInst.transform.localPosition = titleGeneratePoint;
nameInst.GetComponent<Text>().text = categoryTitles[i];
if (isColorSel < 0) nameInst.GetComponent<Text>().color = tutorialTrueColor;
else nameInst.GetComponent<Text>().color = mainTrueColor;
if ((rowCount + 1) / maxRow > 0)
int rowCount = 0;
for (int j = 0; j < categoryCounts[i]; j++)
{
tutorialPoint += new Vector3(-160 * (maxRow - 1), -155);
rowCount = 0;
}
else tutorialPoint += new Vector3(160, 0);
rowCount++;
}
rowCount = 0;
for (int i = tutorialCount; i < stage.Length; i++)
{
var uiInst = Instantiate(buttonUI, transform);
var uiText = uiInst.GetComponentInChildren<Text>();
buttons.Add(uiInst.GetComponent<Button>());
uiInst.transform.localPosition = mainPoint;
uiText.text = (i - tutorialCount + 1).ToString();
if (playerData.isCleared.ContainsKey(i + 1) && playerData.isCleared[i + 1])
{
uiInst.GetComponent<Image>().sprite = mainTrue;
uiText.color = mainTrueColor;
}
else
{
uiInst.GetComponent<Image>().sprite = mainFalse;
uiText.color = mainFalseColor;
}
var uiInst = Instantiate(buttonUI, transform);
var uiText = uiInst.GetComponentInChildren<Text>();
string uiStage = i + "-" + j;
stageIdxs.Add(uiStage);
string nextStage = (j + 1 < categoryCounts[i]) ? (i + "-" + (j + 1)) : ((i + 1) + "-0");
uiInst.GetComponent<Button>().onClick.AddListener(() => StartSelectedStage(uiStage, nextStage, stageIdxCounter));
stageIdxCounter++;
uiInst.transform.localPosition = generatePoint;
uiText.text = j.ToString();
if (playerData.isCleared.ContainsKey(uiStage) && playerData.isCleared[uiStage])
{
if (isColorSel < 0)
{
uiInst.GetComponent<Image>().sprite = tutorialTrue;
uiText.color = tutorialTrueColor;
}
else
{
uiInst.GetComponent<Image>().sprite = mainTrue;
uiText.color = mainTrueColor;
}
}
else
{
if (isColorSel < 0)
{
uiInst.GetComponent<Image>().sprite = tutorialFalse;
uiText.color = tutorialFalseColor;
}
else
{
uiInst.GetComponent<Image>().sprite = mainFalse;
uiText.color = mainFalseColor;
}
}
if ((rowCount + 1) / maxRow > 0)
{
mainPoint += new Vector3(-160 * (maxRow - 1), -155);
rowCount = 0;
if ((rowCount + 1) / maxRow > 0)
{
generatePoint += new Vector3(-160 * (maxRow - 1), -155);
titleGeneratePoint.y -= 155;
rowCount = 0;
}
else generatePoint += new Vector3(160, 0);
rowCount++;
}
else mainPoint += new Vector3(160, 0);
rowCount++;
}
for (int i = 0; i < stage.Length; i++)
{
int _i = i;
buttons[i].onClick.AddListener(() => StartSelectedStage(_i));
generatePoint.x = -470;
generatePoint.y -= 180;
titleGeneratePoint.y -= 180;
isColorSel *= -1;
}
}
public void StartSelectedStage(int stageNum)
public void StartSelectedStage(string stageStr, string nextStr, int stageIdx)
{
selectedStage = stageNum;
nextStage = stageNum + 1;
selectedStage = stageStr;
nextStage = nextStr;
this.stageIdx = stageIdx;
gameObject.GetComponent<Canvas>().enabled = false;
SceneManager.LoadScene("PlayStage");
}
public void SaveClearData(int stage = -1, bool isClear = false)
public void SaveClearData(string stage = "", bool isClear = false)
{
if (stage != -1)
if (stage != "")
{
if (playerData.isCleared.ContainsKey(stage))
{
......@@ -134,7 +144,7 @@ public class StageSelector : SingletonBehaviour<StageSelector>
public class ClearData
{
public Dictionary<int, bool> isCleared = new Dictionary<int, bool>();
public Dictionary<string, bool> isCleared = new Dictionary<string, bool>();
}
void Awake()
......@@ -148,6 +158,6 @@ public class StageSelector : SingletonBehaviour<StageSelector>
void Start()
{
GenerateStageUI();
selectedStage = 0;
selectedStage = "0-0";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment