Esempio n. 1
0
        public List <char> GetValues(SearchWord word)
        {
            List <char> valueList = new List <char>();

            foreach (SearchLetter letter in word.Word)
            {
                char v = letter.Value;
                valueList.Add(v);
            }
            return(valueList);
        }
Esempio n. 2
0
        public bool WordIsSelected(SearchWord word)
        {
            bool isSelected = true;

            for (int ii = 0; ii < word.Word.Count; ii++)
            {
                if (!word.Word[ii].IsSelected)
                {
                    isSelected = false;
                    ii         = word.Word.Count;
                }
            }
            return(isSelected);
        }
Esempio n. 3
0
        public void SetWordPosition(SearchWord word, Vector2 position, WordDirection dir, SearchLetter[,] currentLetterArray)
        {
            int cordX;
            int cordY;

            switch (dir)
            {
            case WordDirection.Box:
            {
                int positionX = 16;
                foreach (SearchLetter l in word.Word)
                {
                    l.Position = new Vector2(positionX, position.Y);
                    positionX += 38;
                }
                break;
            }

            case WordDirection.Up:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX, cordY - (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X, (int)position.Y - ii] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Right:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX + (ii * POS_NEXT), cordY), true);
                    currentLetterArray[(int)position.X + ii, (int)position.Y] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Down:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX, cordY + (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X, (int)position.Y + ii] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Left:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX - (ii * POS_NEXT), cordY), true);
                    currentLetterArray[(int)position.X - ii, (int)position.Y] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Up_Right:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX + (ii * POS_NEXT), cordY - (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X + ii, (int)position.Y - ii] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Down_Right:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX + (ii * POS_NEXT), cordY + (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X + ii, (int)position.Y + ii] = word.Word[ii];
                }
                break;
            }

            case WordDirection.Down_Left:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX - (ii * POS_NEXT), cordY + (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X - ii, (int)position.Y + ii] = word.Word[ii];        //
                }
                break;
            }

            case WordDirection.Up_Left:
            {
                cordX = BASE_POS_X + (int)position.X * POS_NEXT;
                cordY = BASE_POS_Y + (int)position.Y * POS_NEXT;
                for (int ii = 0; ii < word.Word.Count; ii++)
                {
                    word.Word[ii].SetLetterPosition(new Vector2(cordX - (ii * POS_NEXT), cordY - (ii * POS_NEXT)), true);
                    currentLetterArray[(int)position.X - ii, (int)position.Y - ii] = word.Word[ii];
                }
                break;
            }
            }
        }