Esempio n. 1
0
        public static string GetDescription(this FigureType figureType)
        {
            FieldInfo fi = figureType.GetType().GetField(figureType.ToString());

            DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
            return(attributes.Length > 0 ? attributes[0].Description : figureType.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// Return the line with all info about figure
        /// </summary>
        public virtual string DrawFigure(FigureType _type, float _area, float _unique, FigureColor _color)
        {
            var line = "Figure: " + _type.ToString() + ", area: " + System.Math.Round(_area, 2) + " sq. units, " + figureUnique[(int)_type] + ": "
                       + System.Math.Round(_unique, 2) + " units, color: " + _color.ToString();

            return(line);
        }
Esempio n. 3
0
 // установить данные для отображения
 public void SetData(FigureType figureType, FigureData data)
 {
     textType.text = figureType.ToString();
     if (data != null)
     {
         textWeight.text = data.GetWeight.ToString();
         textTitle.text  = data.GetTitle;
         textId.text     = data.GetId.ToString();
     }
     // прячем объект с данными если фигуры нет
     dataGo.SetActive(data != null);
     // отображаем информацию если фигуры в рюкзаке нет
     noFigure.SetActive(data == null);
 }
Esempio n. 4
0
        protected override void Initialize()
        {
            ArrayListIndicesRandom figures_random;
            int pos = 0;

            switch (CurrentDifficulty)
            {
            case GameDifficulty.Easy:
            case GameDifficulty.Medium:
                figures_active = 6;
                rows           = 2;
                columns        = 3;
                break;

            case GameDifficulty.Master:
                figures_active = 9;
                columns        = rows = 3;
                break;

            default:
                throw new InvalidOperationException();
            }

            rect_w         = 0.65 / columns;
            rect_h         = 0.65 / rows;
            figures        = new int [figures_active];
            figures_random = new ArrayListIndicesRandom(FigureType.Total);
            figures_random.Initialize();

            for (int n = 0; n < figures_active; n++)
            {
                figures[n] = figures_random [pos++];

                if (pos >= figures_random.Count)
                {
                    pos = 0;
                    figures_random.Initialize();
                }
            }

            question_pos   = random.Next(figures_active);
            Answer.Correct = FigureType.ToString(figures[question_pos]);
            base.Initialize();
        }
Esempio n. 5
0
        /// <summary>
        /// Представление в виде строки
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            string result = "Sample decoding : " + actualClass.ToString() + "(" + ((int)actualClass).ToString() +
                            "); " + Environment.NewLine + "Input : ";

            for (int i = 0; i < input.Length; ++i)
            {
                result += input[i].ToString() + "; ";
            }
            result += Environment.NewLine + "Output : ";
            if (output == null)
            {
                result += "null;";
            }
            else
            {
                for (int i = 0; i < output.Length; ++i)
                {
                    result += output[i].ToString() + "; ";
                }
            }
            result += Environment.NewLine + "Error : ";

            if (error == null)
            {
                result += "null;";
            }
            else
            {
                for (int i = 0; i < error.Length; ++i)
                {
                    result += error[i].ToString() + "; ";
                }
            }
            result += Environment.NewLine + "Recognized : " + recognizedClass.ToString() + "(" +
                      ((int)recognizedClass).ToString() + "); " + Environment.NewLine;


            return(result);
        }
Esempio n. 6
0
        public override void DrawPossibleAnswers(CairoContextEx gr, int area_width, int area_height, bool rtl)
        {
            double x = DrawAreaX, y = DrawAreaY + 0.1;
            int    pos = 0;

            gr.Color = new Color(DefaultDrawingColor.R, DefaultDrawingColor.G, DefaultDrawingColor.B, 1);

            if (Answer.Draw == true)
            {
                DrawAllFigures(gr, start_x_ans, start_y, area_width, area_height);
                return;
            }

            gr.SetPangoNormalFontSize();
            for (int i = 0; i < figures.Length; i++)
            {
                if (i == question_pos)
                {
                    continue;
                }

                gr.MoveTo(x, y);
                gr.ShowPangoText(FigureType.ToString(figures[i]));

                if ((pos + 1) % 3 == 0)
                {
                    y += 0.2;
                    x  = DrawAreaX;
                }
                else
                {
                    x += 0.30;
                }
                pos++;
            }
        }