Example #1
0
    void SpawnBricksButtons()
    {
        for (int i = 0; i < data.brickSkins.Count; i++)
        {
            BricksSkins bs = bricksDictionary[data.brickSkins[i].name];

            if (i == 0)
            {
                bs.unlocked = true;
            }
            else
            {
                bs.unlocked = Convert.ToBoolean(PlayerPrefs.GetInt(bs.name, 0));
            }

            GameObject btn       = Instantiate(data.ballButtonPrefab, bricksListShop);
            Button     btnScript = btn.GetComponent <Button>();
            BallButton bBtn      = btn.GetComponent <BallButton>();

            bBtn.SetupButton(bs.name, data.brickSkins[i].price, bs.normalBrick);

            if (bs.unlocked)
            {
                bBtn.text.text = bs.name;
            }

            btnScript.onClick.AddListener(delegate { SelectBrick(bs); });

            brickButtons.Add(bBtn);
        }
    }
Example #2
0
    void SpawnPaddleButtons()
    {
        for (int i = 0; i < data.paddles.Count; i++)
        {
            BallShopClass bsc = paddlesDictionary[data.paddles[i].name];
            if (i > 0)
            {
                bsc.Unlocked = Convert.ToBoolean(PlayerPrefs.GetInt(bsc.name, 0));
            }
            else
            {
                bsc.Unlocked = true;
            }

            GameObject btn       = Instantiate(data.ballButtonPrefab, paddleListShop);
            Button     btnScript = btn.GetComponent <Button>();
            BallButton bBtn      = btn.GetComponent <BallButton>();

            btnScript.onClick.AddListener(delegate { SelectPaddle(bsc); });

            bBtn.SetupButton(bsc.name, bsc.price, bsc.sprite);

            if (bsc.Unlocked)
            {
                bBtn.text.text = bsc.name;
            }

            ballsButtons.Add(bBtn);
        }
    }
Example #3
0
    // 랜덤 제외
    public void RndBalls()
    {
        int rnd = 0;
        int i   = 0;

        rnd = Random.Range(5, 10);

        //랜덤 갯수만큼 번호 제외
        for (i = 0; i <= rnd; i++)
        {
            int        rnd2    = Random.Range(1, 45);
            GameObject child   = GameObject.Find("ExButtons").transform.Find("Button" + rnd2).gameObject;
            BallButton ballbtn = child.GetComponent <BallButton>();
            ballbtn.state = true;
            ballbtn.BtnClick();
        }
    }
Example #4
0
    void SpawnBallButtons()
    {
        for (int i = 0; i < data.balls.Count; i++)
        {
            BallShopClass bsc = ballsDictionary[data.balls[i].name];
            if (i > 0)
            {
                bsc.Unlocked = Convert.ToBoolean(PlayerPrefs.GetInt(bsc.name + "_Ball", 0));
            }
            else
            {
                bsc.Unlocked = true;
            }

            GameObject btn       = Instantiate(data.ballButtonPrefab, ballListShop);
            Button     btnScript = btn.GetComponent <Button>();
            BallButton bBtn      = btn.GetComponent <BallButton>();

            btnScript.onClick.AddListener(delegate { SelectBall(bsc); });
            if (bsc.changeMaterial)
            {
                bBtn.SetupButton(bsc.name, bsc.price, bsc.sprite, bsc.material);
            }
            else
            {
                bBtn.SetupButton(bsc.name, bsc.price, bsc.sprite, null);
            }

            if (bsc.Unlocked)
            {
                bBtn.text.text = bsc.name;
            }


            ballsButtons.Add(bBtn);
        }

        SelectBall(ballsDictionary[data.balls[data.selectedBall].name]);
    }
Example #5
0
 void Awake()
 {
     Instance = this;
 }
Example #6
0
 void UpdateButton(BallButton bb, string _text)
 {
     bb.text.text = _text;
 }