Exemplo n.º 1
0
    //All the gestures for the betting panel
    public void Gestures(string type)
    {
        //Confirms bet
        if (type == "DoubleClick")
        {
            if (balance.text != "0")
            {
                if (source == null)
                {
                    bGI = FindObjectOfType <BoardGestureInput>();
                    bGI.SetFirst();
                    confirm.onClick.Invoke();
                }

                else
                {
                    if (amount.text == "100")
                    {
                        bGI = FindObjectOfType <BoardGestureInput>();
                        bGI.SetFirst();
                        confirm.onClick.Invoke();
                    }

                    else
                    {
                        if (!narrator.isPlaying)
                        {
                            source.Play();
                        }
                    }
                }
            }
        }

        //Plays balance
        else if (type == "Click")
        {
            if (!narrator.isPlaying && !amountReader.isPlaying)
            {
                balance.GetComponentInParent <Button>().onClick.Invoke();
            }
        }

        //Changes amount
        else if (type.Contains("Swipe"))
        {
            if (bPT == null)
            {
                bPT = gameObject.GetComponent <BetPanelTimer>();
            }

            bPT.CallTimer();

            string temp = Regex.Replace(balance.text, "[^.0-9]", "");

            int am = int.Parse(amount.text);

            int bal = int.Parse(temp);

            if (type.Contains("Up"))
            {
                if (am + 100 <= bal)
                {
                    am += 100;
                }

                else
                {
                    am = bal;
                }

                amount.text = am.ToString();
            }

            else if (type.Contains("Down"))
            {
                if (am - 100 >= 10)
                {
                    am -= 100;
                }

                else
                {
                    am = 10;
                }

                amount.text = am.ToString();
            }

            else if (type.Contains("Left"))
            {
                if (am - 10 >= 10)
                {
                    am         -= 10;
                    amount.text = am.ToString();
                }
            }

            else if (type.Contains("Right"))
            {
                if (am + 10 <= bal)
                {
                    am         += 10;
                    amount.text = am.ToString();
                }
            }
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        //Plays the value of the bet amount on open if the value isnt changed
        if (!first && panel.activeSelf)
        {
            if (panel.name == "Betting Coins Panel")
            {
                bPT = panel.GetComponent <BetPanelTimer>();
                bPT.CallTimer();
                first = true;
            }
        }

        if (GestureInputManager.CurrentInput != InputAction.Null)
        {
            type = GestureInputManager.CurrentInput.ToString();
            Debug.Log(type);

            //Finds out what panel the user is on to access the right gestures
            if (panel.activeSelf)
            {
                if (panel.name == "Betting Coins Panel")
                {
                    bG.Gestures(type);
                }

                else if (panel.name == "Zoom Panel")
                {
                    zPG.Gestures(type);
                }

                else if (panel.name == "Portrait_Roulette_Table")
                {
                    string current = "";

                    try
                    {
                        Debug.Log(EventSystem.current.currentSelectedGameObject.name);
                        current = EventSystem.current.currentSelectedGameObject.name;
                    }

                    catch
                    {
                    }

                    if (type == "Click" && current != "Board")
                    {
                        cB = FindObjectOfType <ClickButton>();
                        cB.ButtonClicked();
                    }

                    else
                    {
                        rBG.Gestures(type);
                    }
                }

                else if (panel.name == "AnotherBetPanel")
                {
                    pAG.Gestures(type);
                }

                else
                {
                    //For tutorial
                    if (type == "Click")
                    {
                        panel.SetActive(false);
                        panel2.SetActive(true);
                    }
                }
            }
        }
    }