Esempio n. 1
0
    public void CreateVocabDesc(string v, Transform p, GameObject defPrefab, GameObject examplePrefab,
                                GameObject symPrefab, GameObject aymPrefab)
    {
        string def = string.Empty;
        string e1  = string.Empty;
        string t1  = string.Empty;
        string e2  = string.Empty;
        string t2  = string.Empty;
        string sym = string.Empty;
        string aym = string.Empty;

        string gametype = GameModeManager.GetGameType();

        if (gametype.Equals("OXGame") || gametype.Equals("MyList") || gametype.Equals("StudyVocab"))
        {
            def = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.answer];
            e1  = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.e1];
            t1  = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.t1];
            //e2 = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.e2];
            //t2 = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.t2];
            sym = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.sym];
            aym = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.aym];
        }
        else if (gametype.Equals("SentenceGame") || gametype.Equals("MySentenceList"))
        {
            def = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.answer];
            e1  = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.e1];
            t1  = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.t1];
            //e2 = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.e2];
            //t2 = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.t2];
            sym = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.sym];
            aym = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.aym];
        }


        GameObject d = null;
        GameObject e = null;
        GameObject s = null;
        GameObject a = null;

        if (def.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "정     의";
                title.transform.SetParent(p, false);
            }

            d = Instantiate(DGBoxforSentencedef);
            var panel   = d.GetComponent <DGBoxForSentenceDefController>().panel;
            var deflist = UIStaticManager.FormatDescDef(def);
            foreach (var s1 in deflist)
            {
                if (s1.Equals(""))
                {
                    continue;
                }

                var item = Instantiate(sentenceCardDescItem);
                {
                    item.GetComponent <SentenceCardDescController>().SetPsType(s1.Key);
                    item.GetComponent <SentenceCardDescController>().SetDesc(s1.Value);
                    item.GetComponent <SentenceCardDescController>().SetAlpah(1f);
                }
                item.transform.SetParent(panel.transform, false);
            }
            var defsize = defPrefab.GetComponent <DGBoxForSentenceDefController>().panel.GetComponent <RectTransform>()
                          .rect;
            d.GetComponent <RectTransform>().sizeDelta = new Vector2(defsize.width, defsize.height);
            d.GetComponent <CanvasGroup>().alpha       = 1f;
            d.transform.SetParent(p, false);
        }

        if (e1.Equals("") == false ||
            t1.Equals("") == false ||
            e2.Equals("") == false ||
            t2.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "예     문";
                title.transform.SetParent(p, false);
            }

            e = Instantiate(dynGameBGTextBox);

            string exampleSentence = "\n" + e1 + "\n" + "<color=#9d9d9d>" + t1 + "</color>" + "\n\n" + e2 + "\n" + "<color=#9d9d9d>" + t2 + "</color>" + "\n";
            //a.transform.GetComponent<DynamicBGTextBoxController>().SetTitleText("정답");
            e.transform.GetComponent <DynamicBGTextBoxController>().SetText(exampleSentence);

            var exampleSize = examplePrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            e.GetComponent <RectTransform>().sizeDelta = new Vector2(exampleSize.width, exampleSize.height);
            e.GetComponent <CanvasGroup>().alpha       = 1f;
            e.transform.SetParent(p, false);
        }

        if (sym.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "유  의  어";
                title.transform.SetParent(p, false);
            }

            s = Instantiate(dynGameBGTextBox);

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

            var symsize = symPrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            s.GetComponent <RectTransform>().sizeDelta = new Vector2(symsize.width, symsize.height);
            s.GetComponent <CanvasGroup>().alpha       = 1f;
            s.transform.SetParent(p, false);
        }

        if (aym.Equals("") == false)
        {
            var title = Instantiate(titleForResult);
            {
                title.transform.GetChild(0).GetComponent <Text>().text = "반  의  어";
                title.transform.SetParent(p, false);
            }

            a = Instantiate(dynGameBGTextBox);

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

            var aymsize = aymPrefab.GetComponent <DynamicBGTextBoxController>().rTransform.rect;
            a.GetComponent <RectTransform>().sizeDelta = new Vector2(aymsize.width, aymsize.height);
            a.GetComponent <CanvasGroup>().alpha       = 1f;
            a.transform.SetParent(p, false);
        }
        rpanel.GetComponent <ResultPanel>().TurnOffDGBox();
    }
Esempio n. 2
0
    public List <GameObject> CreatePreVocabDesc(string v, Transform p)
    {
        string def      = string.Empty;
        string e1       = string.Empty;
        string t1       = string.Empty;
        string e2       = string.Empty;
        string t2       = string.Empty;
        string sym      = string.Empty;
        string aym      = string.Empty;
        string gametype = GameModeManager.GetGameType();

        if (gametype.Equals("OXGame") || gametype.Equals("MyList") || gametype.Equals("StudyVocab"))
        {
            def = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.answer];
            e1  = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.e1];
            t1  = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.t1];
            //e2 = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.e2];
            //t2 = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.t2];
            sym = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.sym];
            aym = OX_DataLoader.GetOXDataByVocab(v).Value[(int)OX_DataLoader.Index.aym];
        }
        else if (gametype.Equals("SentenceGame") || gametype.Equals("MySentenceList"))
        {
            def = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.answer];
            e1  = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.e1];
            t1  = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.t1];
            //e2 = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.e2];
            //t2 = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.t2];
            sym = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.sym];
            aym = Sentence_DataLoader.GetVocabDatabyVocab(v).Value[(int)OX_DataLoader.Index.aym];
        }

        GameObject d = null;
        GameObject e = null;
        GameObject s = null;
        GameObject a = null;

        if (def.Equals("") == false)
        {
            d = Instantiate(DGBoxforSentencedef);
            var panel   = d.GetComponent <DGBoxForSentenceDefController>().panel;
            var deflist = UIStaticManager.FormatDescDef(def);
            foreach (var s1 in deflist)
            {
                if (s1.Equals(""))
                {
                    continue;
                }

                var item = Instantiate(sentenceCardDescItem);
                {
                    item.GetComponent <SentenceCardDescController>().SetPsType(s1.Key);
                    item.GetComponent <SentenceCardDescController>().SetDesc(s1.Value);
                    item.GetComponent <SentenceCardDescController>().SetAlpah(0f);
                }
                item.transform.SetParent(panel.transform, false);
            }
        }

        if (e1.Equals("") == false ||
            t1.Equals("") == false ||
            e2.Equals("") == false ||
            t2.Equals("") == false)
        {
            e = Instantiate(dynGameBGTextBox);
            string exampleSentence = "\n" + e1 + "\n" + t1 + "\n" + e2 + "\n" + t2 + "\n";
            e.transform.GetComponent <DynamicBGTextBoxController>().SetText(exampleSentence);
        }

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

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

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

        if (e)
        {
            e.transform.SetParent(p, false);
            e.GetComponent <CanvasGroup>().alpha = 0f;
        }
        if (s)
        {
            s.transform.SetParent(p, false);
            s.GetComponent <CanvasGroup>().alpha = 0f;
        }
        if (a)
        {
            a.transform.SetParent(p, false);
            a.GetComponent <CanvasGroup>().alpha = 0f;
        }
        return(new List <GameObject>()
        {
            d, e, s, a
        });
    }