Exemplo n.º 1
0
        public ActionResult display()
        {
            var game_summary =
                _query_service.query_for_single <BlackJackTableView>(
                    x => x.player_token == _player_authenticator.get_player_token());

            var account_view = _query_service.query_for_single <AccountView>(
                x => x.player_token == _player_authenticator.get_player_token());

            var game_play_view = new GamePlayView();

            game_play_view.table = game_summary;
            game_play_view.account_information_view = new AccountInformationView()
            {
                player_is_logged_in = true, player_name = account_view.name
            };

            if (game_summary == null)
            {
                return(RedirectToAction("Bet", "Bet"));
            }
            else
            {
                if (TempData.ContainsKey("Message"))
                {
                    game_summary.game_message = TempData["Message"].ToString();
                }

                return(View(game_play_view));
            }
        }
Exemplo n.º 2
0
    // idx : 游戏idx
    public void OnGameClick(int idx)
    {
        GamePlayView gp = mGamePlayView.GetComponent <GamePlayView>();

        gp.SetGameIdx(idx);
        ViewManager.ReplaceView(mGamePlayView, gameObject.name);
    }
Exemplo n.º 3
0
        public void Start()
        {
            var cockroaches = new List <Cockroach>();

            var gameplayView  = new GamePlayView(cockroaches, Prefabs, GameSettings, MainCamera);
            var interfaceView = new UIView(Screens);
            var model         = new GameModel(GameSettings);

            _presenter = new ApplicationPresenter(gameplayView, interfaceView, model, Screens, GameSettings);
        }
Exemplo n.º 4
0
        public void AddCar(Player player, Model model, GamePlayView gameplay)
        {
            if (model == null)
            {
                model = Game.Content.Load <Model>(@"Models/porsche");
            }

            var car = gameplay.MakeCar();

            Cars[player] = car;
        }
Exemplo n.º 5
0
            public GamePlayState(GamePlayMediator mediator)
            {
                this.Mediator = mediator;

                this.GamePlayModel = mediator._gamePlayModel;
                this.View          = mediator._view;

                this.ProjectSettings = mediator._projectSettings;

                this.RemoteDataModel = mediator._remoteDataModel;
                this.Animals         = mediator._animalViews;
            }
Exemplo n.º 6
0
    public override void Init(IModule module)
    {
        base.Init(module);
        viewScript = InstantiateView <GamePlayView>("GamePlay/Prefabs/GamePlayView");

        control      = new GamePlayController();
        control.view = (GamePlayView)viewScript;
        control.Start();

        RegisterController(control);
        RegisterView(viewScript);
    }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            GameState nextState = currentView.UpdateState(gameTime);

            if (currentState != nextState)
            {
                switch (nextState)
                {
                case GameState.None:
                    break;

                case GameState.MainMenu:
                    currentView = new MenuView(this, GameState.MainMenu);
                    break;

                case GameState.OptionsMenu:
                    currentView = new OptionsMenu(this);
                    break;

                case GameState.Gameplay:
                    if (!(currentView is GamePlayView))
                    {
                        currentView = Components.First(component => component is GamePlayView) as GamePlayView;
                    }
                    break;

                case GameState.PausedGameplay:
                    break;

                case GameState.MultiplayerMenu:
                    this.GetService <ServerClient>().Connect(System.Net.IPAddress.Loopback);
                    currentView = new GamePlayView(this, 0, GameModeChoice.SimpleRace);    //MultiplayerMenu(this);
                    break;

                case GameState.SingleplayerMenu:
                    break;

                case GameState.Exiting:
                    this.Exit();
                    break;

                default:
                    break;
                }
                currentState = nextState;
            }
            base.Update(gameTime);
        }
Exemplo n.º 8
0
 public virtual void Update(GameTime gameTime, GamePlayView gamePlay)
 {
     if (!allStatesFinished)
     {
         GameModeState current = states[CurrentState];
         if (current.IsStateFinished())
         {
             CurrentState++;
             Console.WriteLine("Passed from state " + (CurrentState - 1) + " to state " + CurrentState);
         }
         if (CurrentState > states.Count - 1)
         {
             Console.WriteLine("Game over!");
             GameOverProcedure();
         }
     }
 }
 public override void Update(GameTime gameTime, GamePlayView gamePlay)
 {
     if (TotalRaceTime != TimeSpan.Zero && allStatesFinished)
     {
         gameInstance.GetService <ServerClient>().SendRaceTime(TotalRaceTime);
     }
     if (Statistics != null)
     {
         var playerHeading = Statistics.CategorizedItems.First(h => h.Updateable);
         playerHeading.Items.Clear();
         int place = 1;
         foreach (var player in players.OrderBy(p => p.RaceTime))
         {
             playerHeading.Items[place++ + ". " + player.PlayerName] = player.RaceTime == TimeSpan.MaxValue ? "" : player.RaceTime.ToString(@"m\:ss\:ff");
         }
     }
     base.Update(gameTime, gamePlay);
 }
Exemplo n.º 10
0
        public override void Update(GameTime gameTime, GamePlayView gamePlay)
        {
            if (StartTime == TimeSpan.Zero && GameStarted)
            {
                StartTime = gameTime.TotalGameTime;
            }
            if (Mode == Mode.Singleplayer && !countdown && gamePlay.Initialized)
            {
                countdown = true;
                StartCountdown();
            }

            /*Console.Write("players: ");
             * foreach (var player in players)
             * {
             *  Console.Write(player.PlayerName + " (" + player.Lap + "),");
             * }
             * Console.WriteLine();*/
            PlayerPlace = CalculatePlayerPosition();
            gameInstance.GetService <HUDComponent>().SetPlayerPosition(PlayerPlace);
            base.Update(gameTime, gamePlay);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // Draw as fast as possible :)
            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();

            // set our necessary classes for the game
            GameApplication.Instance.SetGame(this);
            GameApplication.Instance.SetGraphicsDevice(GraphicsDevice);
            ResourceManager.Instance.Content = Content;

            // the console breaks with our current structure but its still a Singleton
            // thus its not that bad. This needs to have some more workarounds but
            // currently its ok the way it is!
            keyboardInputService = new KeyboardInputService();
            Services.AddService(typeof(GameConsole.IKeyboardInputService), keyboardInputService);
            Components.Add(new GameConsole(Services, "Content\\" + GameApplication.Instance.FontPath + "ConsoleFont"));
            GameConsole.Instance.StringParser = new StringParser();
            GameConsole.Instance.ToggleKey = Keys.F11;

            //GameConsole.Instance.SelectedObjects.Add(WorldManager.Instance);
            GameConsole.Instance.SelectedObjects.Add(this);

            // set up our game views

            GamePlayView gamePlayView = new GamePlayView();
             //   MainMenuGameView mainMenu = new MainMenuGameView();

            //    GameViewManager.Instance.AddGameView(mainMenu);
            GameViewManager.Instance.AddGameView(gamePlayView);

            base.Initialize();
        }
Exemplo n.º 12
0
    public GamePlayViewController CreateGamePlayViewController()
    {
        GamePlayView gamePlayView = Instantiate(_gamePlayViewPrefab);

        return(new GamePlayViewController(gamePlayView, _wireframe, this));
    }
Exemplo n.º 13
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 14
0
 public GamePlayState(GamePlayMediator mediator) : base(mediator)
 {
     Mediator      = mediator;
     GamePlayModel = mediator._gamePlayModel;
     View          = mediator._view;
 }