// ステージのボタン(Easyのボタン)を押した時 public void stageBtnClick(string stage) { var pInstance = Instantiate(panelPrefab); pInstance.transform.SetParent(gameObject.transform, false); ReadPlayerPref.SetStringKey("PlayingStage", stage); PlaySE(); }
void Start() { Debug.Log(ReadPlayerPref.GetStringKey(ReadPlayerPref.GetStringKey("PlayingStage"))); TextAsset csv = Resources.Load("CSV/" + ReadPlayerPref.GetStringKey(ReadPlayerPref.GetStringKey("PlayingStage"))) as TextAsset; StringReader reader = new StringReader(csv.text); while (reader.Peek() > -1) { string line = reader.ReadLine(); csvData.Add(line.Split(',')); } for (int i = 0; i < csvData.Count; i++) { for (int j = 0; j < csvData[i].Length; j++) { GameObject tmp; if (int.Parse(csvData[i][j]) != 0) { tmp = Instantiate(stageObjects[int.Parse(csvData[i][j]) - 1], stageObjectsParent); SetName(ref tmp, int.Parse(csvData[i][j]) - 1); tmp.transform.localPosition = new Vector3(j * 1.28f, -i * 1.28f, 0.0f); if (int.Parse(csvData[i][j]) == 1) { meter.minValue = tmp.transform.position.x; Instantiate(player, tmp.transform.position, Quaternion.identity); } if (int.Parse(csvData[i][j]) == 2) { meter.maxValue = tmp.transform.position.x; } } } } }
public void SwitchPanel(string stageName) { panel.SetActive(!panel.activeSelf); ReadPlayerPref.SetStringKey("PlayingStage", stageName); }
void Start() { ReadPlayerPref.SetStringKey("1-1", "stage1"); ReadPlayerPref.SetStringKey("1-2", "stage2"); ReadPlayerPref.SetStringKey("1-3", "stage3"); }