Esempio n. 1
0
        public void GetField(Type obj)
        {
            var fieldList = obj.GetProperties();

            for (int i = 0; i < fieldList.Length; i++)
            {
                var property = fieldList[i];
                AllFields.Add(property.Name);
                Fields += property.Name;
                if (i < fieldList.Length - 1)
                {
                    Fields += ",";
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Feltölti a Field-ek listáját a megadott nehézségen koordinátákkal együtt.
        /// </summary>
        /// <param name="difficulty"></param>

        /*public void createBoard_old(Difficulty difficulty, IBoardShapes boardAnimal)
         * {
         *  if (boardAnimal != null)
         *  {
         *      int[][] boardMap = boardAnimal.getField(difficulty);
         *      Y = boardMap.GetLength(0);
         *      X = boardMap[0].GetLength(0);
         *      for (int y = 0; y < boardMap.GetLength(0); y++)
         *      {
         *          for (int x = 0; x < boardMap[y].GetLength(0); x++)
         *          {
         *              if (boardMap[y][x] == 1)
         *              {
         *                  addRandomFieldToAllFields(difficulty, y, x);
         *              }
         *          }
         *      }
         *  }
         * }*/

        /// <summary>
        /// Feltölti a Field-ek listáját a megadott nehézségen koordinátákkal együtt.
        /// </summary>
        /// <param name="difficulty"></param>
        public void CreateBoard(Difficulty difficulty, IBoardShapes boardAnimal)
        {
            int[][] boardMap     = boardAnimal.GetField(difficulty);
            int     imageCounter = 0;

            Y = boardMap.GetLength(0);
            X = boardMap[0].GetLength(0);
            for (int y = 0; y < boardMap.GetLength(0); y++)
            {
                for (int x = 0; x < boardMap[y].GetLength(0); x++)
                {
                    if (boardMap[y][x] == 1)
                    {
                        //addRandomFieldToAllFields(difficulty, y, x);
                        Field field = new Field(imageList[imageCounter], imageCounter, y, x, true, null);
                        AllFields.Add(field);
                        imageCounter++;
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Hozzáad az összes mezõhöz egy random transzformált képpel rendelkezõ mezõt. A mezõ sor és oszlopadata a paraméterben meghatározott
        /// </summary>
        /// <param name="column"></param>
        /// <param name="row"></param>
        private void AddRandomFieldToAllFields(Difficulty difficulty, int column, int row)
        {
            int           randomImage = random.Next(imageList.Count);
            Transformator trf;

            switch (random.Next(5))
            {
            case (0): trf = new Rotate(difficulty, random.Next()); break;

            case (1): trf = new Mirror(difficulty, random.Next()); break;

#if WINDOWS
            case (2): trf = new Blur(difficulty, random.Next()); break;
#endif
            case (3): trf = new ColorTransformation(difficulty, random.Next()); break;

            default: trf = new Transformator(difficulty, random.Next()); break;
            }
            Field field = new Field(imageList[randomImage], randomImage, column, row, true, trf);
            AllFields.Add(field);
        }
Esempio n. 4
0
    //Processing
    public static void CreateZone(Vector3 _sp, Vector3 _ep, byte ZoneType, byte StorageType = 0)
    {
        Vector3 _StartPoint, _EndPoint;

        Functions.OrderVectors(_sp, _ep, out _StartPoint, out _EndPoint);
        switch (ZoneType)
        {
        case 0:
            Log.Notice(scr, "ZoneTypeIsMissing");
            break;

        case 1:
            AllStorages.Add(new Storage(_StartPoint, _EndPoint));
            break;

        case 2:
            AllFields.Add(new Field(_StartPoint, _EndPoint));
            break;

        case 3:
            AllPastures.Add(new Pasture(_StartPoint, _EndPoint));
            break;

        case 4:
            AllMines.Add(new Mine(_StartPoint, _EndPoint));
            AllMines[AllMines.Count - 1].HighlightAll();
            break;

        case 5:
            AllGatherings.Add(new Gathering(_StartPoint, _EndPoint));
            AllGatherings[AllGatherings.Count - 1].HighlightAll();
            break;

        default:
            Log.Notice(scr, "Zone type " + ZoneType + " undefined");
            break;
        }
    }
        private void CountIntertwined()
        {
            int count = 0;

            if (!IsCalculated)
            {
                Tuple <int, int> tuple;
                foreach (var kvp in SituationIndex.Index)
                {
                    foreach (var dict in kvp.Value)
                    {
                        tuple = new Tuple <int, int>(dict.Value.First(), dict.Value.Last());
                        intervals.Add(tuple);
                    }
                }
            }
            foreach (var tup in intervals)
            {
                foreach (var tup2 in intervals)
                {
                    if (!mem.Contains(new Tuple <Tuple <int, int>, Tuple <int, int> >(tup, tup2)))
                    {
                        if (!(tup.Item1 == tup2.Item1 && tup.Item2 == tup2.Item2))
                        {
                            if (tup.Item1 <= tup2.Item2 && tup2.Item1 <= tup.Item2)
                            {
                                count++;
                            }
                            mem.Add(new Tuple <Tuple <int, int>, Tuple <int, int> >(tup, tup2));
                        }
                    }
                }
            }

            IntertwinedCount = count;
            AllFields.Add("Intertwined situations", count);
        }
Esempio n. 6
0
 public void AddToAllFields(Field field)
 {
     AllFields.Add(field);
 }