Exemplo n.º 1
0
 public GuiControler(GameControler gameControler,GameForm gameForm)
 {
     this.gameControler = gameControler;
     this.gameForm = gameForm;
     this.gameControler.PlayerIsCreated += SetUpTopControlPanel;
     SetUpMainInfoControl();
 }
Exemplo n.º 2
0
 public GameBoardControler(GameForm gameForm, GameControler gameControler)
 {
     this.gameForm = gameForm;
     this.gameControler = gameControler;
     this.gameControler.GameBoardIsCreated += CreatingTileControls;
     this.gameControler.GameBoardIsCreated += CreatingBuildingSpotControls;
 }
Exemplo n.º 3
0
 public Controller(Model.Model Model, GameForm GameForm, BlockingCollection<ApplicationEvent> ViewEvents)
 {
     this.GameModel = Model;
     this.GameForm = GameForm;
     this.ViewEvents = ViewEvents;
     this.Strategies = new Dictionary<System.Type, Strategy>();
 }
Exemplo n.º 4
0
 public override void Link(GameForm f)
 {
     base.Link(f);
     Clicked_NewCampaign = () => f.Push(new CampaignSelectionScreen2(), TransitionStyle.FADE_BLACK);
     Clicked_LaunchGame  = () => { f.Engine.LaunchGame(); f.Push(new GameRunningScreen(), TransitionStyle.FADE_TWEEN); };
     Clicked_Config      = () => f.Push(new ConfigurationScreen(), TransitionStyle.FADE_BLACK);
     Clicked_Quit        = () => { f.ShowConfirmClose = false; f.Close(); };
 }
 public void OnClickNewGame(MainForm form)
 {
     //Set it up to return to main menu after closing
     var nextForm = new GameForm(new GameController());
     nextForm.FormClosed += delegate { form.Show(); };
     nextForm.Show();
     form.Hide();
 }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            Thread th = new Thread(new ThreadStart(delegate() {
                GameForm gameForm = new GameForm();
                Application.Run(gameForm);
            }));

            th.Start();
        }
        public static void UpdateCheckerPosition(CheckerPB ch, Point updatedPosition)
        {
            ch.checker.oldPositionOnBord = updatedPosition;
            ch.FixPosition(updatedPosition);

            GameForm form1Ref = (GameForm)Application.OpenForms["GameForm"];

            form1Ref.updateMainPanelScreenShoot(ch);
        }
Exemplo n.º 8
0
        public void StartTest()
        {
            var form = new GameForm();
            var game = new GameEngine(form);

            game.Init();
            Assert.IsTrue(form.Controls.Count == 1);
            Assert.IsTrue(form.Controls[0].Name == "HomeFrame");
        }
Exemplo n.º 9
0
        /// <summary>
        /// Start application<para/>
        /// Запуск приложения
        /// </summary>
        public static void Start()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            GameForm w = new GameForm(1280, 720, false);

            w.Run(60.0, 60.0);
        }
Exemplo n.º 10
0
        private static void ApplicationOnIdle(GameForm gameForm)
        {
            NativeMessage message;

            while (!PeekMessage(out message, _handleRef, 0, 0, 0))
            {
                gameForm.Render();
            }
        }
Exemplo n.º 11
0
 private void playButton_Click(object sender, EventArgs e)
 {
     using (var game = new GameForm(editController.Area))
     {
         Hide();
         game.ShowDialog();
         Show();
     }
 }
Exemplo n.º 12
0
        private void SetupGamer()
        {
            this.player = new Gamer();
            var             form     = new GameForm();
            IRenderer       renderer = new GuiRenderer(form);
            IInputHandlerer handler  = new GuiInputHandlerer();

            this.engine = new GameEngine(renderer, handler);
        }
Exemplo n.º 13
0
        //public ShadowMap shadowMap;


        /// <summary>
        ///     Constructor del juego.
        /// </summary>
        /// <param name="mediaDir">Ruta donde esta la carpeta con los assets</param>
        /// <param name="shadersDir">Ruta donde esta la carpeta con los shaders</param>
        public GameModel(string mediaDir, string shadersDir, float tiempoJuegoo, float dificultad, GameForm gameForm) : base(mediaDir, shadersDir)
        {
            this.gameForm   = gameForm;
            Category        = Game.Default.Category;
            Name            = Game.Default.Name;
            Description     = Game.Default.Description;
            tiempoJuego     = tiempoJuegoo;
            dificultadJuego = dificultad;
        }
Exemplo n.º 14
0
        private void Start_Click(object sender, EventArgs e)
        {
            //got to do some perliminary checks.
            if (radb_Easy.Checked || radb_Medium.Checked || radb_Hard.Checked)
            {
                //check if user actually selected a difficulty
                //get difficulty.
                if (tb_Tiles.Text.Equals("Tile Default: 10. Min: 5. Max 20"))
                {
                    //go to default
                    btn_Start.Text = "Starting " + getActive().Text + " 10 tile game";

                    //start game here
                    //check if ANY other gameforms have been activated. If it is close it.
                    if (Application.OpenForms.OfType <GameForm>().Count() >= 1)
                    {
                        Application.OpenForms.OfType <GameForm>().First().Close();
                    }
                    GameForm newGame = new GameForm(10, getActive().Text);
                    newGame.Show();
                    this.Hide();
                }
                else
                {
                    //anything but the hint. Time to see if its a real number.
                    if (int.TryParse(tb_Tiles.Text, out int amount))
                    {
                        if (amount < 5)
                        {
                            btn_Start.Text = "Please enter a number higher than 5";
                        }
                        else if (amount > 20)
                        {
                            btn_Start.Text = "Please enter a number lower than 20";
                        }
                        else
                        {
                            //go with custom number
                            generateGame(amount);
                        }
                    }
                    else if (tb_Tiles.Text.Equals("Tile size: Default. Enter for custom"))
                    {
                        generateGame(-1);
                    }
                    else
                    {
                        btn_Start.Text = "Please enter a number.";
                    }
                }
            }
            else
            {
                btn_Start.Text = "Please select difficulty.";
            }
        }
Exemplo n.º 15
0
        private void GameEnded()
        {
            pnlSpel.Controls.ClearAndDispose();
            var           players = _gameFlow.Players.OrderByDescending(p => p.TotalWormScore).ToList();
            StringBuilder sb      = new StringBuilder();

            sb.AppendLine("Eindstand: ");
            players.ForEach(p => sb.AppendLine($" - {p.Name} => {p.TotalWormScore}"));
            GameForm.ShowInfo("Einde spel", sb.ToString());
        }
Exemplo n.º 16
0
 public void Run()
 {
     r_SettingsForm = new SettingsForm();
     r_SettingsForm.ShowDialog();
     if (r_SettingsForm.ValidSettings == true)
     {
         r_GameForm = new GameForm(r_SettingsForm.BoardSize, r_SettingsForm.IsHumanPlayer2, r_SettingsForm.Player1Name, r_SettingsForm.Player2Name);
         r_GameForm.ShowDialog();
     }
 }
Exemplo n.º 17
0
        private void StartButtonClick(object sender, EventArgs e)
        {
            var gamepadID = (Guid) this.controllerDropDown.SelectedValue;

            this.Hide();

            this.gameForm = new GameForm(gamepadID);
            this.gameForm.FormClosed += (x, y) => this.EndGame();
            this.gameForm.Show();
        }
Exemplo n.º 18
0
        public void StartGame()
        {
            r_SettingsForm.ShowDialog();

            if (r_SettingsForm.IsValidSettings)
            {
                m_GameForm = new GameForm(r_SettingsForm.BoardSize, r_SettingsForm.Is2PlayerMode, r_SettingsForm.Player1Name, r_SettingsForm.Player2Name);
                m_GameForm.ShowDialog();
            }
        }
Exemplo n.º 19
0
 public override void Link(GameForm f)
 {
     base.Link(f);
     Clicked_Apply = () => { if (WriteConfig())
                             {
                                 f.Remove(this, TransitionStyle.FADE_BLACK);
                             }
     };
     Clicked_Back = () => f.Remove(this, TransitionStyle.FADE_BLACK);
 }
Exemplo n.º 20
0
        public void StopAnimation()
        {
            GameForm form1Ref = (GameForm)Application.OpenForms["GameForm"];

            form1Ref.animationHolder.stopAnimation();
            animationTimer.Enabled              = false;
            GameController.gameType             = Constants.GAME_TYPE_PLAY_ONLINE;
            GameController.opponents[0].Visible = false;
            GameController.opponents[1].Visible = false;
        }
Exemplo n.º 21
0
        public Engine(GameForm gameUI)
        {
            _gameUI   = gameUI;
            IsRunning = false;

            EntityManager = new EntityManager(this);

            _musicPlayer = new(Resources.title);
            _musicPlayer.PlayLooping();
        }
Exemplo n.º 22
0
 public void GameOver(string msg, string screen) /// game over changes screen
 {
     gameTimer.Enabled = false;
     if (!GameForm.vs)
     {
         // GameForm.score = carrier.hp + "";
     }
     GameForm.msg = msg;
     GameForm.ChangeScreen(this, screen);
 }
Exemplo n.º 23
0
        public void TestRandomNum()
        {
            //instantiate a new form and pass the form properties across
            GameForm myForm = new GameForm();
            //run the method on the form and then pass the number to a variable for testing
            int PoisonedCupNum = myForm.PoisonGenerator();

            //is the number greater than 0 and less than 7? - needs to be between 1 and 6 because there are 6 cups
            Assert.IsTrue((PoisonedCupNum > 0) && (PoisonedCupNum < 7));
        }
Exemplo n.º 24
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var f         = new PlayerForm();
            var gameForm  = new GameForm(f);
            var presenter = new PlayerPresenter(f, gameForm);

            Application.Run(f);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Updates the DOS-like view
        /// </summary>
        /// <param name="level">The currently played lavel</param>
        /// <param name="player">The current player instance</param>
        internal override void Update(Level level, Player player, List <Monster> mon)
        {
            GameForm gf = this.gameForm;
            // NOT FUNCTIONAL ANYMORE!
            //gf.Board.Clear();
            // 'redraw'
            StringBuilder sb = new StringBuilder();

            // show summary screen of level
            if (level.State == GameState.LevelFinished)
            {
                sb.AppendLine("Congratulations! You finished the level!");
                sb.AppendLine("Total Gold: " + player.Gold);
                sb.AppendLine("Total Health: " + player.Health);
                sb.AppendLine("Press [ENTER] to load the next level.");
            }
            else
            {
                // upper border
                var b = new char[level.Size + 2];
                for (int i = 0; i < b.Length; i++)
                {
                    b[i] = BORDER;
                }
                sb.AppendLine(new string(b));

                // board
                for (int i = 0; i < level.Size; i++)
                {
                    var line = new char[level.Size + 2];
                    line[0] = BORDER;
                    line[line.Length - 1] = BORDER;
                    for (int j = 0; j < level.Size; j++)
                    {
                        var fc = '#';
                        if (i == level.End.X && j == level.End.Y)
                        {
                            fc = END;
                        }
                        else
                        {
                            Field f = level.GetField(i, j);
                            fc = GetFieldChar(f);
                        }
                        line[j + 1] = fc;
                    }
                    sb.AppendLine(new string(line));
                }

                // lower boarder
                sb.AppendLine(new string(b));
            }
            //gf.Board.Text = sb.ToString();
        }
Exemplo n.º 26
0
        private static void Main()
        {
            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(true);

            var gameForm = new GameForm();

            Application.Idle += (sender, args) => ApplicationOnIdle(gameForm);
            Application.Run(gameForm);
        }
Exemplo n.º 27
0
        public void TestWinner2()
        {
            string   playerMark = "O";
            GameForm game       = new GameForm(playerMark, "Game8");

            game.board = new string[] { "X", "", playerMark, "", "O", "O", "", "", "", "" };
            bool actual   = game.TestWinner(1, playerMark);
            bool expected = false;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 28
0
        public void CheckForWinner2Test()
        {
            string   playerMark = "O";
            GameForm game       = new GameForm(playerMark, "Game7");

            game.board = new string[] { "X", playerMark, "X", "", playerMark, "", "", "X", "" };
            bool actual   = game.CheckForWinner(playerMark);
            bool expected = false;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
#if CONSOLE
            new ConsoleScopa().Run();
#else
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            GameForm form = new GameForm();
            Application.Run(form);
#endif
        }
Exemplo n.º 30
0
 public GameFacade(MainForm mainForm)
 {
     _communicationController = new WebSocketAdapter(this);
     _gameController          = new GameController(this);
     _keyController           = new KeyControllerConcreteSubject();
     _gameForm = new GameForm(this);
     _keyController.AttachForm(_gameForm);
     _keyController.Attach(_gameForm);
     _mainForm = mainForm;
     _keyController.Attach(_gameController);
 }
Exemplo n.º 31
0
        public Logic(GameForm form)
        {
            this._form   = form;
            this._width  = form.ClientSize.Width;
            this._height = form.ClientSize.Height;

            form.SizeChanged += form_SizeChanged;
            form.KeyDown     += form_KeyDown;
            form.KeyUp       += form_KeyUp;
            form.FormClosing += form_FormClosing;
        }
Exemplo n.º 32
0
 public virtual void Link(GameForm f)
 {
     if (!(this is KeyNavigationHelpScreen) && KeyDescriptions.Count > 0)
     {
         Clicked_KeyHelp += () =>
         {
             KeyNavigationHelpScreen help = new KeyNavigationHelpScreen();
             help.SetKeys(KeyDescriptions);
             f.Push(help);
         };
     }
 }
Exemplo n.º 33
0
        public void Start(GameForm form, string playerName)
        {
            _form = form;

            _player = new Player(playerName);
            _zones  = new Dictionary <string, Zone>();

            LoadZones();
            _player.EnterZone(FindZone("Garden"));

            Log("Finished starting up the game!");
        }
Exemplo n.º 34
0
        public static void OnLocalGameMenuClick()
        {
            GameForm gameFormRef = (GameForm)Application.OpenForms["GameForm"];

            Thread thread = new Thread(delegate()
            {
                DTO_Player[] players = duplexServiceClient.ClientGetPlayers(GameController.loggedInAccount.EMAIL);
                gameFormRef.LoadAndDesignLocalGameStartPanel(players);
            });

            thread.Start();
        }
Exemplo n.º 35
0
        private void buttonNewGame_Click(object sender, EventArgs e)
        {
            double newBalanceAmount = 2000;

            SaveFormatter.Save(0);
            GameForm gameForm = new GameForm(newBalanceAmount);

            gameForm.Show();
            gameForm.StartPosition = FormStartPosition.Manual;
            gameForm.Location      = this.Location;
            this.Hide();
        }
Exemplo n.º 36
0
        public void Initialize(GameForm form)
        {
            this.form = form;
            this.camera = GameForm.camera;

            this.cursor = GameForm.cursor;
            this.sesgMan = GameData.sesgMan;
            SpriteGridGuiMessages.camera = this.camera;
            SpriteGridGuiMessages.random = this.random;
            SpriteGridGuiMessages.sesgMan = GameData.sesgMan;

            mEditorProperties = GameData.EditorProperties;
        }
        /// <summary>
        /// Todo on activation of the user control
        /// </summary>
        /// <param name="parent"></param>
        public override void Activate(GameForm parent)
        {
            base.Activate(parent);

            Configuration = parent.Manager.Config;
            bsVerdelingStartOpties.DataSource = PlayerSequenceDeterminator.All;
            if(Configuration == null)
            {
                bsConfig.DataSource = typeof(GameConfiguration);
            }
            else
            {
                bsConfig.DataSource = Configuration;
            }
        }
Exemplo n.º 38
0
            public Game()
            {
                gameForm = new GameForm(this);

                inputManager = new InputManager(this);
                objectManager = new ObjectManager(this);
                drawManager = new DrawManager(this);
                gameLogic = new GameLogic(this);

                //System.Threading.TimerCallback tcb = this.GameFlow; //Инициализация и запуск таймера
                //MediaPlayer player = new MediaPlayer();
                //player.Open(new Uri(@"Haddaway-What is love.mp3", UriKind.Relative));
                //player.Play();
                init = true;
                Application.Run(gameForm);
                Console.WriteLine("Closing");
            }
Exemplo n.º 39
0
        private Window GetForm(GameForm form)
        {
            Window window;

            switch (form)
            {
                case GameForm.LOGIN_FORM:
                    window = (new LoginForm(manager)).Window;
                    break;

                case GameForm.TANK_LIST_FORM:
                    window = new TankList(manager).Window;
                    break;

                case GameForm.TANK_CREATION_FORM:
                    window = new TankCreation(manager).Window;
                    break;

                case GameForm.TANK_EDIT_FORM:
                    window = new Window(manager);
                    break;

                case GameForm.SERVER_LIST_FORM:
                    window = new Window(manager);
                    break;

                case GameForm.LOADING_SCREEN_FORM:
                    window = new Window(manager);
                    break;

                case GameForm.GAMEPLAY_FORM:
                    window = new Window(manager);
                    break;

                default:
                    window = new Window(manager);
                    break;
            }

            return window;
        }
Exemplo n.º 40
0
 public Renderer(GameForm form)
 {
     this.form = form;
 }
 /// <summary>
 /// Activate user Control
 /// </summary>
 /// <param name="parent"></param>
 public override void Activate(GameForm parent)
 {
     base.Activate(parent);
     _gameFlow = GameForm.Manager.CreateGameFlow();
     init();
 }
Exemplo n.º 42
0
 public GameControler(GameForm gameForm)
 {
     gameBoardControler = new GameBoardControler(gameForm, this);
 }
Exemplo n.º 43
0
        public MapUserControl(  GameForm gameForm, 
                                BackpackController backpackController,
                                SpellbookController spellbookController,
                                IAtomListener selectorMsgListener)
        {
            InitializeComponent();

            this.Size = new Size();

            this.DoubleBuffered = true;
            this.BackColor = Color.Black;
            this.Font = new Font(FontFamily.GenericMonospace, charSize + charFontPadding);

            this.aiCharacters = new List<AICharacter>();
            this.backpackController = backpackController;
            this.spellbookController = spellbookController;
            this.gameForm = gameForm;

            this.MinimumSize = new Size((int)charSize, this.FontHeight);
            
            this.selectorCursor.RegisterView(selectorMsgListener);

            TransparentPanelCreation();
        }
Exemplo n.º 44
0
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            /*******************************************************************************************
            BLITZKRIEG 0.1 - PROGRAM CONTOH PEMANFAATAN GADGETEER SEBAGAI DEVICE MULTI-FUNGSI
            *******************************************************************************************/
            Debug.Print("Program Started");

            //init pins
            boardPins = new Hashtable();
            for (int i = 1; i <= 10; i++)
            {
                var pin = new BoardPins();
                pin.PinType = BoardPins.PinTypes.None;
                pin.ThisPin = null;
                boardPins.Add(i, pin);
            }
            SetupBackgroundService();
            Screens = new Hashtable();
            //populate all form
            var F1 = new SplashForm(ref MainWindow);
            F1.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Splash, F1);

            var F2 = new MainMenuForm(ref MainWindow);
            F2.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.MainMenu, F2);

            var F3 = new MyRoomForm(ref MainWindow, ref tempHumidSI70, ref lightSense);
            F3.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.MyRoom, F3);

            var F4 = new InboxForm(ref MainWindow, ref cellularRadio, ref sdCard, ref displayTE35);
            F4.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Inbox, F4);

            var F5 = new GalleryForm(ref MainWindow, ref serialCameraL1, ref sdCard, ref wifiRS21);
            F5.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Gallery, F5);

            var F6 = new GameForm(ref MainWindow, ref displayTE35);
            F6.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Game, F6);

            var F7 = new RegisterForm(ref MainWindow, ref wifiRS21, ref sdCard);
            F7.FormRequestEvent += General_FormRequestEvent;
            Screens.Add(Screen.ScreenTypes.Register, F7);

            Glide.FitToScreen = true;
            GlideTouch.Initialize();

            //load splash
            LoadForm(Screen.ScreenTypes.Splash);
        }
 /// <summary>
 /// Activates this control
 /// </summary>
 /// <param name="parent"></param>
 public virtual void Activate(GameForm parent) {
     GameForm = parent;
     Visible = true;
     Dock = DockStyle.Fill;
 }
Exemplo n.º 46
0
 public void AddWindow(GameForm form)
 {
     AddWindow(GetForm(form));
 }
Exemplo n.º 47
0
 public void SwitchWindows(GameForm form)
 {
     SwitchWindows(GetForm(form));
 }
Exemplo n.º 48
0
 public GuiInputHandlerer(GameForm form)
 {
     this.form = form;
 }
Exemplo n.º 49
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            state = ClientState.Offline;
            serverManager = new ServerManager();
            regForm = new RegForm();
            gameForm = new GameForm();
            var i = gameForm.Handle;
            Context = new ApplicationContext(regForm);
            Application.Run(Context);
        }