void GetAccountComplete(RecordAccount account) { List <RecordPet> pets = account != null ? account.pets : null; if (loading != null) { loading.SetActive(false); } if (pets != null) { for (int i = 0; i < pets.Count; i++) { MyPet myPet = Instantiate(myPetProto) as MyPet; myPet.gameObject.SetActive(true); myPet.Set(pets [i]); myPet.transform.SetParent(myPetProto.transform.parent); myPet.name = pets [i].id; if (myPets == null) { myPets = new List <MyPet> (); } myPets.Add(myPet); Debug.Log("create " + myPet.name); } } money.text = "money: " + (account != null ? account.money.ToString() : "---"); }
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); }
void GetEnemyComplete(RecordPet petEnemy) { this.petEnemy = petEnemy; enemyPet.Set(petEnemy); buttonAttack.SetActive(true); }