コード例 #1
0
        public void TransferBtnClicked()
        {
            if (!dropDown.activeSelf)
            {
                dropDownElem.value = dropDownMain.value;
                dropDownElem.RefreshShownValue();
                dropDown.SetActive(true);
            }
            else
            {
                string        toGroup       = dropDownElem.options [dropDownElem.value].text;
                List <string> selectedWords = new List <string> ();

                foreach (Transform wordTrans in listContainer.transform)
                {
                    RespondTouchEvents wr = wordTrans.gameObject.GetComponent <RespondTouchEvents> ();
                    if (wr.isSelected)
                    {
                        FetchSamples fs   = wordTrans.gameObject.GetComponent <FetchSamples> ();
                        string       word = fs.inText.text;
                        selectedWords.Add(word);
                    }
                }

                container.TransferWords(toGroup, selectedWords);
                dropDown.SetActive(false);
            }
        }
コード例 #2
0
        private void SetBoolStates()
        {
            isContainerEmpty = (container.childCount == 0);
            isNoGroup        = (mainDropDown.options.Count == 0);
            isOneGroup       = (mainDropDown.options.Count == 1);

            isSomeWordSelected  = false;
            isNoNewWord         = true;
            isKnownWordSelected = false;
            foreach (Transform t in container)
            {
                FetchSamples       sample = t.gameObject.GetComponent <FetchSamples> ();
                RespondTouchEvents tch    = t.gameObject.GetComponent <RespondTouchEvents> ();

                if (sample.outTextCnt.text == "0")
                {
                    isNoNewWord = false;
                }
                else if (tch.isSelected)
                {
                    isKnownWordSelected = true;
                }

                if (tch.isSelected)
                {
                    isSomeWordSelected = true;
                }
            }
        }
コード例 #3
0
        public void OutputGroup(string groupName)
        {
            // drop previous words if present
            // add words from groupName in the form of wordPanel
            foreach (Transform childTrans in container.transform)
            {
                Destroy(childTrans.gameObject);
            }

            /*if (groupName == "All Groups") {
             *
             *      List<string> wordsAllGroups = new List<string> ();
             *      foreach (List<string> group in groups.Values)
             *              wordsAllGroups.Union(group);
             *
             *      foreach (string selem in wordsAllGroups) { //wordsOfOneGroup) {
             *              GameObject go = (GameObject)Instantiate (prefabElement);
             *              go.GetComponent<FetchSamples> ().inText.text = selem;
             *              go.GetComponent<FetchSamples> ().outTextCnt.text = "0";
             *              go.transform.SetParent (container.transform);
             *      }
             *
             * } else {*/

            if (!groups.ContainsKey(groupName))
            {
                Debug.Log("No group with name " + groupName);
            }
            else
            {
                foreach (string selem in groups[groupName])                           //wordsOfOneGroup) {
                {
                    GameObject   go = (GameObject)Instantiate(prefabElement);
                    FetchSamples fs = go.GetComponent <FetchSamples> ();
                    fs.groupsContainer = this;
                    fs.inText.text     = selem;
                    if (sentences.ContainsKey(selem))
                    {
                        fs.sentences       = sentences [selem];
                        fs.outTextCnt.text = (fs.sentences.Count / 2).ToString();
                    }
                    else
                    {
                        fs.outTextCnt.text = "0";
                    }

                    RespondTouchEvents rte = go.GetComponent <RespondTouchEvents> ();
                    rte.container      = container;
                    rte.navigate       = navigate;
                    rte.enabledButtons = enableButtons;

                    go.transform.SetParent(container.transform);
                }
            }
            enableButtons.CheckEnabledButtons();
            // }
        }
コード例 #4
0
        public void SetSamples(FetchSamples samples)
        {
            currentSentences = samples;
            indexSentence    = 0;
            countSentences   = samples.sentences.Count;

            if (countSentences > 1)
            {
                upSentenceWin.text   = samples.sentences [0];
                downSentenceWin.text = samples.sentences [1];
            }
        }
コード例 #5
0
 public void FetchWordsInLists()
 {
     foreach (Transform wordTrans in listContainer.transform)
     {
         //RespondTouchEvents w = wordTrans.gameObject.GetComponent<RespondTouchEvents> ();
         //if (w.isSelected) {
         FetchSamples wr = wordTrans.gameObject.GetComponent <FetchSamples> ();
         string       wd = wr.inText.text;
         string       cd = wr.outTextCnt.text;
         if (cd == "0")
         {
             wr.LoadFromHtmlPage();
             //	Animation anim = wordTrans.gameObject.GetComponent<Animation> ();
             //	anim.Play ("LoadFromHtml");
         }
         //}
     }
 }
コード例 #6
0
        public void VisualizeModal()
        {
            if (container.groups [container.activeGroup].Count == 0)
            {
                question.text      = "Are you sure want to delete group";
                questionParam.text = container.activeGroup;
                isGroupDelete      = true;

                panelModal.SetActive(true);
            }
            else
            {
                wordDeleting.Clear();
                string wordsDelFlat = "";


                foreach (Transform wordTrans in listContainer.transform)
                {
                    RespondTouchEvents w = wordTrans.gameObject.GetComponent <RespondTouchEvents> ();
                    if (w.isSelected)
                    {
                        FetchSamples wr = wordTrans.gameObject.GetComponent <FetchSamples> ();

                        string wd = wr.inText.text;
                        wordDeleting.Add(wd);
                        wordsDelFlat += "  " + wd;
                    }
                }

                if (wordDeleting.Count > 0)
                {
                    question.text      = "Are you sure want to delete words";
                    questionParam.text = wordsDelFlat;
                    isWordsDelete      = true;

                    panelModal.SetActive(true);
                }
            }
        }