コード例 #1
0
ファイル: HomeView.cs プロジェクト: EricChen1/Q-Game
    public void NextArea()
    {
        int soundState = PlayerPrefs.GetInt(GameConstant.SOUND_STATE, 0);

        if (soundState == 0)
        {
            AudioPlayer.Instance.PlaySE(GameConstant.BUTTON_CLICK_SOUND);
        }
        int nextArea = 0;

        if (areaNum < GameConstant.MAX_LEVEL)
        {
            nextArea = areaNum + 1;
        }
        else
        {
            nextArea = 1;
        }
        bool isUnlockArea = IsNextAreaUnlock(nextArea);

        areaNum = nextArea;
        foreach (GameObject stageGO in stageList)
        {
            Destroy(stageGO);
        }
        stageList.Clear();
        areaText.text = "LEVEL" + areaNum;
        nextButton.ChangeState(GameButton.ButtonState.NORMAL);
        if (isUnlockArea)
        {
            PlayerPrefs.SetInt(GameConstant.UNLOCK_PREFIX + "_" + nextArea, 1);
            if (areaNum == GameConstant.MAX_LEVEL)
            {
                LoadStageUI(1, 7);
            }
            else
            {
                LoadStageUI(1, 10);
            }
        }
        else
        {
            AddLockArea();
        }
    }
コード例 #2
0
ファイル: HomeView.cs プロジェクト: EricChen1/Q-Game
    public void Initialize(int areaNum)
    {
        this.areaNum = areaNum;
        nextButton   = nextButtonGO.GetComponent <GameButton>();
        int nextArea = areaNum + 1;

        if (IsNextAreaUnlock(nextArea))
        {
            int nextAreaStatus = PlayerPrefs.GetInt(GameConstant.UNLOCK_PREFIX + "_" + nextArea, 0);
            if (nextAreaStatus == 0)
            {
                NewStageAnimation();
                nextButton.ChangeState(GameButton.ButtonState.FADE);
                PlayerPrefs.SetInt(GameConstant.UNLOCK_PREFIX + "_" + nextArea, 1);
            }
            nextButtonGO.GetComponent <Image>().enabled = true;
            backButton.GetComponent <Image>().enabled   = true;
        }
        stageList     = new List <GameObject>();
        areaText.text = "LEVEL" + areaNum;
        if (areaNum == 1)
        {
            Tutorial();
        }
        else
        {
            nextButtonGO.GetComponent <Image>().enabled = true;
            backButton.GetComponent <Image>().enabled   = true;
            if (areaNum == GameConstant.MAX_LEVEL)
            {
                LoadStageUI(1, 7);
            }
            else
            {
                LoadStageUI(1, 10);
            }
        }
    }