Exemplo n.º 1
0
    public void BtnReinforceEquipment()
    {
        if (isRollingInforce)
        {
            return;
        }
        if (_mainEquip == null)
        {
            //TextNotifyScript.instance.SetData("Please insert the Equipment into reinforcement window!");
            return;
        }
        if (_numberAlchemyMaterial <= 0)
        {
            TextNotifyScript.instance.SetData("Not enough material to upgrade!");
            return;
        }
        isRollingInforce = true;
        _timeRolling     = _effectPatternUpgrade._timeRolling;
        isHaveResult     = false;
        _resultUpgrade   = string.Empty;
        _effectPatternUpgrade.StartRolling();

        if (isSpecialUpgrade)
        {
            if (_mainEquip.typeItem == TypeEquipmentCharacter.Avatar)
            {
                StartCoroutine(ServerAdapter.UpgradeReinforceAvatar(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero,
                                                                    _mainEquip.idItem, int.Parse(_itemAlchemyMaterial.getValue("idhg").ToString()),
                                                                    (_LuckyMaterial == null ? 0 : int.Parse(_LuckyMaterial.getValue("idht").ToString())),
                                                                    result =>
                {
                    isHaveResult   = true;
                    _resultUpgrade = result;
                }));
            }
            else
            {
                StartCoroutine(ServerAdapter.UpgradeReinforceBook(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero,
                                                                  _mainEquip.idItem, int.Parse(_itemAlchemyMaterial.getValue("idhg").ToString()),
                                                                  (_LuckyMaterial == null ? 0 : int.Parse(_LuckyMaterial.getValue("idht").ToString())),
                                                                  result =>
                {
                    isHaveResult   = true;
                    _resultUpgrade = result;
                }));
            }
        }
        else
        {
            StartCoroutine(ServerAdapter.UpgradeReinforceEquipment(CharacterInfo._instance._baseProperties.idHero, CharacterInfo._instance._baseProperties.idCodeHero,
                                                                   _mainEquip.idItem, int.Parse(_itemAlchemyMaterial.getValue("idhg").ToString()),
                                                                   (_LuckyMaterial == null ? 0 : int.Parse(_LuckyMaterial.getValue("idht").ToString())),
                                                                   result =>
            {
                isHaveResult   = true;
                _resultUpgrade = result;
            }));
        }
    }