예제 #1
0
    public void InitializeUI()
    {
        GiveMoneyTo.onValueChanged.RemoveAllListeners();
        AmountToGive.onValueChanged.RemoveAllListeners();

        AmountToGive.text = "0";
        AmountToGive.onValueChanged.AddListener(ValidateInputField);

        SetActiveBoolOnGoArray(ReceiverPart, true);

        FinanceLogic.Bank bank = FindObjectOfType <ManagementScripts.GameManager>().bank;


        //FIXME: use dropdownhandler instead
        GiveMoneyTo.gameObject.GetComponent <DropdownHandler>().PopulateDropDown(FinancialDataSupplier.AccountsIDs(bank), currentAccountId);

        GiveMoneyTo.onValueChanged.AddListener(DropdownListener);



        SetActiveBoolOnGoArray(AmountPart, true);

        SetActiveBoolOnGoArray(ReceiverPart, false);

        ConfirmButton.SetActive(false);

        NewTransactionButton.SetActive(false);
    }
    void SetMoneyText(string financialAccountID)
    {
        Bank bank = FindObjectOfType <ManagementScripts.GameManager>().bank;


        MoneyText.text = "Balance: " + FinancialDataSupplier.GetBalance(bank, financialAccountID).ToString();
    }
 public void DisplayAccounts(bool isVisible)
 {
     if (!isVisible)
     {
         Bank bank = FindObjectOfType <ManagementScripts.GameManager>().bank;
         textDisplayTemplate.GetComponent <IDisplayAccounts>().Display(FinancialDataSupplier.AccountsIDs(bank));
     }
 }
예제 #4
0
        public void can_create_an_account_and_verify_exists()
        {
            string accountRequestedID = "Test Account Name String";
            Bank   bank           = new Bank();
            string accountGivenID = FinancialDataCreator.CreateNewAccount(bank, accountRequestedID);


            Assert.NotNull(FinancialDataSupplier.AccountsIDs(bank));
            Assert.AreEqual(FinancialDataSupplier.AccountsIDs(bank)[FinancialDataSupplier.AccountsIDs(bank).Length - 1], accountGivenID);
        }
예제 #5
0
        public void can_create_two_accounts_with_100_and_transfer_50_from_a_to_b()
        {
            string accountsRequestedID = "Test Account Name String";
            Bank   bank = new Bank();
            string account_a_GivenID = FinancialDataCreator.CreateNewAccount(bank, accountsRequestedID, 100);
            string account_b_GivenID = FinancialDataCreator.CreateNewAccount(bank, accountsRequestedID, 100);


            FinancialDataCreator.MakeTransactionFromIdString(bank, 50, account_a_GivenID, account_b_GivenID);

            Assert.AreEqual(50, FinancialDataSupplier.GetBalance(bank, account_a_GivenID));
            Assert.AreEqual(150, FinancialDataSupplier.GetBalance(bank, account_b_GivenID));
        }
예제 #6
0
    private void ValidateInputField(string mountString)
    {
        Bank bank   = FindObjectOfType <ManagementScripts.GameManager>().bank;
        int  amount = int.Parse(mountString);

        if (amount > 0)
        {
            int balance = FinancialDataSupplier.GetBalance(bank, currentAccountId);
            if (amount > balance)
            {
                amount            = balance;
                AmountToGive.text = balance.ToString();
            }
            SetActiveBoolOnGoArray(ReceiverPart, true);
        }
        else
        {
            SetActiveBoolOnGoArray(ReceiverPart, false);
            ConfirmButton.SetActive(false);
        }
    }