// Use this for initialization
    void Start()
    {
        //reserve = new List<GameObject>();

        wa = GameObject.FindGameObjectWithTag("GameController").GetComponent <WordArray>();
        wa.BuildArray();

        wordsLayout = GameObject.FindGameObjectWithTag("words_layout");
        Instantiate(prefab, wordsLayout.transform);

        scoreCanvas    = GameObject.FindGameObjectWithTag("scoreCanvas");
        humanScoreText = GameObject.FindGameObjectWithTag("humanScoreText").GetComponent <Text>();
        robotScoreText = GameObject.FindGameObjectWithTag("robotScoreText").GetComponent <Text>();
        scoreMsg       = GameObject.FindGameObjectWithTag("scoreMsg").GetComponent <Text>();

        categories  = GameObject.FindGameObjectsWithTag("category_picker");
        startButton = GameObject.FindGameObjectWithTag("start_button");

        start_canvas = GameObject.FindGameObjectWithTag("start_canvas");

        quiz_canvas = GameObject.FindGameObjectWithTag("quiz_canvas");

        textScore = GameObject.FindGameObjectWithTag("score_Board");

        wordsQuiz      = GameObject.FindGameObjectsWithTag("word_quiz");
        categoriesQuiz = GameObject.FindGameObjectsWithTag("category_quiz");

        startButton.SetActive(false);
        start_canvas.SetActive(true);
        quiz_canvas.SetActive(false);
        scoreCanvas.SetActive(false);
    }
示例#2
0
    void OnTriggerStay2D(Collider2D c)
    {
        if (!dragging && c.tag == "category_quiz")
        {
            string    cat  = c.gameObject.GetComponentInChildren <Text> ().text;
            WordArray wa   = GameObject.FindGameObjectWithTag("GameController").GetComponent <WordArray>();
            string    word = this.gameObject.GetComponentInChildren <Text> ().text;
            string    corr = wa.GetCategoryOfWord(word);
            //Debug.Log ("CATEGORY IS " + corr);
            CategoryReaction cr = c.gameObject.GetComponent <CategoryReaction>();
            if (cr != null)
            {
                if (corr == cat)
                {
                    cr.CorrectActivation();
                    Destroy(this.gameObject);
                }
                else
                {
                    cr.WrongActivation();
                    pnael_exp = GameObject.FindGameObjectWithTag("explanation");
                    Color cc = explanation.GetComponent <Image>().color;
                    explanation.GetComponent <Image>().color = new Color(cc.r, cc.g, cc.b, 0.5f);
                    cc = explanation.GetComponentInChildren <Text>().color;
                    explanation.GetComponentInChildren <Text>().color = new Color(cc.r, cc.g, cc.b, 0.75f);
                    pnael_exp.GetComponentInChildren <Text> ().text   = wa.GetDescriptionOfWord(word);


                    StartCoroutine(Wait());
                    this.gameObject.transform.position = new Vector3(1000, 1000, 0);
                }
            }
        }
    }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(comboBox1.Text))
            {
                textBox1.Clear();
                textBox1.AppendText(string.Format("Версия библиотеки: {0}\r\n", Core.Version));
                if (radioButton1.Checked)
                {
                    Ru lang = new Ru();
                    textBox1.AppendText(string.Format("[Ru] Версия правил: {0}\r\n", Ru.LanguageBuild));
                    textBox1.AppendText("\r\n");

                    string[]  m  = lang.Q(comboBox1.Text);
                    WordArray wa = lang.GetWordsArray();
                    textBox1.AppendText(string.Format("Фамилия:  {0}\r\n", lang.GetSurNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText(string.Format("Имя:      {0}\r\n", lang.GetNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText(string.Format("Отчество: {0}\r\n", lang.GetPatrNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText("\r\n");

                    textBox1.AppendText(string.Format("Пол: {0}\r\n", lang.GenderAutoDetect().GetDescription()));
                    textBox1.AppendText("\r\n");

                    textBox1.AppendText("Падежи:\r\n");
                    textBox1.AppendText(string.Format(" Именительный   (кто? что?): {0}\r\n", m[0]));
                    textBox1.AppendText(string.Format(" Родительный  (кого? чего?): {0}\r\n", m[1]));
                    textBox1.AppendText(string.Format(" Дательный    (кому? чему?): {0}\r\n", m[2]));
                    textBox1.AppendText(string.Format(" Винительный   (кого? что?): {0}\r\n", m[3]));
                    textBox1.AppendText(string.Format(" Творительный   (кем? чем?): {0}\r\n", m[4]));
                    textBox1.AppendText(string.Format(" Предложный (о ком? о чём?): {0}\r\n", m[5]));
                }
                else
                {
                    Ua lang = new Ua();
                    textBox1.AppendText(string.Format("[Ua] Версiя правил: {0}\r\n", Ua.LanguageBuild));
                    textBox1.AppendText("\r\n");

                    string[]  m  = lang.Q(comboBox1.Text);
                    WordArray wa = lang.GetWordsArray();
                    textBox1.AppendText(string.Format("Прізвище: {0}\r\n", lang.GetSurNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText(string.Format("Iм'я:     {0}\r\n", lang.GetNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText(string.Format("Батькові: {0}\r\n", lang.GetPatrNameCase(Padeg.IMENITLN)));
                    textBox1.AppendText("\r\n");

                    Gender gender = lang.GenderAutoDetect();
                    textBox1.AppendText(string.Format("Стать: {0}\r\n", (gender == Gender.Man) ? "Чоловіча" : "Жіноча"));
                    textBox1.AppendText("\r\n");

                    textBox1.AppendText("Відмінки:\r\n");
                    textBox1.AppendText(string.Format(" Називний : {0}\r\n", m[0]));
                    textBox1.AppendText(string.Format(" Родовий  : {0}\r\n", m[1]));
                    textBox1.AppendText(string.Format(" Давальний: {0}\r\n", m[2]));
                    textBox1.AppendText(string.Format(" Знахідний: {0}\r\n", m[3]));
                    textBox1.AppendText(string.Format(" Орудний  : {0}\r\n", m[4]));
                    textBox1.AppendText(string.Format(" Місцевий : {0}\r\n", m[5]));
                    textBox1.AppendText(string.Format(" Кличний  : {0}\r\n", m[6]));
                }
            }
        }
示例#4
0
        private void placeWord(string word, int x, int y, bool vertical)   //places a new active word on the board
        {
            var wordPlaced = false;

            if (vertical)
            {
                if (word.Length + x < rows)
                {
                    for (int i = 0; i < word.Length; i++)
                    {
                        crozzle_board[x + i][y].targetChar = word[i];
                    }
                    wordPlaced = true;
                }
            }
            else
            {
                if (word.Length + y < cols)
                {
                    for (int i = 0; i < word.Length; i++)
                    {
                        crozzle_board[x][y + i].targetChar = word[i];
                    }
                    wordPlaced = true;
                }
            }

            if (wordPlaced)
            {
                //var currentIndex = activeWordList.Count;
                WordArray tempActiveWordList = new WordArray();
                tempActiveWordList.word     = word;
                tempActiveWordList.x        = x;
                tempActiveWordList.y        = y;
                tempActiveWordList.vertical = vertical;

                if (tempActiveWordList.vertical)
                {
                    downCount++;
                    tempActiveWordList.number = downCount;
                }
                else
                {
                    acrossCount++;
                    tempActiveWordList.number = acrossCount;
                }
                activeWordList.Add(tempActiveWordList);
            }
        }
示例#5
0
        public NewCrozzle(int c, int r, string[] words)
        {
            this.cols           = c;
            this.rows           = r;
            this.activeWordList = new List <WordArray>();
            this.coordList      = new List <CoordinateList>();
            this.word_list      = new WordArray[words.Length];

            int n = 0;

            foreach (string s in words)
            {
                word_list[n]          = new WordArray();
                word_list[n].x        = -1;
                word_list[n].y        = -1;
                word_list[n].number   = -1;
                word_list[n].vertical = false;
                word_list[n].word     = s;
                n++;
            }

            this.crozzle_board = new GridArray[rows][];
            for (int i = 0; i < rows; i++)
            {
                crozzle_board[i] = new GridArray[cols];

                for (int j = 0; j < cols; j++)
                {
                    crozzle_board[i][j] = new GridArray();
                }
            }

            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < cols; j++)
                {
                    crozzle_board[i][j].targetChar   = EMPTYCHAR; //target character, hidden
                    crozzle_board[i][j].indexDisplay = ' ';       //used to display index number of word start
                    crozzle_board[i][j].value        = '-';       //actual current letter shown on board
                }
            }
        }