예제 #1
0
        protected override void Initialize()
        {
            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
            random_indices_questions = new ArrayListIndicesRandom (4);
            random_indices_questions.Initialize ();

            random_indices_answers = new ArrayListIndicesRandom (3);
            random_indices_answers.Initialize ();

            for (int i = 0; i < random_indices_answers.Count; i++) {
                if (random_indices_answers [i] == 0) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    break;
                }
            }

            HorizontalContainer container = new HorizontalContainer (0.1, 0.5, 0.8, 0.4);
            DrawableArea drawable_area;
            AddWidget (container);

            for (int i = 0; i < 3; i++)
            {
                drawable_area = new DrawableArea (0.8 / 3, 0.4);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                    DrawAnswerFigures (e.Context, 0.05, 0.2, random_indices_answers [n]);
                    e.Context.MoveTo (0.05, 0.33);
                    e.Context.ShowPangoText (Answer.GetFigureName (n));
                };
            }
        }
예제 #2
0
        protected override void Initialize()
        {
            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
            palette = new ColorPalette ();

            switch (random.Next (2)) {
            case 0:
                quest1 = g1question_A;
                quest2 = g1question_B;
                answer = g1answer;
                ranswer = g1rightanswer;
                break;
            case 1:
                quest1 = g2question_A;
                quest2 = g2question_B;
                answer = g2answer;
                ranswer = g2rightanswer;
                break;
            }

            random_indices = new ArrayListIndicesRandom (answers);
            random_indices.Initialize ();

            for (int i = 0; i < answers; i++)
            {
                if (random_indices[i] == ranswer) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    break;
                }
            }

            double x = DrawAreaX, y = DrawAreaY;

            // Question
            DrawableArea drawable_area;
            HorizontalContainer container = new HorizontalContainer (x, y, 0.8, 0.3);
            AddWidget (container);

            drawable_area = new DrawableArea (container.Width / 2, 0.25);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                DrawSquare (e.Context, 0.15, 0);
            };

            drawable_area = new DrawableArea (container.Width / 2, 0.25);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                DrawLShape (e.Context, 0.15, 0);
            };

            // Answers
            y += 0.28;
            container = new HorizontalContainer (x, y, 0.8, 0.3);
            AddWidget (container);

            for (int i = 0; i < 2; i++)
            {
                drawable_area = new DrawableArea (container.Width / 2, 0.25);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;
                    DrawPossibleAnswer (e.Context, 0.12, 0.03, answer, random_indices [n], n);

                    e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetFigureName (n));
                    e.Context.Stroke ();
                };
            }

            container = new HorizontalContainer (x, y + 0.3, 0.8, 0.3);
            AddWidget (container);

            for (int i = 2; i < 4; i++)
            {
                drawable_area = new DrawableArea (container.Width / 2, 0.25);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;
                    DrawPossibleAnswer (e.Context, 0.12, 0.03, answer, random_indices [n], n);

                    e.Context.DrawTextCentered (drawable_area.Width / 2, 0.22, Answer.GetFigureName (n));
                    e.Context.Stroke ();
                };
            }
        }
예제 #3
0
        protected override void Initialize()
        {
            sum_offset = random.Next (3);
            random_indices = new ArrayListIndicesRandom (slices.Length / items_per_slice);
            random_indices.Initialize ();
            ans_pos = random.Next (possible_answers);

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
            Answer.SetMultiOptionAnswer (ans_pos, Answer.GetFigureName (ans_pos));

            bad_answers = new int [possible_answers * items_per_slice];
            for (int i = 0; i < bad_answers.Length; i++) {
                bad_answers[i] = 1 + random.Next (9);
            }

            HorizontalContainer container = new HorizontalContainer (DrawAreaX, 0.62, 0.8, 0.3);
            DrawableArea drawable_area;
            AddWidget (container);

            for (int i = 0; i < possible_answers; i++)
            {
                drawable_area = new DrawableArea (0.8 / 3, 0.3);
                drawable_area.SelectedArea = new Rectangle (0, 0, radius, 0.2);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                    DrawSlice (e.Context, 0, 0);
                    if (n == ans_pos) {
                        int pos = random_indices [0];
                        DrawSliceText (e.Context, 0, 0, 0, (sum_offset +
                        slices [pos * items_per_slice]).ToString (),
                        (sum_offset + slices [1 + (pos * items_per_slice)]).ToString (),
                        (sum_offset + slices [2 + (pos * items_per_slice)]).ToString ());
                    } else {
                        DrawSliceText (e.Context, 0, 0, 0,
                            bad_answers [n * items_per_slice].ToString (),
                            bad_answers [1 + (n * items_per_slice)].ToString (),
                            bad_answers [2 + (n * items_per_slice)].ToString ());
                    }

                    e.Context.MoveTo (0.0, 0.25);
                    e.Context.DrawTextCentered (radius / 2, 0.25, Answer.GetFigureName (n));
                    e.Context.Stroke ();
                };
            }
        }
예제 #4
0
        protected override void Initialize()
        {
            question_indices = new ArrayListIndicesRandom (question_columns);
            question_indices.Initialize ();

            answer_indices = new ArrayListIndicesRandom (possible_answers);
            answer_indices.Initialize ();

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
            BuildPossibleAnswers ();

            const double total_width = 0.8, total_height = 0.42;
            HorizontalContainer container = new HorizontalContainer (DrawAreaX, 0.52, total_width, total_height);
            AddWidget (container);

            // Possible answers columns
            for (int ans = 0; ans < possible_answers; ans++)
            {
                DrawableArea drawable_area = new DrawableArea (total_width / possible_answers, total_height);
                drawable_area.Data = ans;
                drawable_area.DataEx = Answer.GetMultiOption (ans);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    double width = total_width / possible_answers;
                    double x = (width - figure_size) / 2, y = 0;
                    int column = (int) e.Data;

                    for (int figure = 0; figure < figures_column; figure++)
                    {
                        DrawFigure (e.Context, x, y, figure_answers [(column * figures_column) + figure]);
                        y+= figure_size + space_height;
                    }

                    e.Context.DrawTextCentered (width / 2, total_height - 0.02, Answer.GetFigureName (column));
                    e.Context.Stroke ();
                };
            }
            Answer.SetMultiOptionAnswer (answer_indices[good_answer], Answer.GetFigureName (answer_indices[good_answer]));
        }
예제 #5
0
        protected override void Initialize()
        {
            int position;

            // In all these cases the clock logic clearly do not work since the small hand is in the next hour
            switch (random.Next (3)) {
            case 0:
                position = 48;
                addition = 5;
                break;
            case 1:
                position = 38;
                addition = 15;
                break;
            case 2:
            default:
                position = 24;
                addition = 5;
                break;
            }

            handles = new int [clocks * handle_num];

            for (int i = 0; i < handles.Length; i++, i++)
            {
                handles [i] = position / 10;
                handles [i + 1] = position - ((position / 10) * 10);
                position += addition;
            }

            Answer.Correct = handles[7].ToString ();

            // First row
            HorizontalContainer container = new HorizontalContainer (DrawAreaX, 0.05, 0.8, 0.45);
            DrawableArea drawable_area;
            AddWidget (container);

            drawable_area = new DrawableArea (0.8 / 2, 0.4);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawClock (0.05, 0, figure_size, handles[0], handles[1]);
                e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (0));
                e.Context.Stroke ();
            };

            drawable_area = new DrawableArea (0.8 / 2, 0.4);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawClock (0.05, 0, figure_size, handles[2], handles[3]);
                e.Context.MoveTo (0.03, 0.29);
                e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (1));
                e.Context.Stroke ();
            };

            // Second row
            container = new HorizontalContainer (DrawAreaX, 0.05 + 0.45, 0.8, 0.45);
            AddWidget (container);

            drawable_area = new DrawableArea (0.8 / 2, 0.4);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawClock (0.05, 0, figure_size, handles[4], handles[5]);
                e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (2));
                e.Context.Stroke ();
            };

            drawable_area = new DrawableArea (0.8 / 2, 0.4);
            drawable_area.Sensitive = false;
            container.AddChild (drawable_area);

            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawClock (0.05, 0, figure_size, handles[6], Answer.Draw == true ? handles[7] : 0);
                e.Context.MoveTo (0.03, 0.29);
                e.Context.DrawTextCentered (drawable_area.Width / 2, 0.36, Answer.GetFigureName (3));
                e.Context.Stroke ();
            };

            /*DateTime dt1 = new DateTime (2008, 2, 20, handles[0], handles[1] * 5, 0);
            DateTime dt2 = new DateTime (2008, 2, 20, handles[2], handles[3] * 5, 0);
            Console.WriteLine ("t1 {0}", dt1);
            Console.WriteLine ("t2 {0}", dt2);
            Console.WriteLine ("Time diff {0} from 1st to 2nd", dt2-dt1);

            dt1 = new DateTime (2008, 2, 20, handles[2], handles[3] * 5, 0);
            dt2 = new DateTime (2008, 2, 20, handles[4], handles[5] * 5, 0);
            Console.WriteLine ("t1 {0}", dt1);
            Console.WriteLine ("t2 {0}", dt2);
            Console.WriteLine ("Time diff {0} from 1st to 2nd", dt2-dt1);

            dt1 = new DateTime (2008, 2, 20, handles[4], handles[5] * 5, 0);
            dt2 = new DateTime (2008, 2, 20, handles[6], handles[7] * 5, 0);
            Console.WriteLine ("t1 {0}", dt1);
            Console.WriteLine ("t2 {0}", dt2);
            Console.WriteLine ("Time diff {0} from 1st to 2nd", dt2-dt1);*/
        }
예제 #6
0
        protected override void Initialize()
        {
            ArrayListIndicesRandom random_indices = new ArrayListIndicesRandom (total_slices);
            Color clr;

            cp = new ColorPalette ();

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;

            cercle_colors = new Color [total_slices];
            badcercle_colors =  new Color [total_slices];
            for (int i = 0; i < total_slices; i++) {
                cercle_colors [i] = cp.Cairo (i);
                badcercle_colors [i] = cp.Cairo (i);
            }

            // Correct answer
            random_indices.Initialize ();
            clr = badcercle_colors [random_indices[0]];
            badcercle_colors [random_indices[0]] =  badcercle_colors [random_indices[1]];
            badcercle_colors [random_indices[1]] = clr;

            // Create random color order for the session
            start_indices = new int [circles];
            for (int i = 0; i < circles; i++)
                start_indices[i] = (random_indices[i]);

            ans_pos = random.Next (circles);
            Answer.SetMultiOptionAnswer (ans_pos, Answer.GetFigureName (ans_pos));

            const double text_offset = 0.04;
            const double witdh_used = 0.9; // Total width used for drawing all the figures
            const double margin = 0.1 / circles / 2;
            const double box_size = witdh_used / circles;
            double y;
            HorizontalContainer container;
            DrawableArea drawable_area;
            Color [] colors;

            y = DrawAreaY + 0.1 + (radius / 2);

            container = new HorizontalContainer (0.05, y, witdh_used, box_size);
            AddWidget (container);

            circle_parameters = new CircleParameters [circles];
            for (int i = 0; i < circles; i++)
            {
                if (ans_pos == i)
                    colors = badcercle_colors;
                else
                    colors = cercle_colors;

                circle_parameters [i] = new CircleParameters (colors);
                drawable_area = new DrawableArea (box_size, box_size);
                drawable_area.SelectedArea = new Rectangle ((box_size - box_size) / 2, 0, box_size, box_size);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int idx = (int) e.Data;
                    CircleParameters circle = circle_parameters [idx];
                    double x1, y1;

                    x1 = y1 = radius + margin;

                    DrawCircle (e.Context, x1, y1, circle.Colors, start_indices [idx]);
                    e.Context.DrawTextCentered (e.Width / 2, box_size + text_offset,
                        Answer.GetFigureName (idx));
                    e.Context.Stroke ();
                };
                container.AddChild (drawable_area);
            }
        }
예제 #7
0
        protected override void Initialize()
        {
            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;
            possible_answers = new ArrayListIndicesRandom (3);
            possible_answers.Initialize ();

            puzzle_index = random.Next (puzzles.Length);
            puzzle = puzzles [puzzle_index];

            DrawableArea drawable_area;
            HorizontalContainer container = new HorizontalContainer (0.05, 0.5, 0.9, figure_size + 0.1);
            AddWidget (container);

            for (int i = 0; i < possible_answers.Count; i++) {

                drawable_area = new DrawableArea (figure_size + space_figures, figure_size + 0.1);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                drawable_area.SelectedArea = new Rectangle (space_figures / 2, space_figures / 2, figure_size, figure_size);

                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    DrawPossibleAnswer (e.Context, space_figures / 2, space_figures / 2, possible_answers [(int)e.Data]);
                    e.Context.DrawTextCentered (space_figures / 2 + figure_size / 2, space_figures + figure_size + 0.02,
                        Answer.GetFigureName ((int)e.Data));
                };
            }

            for (int i = 0; i < possible_answers.Count; i++) {
                if (possible_answers[i] == 0) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    break;
                }
            }
        }
예제 #8
0
        protected override void Initialize()
        {
            indications = new Indication [CurrentDifficulty == GameDifficulty.Easy ? 5 : 7];
            Indication.TurnDirection second_turn = (Indication.TurnDirection) 2 +  random.Next (2);

            indications[0] = new Indication (Translations, Indication.Type.Start, 0);
            indications[1] = new Indication (Translations, Indication.Type.Turn, random.Next (2)); // right or left
            indications[2] = new Indication (Translations, Indication.Type.Turn, second_turn); // up or down
            indications[3] = new Indication (Translations, Indication.Type.Turn, random.Next (2)); // right or left

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;

            if (CurrentDifficulty==GameDifficulty.Easy) {
                indications[4] = new Indication (Translations, Indication.Type.End, 1);
            } else {
                if (second_turn == Indication.TurnDirection.Up)
                    indications[4] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Up);
                else
                    indications[4] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Down);

                indications[5] = new Indication (Translations, Indication.Type.Turn, random.Next (2)); // right or left
                indications[6] = new Indication (Translations, Indication.Type.End, 1);
            }

            indications_wrongA = CopyAnswer ();
            indications_wrongB = CopyAnswer ();
            indications_wrongC = CopyAnswer ();

            if ((Indication.TurnDirection) indications[3].obj == Indication.TurnDirection.Right) {
                indications_wrongA[3] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Left);
            }
            else {
                indications_wrongA[3] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Right);
            }

            if (CurrentDifficulty == GameDifficulty.Easy) {
                if ((Indication.TurnDirection) indications[2].obj == Indication.TurnDirection.Up) {
                    indications_wrongB[2] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Down);
                }
                else {
                    indications_wrongB[2] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Up);
                }
            } else {
                if ((Indication.TurnDirection) indications[5].obj == Indication.TurnDirection.Right) {
                    indications_wrongB[5] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Left);
                }
                else {
                    indications_wrongB[5] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Right);
                }
            }

            if ((Indication.TurnDirection) indications[1].obj == Indication.TurnDirection.Right) {
                indications_wrongC[1] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Left);
            }
            else {
                indications_wrongC[1] = new Indication (Translations, Indication.Type.Turn, Indication.TurnDirection.Right);
            }

            base.Initialize ();

            answers = new ArrayListIndicesRandom (4);
            answers.Initialize ();

            for (int i = 0; i < answers.Count; i++) {
                if (answers [i] == 0) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    ans = i;
                    break;
                }
            }

            // Draw row 1
            HorizontalContainer container = new HorizontalContainer (0.05, 0.1, 0.9, 0.4);
            AddWidget (container);

            for (int i = 0; i  < 2; i++)
            {
                DrawableArea drawable_area = new DrawableArea (0.45, 0.4);
                container.AddChild (drawable_area);
                drawable_area.SelectedArea = new Rectangle (0, 0, 0.45, 0.3);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                    DrawPossibleAnswers (e.Context, 0.2, 0.1, WhichAnswer (answers[n]));
                    e.Context.MoveTo (0.2, 0.12 + 0.2);
                    e.Context.ShowPangoText (Answer.GetFigureName (n));
                };
            }

            // Draw row 2
            container = new HorizontalContainer (0.05, 0.5, 0.9, 0.4);
            AddWidget (container);

            for (int i = 2; i  < 4; i++)
            {
                DrawableArea drawable_area = new DrawableArea (0.45, 0.4);
                container.AddChild (drawable_area);
                drawable_area.SelectedArea = new Rectangle (0, 0, 0.45, 0.3);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                    DrawPossibleAnswers (e.Context, 0.2, 0.1, WhichAnswer (answers[n]));
                    e.Context.MoveTo (0.2, 0.12 + 0.2);
                    e.Context.ShowPangoText (Answer.GetFigureName (n));
                };
            }
        }
예제 #9
0
        private void SetDrawAnswer()
        {
            double h = 0.25, sel_marginw = 0.05, sel_marginh = 0.025;
            double x = DrawAreaX + 0.1, y = DrawAreaY + 0.62;
            int fig_count = (int) Figures.Last;

            HorizontalContainer container = new HorizontalContainer (x, y, fig_count * (figure_size + space_x), h);
            DrawableArea drawable_area;

            AddWidget (container);

            for (int i = 0; i < fig_count; i++)
            {
                drawable_area = new DrawableArea (figure_size  + space_x, h);
                drawable_area.SelectedArea = new Rectangle (-sel_marginw, -sel_marginh, figure_size  + sel_marginw * 2, h);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int fig = (int) e.Data;

                    switch ((Figures) random_indices[fig]) {
                    case Figures.TwoLines:
                        DrawTwoLines (e.Context, 0, 0, figure_size);
                        break;
                    case Figures.Cross:
                        DrawCross (e.Context, 0, 0, figure_size);
                        break;
                    case Figures.RotatedCross:
                        DrawRotatedCross (e.Context, 0, 0, figure_size);
                        break;
                    }

                    e.Context.MoveTo (0, 0.17);
                    e.Context.ShowPangoText (Answer.GetFigureName (fig));
                };
            }
        }
예제 #10
0
        protected override void Initialize()
        {
            // Question
            ArrayList array_good = new ArrayList ();
            array_good.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.SmallCircle,
                Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;

            // Four random samples with equal elements
            questions = new ArrayList ();
            for (int i = 0; i < 4; i++) {
                questions.Add (BuildFigure (array_good, questions));
            }

            ArrayList array = new ArrayList ();
            answers = new ArrayList ();
            random_indices_answers = new ArrayListIndicesRandom (4);
            random_indices_answers.Initialize ();

            for (int i = 0; i < random_indices_answers.Count; i++) {
                if ((int) random_indices_answers [i] == 0) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    break;
                }
            }

            if (CurrentDifficulty ==  GameDifficulty.Easy) {
                // Answer 1 (good)
                array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.SmallCircle,
                Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 2
                array.Clear ();
                array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.MediumCircle,
                Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 3
                array.Clear ();
                array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.MediumCircle,
                Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 4
                array.Clear ();
                array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.MediumCircle,
                Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));
            }
            else  // Medium or Master
            {

                // Answer 1 (good)
                array.AddRange (new Element [] {Element.SmallCircle, Element.SmallCircle, Element.MediumCircleWithChild,
                    Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 2
                array.Clear ();
                array.AddRange (new Element [] {Element.SmallCircle, Element.MediumCircle, Element.MediumCircle,
                    Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 3
                array.Clear ();
                array.AddRange (new Element [] {Element.SmallCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild,
                    Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));

                // Answer 4
                array.Clear ();
                array.AddRange (new Element [] {Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild,
                    Element.MediumCircle,Element.MediumCircle, Element.MediumCircleWithChild, Element.MediumCircleWithChild});
                answers.Add (BuildFigure (array, answers));
            }

            double figure_size = 0.22;
            double x = DrawAreaX - 0.05, y = DrawAreaY + 0.45;

            HorizontalContainer container = new HorizontalContainer (x, y, random_indices_answers.Count * figure_size, 0.3);
            DrawableArea drawable_area;

            AddWidget (container);

            for (int i = 0; i < random_indices_answers.Count; i++)
            {
                drawable_area = new DrawableArea (figure_size, figure_size + 0.05);
                drawable_area.SelectedArea = new Rectangle (0.05, 0.05, 0.15, 0.15);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                    DrawFigure (e.Context, 0.05, 0.05, (FigureElement []) answers[random_indices_answers[n]]);
                    e.Context.MoveTo (0.05, 0.22);
                    e.Context.ShowPangoText (Answer.GetFigureName (n));
                };

                container.AddChild (drawable_area);
            }
        }
예제 #11
0
        public WelcomeView()
        {
            Container container;
            DrawableArea drawable_area;
            double y = 0.22;

            containers = new List <Toolkit.Container> ();

            /* Logic */
            container = new HorizontalContainer (0.05, y, 0.95, space);
            containers.Add (container);

            drawable_area = new DrawableArea (0.17, image_size);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawImageFromAssembly ("logic-games.svg", 0, 0, image_size, image_size);
            };

            drawable_area = new DrawableArea (0.75, space);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawStringWithWrapping (0, 0,
                    ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Logic puzzles. Challenge your reasoning and thinking skills."),
                    e.Width);
            };

            /* Math */
            y += space;
            container = new HorizontalContainer (0.05, y, 0.95, space);
            containers.Add (container);

            drawable_area = new DrawableArea (0.17, image_size);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawImageFromAssembly ("math-games.svg", 0, 0, image_size, image_size);
            };

            drawable_area = new DrawableArea (0.75, space);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawStringWithWrapping (0, 0,
                    ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Mental calculation. Arithmetical operations that test your mental calculation abilities."),
                    e.Width);
            };

            /* Memory */
            y += space;
            container = new HorizontalContainer (0.05, y, 0.95, space);
            containers.Add (container);

            drawable_area = new DrawableArea (0.17, image_size);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawImageFromAssembly ("memory-games.svg", 0, 0, image_size, image_size);
            };

            drawable_area = new DrawableArea (0.75, space);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawStringWithWrapping (0, 0,
                    ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Memory trainers. To prove your short term memory."),
                    e.Width);
            };

            /* Verbal */
            y += space;
            container = new HorizontalContainer (0.05, y, 0.95, space);
            containers.Add (container);

            drawable_area = new DrawableArea (0.17, image_size);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawImageFromAssembly ("verbal-games.svg", 0, 0, image_size, image_size);
            };

            drawable_area = new DrawableArea (0.75, space);
            container.AddChild (drawable_area);
            drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
            {
                e.Context.DrawStringWithWrapping (0, 0,
                    ServiceLocator.Instance.GetService <ITranslations> ().GetString ("Verbal analogies. Challenge your verbal aptitude."),
                    e.Width);
            };
        }
예제 #12
0
        protected override void Initialize()
        {
            random_indices = new ArrayListIndicesRandom ((int) Figures.Last);
            random_indices.Initialize ();
            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption | GameAnswerCheckAttributes.IgnoreSpaces;

            for (int i = 0; i < (int) Figures.Last; i++)
            {
                if (random_indices[i] == (int) Figures.Third) {
                    Answer.SetMultiOptionAnswer (i, Answer.GetFigureName (i));
                    break;
                }
            }

            HorizontalContainer container = new HorizontalContainer (DrawAreaX, DrawAreaY + figure_size + 0.16, 0.8, 0.3);

            DrawableArea drawable_area;
            AddWidget (container);

            for (int i = 0; i < (int) Figures.Last; i++)
            {
                drawable_area = new DrawableArea (space_figures, 0.2);
                drawable_area.SelectedArea = new Rectangle (0, 0, figure_size, figure_size);
                drawable_area.Data = i;
                drawable_area.DataEx = Answer.GetMultiOption (i);
                container.AddChild (drawable_area);

                drawable_area.DrawEventHandler += delegate (object sender, DrawEventArgs e)
                {
                    int n = (int) e.Data;

                 	switch ((Figures) random_indices[n]) {
                    case Figures.First:
                        DrawDiamon (e.Context, 0, 0, CerclePosition.Right | CerclePosition.Left);
                        break;
                    case Figures.Second:
                        DrawDiamon (e.Context, 0, 0, CerclePosition.Top | CerclePosition.Right);
                        break;
                    case Figures.Third:
                        DrawDiamon (e.Context, 0, 0, CerclePosition.Bottom | CerclePosition.Top);
                        break;
                    default:
                        throw new InvalidOperationException ();
                    }

                    e.Context.MoveTo (0.02, 0.25);
                    e.Context.ShowPangoText (Answer.GetFigureName (n));
                    e.Context.Stroke ();
                };
            }
        }