Пример #1
0
    /// <summary>
    /// Inicializar pantalla actual
    /// </summary>
    protected override void OnInit()
    {
        Instance = this;
        List <Transform> findPages = new List <Transform>();

        ComUtil.GetTransformInChild(mFindNames, CacheTransform, ref findPages);
        List <Transform> findLevels = new List <Transform>();

        for (int i = 0; i < findPages.Count; i++)
        {
            if (findPages[i].name.Equals(mFindNames[0]) ||
                findPages[i].name.Equals(mFindNames[1]) ||
                findPages[i].name.Equals(mFindNames[2]))
            {
                Image mPage1 = findPages[i].GetComponent <Image>();
                mPages.Add(mPage1);
                string s    = findPages[i].name.Substring(findPages[i].name.Length - 1, 1);
                int    page = 0;
                int.TryParse(s, out page);
                if (page != 0)
                {
                    findLevels.Clear();
                    ComUtil.GetTransformInChild(mFindNames1, findPages[i], ref findLevels);
                    for (int j = 0; j < findLevels.Count; j++)
                    {
                        int level = 0;
                        int.TryParse(findLevels[j].name, out level);
                        if (level != 0)
                        {
                            Button   btn      = findLevels[j].GetComponent <Button>();
                            LevelBtn levelBtn = new LevelBtn(btn, level + ((page - 1) * 3));
                            btn.onClick.AddListener(levelBtn.SelectLevel);
                            mLevels.Add(levelBtn);
                        }
                    }
                }
            }
            else
            {
                Button btn = findPages[i].GetComponent <Button>();
                btn.onClick.AddListener(() => { OnBtnClick(btn); });

                if (findPages[i].name.Equals(mFindNames[4]))
                {
                    mBtnDown = btn;
                }
                else
                {
                    mBtnUp = btn;
                }
            }
        }

        mCurPage = mPages[0];
        DetectionPageBtn();

        mLevels.Sort((LevelBtn a, LevelBtn b) => { return(a.level.CompareTo(b.level)); });
    }
Пример #2
0
    IEnumerator spawnCount(int money1, int money2, int money3)
    {
        AudioManager.PlaySound(AudioManager.Audio.rise01);
        for (int i = 1; i <= money1; ++i)
        {
            gameOverMenu.moneyTargetText1.text = i.ToString();
            yield return(new WaitForSeconds(0.015f));
        }

        AudioManager.PlaySound(AudioManager.Audio.rise02);
        for (int i = 1; i <= money2; ++i)
        {
            gameOverMenu.moneyTargetText2.text = i.ToString();
            yield return(new WaitForSeconds(0.015f));
        }

        AudioManager.PlaySound(AudioManager.Audio.rise03);
        for (int i = 1; i <= money3; ++i)
        {
            gameOverMenu.moneyTargetText3.text = i.ToString();
            yield return(new WaitForSeconds(0.015f));
        }

        AudioManager.PlaySound(AudioManager.Audio.rise04);
        int total = money1 + money2 + money3;

        for (int i = 1; i <= total; ++i)
        {
            gameOverMenu.moneyTotalText.text = i.ToString();
            yield return(new WaitForSeconds(0.015f));
        }

        Color32 gray = new Color32(255, 255, 255, 255);

        AdvertBtn.GetComponent <Button>().enabled = true;
        HomeBtn.GetComponent <Button>().enabled   = true;
        LevelBtn.GetComponent <Button>().enabled  = true;
        AdvertBtn.GetComponent <Image>().color    = gray;
        HomeBtn.GetComponent <Image>().color      = gray;
        LevelBtn.GetComponent <Image>().color     = gray;
    }