Example #1
0
        public Game(
            IGameLogger logger,
            IGameRegion gameRegion)
        {
            this.logger           = logger;
            this.categorySelector = gameRegion.CategorySelector;
            this.board            = gameRegion.Board;
            var questionFactory = gameRegion.QuestionFactory;

            allQuestions = questionFactory.GenerateQuestionsForCategories();
        }
Example #2
0
        public Game(
            IGameLogger logger,
            ICategorySelector categorySelector,
            IQuestionFactory questionFactory)
        {
            this.logger           = logger;
            this.categorySelector = categorySelector;

            popQuestions     = questionFactory.GenerateQuestionsForCategory(QuestionCategory.Pop);
            scienceQuestions = questionFactory.GenerateQuestionsForCategory(QuestionCategory.Science);
            sportsQuestions  = questionFactory.GenerateQuestionsForCategory(QuestionCategory.Sports);
            rockQuestions    = questionFactory.GenerateQuestionsForCategory(QuestionCategory.Rock);
        }
Example #3
0
        public Category(XmlNode node)
        {
            Selector     = CategorySelector.CreateSelectors(node);
            Field        = node.ReadStr("@dstfield");
            FieldIsEvent = Field.Contains('/');

            XmlNodeList subNodes = node.SelectNodes(node.Name);

            if (subNodes.Count > 0)
            {
                SubCats = new Category[subNodes.Count];
                for (int i = 0; i < subNodes.Count; i++)
                {
                    SubCats[i] = Create(subNodes[i]);
                }
            }
        }
Example #4
0
 public GameRegion(IQuestionFactory questionFactory, ICategorySelector defaultCategorySelector, IBoard board)
 {
     QuestionFactory  = questionFactory;
     CategorySelector = defaultCategorySelector;
     Board            = board;
 }
        public CategoryDisplayFormW3M1(CategoryContext ctx, Point?anchor)
        {
            this.ctx    = ctx;
            this.anchor = anchor;

            InitializeComponent();

            if (ctx.MaxCategoryNameLength > 0)
            {
                txtNewCategory.MaxLength = ctx.MaxCategoryNameLength;
            }

            /* TODO: Whoops, missed UI Freeze... do this later
             * txtFilter.AccessibleName = Res.Get(StringId.CategoryCategoryFilter);
             * cbParent.AccessibleName = Res.Get(StringId.CategoryNewCategoryParent);
             */
            txtNewCategory.AccessibleName = Res.Get(StringId.CategoryCategoryName);
            btnRefresh.AccessibleName     = Res.Get(StringId.CategoryRefreshList);

            grpAdd.Enter += delegate { AcceptButton = btnDoAdd; };
            grpAdd.Leave += delegate { AcceptButton = null; };

            grpAdd.Text   = Res.Get(StringId.CategoryAdd);
            btnDoAdd.Text = Res.Get(StringId.AddButton2);
            toolTip.SetToolTip(btnRefresh, Res.Get(StringId.CategoryRefreshList));
            ControlHelper.SetCueBanner(txtNewCategory, Res.Get(StringId.CategoryCategoryName));
            lblNone.Text = Res.Get(StringId.CategoryControlNoCategories2);

            RefreshParentCombo();

            btnRefresh.Image      = ResourceHelper.LoadAssemblyResourceBitmap("OpenPost.Images.RefreshPostListEnabled.png");
            btnRefresh.ImageAlign = ContentAlignment.MiddleCenter;
            pictureBox1.Image     = ResourceHelper.LoadAssemblyResourceBitmap("PostPropertyEditing.CategoryControl.Images.Search.png");
            pictureBox1.SizeMode  = PictureBoxSizeMode.StretchImage;
            DismissOnDeactivate   = true;

            Control selectorControl;

            if (ctx.SelectionMode == CategoryContext.SelectionModes.SingleSelect)
            {
                selectorControl = new RadioCategorySelector(ctx);
            }
            else if (ctx.SelectionMode == CategoryContext.SelectionModes.MultiSelect)
            {
                selectorControl = new TreeCategorySelector(ctx);
            }
            else
            {
                throw new ArgumentException("Unexpected selection mode: " + ctx.SelectionMode);
            }

            lblNone.BringToFront();
            lblNone.Visible = ctx.Categories.Length == 0;

            selector = (ICategorySelector)selectorControl;
            AdaptAddCategories();
            ctx.Changed         += ctx_Changed;
            Disposed            += delegate { ctx.Changed -= ctx_Changed; };
            selectorControl.Dock = DockStyle.Fill;
            selectorContainer.Controls.Add(selectorControl);

            txtFilter.AccessibleName = Res.Get(StringId.FindCategory);
            cbParent.AccessibleName  = ControlHelper.ToAccessibleName(Res.Get(StringId.CategoryParentAccessible));
        }
        public CategoryDisplayFormW3M1(CategoryContext ctx, Point? anchor)
        {
            this.ctx = ctx;
            this.anchor = anchor;

            InitializeComponent();

            if (ctx.MaxCategoryNameLength > 0)
                txtNewCategory.MaxLength = ctx.MaxCategoryNameLength;

            /* TODO: Whoops, missed UI Freeze... do this later
            txtFilter.AccessibleName = Res.Get(StringId.CategoryCategoryFilter);
            cbParent.AccessibleName = Res.Get(StringId.CategoryNewCategoryParent);
             */
            txtNewCategory.AccessibleName = Res.Get(StringId.CategoryCategoryName);
            btnRefresh.AccessibleName = Res.Get(StringId.CategoryRefreshList);

            grpAdd.Enter += delegate { AcceptButton = btnDoAdd; };
            grpAdd.Leave += delegate { AcceptButton = null; };

            grpAdd.Text = Res.Get(StringId.CategoryAdd);
            btnDoAdd.Text = Res.Get(StringId.AddButton2);
            toolTip.SetToolTip(btnRefresh, Res.Get(StringId.CategoryRefreshList));
            ControlHelper.SetCueBanner(txtNewCategory, Res.Get(StringId.CategoryCategoryName));
            lblNone.Text = Res.Get(StringId.CategoryControlNoCategories2);

            RefreshParentCombo();

            btnRefresh.Image = ResourceHelper.LoadAssemblyResourceBitmap("OpenPost.Images.RefreshPostListEnabled.png");
            btnRefresh.ImageAlign = ContentAlignment.MiddleCenter;
            pictureBox1.Image = ResourceHelper.LoadAssemblyResourceBitmap("PostPropertyEditing.CategoryControl.Images.Search.png");
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            DismissOnDeactivate = true;

            Control selectorControl;
            if (ctx.SelectionMode == CategoryContext.SelectionModes.SingleSelect)
                selectorControl = new RadioCategorySelector(ctx);
            else if (ctx.SelectionMode == CategoryContext.SelectionModes.MultiSelect)
                selectorControl = new TreeCategorySelector(ctx);
            else
                throw new ArgumentException("Unexpected selection mode: " + ctx.SelectionMode);

            lblNone.BringToFront();
            lblNone.Visible = ctx.Categories.Length == 0;

            selector = (ICategorySelector)selectorControl;
            AdaptAddCategories();
            ctx.Changed += ctx_Changed;
            Disposed += delegate { ctx.Changed -= ctx_Changed; };
            selectorControl.Dock = DockStyle.Fill;
            selectorContainer.Controls.Add(selectorControl);

            txtFilter.AccessibleName = Res.Get(StringId.FindCategory);
            cbParent.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.CategoryParentAccessible));
        }
Example #7
0
 public Player(ICategorySelector categorySelector)
 {
     CategorySelector = categorySelector;
     Nick             = Nicks[new Random().Next(0, Nicks.Count)] + new Random().Next(1920, 2020);
 }
Example #8
0
 public CatergoryNotSelectorWrapper(ICategorySelector other)
 {
     wrapped = other;
 }