예제 #1
0
    public List <GameObject> CreatePreSentenceVocab(int id, Transform p)
    {
        string explain   = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.explain];
        string answer    = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.ans];
        string translate = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.translate];

        GameObject a = null;
        GameObject e = null;
        GameObject t = null;

        if (answer.Equals("") == false)
        {
            a      = Instantiate(dynGameBGTextBox);
            answer = "\n" + answer + "\n";
            a.transform.GetComponent <DynamicBGTextBoxController>().SetText(answer);
        }

        if (explain.Equals("") == false)
        {
            e       = Instantiate(dynGameBGTextBox);
            explain = "\n" + explain + "\n";
            e.transform.GetComponent <DynamicBGTextBoxController>().SetText(explain);
        }

        if (translate.Equals("") == false)
        {
            t         = Instantiate(dynGameBGTextBox);
            translate = "\n" + translate + "\n";
            t.transform.GetComponent <DynamicBGTextBoxController>().SetText(translate);
        }

        if (a)
        {
            a.transform.SetParent(p, false);
            a.GetComponent <CanvasGroup>().alpha = 0f;
        }

        if (e)
        {
            e.transform.SetParent(p, false);
            e.GetComponent <CanvasGroup>().alpha = 0f;
        }

        if (t)
        {
            t.transform.SetParent(p, false);
            t.GetComponent <CanvasGroup>().alpha = 0f;
        }
        return(new List <GameObject>()
        {
            a, e, t
        });
    }
예제 #2
0
    public void OnClickStarForSentence()
    {
        var data = Sentence_DataLoader.GetSentenceListDataById(nId);

        if (star.activeSelf)
        {
            SetEmptyStar();
            UserDataManager.Instance.DeleteUserSentenceList(nId);
            return;
        }

        SetStar();
        UserDataManager.Instance.AddUserSentenceList(nId);
    }
예제 #3
0
    public void SetSentenceResultPanel()
    {
        int corretCnt = 0;

        foreach (var item in Sentence_DataLoader.GetRecord())
        {
            int  id        = item.Key;
            bool isCoreect = item.Value;
            //var d = Sentence_DataLoader.sentenceList[index];
            var d = Sentence_DataLoader.GetSentenceListDataById(id);
            var r = Instantiate(PrefabManager.Instance.sentenceResultItem);
            {
                string sentence = UIStaticManager.ReplaceUnderline(d.Value[0]);
                r.GetComponent <ResultItem>().SetVocabDesc(sentence, "", isCoreect);

                if (isCoreect)
                {
                    corretCnt++;
                }

                SetPreSentence(r.transform, id);

                r.GetComponent <ResultItem>().SetEmptyStar();
                if (UserDataManager.Instance.IsSentenceDataExist(id))
                {
                    r.GetComponent <ResultItem>().SetStar();
                }
            }
        }

        // write data
        int   totalQuestionSize = GameModeManager.GetQuestionSize();
        float finalscore        = ((float)((float)corretCnt / (float)totalQuestionSize) * 100f);

        UserDataManager.Instance.SetUserSentenceFinalScore(finalscore);
        int dayid = GameModeManager.GetCurrentDay();

        UserDataManager.Instance.SetUserSentenceDayResult(dayid, finalscore);
        UserDataManager.Instance.SetSentenceNextDayUnlock(dayid);
        string filename = FileReadWrite.Instance.GetSentenceFileName();

        FileReadWrite.Instance.WriteUserData(filename);
    }
예제 #4
0
    void SetMyListSentencePanel()
    {
        Sentence_DataLoader.ClearData();
        Sentence_DataLoader.PrepareAllData();
        Sentence_DataLoader.InitAllSentenceList();
        var list = UserDataManager.Instance.GetUserSentenceList();

        foreach (var item in list)
        {
            int id = item.Key;
            var d  = Sentence_DataLoader.GetSentenceListDataById(id);
            var r  = Instantiate(PrefabManager.Instance.sentenceResultItem);
            {
                string sentence = UIStaticManager.ReplaceUnderline(d.Value[0]);
                r.GetComponent <ResultItem>().SetVocabForMyListSentence(sentence, "");
                SetPreSentence(r.transform, id);
                r.GetComponent <ResultItem>().SetEmptyStar();
                if (UserDataManager.Instance.IsSentenceDataExist(id))
                {
                    r.GetComponent <ResultItem>().SetStar();
                }
            }
        }
    }
예제 #5
0
    public void CreateSetenceVocab(int id, Transform p, GameObject answerPrefab, GameObject explainPrefab, GameObject translatePrefab) // create setence vocab before so can get the size.
    {
        string explain   = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.explain];
        string answer    = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.ans];
        string translate = Sentence_DataLoader.GetSentenceListDataById(id).Value[(int)Sentence_DataLoader.Index.translate];

        GameObject a = null;
        GameObject e = null;
        GameObject t = null;

        //float titleHeight = answerPrefab.GetComponent<DynamicBGTextBoxController>().titleTransform.rect.height;
        if (answer.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "정     답";
                title.transform.SetParent(p, false);
            }

            a = Instantiate(dynGameBGTextBox);

            answer = "\n" + answer + "\n";
            //a.transform.GetComponent<DynamicBGTextBoxController>().SetTitleText("정답");
            a.transform.GetComponent <DynamicBGTextBoxController>().SetText(answer);

            var answerSize = answerPrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            //a.GetComponent<RectTransform>().sizeDelta = new Vector2(answerSize.width, answerSize.height + titleHeight);
            a.GetComponent <RectTransform>().sizeDelta = new Vector2(answerSize.width, answerSize.height);
            a.GetComponent <CanvasGroup>().alpha       = 1f;
            a.transform.SetParent(p, false);
        }
        if (translate.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "번     역";
                title.transform.SetParent(p, false);
            }

            t         = Instantiate(dynGameBGTextBox);
            translate = "\n" + translate + "\n";

            //t.transform.GetComponent<DynamicBGTextBoxController>().SetTitleText("번역");
            t.transform.GetComponent <DynamicBGTextBoxController>().SetText(translate);

            var translateSize = translatePrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            //t.GetComponent<RectTransform>().sizeDelta = new Vector2(translateSize.width, translateSize.height + titleHeight);
            t.GetComponent <RectTransform>().sizeDelta = new Vector2(translateSize.width, translateSize.height);
            t.GetComponent <CanvasGroup>().alpha       = 1f;
            t.transform.SetParent(p, false);
        }
        if (explain.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "해     설";
                title.transform.SetParent(p, false);
            }

            e       = Instantiate(dynGameBGTextBox);
            explain = "\n" + explain + "\n";

            //e.transform.GetComponent<DynamicBGTextBoxController>().SetTitleText("해설");
            e.transform.GetComponent <DynamicBGTextBoxController>().SetText(explain);

            var explainSize = explainPrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            //e.GetComponent<RectTransform>().sizeDelta = new Vector2(explainSize.width, explainSize.height + titleHeight);
            e.GetComponent <RectTransform>().sizeDelta = new Vector2(explainSize.width, explainSize.height);
            e.GetComponent <CanvasGroup>().alpha       = 1f;
            e.transform.SetParent(p, false);
        }
        rpanel.GetComponent <ResultPanel>().TurnOffDGBox();
    }