コード例 #1
0
        public JumperGame(MetroPanel gamePanel, int numberOfRows = 6) : base(new JumperEngine(4), gamePanel)
        {
            List <Control> jumperControls = Finder.GetAllElementsInPanel(gamePanel);

            engine = mainEngine as JumperEngine;

            userControls = Finder.FindElementsWithTag(jumperControls, "UserControls");
            foreach (Control c in userControls)
            {
                c.MouseClick += addToAnswer;
                c.Enabled     = false;
            }

            this.numberOfRows = numberOfRows;

            answer = new int[] { 0, 0, 0, 0 };

            setMainDisp(jumperControls);
            setCorrectCombinationDisplay(jumperControls);

            nextRowButton             = Finder.FindElementWithTag(jumperControls, "NextRowButton");
            nextRowButton.MouseClick += startGame;
            nextRowButton.Enabled     = true;



            engine.Subscribe(mainDisp);
            GUIElements.Add(mainDisp);
        }
コード例 #2
0
        public JumperGame(JumperEngine engine, Grid gameGrid, int numberOfRows = 6) : base(gameGrid, "jumper")
        {
            this.engine = engine;

            userControls = Finder.FindElementsWithTag(allControls, "UserControls");

            setUserControlsEnabled(false);
            foreach (Control c in userControls)
            {
                (c as Button).Click += addToAnswer;
            }

            this.numberOfRows = numberOfRows;

            answer = new int[] { 0, 0, 0, 0 };

            setMainDisp(allControls);
            setCorrectCombinationDisplay(allControls);

            nextRowButton           = (Button)Finder.FindElementWithTag(allControls, "NextRowButton");
            nextRowButton.Click    += startGame;
            nextRowButton.IsEnabled = true;

            engine.Subscribe(mainDisp);
            GUIElements.Add(mainDisp);
        }
コード例 #3
0
        public MyNumberControler(IAnimatableGUI gui, MyNumberEngine engine, Grid grid, int numberOfFields = 9) : base(grid, "mynumber")
        {
            if (gui is MyNumberComposite)
            {
                this.gui = gui as MyNumberComposite;
            }
            else
            {
                throw new ArgumentException("Wrong GUI type");
            }

            this.engine = engine;

            engine.Subscribe(gui);
            engine.Broadcast(engine.GetAllNumbers());

            expression = string.Empty;

            expressionDisplay = new Display(Finder.FindElementWithTag(allControls, "ExpressionDisplay"));

            GUIElements.Add(expressionDisplay);
            graphicalElements.Add(gui);
            anims.Add(gui);

            gui.Enable(false);

            this.numberOfFields = numberOfFields;
        }
コード例 #4
0
        public LoLGameControler(LoLGUI mainDisplay, LoLEngine engine, Grid gameGrid) : base(gameGrid, "letteronletter")
        {
            this.engine      = engine;
            this.mainDisplay = mainDisplay;

            engine.Subscribe(mainDisplay);
            engine.Broadcast(engine.GetLetters());

            answer = string.Empty;

            wordDisplay  = new Display(Finder.FindElementWithTag(allControls, "CurrentWord"));
            checkDisplay = Finder.FindElementWithTag(allControls, "CheckFeedback") as TextBox;

            graphicalElements.Add(mainDisplay);
            GUIElements.Add(wordDisplay);
            anims.Add(mainDisplay);
        }
コード例 #5
0
        public LoLGame(MetroPanel gamePanel) : base(new LoLEngine(12), gamePanel)
        {
            List <Control> WoWControls = Finder.GetAllElementsInPanel(gamePanel);

            letterDisp = Finder.FindElementsWithTag(WoWControls, "CharacterDisplayButton");
            foreach (Control b in letterDisp)
            {
                b.MouseClick += addToAnswer;
                b.Enabled     = false;
            }
            usedLetters = new List <Control>();

            currentWordDisplay = new Display(Finder.FindElementWithTag(WoWControls, "CurrentWord"));
            longestWordDisplay = new Display(Finder.FindElementWithTag(WoWControls, "LongestWord"));

            mainDisp = new LoLDisplay(letterDisp.ToArray(), letterDisp.Count);

            engine = mainEngine as LoLEngine;

            engine.Subscribe(mainDisp);

            GUIElements.Add(mainDisp); GUIElements.Add(currentWordDisplay); GUIElements.Add(longestWordDisplay);

            anims.Add(mainDisp);

            checkBox = Finder.FindElementWithTag(WoWControls, "CheckFeedback");

            check              = Finder.FindElementWithTag(WoWControls, "CheckerButton");
            check.MouseClick  += wordFeedback;
            submit             = Finder.FindElementWithTag(WoWControls, "SSButton");
            submit.MouseClick += ssClick;
            undo             = Finder.FindElementWithTag(WoWControls, "UndoButton");
            undo.MouseClick += undoLastLetter;

            answer = "";

            engine.Broadcast(engine.GetLetters());
        }