Example #1
0
    //private int m_iLevel;

    public void Initialize(int _iLevel)
    {
        //m_iLevel = _iLevel;

        m_lbText.text = _iLevel.ToString();

        DefineProject.STAGE_STATUS eStageStatus = DataManagerEqual.Instance.GetStageStatus(_iLevel);

        switch (eStageStatus)
        {
        case DefineProject.STAGE_STATUS.NONE:
            m_sprBack.color = new Color(0.5f, 0.5f, 0.5f);
            break;

        case DefineProject.STAGE_STATUS.NO_PLAY:
            m_sprBack.color = Color.white;
            break;

        case DefineProject.STAGE_STATUS.CHALLENGING:
            m_sprBack.color = Color.white;
            break;

        case DefineProject.STAGE_STATUS.CLEARED:
            m_sprBack.color = Color.yellow;
            break;

        case DefineProject.STAGE_STATUS.MAX:
        default:
            break;
        }
    }
Example #2
0
    // Update is called once per frame
    new void Update()
    {
        bool bInit = false;

        if (m_eStepPre != m_eStep)
        {
            m_eStepPre = m_eStep;
            bInit      = true;
        }
        switch (m_eStep)
        {
        case STEP.INIT:

            if (bInit)
            {
                m_fTimer = 0.0f;
                FadeInOut.Instance.Close(0.0f);
                m_csCenterOnChild.onCenter = DragBanner;
                m_btnHelp.TriggerClear();
                if (DataManagerEqual.Instance.m_iPlayLevel == 0)
                {
                    DataManagerEqual.Instance.m_iPlayLevel = 1;
                }

                // 初期化処理
                if (false == PlayerPrefs.HasKey(DefineProject.GetKeyStage(1)))
                {
                    DataManagerEqual.Instance.SetStageStatus(1, DefineProject.STAGE_STATUS.NO_PLAY);
                }
                m_goIconRootList.Clear();
                ButtonRefresh();
                //ButtonRefresh (PAGE_NUM * PAGE_DISP_ICON);

                for (int page = 0; page < PAGE_NUM; page++)
                {
                    GameObject objList = PrefabManager.Instance.MakeObject("prefab/LevelIconPage", m_goScrollView);

                    objList.name = string.Format("{0}{1}", STR_PAGE_ROOT, page);

                    for (int icon = 0; icon < PAGE_DISP_ICON; icon++)
                    {
                        GameObject objIcon = PrefabManager.Instance.MakeObject("prefab/LevelIcon", objList);

                        AddButtonBase(objIcon);
                        //AddButtonBase (page * PAGE_DISP_ICON + icon, objIcon);

                        int iLevel = page * PAGE_DISP_ICON + icon + 1;
                        objIcon.GetComponent <LevelIcon> ().Initialize(iLevel);
                    }
                    m_goIconRootList.Add(objList);
                }
                m_goScrollView.GetComponent <UIGrid> ().enabled = true;

                // 順番的にここでやらないと反応できない
                SetBanner((DataManagerEqual.Instance.m_iPlayLevel - 1) / PAGE_DISP_ICON);

                ButtonInit();
                TriggerClearAll();
            }

            m_fTimer += Time.deltaTime;
            if (0.2f < m_fTimer)
            {
                m_eStep = STEP.IDLE;
            }
            break;

        case STEP.IDLE:
            if (bInit)
            {
                FadeInOut.Instance.Open(0.25f);
                m_btnReturn.TriggerClear();
                m_btnHelp.TriggerClear();
            }
            if (ButtonPushed)
            {
                Debug.Log(Index);
                TriggerClearAll();

                int iLevel = Index + 1;

                DefineProject.STAGE_STATUS eStageStatus = DataManagerEqual.Instance.GetStageStatus(iLevel);
                if (eStageStatus == DefineProject.STAGE_STATUS.NONE)
                {
                }
                else
                {
                    // 補正
                    DataManagerEqual.Instance.m_iPlayLevel = Index + 1;
                    m_eStep = STEP.START_GAME;
                }
            }
            else if (m_btnNext.ButtonPushed)
            {
                Debug.Log("here");
                m_btnNext.TriggerClear();
                m_iPageIndex += 1;
                m_iPageIndex %= PAGE_NUM;
                SetBanner(m_iPageIndex);
            }
            else if (m_btnPrev.ButtonPushed)
            {
                Debug.Log("here2");
                m_btnPrev.TriggerClear();
                m_iPageIndex -= 1;
                if (m_iPageIndex < 0)
                {
                    m_iPageIndex += PAGE_NUM;
                }
                SetBanner(m_iPageIndex);
            }
            else if (m_btnReturn.ButtonPushed)
            {
                m_eStep = STEP.GOTO_TITLE_WAIT;
            }
            else if (m_btnHelp.ButtonPushed)
            {
                m_eStep = STEP.HELP;
            }
            else
            {
            }
            break;

        case STEP.HELP:
            if (bInit)
            {
                //m_NendAdIcon.Hide ();
                m_page = PrefabManager.Instance.MakeScript <HelpMain> ("prefab/RootHelp", m_goDispRoot);
                m_page.PageStart();
            }
            if (m_page.IsEnd())
            {
                //m_NendAdIcon.Show ();
                m_eStep = STEP.IDLE;
                Destroy(m_page.gameObject);
            }
            break;

        case STEP.START_GAME:
            if (bInit)
            {
                FadeInOut.Instance.Close(0.25f);
            }
            if (FadeInOut.Instance.IsIdle())
            {
                SceneManager.LoadScene("game");
            }
            break;

        case STEP.GOTO_TITLE_WAIT:
            if (bInit)
            {
                FadeInOut.Instance.Close(0.25f);
            }
            if (FadeInOut.Instance.IsIdle())
            {
                m_eStep = STEP.GOTO_TITLE;
            }
            break;

        case STEP.GOTO_TITLE:
            if (bInit)
            {
                SceneManager.LoadScene("title");
            }
            break;

        default:
            break;
        }
    }
Example #3
0
 public void SetStageStatus(int _iLevel, DefineProject.STAGE_STATUS _eStatus)
 {
     PlayerPrefs.SetInt(DefineProject.GetKeyStage(_iLevel), (int)_eStatus);
     m_iStageStatusArr [_iLevel] = (int)_eStatus;
     return;
 }