Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (UserIn.getValue() < 100)
        {
            charge = 0;
        }

        else if (UserIn.getValue() >= 100 && UserIn.getValue() <= 500)
        {
            charge = UserIn.getValue() * 0.01;
        }

        else if (UserIn.getValue() >= 500 && UserIn.getValue() <= 1000)
        {
            charge = UserIn.getValue() * 0.02;
        }

        else
        {
            charge = UserIn.getValue() * 0.03;
        }
        totalcost        = charge + UserIn.getValue();
        receiptText.text = "Receipt" +
                           "\nAddress:" +
                           "\n1A Uxbridge Street" +
                           "\nUB3 3BB" +
                           "\nUxbride" +
                           "\nMiddlsex" +
                           "\n" +
                           "\nUser Name: " + UserIn.getUsername() +
                           "\nUser Surname: " + UserIn.getUserSurn() +
                           "\nUser ID: " + UserIn.getUserID() +
                           "\nClient Name:" + UserIn.getClient() +
                           "\nTime: " + passTime.getTime() +
                           "\nDate: " + passTime.getDate() +
                           "\nMoney Inserted: " + UserIn.getValue() + " " + ConvOut.getCurrencyIn() +
                           "\nConverted To: " + ConvOut.getResult() + " " + ConvOut.getCurrencyOut() +
                           "\nTotal Charge: " + totalcost + " " + ConvOut.getCurrencyIn();
    }
    public void conversion(int index)
    {
        //FromGBP
        if (index == 0)
        {
            //USD
            moneyIn     = money.getValue();
            rate        = 1.40;
            result      = rate * moneyIn;
            currTypeIn  = "GBP";
            currTypeOut = "Dollars";
            Debug.Log(result);
            i = 0;
        }
        else if (index == 1)
        {
            //Euro
            moneyIn     = money.getValue();
            rate        = 1.14;
            result      = rate * moneyIn;
            currTypeIn  = "GBP";
            currTypeOut = "Euro";
            Debug.Log(result);
            i = 0;
        }
        else if (index == 2)
        {
            //Yen
            moneyIn     = money.getValue();
            rate        = 149.02;
            result      = rate * moneyIn;
            currTypeIn  = "GBP";
            currTypeOut = "Yen";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 3)
        {
            //INR
            moneyIn     = money.getValue();
            rate        = 91.43;
            result      = rate * moneyIn;
            currTypeIn  = "GBP";
            currTypeOut = "Rupees";
            Debug.Log(result);
            i = 0;
        }

        //FromUSD
        else if (index == 4)
        {
            //GBP
            moneyIn     = money.getValue();
            rate        = 0.71;
            result      = rate * moneyIn;
            currTypeIn  = "Dollars";
            currTypeOut = "GBP";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 5)
        {
            //EURO
            moneyIn     = money.getValue();
            rate        = 0.82;
            result      = rate * moneyIn;
            currTypeIn  = "Dollars";
            currTypeOut = "Euro";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 6)
        {
            //YEN
            moneyIn     = money.getValue();
            rate        = 106.53;
            result      = rate * moneyIn;
            currTypeIn  = "Dollars";
            currTypeOut = "Yen";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 7)
        {
            //INR
            moneyIn     = money.getValue();
            rate        = 65.25;
            result      = rate * moneyIn;
            currTypeIn  = "Dollars";
            currTypeOut = "Rupees";
            Debug.Log(result);
            i = 0;
        }

        //FromEUR
        else if (index == 8)
        {
            //GBP
            moneyIn     = money.getValue();
            rate        = 0.87;
            result      = rate * moneyIn;
            currTypeIn  = "Euro";
            currTypeOut = "GBP";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 9)
        {
            //USD
            moneyIn     = money.getValue();
            rate        = 1.22;
            result      = rate * moneyIn;
            currTypeIn  = "Euro";
            currTypeOut = "Dollars";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 10)
        {
            //YEN
            moneyIn     = money.getValue();
            rate        = 130.43;
            result      = rate * moneyIn;
            currTypeIn  = "Euro";
            currTypeOut = "YEN";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 11)
        {
            //INR
            moneyIn     = money.getValue();
            rate        = 79.87;
            result      = rate * moneyIn;
            currTypeIn  = "Euro";
            currTypeOut = "Rupees";
            Debug.Log(result);
            i = 0;
        }

        //FromYEN
        else if (index == 12)
        {
            //USD
            moneyIn     = money.getValue();
            rate        = 0.0094;
            result      = rate * moneyIn;
            currTypeIn  = "YEN";
            currTypeOut = "Dollars";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 13)
        {
            //EURO
            moneyIn     = money.getValue();
            rate        = 0.0077;
            result      = rate * moneyIn;
            currTypeIn  = "YEN";
            currTypeOut = "Euro";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 14)
        {
            //GBP
            moneyIn     = money.getValue();
            rate        = 0.0067;
            result      = rate * moneyIn;
            currTypeIn  = "YEN";
            currTypeOut = "GBP";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 15)
        {
            //INR
            moneyIn     = money.getValue();
            rate        = 0.61;
            result      = rate * moneyIn;
            currTypeIn  = "YEN";
            currTypeOut = "Rupees";
            Debug.Log(result);
            i = 0;
        }

        //FromINR
        else if (index == 16)
        {
            //USD
            moneyIn     = money.getValue();
            rate        = 0.015;
            result      = rate * moneyIn;
            currTypeIn  = "Rupees";
            currTypeOut = "Dollars";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 17)
        {
            //EURO
            moneyIn     = money.getValue();
            rate        = 0.013;
            result      = rate * moneyIn;
            currTypeIn  = "Rupees";
            currTypeOut = "Euro";
            Debug.Log(result);
            i = 0;
        }

        else if (index == 18)
        {
            //YEN
            moneyIn     = money.getValue();
            rate        = 1.63;
            result      = rate * moneyIn;
            currTypeIn  = "Rupees";
            currTypeOut = "YEN";
            Debug.Log(result);
            i = 0;
        }

        else
        {
            //GBP
            moneyIn     = money.getValue();
            rate        = 0.011;
            result      = rate * moneyIn;
            currTypeIn  = "Rupees";
            currTypeOut = "GBP";
            Debug.Log(result);
            i = 0;
        }
    }