public void GetGoldByGems(int _gems) { if (CharacterInfo._instance._baseProperties.Diamond >= _gems) { StartCoroutine(ServerAdapter.ReduceCustomValue(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, "diamond", _gems, result1 => { if (result1.StartsWith("Error")) { Debug.Log("Do nothing"); } else { StartCoroutine(ServerAdapter.AddCustomValue(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, "gold", 5000, result2 => { if (result2.StartsWith("Error")) { Debug.Log("Do nothing"); } else { CharacterInfo._instance._baseProperties.Gold += 5000; CharacterInfo._instance._baseProperties.Diamond -= _gems; this.PostEvent(EventID.OnPropertiesChange); } })); } })); } }
public void GetDiamond(int _numberDiamond) { StartCoroutine(ServerAdapter.AddCustomValue(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, "diamond", _numberDiamond, result => { if (result.StartsWith("Error")) { Debug.Log("Do nothing"); } else { CharacterInfo._instance._baseProperties.Diamond += 5000; this.PostEvent(EventID.OnPropertiesChange); } })); }
public void GetFreeGold() { StartCoroutine(ServerAdapter.AddCustomValue(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, "gold", 5000, result => { if (result.StartsWith("Error")) { Debug.Log("Do nothing"); } else { CharacterInfo._instance._baseProperties.Gold += 5000; this.PostEvent(EventID.OnPropertiesChange); } })); }