IEnumerator LoadDataDetailHero(int _idhero, string _idcode) { StartCoroutine(ServerAdapter.ListSkillOfHero(_idhero, _idcode, result => { if (result.StartsWith("Error")) { Debug.Log("Do nothing"); } else { SplitDataFromServe.ReadSkillHeroData(result.ToString()); } })); yield return(StartCoroutine(ServerAdapter.LoadDetailHero(_idcode, _idhero, result => { if (result.StartsWith("Error")) { Debug.Log("Do nothing"); ShowPopupError(6); } else { SplitDataFromServe.ReadDetailDataHeroCurrentPlay(result); SplitDataFromServe.ReadItemInBagData(result); StartCoroutine(SceneLoader._instance.LoadNewScene(2)); } }))); }
IEnumerator LoadDataDetailEnemyHero(int _idhero, string _idcode) { StartCoroutine(ServerAdapter.ListSkillOfHero(_idhero, _idcode, result => { if (result.StartsWith("Error")) { Debug.Log("Do nothing"); } else { SplitDataFromServe.ReadEnemySkillData(result.ToString()); } })); WWWForm form = new WWWForm(); form.AddField("idh", _idhero); form.AddField("idcode", _idcode); WWW w = new WWW(Constant.urlRequest + "/api/hero/detail", form); yield return(w); string data = w.text; var N = JSONNode.Parse(data); if (Boolean.Parse(N["return"])) { SplitDataFromServe.ReadDetailDataHeroEnemyPlay(N["data"].ToString()); GameObject enemy = Instantiate(CharacterItemInGame.Instance._characterPrefabs[ConvertIdClassToClassName(SplitDataFromServe._heroEnemyPlay.idclass).ToString()]); enemy.transform.position = new Vector3(5.5f, -2f, 0f); enemy.transform.localScale = new Vector3(-1f, 1f, 1f); _enemyCharacter = enemy.AddComponent <CharacterPlayer>(); CharacterPlayer.LoadCharacterEnemy(_enemyCharacter); //enemy.AddComponent<AnimationController>(); enemy.SetActive(false); WaitingRoomUI.Instance.SetLog("Load data nhan vat thanh cong"); if (!SocketIOController.Instance.isReconnect) { WaitingRoomUI.Instance.SetLog("Tao timeout confirm load nhan vat thanh cong"); this.PostEvent(EventID.CreateTimeoutConfirmLoadData); } if (SocketIOController.Instance.isReconnect) { this.PostEvent(EventID.ReconnectBattleScene); } WatingRoomController.Instance.state_waitingroom = STATEINWAITING.CONFIRM_LOADDATA; } else if (!Boolean.Parse(N["return"])) { Debug.Log("Do nothing"); } // if Master create timeout for done B request // if Slave send done slave, create timeout for done A response }