예제 #1
0
 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);
                     }
                 }));
             }
         }));
     }
 }