//IEnumerator LoadImgItem(Image _img, int _idInitItem, int _typeItem) //{ // if (_typeItem == 1) // { // yield return StartCoroutine(ControllerItemsInGame._instance.GetIconForEquipmentByID(_idInitItem, value => _img.sprite = value)); // } // else if (_typeItem == 2) // { // yield return StartCoroutine(ControllerItemsInGame._instance.GetIconForItemByID(_idInitItem, value => _img.sprite = value)); // } // else if (_typeItem == 3) // { // yield return StartCoroutine(ControllerItemsInGame._instance.GetIconForGemsByID(_idInitItem, value => _img.sprite = value)); // } //} void SellItem() { if (isGem) { StartCoroutine(ServerAdapter.SellGem(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, idHeroItem, _numberSell, result => { if (result.StartsWith("Error")) { TextNotifyScript.instance.SetData(result); } else { var N = JSON.Parse(result); if (N["quantity"].AsInt == 0) { SplitDataFromServe._listGemInBag.Remove(_itemCached); } else { _itemCached.setValue("quantity", _maxQuantity - _numberSell); } CharacterInfo._instance._baseProperties.Gold += N["goldplus"].AsInt; this.PostEvent(EventID.OnPropertiesChange); _myStorage.DisplayGemInBag(true); } })); } else { StartCoroutine(ServerAdapter.SellItem(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero, idHeroItem, _numberSell, result => { if (result.StartsWith("Error")) { TextNotifyScript.instance.SetData(result); } else { if (_numberSell == _maxQuantity) { SplitDataFromServe._listItemInBag.Remove(_itemCached); } else { _itemCached.setValue("quantity", _maxQuantity - _numberSell); } CharacterInfo._instance._baseProperties.Gold += _numberSell * _pricePerOne; this.PostEvent(EventID.OnPropertiesChange); _myStorage.DisplayItemInBag(true); } })); } ClosePopup(); }