Exemple #1
0
    private IEnumerator Load()
    {
        while (ETHManager.Instance.IsGetBalance || ETHManager.Instance.IsGetAdventure || ETHManager.Instance.IsSetAdventure)
        {
            yield return(null);
        }
        yield return(null);

        Loading.SetActive(false);

        Balance.text = ETHUtils.TrimForDecimal(ETHManager.Instance.SaveData.Balance);
        ListContent.transform.DetachChildren();

        AdventureModel adventure = ETHManager.Instance.SaveData.adventure;

        if (adventure == null || string.IsNullOrEmpty(adventure.address))
        {
            BuyButton.gameObject.SetActive(true);
            MyAdventure.gameObject.SetActive(false);
            Name.text  = "";
            Score.text = "";
        }
        else
        {
            BuyButton.gameObject.SetActive(false);
            MyAdventure.gameObject.SetActive(true);
            MyAdventure.runtimeAnimatorController = animators[adventure.charaId];
            Name.text  = adventure.name;
            Score.text = adventure.score.ToString();
        }

        ListUpdate();
    }
Exemple #2
0
    public IEnumerator _GetBalance()
    {
        EthGetBalanceUnityRequest getBalance = new EthGetBalanceUnityRequest(url);

        yield return(getBalance.SendRequest(SaveData.Address, BlockParameter.CreateLatest()));

        HexBigInteger balance = getBalance.Result;

        SaveData.Balance = ETHUtils.IntegerToDecimal(decimal.Parse(balance.Value.ToString()), 18);
        Debug.Log("GetBalance ret:" + SaveData.Balance.ToString());
        GetAdventureAndTop100();
        IsGetBalance = false;
        Save();
    }