void ExecuteCommand(int value, int type) // type 0 = 일반 버튼, type 1 = 상점 아이템 버튼, type 2 = 인벤토리 아이템 버튼 { if (type == 0) { switch (value) { case 0: // 로비 버튼 FileManager.AccountDataGenerate("SaveFile/AccountData.txt", account); StartCoroutine(Button_Anim(1)); break; case 1: // 구입 버튼 PurchaseItem(); break; case 2: // 판매 버튼 SellItem(); break; case 3: // 확인 버튼 (메세지 창) messagewindow.SetActive(false); break; } } else { ClickButton(value, type); } }
IEnumerator EndGame() { int i; GameObject[] allyList = GameObject.FindGameObjectsWithTag("Ally"); GameObject[] enemyList = GameObject.FindGameObjectsWithTag("Enemy"); if (allyList.Length == 0 || enemyList.Length == 0) // 아군 혹은 적군의 수가 0일 경우 { battlecond = false; yield return(null); if (enemyList.Length == 0) // 플레이어가 이겼을 경우 { AllyCharacter temp; List <EquipmentData> temp_list = new List <EquipmentData>(); List <int> exp_data = FileManager.ListDataLoad <int>("SaveFile/ExpData.txt"); // 경험치 차트 로드 int[,] param_data = new int[allies.Count, 2]; // 종료 UI 애니메이션을 위한 매개변수 데이터, (level, exp) 형태 for (i = 0; i < allies.Count; i++) { temp = allies[i].GetComponent <AllyCharacter>(); param_data[i, 0] = temp.Access_level; param_data[i, 1] = temp.Access_exp; temp.Access_exp += stage.Access_exp; while (temp.Access_exp >= exp_data[temp.Access_level]) // 레벨 업 { temp.Access_exp -= exp_data[temp.Access_level]; temp.Access_level += 1; temp.LevelUp(); } for (int j = 0; j < temp.Access_equipments.Count; j++) // 장비 능력치 해제 { if (temp.Access_equipment(j) != null) { temp.Access_atkpower -= temp.Access_equipment(j).atkpower; temp.Access_atkspeed -= temp.Access_equipment(j).atkspeed; temp.Access_defpower -= temp.Access_equipment(j).defpower; } } } temp_list = GetComponent <RewardManager>().TryGetReward(stage); yield return(StartCoroutine(GetComponent <BattleUIManager>().EndGame_Animation(true, param_data, temp_list))); // 종료 UI 애니메이션 코루틴 실행 account.Access_currentstage += 1; // 스테이지 + 1 account.Access_characters = allies; // 계정 정보에 경험치가 증가된 캐릭터 입력 후 직렬화 FileManager.AccountDataGenerate("SaveFile/AccountData.txt", account); } else // 플레이어가 졌을 경우 { EnemyCharacter temp; for (i = 0; i < enemyList.Length; i++) { temp = enemyList[i].GetComponent <EnemyCharacter>(); temp.StopCoroutine("Idle"); temp.StopCoroutine("AttackAnimation"); temp.Access_animator.SetInteger("State", 3); } yield return(StartCoroutine(GetComponent <BattleUIManager>().EndGame_Animation(false, null, null))); } } }