Exemple #1
0
        void DrawingAnswerObjects()
        {
            Container container = new Container(DrawAreaX + 0.2, DrawAreaY + 0.4, 0.5, answers.Length * 0.10);

            AddWidget(container);

            for (int i = 0; i < answers.Length; i++)
            {
                DrawableArea drawable_area = new DrawableArea(0.4, 0.1);
                drawable_area.X = DrawAreaX + 0.23;
                drawable_area.Y = DrawAreaY + 0.4 + i * 0.1;
                container.AddChild(drawable_area);
                drawable_area.Data   = i;
                drawable_area.DataEx = Answer.GetMultiOption(i);

                drawable_area.DrawEventHandler += delegate(object sender, DrawEventArgs e)
                {
                    int d = (int)e.Data;
                    e.Context.SetPangoLargeFontSize();
                    e.Context.MoveTo(0.07, 0.02);
                    e.Context.ShowPangoText(String.Format(Translations.GetString("{0}) {1}"), Answer.GetMultiOption(d),
                                                          converter.ToString(answers[d])));
                };
            }
        }
Exemple #2
0
        protected override void Initialize()
        {
            converter = new FigureTypeConverter(Translations);

            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;
            question_pos = random.Next(figures_active);

            RandomizeFigures();
            RandomizePossibleAnswers();

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
            Answer.SetMultiOptionAnswer(answer_idx, converter.ToString(figures[question_pos]));
            Answer.CorrectShow = converter.ToString(figures[question_pos]);
            base.Initialize();

            DrawingAnswerObjects();
        }
        protected override void Initialize()
        {
            converter = new FigureTypeConverter (Translations);

            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;
            question_pos = random.Next (figures_active);

            RandomizeFigures ();
            RandomizePossibleAnswers ();

            Answer.CheckAttributes |= GameAnswerCheckAttributes.MultiOption;
            Answer.SetMultiOptionAnswer (answer_idx, converter.ToString (figures[question_pos]));
            Answer.CorrectShow = converter.ToString (figures[question_pos]);
            base.Initialize ();

            DrawingAnswerObjects ();
        }