示例#1
0
    public void OpenMenu()
    {
        if (scrollView != null && !gScript.IsRoundNewTime())
        {
            if (disableMenuButton == false)
            {
                if (scrollIsActive == false)
                {
                    gScript.PauseGame(true);

                    buyPanelActive = true;

                    panel.SetActive(true);

                    audioOut.PlayOneShot(acClickOn, 0.8f);
                    backGroundFade.SetActive(true);

                    buyButton.SetActive(true);

                    BackButton blarg = backButton.GetComponentInParent <BackButton>();
                    if (roundOver == true)
                    {
                        backButton.enabled = false;
                        if (blarg != null)
                        {
                            blarg.SetAlpha(0f);
                        }
                    }
                    else
                    {
                        backButton.enabled = true;
                        if (blarg != null)
                        {
                            blarg.SetAlpha(255f);
                        }
                    }

                    // move the canvas in
                    bPanel.SetMovePanelIn();

                    watchAdsBut = GameObject.FindGameObjectWithTag("uiWatchAds").GetComponent <WatchAdsButton>();
                    if (watchAdsBut == null)
                    {
                        Debug.Log("Menu Button script couldnt get reference to the watch ads button.");
                    }
                    watchAdsBut.SetWiggle(false);

                    Button btn = buyButton.GetComponent <Button>();
                    if (btn == null)
                    {
                        Debug.Log("Menu Button couldnt get a reference to the Buy Button Button component.");
                    }
                    else
                    {
                        btn.enabled = false;
                    }

                    BuyButton bbtn = buyButton.GetComponent <BuyButton>();
                    if (btn == null)
                    {
                        Debug.Log("Menu Button couldnt get a reference to the Buy Button Button component.");
                    }
                    else
                    {
                        bbtn.SetWiggle(false);
                    }



                    // get reference to the text that shows the coin bank and update
                    Text coinB = GameObject.FindGameObjectWithTag("uiTotalCoins").GetComponent <Text>();
                    if (coinB != null)
                    {
                        string str = "" + gScript.GetBigCoinBank().ToString();
                        coinB.text = str;
                    }

                    // update current lerper character fields
                    currentName.text     = "" + pScript.GetCharName(charIndex);
                    currentJump.text     = "" + pScript.GetCharJumpTimes(charIndex).ToString();
                    currentDistance.text = "" + pScript.GetCharDistance(charIndex).ToString();
                    currentLevel.text    = "" + pScript.GetCharLevel(charIndex).ToString();

                    // close the winpanel
                    //winPanel.SetActive(false);

                    playButton.enabled = true;
                    scrollView.SetActive(true);
                    scrollIsActive = true;


                    GameSaver.gSaver.SaveData();
                    Debug.Log("bugger");
                }
                else
                {
                    if (roundOver == false)
                    {
                        CloseMenu();
                    }
                }
            }
        }
    }