Exemplo n.º 1
0
    void Respond(string resString)
    {
        ExchangeApiResponse response = JsonUtility.FromJson <ExchangeApiResponse>(resString);

        if (response.res == 0)
        {
            //main.addToMyMoney(response.data.Gold - main.money.getValue());
            if (response == null)
            {
                Debug.Log("response == null");
            }
            if (response.data == null)
            {
                Debug.Log("response.data == null");
            }
            if (main.money == null)
            {
                Debug.Log("main.money == null");
            }
            if (main.raffle == null)
            {
                Debug.Log("main.raffle.flyExchengeMoneyToPocket == null");
            }


            HUD.getHUD.flyExchengeMoneyToPocket = response.data.Gold - main.money.getValue();
            main.addToMyRubins(response.data.Crystal - main.rubins.getValue());
            Flickering.set(main.rubins.transform.parent.gameObject, 1.0f, 1);
        }
        else
        {
            Errors.showError(response.res, GameScene.MAIN_MENU);
        }
    }
Exemplo n.º 2
0
    void Respond(string payload)
    {
        BuyApiResponse response = JsonUtility.FromJson <BuyApiResponse>(payload);

        if (response.res == Api.ServerErrors.E_OK)
        {
            main.purchase.ConfirmPurchase(response.data.Pid);
            main.addToMyRubins(response.data.Acc.Crystal - main.rubins.getValue());
        }
        else
        {
            main.purchase.ClearPurchase();
            Errors.showError(response.res, GameScene.MAIN_MENU);
        }
    }