Beispiel #1
0
    public void SetCanvas()
    {
        var s = SceneManager.GetActiveScene();

        if (s.name.Equals("OXScene"))
        {
            uicanvas = GameObject.Find("Canvas");
            GameModeManager.SetGameType("OXGame");
            GameModeManager.SetGameFinished(false);
            GameModeManager.SetQuestionSize(ox_testSize);
            SetBackButton("MainScene");
            InitOXScene();
        }
        else if (s.name.Equals("SentenceScene"))
        {
            uicanvas = GameObject.Find("Canvas");
            GameModeManager.SetGameType("SentenceGame");
            GameModeManager.SetGameFinished(false);
            GameModeManager.SetQuestionSize(sentence_testSize);
            SetBackButton("MainScene");
            InitSentenceScene();
        }
        else if (s.name.Equals("ResultScene"))
        {
            uicanvasResult = GameObject.Find("Canvas");
            InitResultScene();
        }
        else if (s.name.Equals("MenuScene"))
        {
            uicanvas = GameObject.Find("Canvas");
            InitMenuScene();
        }
        else if (s.name.Equals("StudyVocabScene"))
        {
            uicanvasResult = GameObject.Find("Canvas");
            InitStudyVocabScene();
        }
        else if (s.name.Equals("MyListScene"))
        {
            GameModeManager.SetGameType("MyList");
            uicanvasResult = GameObject.Find("Canvas");
            InitMyListScene();
        }
        else if (s.name.Equals("MySentenceListScene"))
        {
            GameModeManager.SetGameType("MySentenceList");
            uicanvasResult = GameObject.Find("Canvas");
            InitMySentenceListScene();
        }
    }
    IEnumerator StartResultAnimation(bool isCorrect)
    {
        PrefabManager.Instance.destroyQuestionPanel.transform.SetAsFirstSibling();
        PrefabManager.Instance.destroyChoicePanel.GetComponent <CanvasGroup>().alpha = 0f;
        var bg = PrefabManager.Instance.bg.GetComponent <BackgroundController>();

        if (isCorrect)
        {
            bg.ShowO();
        }
        else
        {
            bg.ShowX();
        }

        yield return(new WaitWhile(() => bg.isOXshow == true));

        yield return(new WaitForSeconds(PrefabManager.waitforseconds));

        //PrefabManager.Instance.count.GetComponent<QuestionCountController>().SentenceIncreaseCount();

        if (isCorrect)
        {
            //PrefabManager.Instance.score.GetComponent<ScoreController>().Sentence_IncreaseScore();
            UserDataManager.Instance.IncreaseUserSentenceScore();
        }

        PrefabManager.Instance.destroyChoicePanel.GetComponent <CanvasGroup>().alpha = 0f;

        Sentence_DataLoader.Sentence_SetRecord(isCorrect);

        Sentence_DataLoader.NextQuestion();

        int currentIndex = Sentence_DataLoader.GetCurrentSentenceIndex();

        GameModeManager.SetGameFinished(currentIndex);

        PrefabManager.Instance.count.GetComponent <QuestionCountController>().SentenceIncreaseCount(currentIndex);

        PrefabManager.Instance.CreateSentenceCard();

        if (GameModeManager.IsTurnBaseMode())
        {
            PrefabManager.Instance.tbar.GetComponent <TimeController>().timeLeft = 0f;
        }
    }
Beispiel #3
0
    public void CreateCard()
    {
        if (destroyCard)
        {
            Destroy(destroyCard);
        }

        if (OX_DataLoader.IsIndexOutOfRange())
        {
            Debug.Log("<color=red> DataLoader.cs : CreateCard : index out of range.</color>");
            return;
        }

        if (bg.GetComponent <BackgroundController>().timeup.gameObject.activeSelf) // 타임 업이 보이면, 더 이상 함수를 진행하지않는다.
        {
            return;
        }

        if (GameModeManager.IsGameFinished()) // 다 풀었다! 게임 끝!
        {
            return;
        }

        var s = OX_DataLoader.GetCurrentOXData();
        var o = Instantiate(card);

        {
            o.transform.position      = Vector3.zero;
            o.transform.localPosition = Vector3.zero;
            o.transform.SetParent(bg.transform, false);
            o.transform.Find("Panel").GetComponent <CardFormatter>().SetVocab(s.Key);
            o.transform.SetAsFirstSibling();
        }

        bg.transform.Find("X").SetSiblingIndex(1);
        bg.transform.Find("O").SetSiblingIndex(2);

        GetComponent <CanvasGroup>().DOFade(0f, 0f);

        if (s.Value.Value[(int)OX_DataLoader.Index.isTrick].Equals("true"))       // set trick
        {
            string trick = OX_DataLoader.OX_GetTrick(s.Key);
            var    dic   = UIStaticManager.TrimDesc(trick, s.Value.Value[(int)OX_DataLoader.Index.isTrick]);
            o.transform.Find("Panel").GetComponent <CardMove>().isTrickCard = true;
            o.transform.Find("Panel").GetComponent <CardFormatter>().SetDescList(dic);   // set trick desc
        }
        else
        {
            var dic = UIStaticManager.TrimDesc(s.Value.Value[(int)OX_DataLoader.Index.answer], s.Value.Value[(int)OX_DataLoader.Index.isTrick]);
            o.transform.Find("Panel").GetComponent <CardMove>().isTrickCard = false;
            o.transform.Find("Panel").GetComponent <CardFormatter>().SetDescList(dic);
        }

        //if (OX_DataLoader.IsBonusTurn())
        //{
        //    o.transform.Find("Panel").transform.Find("Bonus").gameObject.SetActive(true);
        //    o.transform.Find("Panel").GetComponent<CardMove>().isBonusTimeCard = true;
        //}
#if TEST
        if (o.transform.Find("Panel").transform.Find("Number").gameObject.activeSelf == false)
        {
            o.transform.Find("Panel").transform.Find("Number").gameObject.SetActive(true);
        }

        o.transform.Find("Panel").transform.Find("Number").GetComponent <Text>().text = OX_DataLoader.GetVocabIndex(s.Key).ToString();
#endif
        tbar.GetComponent <TimeController>().StartOXTimer(o);
        if (GameModeManager.IsTurnBaseMode())
        {
            tbar.GetComponent <TimeController>().timeLeft = 0;
        }

        destroyCard = o;

        OX_DataLoader.NextOXCard();

        int currentIndex = OX_DataLoader.GetCurrentOXIndex();
        GameModeManager.SetGameFinished(currentIndex);
    }