Beispiel #1
0
    public static void OX_InitWordList() // init word list
    {
        int cnt = GameModeManager.GetQuestionSize();

        for (var i = 0; i < cnt; i++)
        {
            string vocab  = ((string)ox_data[i]["vocab"]).Trim();
            string answer = ((string)ox_data[i]["def"]).Trim();
            int    id     = ((int)ox_data[i]["id"]);
            string e1     = ((string)ox_data[i]["e1"]).Trim();
            string t1     = ((string)ox_data[i]["t1"]).Trim();
            //string e2 = ((string) ox_data[i]["e2"]).Trim();
            //string t2 = ((string) ox_data[i]["t2"]).Trim();
            string sym = ((string)ox_data[i]["sym"]).Trim();
            string aym = ((string)ox_data[i]["aym"]).Trim();

            if (wordList.ContainsKey(vocab)) //  중복 막기
            {
                Debug.Log("<color=red>" + " same vocab : index : " + i + " : " + ox_data[i]["vocab"] + "</color>");
                continue;
            }

            if (answer.Equals("")) // skip if no answer
            {
                Debug.Log("<color=red>" + " no answer : index : " + i + " : " + ox_data[i]["vocab"] + "</color>");
                continue;
            }
#if TEST
            bool istrick = false;
#else
            int  b       = random.Next(2);
            bool istrick = Convert.ToBoolean(b);
#endif
            //wordList.Add(vocab, new KeyValuePair<string, bool>(answer, istrick));

            List <string> infolist = new List <string>();
            {
                if (istrick)
                {
                    infolist.Add("true");
                }
                else
                {
                    infolist.Add("false");
                }

                infolist.Add(answer);
                infolist.Add(e1);
                infolist.Add(t1);
                //infolist.Add(e2);
                //infolist.Add(t2);
                infolist.Add(sym); // 6
                infolist.Add(aym); // 7
            }
            //wordList.Add(vocab, new KeyValuePair<string, bool>(answer, false));
            wordList.Add(vocab, new KeyValuePair <int, List <string> >(id, infolist));
            //Debug.Log("<color=yellow>" + (i).ToString() + ": vocab : " + vocab + "answer : " + answer + "</color>");
        }
    }
    public static void Sentence_InitList()
    {
        int cnt = GameModeManager.GetQuestionSize();

        for (var i = 0; i < cnt; i++)
        {
            int id = ((int)sentence_data[i]["id"]);
            if (id < 0)
            {
                Debug.Log("<color=yellow> Sentence Data Finished Loading !!! </color>");
                break;
            }
            string sentence  = ((string)sentence_data[i]["sentence"]).Trim();
            string answer    = ((string)sentence_data[i]["answer"]).Trim();
            string w1        = ((string)sentence_data[i]["w1"]).Trim();
            string w2        = ((string)sentence_data[i]["w2"]).Trim();
            string w3        = ((string)sentence_data[i]["w3"]).Trim();
            string explain   = ((string)sentence_data[i]["explain"]).Trim();
            string ans       = ((string)sentence_data[i]["ans"]).Trim();
            string vocabs    = ((string)sentence_data[i]["vocabs"]).Trim();
            string translate = ((string)sentence_data[i]["translate"]).Trim();

            if (sentence.Equals("[END]"))
            {
                break;
            }
            if (answer.Equals("") || w1.Equals("") || w2.Equals("") || w3.Equals(""))       // skip if no answer or wrong.
            {
                Debug.Log("<color=red>" + " no answer : index : " + i + " : " + sentence_data[i]["sentence"] + "</color>");
                continue;
            }
            var list = new List <string>();
            {
                list.Add(sentence);
                list.Add(answer);
                list.Add(w1);
                list.Add(w2);
                list.Add(w3);
                list.Add(explain);
                list.Add(ans);          // 6
                list.Add(vocabs);       // 7
                list.Add(translate);    // 8
            }
            sentenceList.Add(i, new KeyValuePair <int, List <string> >((id), list));
            //Debug.Log("<color=yellow> added >> " + (i).ToString() + "</color>\n\n"
            //          + "<color=yellow> question :  " + sentence + "</color>\n\n"
            //          + "<color=yellow> answer : " + answer + "</color>\n"
            //          + "<color=yellow> w1 : " + w1 + "</color>\n"
            //          + "<color=yellow> w2 : " + w2 + "</color>\n"
            //          + "<color=yellow> w3 : " + w3 + "</color>");
        }
    }
Beispiel #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);
    }
Beispiel #4
0
    public void SetOXResultPanel()
    {
        int corretCnt = 0;

        foreach (var item in OX_DataLoader.records)
        {
            string vocab     = item.Key;
            bool   isCoreect = item.Value;
            var    word      = OX_DataLoader.GetVocab(vocab);
            var    r         = Instantiate(PrefabManager.Instance.oxresultItem);
            r.GetComponent <ResultItem>().SetVocabDesc(vocab, "", isCoreect);

            SetPreVocab(vocab, r.transform);
            if (isCoreect)
            {
                corretCnt++;
            }
            r.GetComponent <ResultItem>().SetEmptyStar();
            if (UserDataManager.Instance.IsVocabExist(vocab))
            {
                r.GetComponent <ResultItem>().SetStar();
            }
        }

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

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

        UserDataManager.Instance.SetUserOXDayResult(dayid, finalscore);
        UserDataManager.Instance.SetOXNextDayUnlock(dayid);
        string filename = FileReadWrite.Instance.GetOXFileName();

        FileReadWrite.Instance.WriteUserData(filename);
    }
Beispiel #5
0
 void StartIncreaseCountAnimation(int n)
 {
     count.currentPercent = ((float)n / (float)GameModeManager.GetQuestionSize()) * 100f;
     count.UpdateUIdotween(callback, n);
 }