Example #1
0
    public void Show(QuizSlot slot, Action <QuizSlot> callback)
    {
        if (quizParent != null)
        {
            quizParent.SetActive(true);
        }
        this.callback = callback;
        this.gameObject.SetActive(true);
        this.slot = slot;
        for (int i = 0; i < onList.Count; i++)
        {
            onList[i].gameObject.SetActive(false);
        }

        for (int i = 0; i < onList.Count; i++)
        {
            if (slot.answerList[i])
            {
                onList[i].gameObject.SetActive(true);
            }
        }

        for (int i = 0; i < quizObject.Count; i++)
        {
            quizObject[i].gameObject.SetActive(false);
        }

        quizObject[slot.index].gameObject.SetActive(true);
        teamButtonObject.SetActive(false);
        index = 0;
        ShowNext();
    }
Example #2
0
 public void SlotCallback(QuizSlot slot)
 {
     if (slot.level == currentLevel)
     {
         //현재 레벨
         if (slot.stateType == QuizSlot.StateType.Lock)
         {
             //현재 선택된 잠겨있는 슬롯이 없을 때만 동작.
             if (currentSlot == null)
             {
                 slot.SetOpen();
                 currentSlot = slot;
             }
         }
         else if (slot.stateType == QuizSlot.StateType.Clear)
         {
             questionUI.Show(slot, AnswerCallback);
         }
         else
         {
             //마지막으로 깐 슬롯과 동일할 경우에만 동작.
             if (currentSlot == slot)
             {
                 questionUI.Show(slot, AnswerCallback);
                 currentSlot = null;
             }
         }
     }
     else if (slot.level < currentLevel)
     {
         //이미 깬것.
     }
     else
     {
         //아직 아님.
     }
 }
Example #3
0
    private void AnswerCallback(QuizSlot slot)
    {
        if (currentLevel == slot.level)
        {
            bool isAllClear = true;

            if (currentLevel == 0)
            {
                for (int i = 0; i < slotList1.Count; i++)
                {
                    if (slotList1[i].stateType != QuizSlot.StateType.Clear)
                    {
                        isAllClear = false;
                        break;
                    }
                }
            }
            else if (currentLevel == 1)
            {
                for (int i = 0; i < slotList2.Count; i++)
                {
                    if (slotList2[i].stateType != QuizSlot.StateType.Clear)
                    {
                        isAllClear = false;
                        break;
                    }
                }
            }
            else if (currentLevel == 2)
            {
                for (int i = 0; i < slotList3.Count; i++)
                {
                    if (slotList3[i].stateType != QuizSlot.StateType.Clear)
                    {
                        isAllClear = false;
                        break;
                    }
                }
            }

            if (isAllClear)
            {
                currentLevel++;

                for (int i = 0; i < currentLevelObjectList.Count; i++)
                {
                    currentLevelObjectList[i].SetActive(false);
                }

                for (int i = 0; i < currentLevelObjectOffList.Count; i++)
                {
                    currentLevelObjectOffList[i].SetActive(true);
                }

                if (currentLevel < currentLevelObjectList.Count)
                {
                    currentLevelObjectList[currentLevel].SetActive(true);
                    currentLevelObjectOffList[currentLevel].SetActive(false);
                }
            }
        }

        if (currentLevel >= 3)
        {
            scoreUI.Show(allList, true);
        }
    }