public Texture2D getAccountAvatar(string account_pubkey)
    {
        string avatar_base64 = client.getContactAvatar(account_pubkey);

        byte[]    avatar_bytes   = System.Convert.FromBase64String(avatar_base64);
        Texture2D avatar_texture = new Texture2D(1, 1);

        avatar_texture.LoadImage(avatar_bytes);
        return(avatar_texture);
    }
예제 #2
0
    void loadClientData()
    {
        //load utopia client version
        JObject systemInfo = client.getSystemInfo();

        versionInfoLabel.text = "Utopia client v." + systemInfo ["build_number"].ToString();

        //get account public key
        JObject account_data   = client.getOwnContact();
        string  account_pubkey = account_data ["pk"].ToString();

        hashedPKLabel.text = "hashed pk: " + account_data ["hashedPk"].ToString();

        //get account avatar
        string avatar_base64 = client.getContactAvatar(account_pubkey);

        byte[]    avatar_bytes   = System.Convert.FromBase64String(avatar_base64);
        Texture2D avatar_texture = new Texture2D(1, 1);

        avatar_texture.LoadImage(avatar_bytes);
        userAvatarImage.texture = avatar_texture;

        //load account balance
        //TODO: check getBalance method available for this token
        float balance = (float)client.getBalance();

        //float balance_truncated = Mathf.Floor (balance * 100) / 100;
        balanceLabel.text = "Balance: " + balance.ToString() + " CRP";

        //indicators & network info
        JObject network_info = client.getNetworkConnections();

        setIndicatorStatus(imageIndicatorCRP, (bool)network_info["summary"]["crypton_engine_status"]);
        setIndicatorStatus(imageIndicatorChannels, !(bool)network_info["summary"]["channel_database_sync_status"]);
        //TOQ: not sure
        int mining_status = client.statusHistoryMining();

        setIndicatorStatus(imageIndicatorMining, mining_status == 1);
    }