Ejemplo n.º 1
0
 public void GetCurrentMoney()
 {
     fakeExp       = LojaController.GetComponent <LojaConstroller>().expfake;
     currentMoneyV = LojaController.GetComponent <LojaConstroller>().currentMoney;
     currentCashV.GetComponent <TextMesh> ().text = currentMoneyV.ToString();
     AtualCash.GetComponent <TextMesh> ().text    = currentMoneyV.ToString();
 }
Ejemplo n.º 2
0
    public void GetCurrentMoney()
    {
        fileName = "Player.json";

        //String "master" It contains all the text for json file.
        string str = Read();

        //Still do not get it right what this means, but it is the variable that understands that the string is a json object.
        JSONNode json = JSON.Parse(str);


        expfake      = int.Parse(json["Exp"]);
        currentMoney = int.Parse(json["money"]);
        AtualCash.GetComponent <TextMesh> ().text = currentMoney.ToString();
    }
Ejemplo n.º 3
0
    public void Vender()
    {
        if (totalPayV > 0)
        {
            currentMoneyV += totalPayV;
            LojaController.GetComponent <LojaConstroller>().currentMoney = currentMoneyV;
            LojaController.GetComponent <LojaConstroller> ().Citem1     -= QuanItem1V;
            LojaController.GetComponent <LojaConstroller> ().Citem2     -= QuanItem2V;
            LojaController.GetComponent <LojaConstroller> ().Citem3     -= QuanItem3V;
            LojaController.GetComponent <LojaConstroller> ().Citem4     -= QuanItem4V;
            LojaController.GetComponent <LojaConstroller> ().Citem5     -= QuanItem5V;
            LojaController.GetComponent <LojaConstroller> ().Citem6     -= QuanItem6V;

            playerSafe = new PlayerP(fakeExp, currentMoneyV);
            playerJson = JsonMapper.ToJson(playerSafe);
            File.WriteAllText((Application.persistentDataPath + "/Player.json"), playerJson.ToString());

            saveMaterial = new Materiais(LojaController.GetComponent <LojaConstroller> ().Citem1,
                                         LojaController.GetComponent <LojaConstroller> ().Citem2,
                                         LojaController.GetComponent <LojaConstroller> ().Citem3,
                                         LojaController.GetComponent <LojaConstroller> ().Citem4,
                                         LojaController.GetComponent <LojaConstroller> ().Citem5,
                                         LojaController.GetComponent <LojaConstroller> ().Citem6);
            playerJson = JsonMapper.ToJson(saveMaterial);
            File.WriteAllText((Application.persistentDataPath + "/Materiais.json"), playerJson.ToString());

            currentCashV.GetComponent <TextMesh> ().text = currentMoneyV.ToString();
            AtualCash.GetComponent <TextMesh> ().text    = currentMoneyV.ToString();
            ZeraItens();
            ValorGastar();
            currentMoneyV = LojaController.GetComponent <LojaConstroller>().currentMoney;
        }
        else
        {
            LojaController.GetComponent <LojaConstroller> ().warnning2();
        }
    }
    public void Comprar()
    {
        if (totalPay <= currentMoney)
        {
            currentMoney -= totalPay;
            LojaController.GetComponent <LojaConstroller>().currentMoney = currentMoney;
            LojaController.GetComponent <LojaConstroller> ().Pitem1     += QuanItem1;
            LojaController.GetComponent <LojaConstroller> ().Pitem2     += QuanItem2;
            LojaController.GetComponent <LojaConstroller> ().Pitem3     += QuanItem3;
            LojaController.GetComponent <LojaConstroller> ().Pitem4     += QuanItem4;
            LojaController.GetComponent <LojaConstroller> ().Pitem5     += QuanItem5;
            LojaController.GetComponent <LojaConstroller> ().Pitem6     += QuanItem6;

            playerSafe = new PlayerP(fakeExp, currentMoney);
            playerJson = JsonMapper.ToJson(playerSafe);
            File.WriteAllText((Application.persistentDataPath + "/Player.json"), playerJson.ToString());

            saveItens = new Itens(LojaController.GetComponent <LojaConstroller> ().Pitem1
                                  , LojaController.GetComponent <LojaConstroller> ().Pitem2
                                  , LojaController.GetComponent <LojaConstroller> ().Pitem3
                                  , LojaController.GetComponent <LojaConstroller> ().Pitem4
                                  , LojaController.GetComponent <LojaConstroller> ().Pitem5
                                  , LojaController.GetComponent <LojaConstroller> ().Pitem6);
            playerJson = JsonMapper.ToJson(saveItens);
            File.WriteAllText((Application.persistentDataPath + "/Materiais.json"), playerJson.ToString());

            currentCash.GetComponent <TextMesh> ().text = currentMoney.ToString();
            AtualCash.GetComponent <TextMesh> ().text   = currentMoney.ToString();
            ZeraItens();
            ValorGastar();
        }
        else
        {
            LojaController.GetComponent <LojaConstroller> ().warnning();
        }
    }