public void ShowFight(RecordPet pet) { menuLogin.gameObject.SetActive(false); menuPets.gameObject.SetActive(false); menuFight.gameObject.SetActive(true); menuFight.Show(pet); }
IEnumerator IEGetEnemy(string pet_id, System.Action <RecordPet> callback) { byte[] bytes = System.Text.Encoding.UTF8.GetBytes(pet_id); using (WWW www = new WWW("http://localhost:8080/getenemy", bytes)) { yield return(www); RecordPet pet = JsonConvert.DeserializeObject <RecordPet>(www.text); Debug.Log(pet != null ? pet.ToString() : "NULL"); callback(pet); } }
public void Set(RecordPet pet) { this.pet = pet; textId.text = pet != null ? pet.id : "none"; textAttack.text = pet != null?pet.attack.ToString() : "none"; textHealth.text = pet != null?pet.health.ToString() : "none"; pic.sprite = pet != null?pet.GetSkin() : null; if (menu != null) { menu.SetActive(false); } }
public void Show(RecordPet pet) { this.pet = pet; myPet.Set(pet); buttonAttack.SetActive(false); buttonDone.SetActive(false); textWin.SetActive(false); textLost.SetActive(false); UpdateMoney(null); Server.GetAccount(UpdateMoney); Server.GetEnemy(pet, GetEnemyComplete); SetButtonsAttack(attackType); SetButtonsProtect(protectType); }
public static void GetEnemy(RecordPet pet, System.Action <RecordPet> callback) { Instance.StartCoroutine(Instance.IEGetEnemy(pet.id, callback)); }
void GetEnemyComplete(RecordPet petEnemy) { this.petEnemy = petEnemy; enemyPet.Set(petEnemy); buttonAttack.SetActive(true); }