// 혼자하기 유형 02, 03인 경우 void SetGamePanel02(ButtonManager03 buttonManager) { cubeResetButton.onClick.AddListener(() => buttonManager.ResetCubes()); plusButton.onClick.AddListener(() => buttonManager.PlusCube()); minusButton.onClick.AddListener(() => buttonManager.MinusCube()); cardButton.onClick.AddListener(() => buttonManager.ShowCard()); }
// 혼자하기 유형 01인 경우 void SetGamePanel01(ButtonManager03 buttonManager) { // Game Board 리셋 boardResetButton.onClick.AddListener(() => buttonManager.ResetGameBoard()); // Game Board 크기 조절 Slider boardSizeSlider.onValueChanged.AddListener(delegate { buttonManager.ChangeBoardSize(boardSizeSlider.value); }); // 정답 확인 버튼 checkAnswerButton.onClick.AddListener(() => buttonManager.CheckAnswer()); }
// 버튼 기능 할당 public void SetGamePanel(ButtonManager03 buttonManager, ModeType modeType) { if (modeType == ModeType.Create) { SetGamePanel_Create(buttonManager); } else if (modeType == ModeType.Alone_Count) { SetGamePanel01(buttonManager); buttonManager.inputField = inputField; } else if (modeType == ModeType.Alone_Minus || modeType == ModeType.Alone_Plus) { SetGamePanel01(buttonManager); SetGamePanel02(buttonManager); } }
void SetCardBoard(ButtonManager03 buttonManager, GameObject playSceneCanvas) { // Card가 없는 경우 if (cardCtrl == null) { cardboard = Instantiate(cardboardPrefab, playSceneCanvas.transform); buttonManager.cardboard = cardboard; cardCtrl = cardboard.GetComponent <CardCtrl>(); } else { cardboard.SetActive(true); } cardCtrl.SetCardData(); GetAnswerData(); }
// Create Mode인 경우 void SetGamePanel_Create(ButtonManager03 buttonManager) { if (gridSizeSlider != null) { gridSizeSlider.onValueChanged.AddListener(delegate { buttonManager.SetGameboardGrid((int)gridSizeSlider.value); }); confirmButton.onClick.AddListener(() => buttonManager.SetGamePanel_Create()); } else { // Game Board 리셋 boardResetButton.onClick.AddListener(() => buttonManager.ResetGameBoard()); // Game Board 크기 조절 Slider boardSizeSlider.onValueChanged.AddListener(delegate { buttonManager.ChangeBoardSize(boardSizeSlider.value); }); cubeResetButton.onClick.AddListener(() => buttonManager.ResetCubes()); plusButton.onClick.AddListener(() => buttonManager.PlusCube()); minusButton.onClick.AddListener(() => buttonManager.MinusCube()); } }
// 혼자하기 모드 문제 설정 public void SetAloneModeQuest(ButtonManager03 buttonManager, GameObject playSceneCanvas) { if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { Destroy(list[i]); } list.Clear(); } ModeType modeType = GameManager.Instance.modeType; // 혼자하기 모드 - 유형 01 if (modeType == ModeType.Alone_Count) { ChangeGridSize(); string top = QuestManager.Instance.currQuest[stageID].GetTopInfo(); totalCount = 0; // 문제에 맞춰 CubePrefab 생성 for (int i = 0; i < gridCount; i++) { int cubeCount = int.Parse(top.Substring(i, 1)); GameObject gridCell = currGrid.transform.GetChild(i).gameObject; totalCount += cubeCount; if (cubeCount != 0) { for (int j = 0; j < cubeCount; j++) { GameObject obj = Instantiate(cubePrefab , gridCell.transform.GetChild(j).transform.position , gameboard.transform.rotation , cubeList.transform); obj.transform.localScale = gameboard.GetComponent <GameboardCtrl>().GetCubeScale(); list.Add(obj); } } } } // 혼자하기 모드 - 유형 02 else if (modeType == ModeType.Alone_Minus) { ChangeGridSize(); // 각 Grid마다 Grid Size 값만큼 Cube 생성 if (list.Count == 0) { for (int i = 0; i < gridCount; i++) { GameObject obj = currGrid.transform.GetChild(i).gameObject; for (int j = 0; j < obj.transform.childCount; j++) { GameObject cube = Instantiate(cubePrefab , obj.transform.GetChild(j).transform.position , gameboard.transform.rotation , cubeList.transform); //cube.transform.localScale = gameboard.GetComponent<GameboardCtrl>().GetCubeScale(); cube.transform.localScale = obj.transform.localScale; list.Add(cube); } } } else { ResetCubeData(); } SetCardBoard(buttonManager, playSceneCanvas); } // 혼자하기 유형 03 else { ChangeGridSize(); SetCardBoard(buttonManager, playSceneCanvas); } }