示例#1
0
    // Play Pachinko!
    void OnMouseClicked()
    {
        if (isPlay())
        {
            return;
        }
        ClearBoxes();

        string toggle = "";

        GameObject[] btns = GameObject.FindGameObjectsWithTag("BetBtn");
        for (int i = 0; i < btns.Length; i++)
        {
            if (btns[i].GetComponent <Pinball_BetBtn>().toggle)
            {
                toggle = btns[i].transform.name;
            }
        }

        if (toggle.Length == 0)
        {
            AlertWindow window = (AlertWindow)((GameObject)Instantiate(Resources.Load("prefab/Alert"))).GetComponent <AlertWindow>();
            window.title.text = "Pin&Ball";
            window.text.text  = "You need selecting bet coin";
        }
        else
        {
            int num = 0;
            if (toggle == "Bet1")
            {
                num = 1;
            }
            else if (toggle == "Bet10")
            {
                num = 10;
            }
            else if (toggle == "Bet50")
            {
                num = 50;
            }

            if (PlayerMeta.GetGold() >= num)
            {
                PlayerMeta.decreaseGold(num);

                transform.localScale = new Vector3(1.4f, 1.4f, 1);
                GameObject shooter = GameObject.Find("Shooter");
                shooter.SendMessage("GameStart", num);
            }
            else
            {
                AlertWindow window = (AlertWindow)((GameObject)Instantiate(Resources.Load("prefab/Alert"))).GetComponent <AlertWindow>();
                window.title.text = "Pin&Ball";
                window.text.text  = "You need more gold";
            }
        }
    }
示例#2
0
 // Update My Gold!
 void Update()
 {
     text.text = "" + PlayerMeta.GetGold();
 }