Beispiel #1
0
    //
    private void SetStageBtns(bool tween = true)
    {
        if (bm == null)
        {
            bm = FindObjectOfType <ButtonManager>(true);
            bm.SetPanel(currentDifficulty);
        }
        //
        { // 0 : locked, 1 : unlock Effect, 2 : unlocked, 3 : clear
            for (int i = 0; i < bm.stagePanels.Count; ++i)
            {
                // Child[0] : Panel_DifficultyText, Child[1] : STAGE
                Transform stage = bm.stagePanels[i].GetChild(1);
                // Activate first stage
                StageButton first = stage.GetChild(1).GetComponentInChildren <StageButton>();
                first.Activate(false);
                // stageBtn children order : 0(inf), 1(first), 2 ~ 6
                for (int j = 0; j < stage.childCount; ++j)
                {
                    int         btnState = saveData.stageBtnState[i][j];
                    StageButton sb       = stage.GetChild(j).GetComponentInChildren <StageButton>();
                    if (tween == false)
                    { // call by SceneChange
                        switch (btnState)
                        {
                        case 0:     // locked
                        case 1:     // unlock Effect
                            break;

                        case 2:     // unlocked
                        case 3:     // clear
                            sb.Activate(false);
                            break;
                        }
                    }
                    else
                    { // call by Clear Sequence
                        switch (btnState)
                        {
                        case 0:     // locked
                            break;

                        case 1:     // unlock Effect
                            sb.Activate(true);
                            saveData.stageBtnState[i][j] = 2;
                            Save();
                            break;

                        case 2:     // unlocked
                        case 3:     // clear
                            break;
                        }
                    }
                }
            }
        }
    }
Beispiel #2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        //
        StageButton btn = (StageButton)target;

        //
        if (GUILayout.Button("Activate"))
        {
            btn.Activate();
        }
        if (GUILayout.Button("DeActivate"))
        {
            btn.DeActivate();
        }
    }