Пример #1
0
    //Gets the list of numbers the player can win on according to the number they chose and the type of bet
    //and saves it in winNum list
    private void WinningNumbers(string betType)
    {
        gBN = FindObjectOfType <GetButtonNum>();

        int num;

        //Zero does not have a zoom screen so it never uses the GetButtonNum script, so any errors must mean the bet on number was zero
        try
        {
            num = gBN.GetNumber();
        }

        catch
        {
            num = 0;
        }

        winNum.Add(num);

        if (betType == "Split Bet")
        {
            switch (btnName)
            {
            case "Top Middle Number":
                if (num < 3)
                {
                    winNum.Add(0);
                }

                else
                {
                    winNum.Add(num - 3);
                }
                break;

            case "Middle Left Number":
                winNum.Add(num - 1);
                break;

            case "Middle Right Number":
                winNum.Add(num + 1);
                break;

            case "Bottom Middle Number":
                winNum.Add(num + 3);
                break;
            }
        }

        else if (betType == "Corner Bet")
        {
            switch (btnName)
            {
            case "Top Left Number":
                winNum.Add(num - 1);
                winNum.Add(num - 4);
                winNum.Add(num - 3);
                break;

            case "Top Right Number":
                winNum.Add(num - 3);
                winNum.Add(num - 2);
                winNum.Add(num + 1);
                break;

            case "Bottom Left Number":
                winNum.Add(num + 2);
                winNum.Add(num + 3);
                winNum.Add(num - 1);
                break;

            case "Bottom Right Number":
                winNum.Add(num + 1);
                winNum.Add(num + 3);
                winNum.Add(num + 4);
                break;
            }
        }

        else if (betType == "Street Bet")
        {
            winNum.Add(num + 1);
            winNum.Add(num + 2);
        }

        else if (betType == "Trio Bet")
        {
            if (num == 1)
            {
                winNum.Add(0);
                winNum.Add(2);
            }

            if (num == 2)
            {
                if (btnName == "Top Left Number")
                {
                    winNum.Add(0);
                    winNum.Add(1);
                }

                else
                {
                    winNum.Add(0);
                    winNum.Add(3);
                }
            }

            if (num == 3)
            {
                winNum.Add(0);
                winNum.Add(2);
            }
        }

        else if (betType == "Six Line Bet")
        {
            if (btnName == "Bottom Left Number")
            {
                for (int i = 1; i < 6; i++)
                {
                    winNum.Add(num + i);
                }
            }

            else
            {
                winNum.Add(num - 3);
                winNum.Add(num - 2);
                winNum.Add(num - 1);
                winNum.Add(num + 1);
                winNum.Add(num + 2);
            }
        }

        else if (betType == "Basket Bet")
        {
            for (int i = 0; i < 4; i++)
            {
                if (i != 1)
                {
                    winNum.Add(i);
                }
            }
        }
        SaveNums(betType);
    }
Пример #2
0
    //Gets the button number that was first clicked e.g 5 and the name of the button around the zoomed number e.g TopRightButton
    //To determine where the coin should go
    public void CoinPos()
    {
        gBN = FindObjectOfType <GetButtonNum>();
        bool isTwo = false;

        //Gets the currently selected button which is one of the buttons around the zoomed number
        string name = EventSystem.current.currentSelectedGameObject.name;
        float  x    = 0;
        float  y    = 0;

        num = gBN.num;

        //If a trio bet between 2 and zero, then the coin should be placed between 0, 1, 2 or 0, 2, 3
        if (num == 2)
        {
            if (name == "Top Right Number")
            {
                num   = 3;
                isTwo = true;
            }

            else if (name == "Top Left Number")
            {
                num   = 1;
                isTwo = true;
            }
        }

        //Sets the button
        btn = SetButton();

        //If a first column number was picked, check if it was a street bet
        if (num % 3 == 1 && name.Contains("Left Number") && !isTwo)
        {
            btn2 = GameObject.Find("StreetCalc").GetComponent <Button>();

            if (name.Contains("Middle"))
            {
                y = btn.transform.position.y;
            }

            else
            {
                x    = XMove();
                btn2 = null;

                if (name.Contains("Top"))
                {
                    num -= 3;
                }

                else
                {
                    num += 3;
                }
            }
        }

        else
        {
            //For most numbers this gets the second number the coin will be between
            switch (name)
            {
            case "Top Left Number":
                num -= 4;
                break;

            case "Top Middle Number":
                num -= 3;
                break;

            case "Top Right Number":
                if (isTwo)
                {
                    num = 0;
                }

                else
                {
                    num -= 2;
                }
                break;

            case "Middle Left Number":
                num--;
                break;

            case "Middle Right Number":
                num++;
                break;

            case "Bottom Left Number":
                num += 2;
                break;

            case "Bottom Middle Number":
                num += 3;
                break;

            case "Bottom Right Number":
                num += 4;
                break;
            }
        }

        //For buttons 1_Cell 2_Cell 3_Cell since only 0 is in the row above is num is less than zero then zero must be the other number
        if (num <= 0)
        {
            num = 0;
            //Don't need to calculate x for split bets containing zero, just use the first buttons x value
            if (name == "Top Middle Number")
            {
                x = btn.transform.position.x;
            }
        }

        //If not a street bet
        if (y == 0)
        {
            btn2 = SetButton();
            y    = YMove();
        }

        if (x == 0)
        {
            x = XMove();
        }

        //Set the token position
        token.transform.position = new Vector2(x, y);
    }