protected override void Initialize() { new GameInstance().SetGame(this); _currentView = new HighlightedMap(Map.Map.Create()); base.Initialize(); IsMouseVisible = true; }
protected StateContainer(TPeer peer, GameState game, PlayerLookup players, IGameView view) { this.view = view; this.players = players; this.game = game; this.peer = peer; }
void Start() { _model = new GameModel(); var v = FindObjectsOfType <MonoBehaviour>().OfType <IGameView>(); var gameViews = v.ToList(); if (gameViews.Any()) { _view = gameViews[0]; } if (_view == null) { throw new Exception("Не найден объект IGameView"); } Instantiate(_model.GetBackgroundManager(), Vector3.zero, Quaternion.identity, _view.GetTransform); Instantiate(_model.GetCharacterManager(), Vector3.zero, Quaternion.identity, _view.GetTransform); Instantiate(_model.GetDialogManager(), Vector3.zero, Quaternion.identity, _view.GetTransform); // foreach (var prefab in _prefabs) { // Instantiate(prefab, Vector3.zero, Quaternion.identity, _view.GetTransform); // } _view.Init(this); ShowFirstScene(); }
public GamePresenter(IGameView view) { this.view = view; this.model = new GameModel(); view.ShowLobby(); view.AddOnFightListener(this); }
/// <summary> /// Create console user interface. /// </summary> public ConsoleUI() { _gameSelector = new ConsoleGameSelector(); _gameView = new ConsoleView(); _commandReader = new ConsoleCommandReader(); _sizeReader = new ConsoleSizeReader(); }
public void Update(IGameView G) { GameBoardPage M = (GameBoardPage)G; this.Dispatcher.Invoke(new Action(() => M.CountDownLabel.Visibility = Visibility.Hidden)); }
public void OnClose(IGameView view) { view.PlayerDeadEvent -= OnPlayerDead; view.PlayerHealthChangeEvent -= OnPlayerHealthChange; view.BaseHealthChangeEvent -= OnBaseHealthChange; _view = null; }
private void Awake() { m_gameView = Dependencies.GameView; m_input = Dependencies.InputManager; m_input.DeviceEnabled += OnDeviceEnabled; m_input.DeviceDisabled += OnDeviceDisabled; }
public CompositionRoot(IDomainEventChannelFactory domainEventChannelFactory, IGameBuilder gameBuilder, IUICommandChannelFactory commandChannelFactory, IGameViewFactory gameViewFactory) { this.GameId = Guid.NewGuid(); this.domainEventChannel = MaybeConvertions.ToMaybe(domainEventChannelFactory.Create()); // Application gameService = new GameService(this.domainEventChannel, new GameInMemoryRepository(), gameBuilder); gameService.GenerateNewGame(this.GameId); // View this.uiCommandChannel = commandChannelFactory.Create(); this.gameView = gameViewFactory.Create(this.uiCommandChannel); // Handlers this.fromUICommandsToDomainHandler = new FromUICommandsToDomainHandler(this.uiCommandChannel, this.gameService, this.GameId); this.fromDomainEventsToViewHandler = new FromDomainEventsToViewHandler(this.domainEventChannel, this.gameView); }
public void Initialize(IGameView game, RandomNumberGenerator randomNumberGenerator) { gameView = game; gameView.MouseStep += ChooseDirection; gameView.TargetReached += OnTargetReached; }
public GameWindowPresenter(IGameView view) { this.gameView = view; int themeID = 0; try { Lexemes.Clear(); themeID = GetSelectedThemeID(); if (themeID == -1) { throw new Exception("Selected theme for game could not be found, please, select existing one in the Settings menu"); } Lexemes.LexemeDictionary = LexemGateway.GetLexemes(themeID); if (Lexemes.LexemeDictionary.Count < 3) { throw new Exception("The theme should contain at least 3 words to start a game"); } } catch (Exception ex) { this.HandleException("", ex); CanBeStarted = false; return; } this.GameView.OnPlayEnd += new PlayEnd(GameView_OnPlayEnd); this.GameView.OnThrowBegin += new ThrowBegin(GameView_OnThrowBegin); this.GameView.OnThrowEnd += new ThrowEnd(GameView_OnThrowEnd); CanBeStarted = true; }
public ArcadeProgram(IntCodeStateMachine cpu, IGameView gameView, IGameInput gameInput = null) { cpu.OnOutput += Advance; _gameView = gameView; gameInput.OnInput += (_, e) => cpu.SetInput(e); _gameState = new GameState(gameView, gameInput); }
public GameState(IGameView gameView, IGameInput gameInput) { currentGameState = CurrentState.Starting; _wallsCompletedAfterPaddle = 0; _gameView = gameView; _gameInput = gameInput; }
public MainController(IGameView gameView) { mf = new ModelFacade(); dc = new DifficultyController(); this.gameView = gameView; IntializeCommandMap(); }
public GameBoardForm(IGameView view, GameController gController) { GameController = gController; View = view; InitializeComponent(); View.SetMain(this); }
GameObject _GetCachedOrCreateNew(string pView) { IList <IGameView> cachedViews; IGameView cachedView = null; GameObject cachedViewGameObject = null; if (!System.String.IsNullOrEmpty(pView) && _viewCache.ContainsKey(pView)) { cachedViews = _viewCache[pView]; if (cachedViews != null && cachedViews.Count > 0) { cachedView = cachedViews[0]; cachedViewGameObject = cachedView.gameObject; cachedViews.RemoveAt(0); } } if (cachedViewGameObject == null && !System.String.IsNullOrEmpty(pView) && _viewPrefabs.ContainsKey(pView) && _viewPrefabs[pView] != null) { cachedViewGameObject = GameObject.Instantiate <GameObject>(_viewPrefabs[pView]); } return(cachedViewGameObject); }
public GamePresenter(IGameModel model, IGameView view) { _model = model; _view = view; _view.Init(this); }
private StateContainer(NetServer peer, GameState game, PlayerLookup players, IGameView view, PlayerConnectionLookup connections) : base(peer, game, players, view) { this.connections = connections; }
public override void InstallBindings() { Container.Bind <IClient>().To <Client>().AsSingle(); Container.Bind <Additionals.Logger.ILogger>().To <Additionals.Logger.Logger>().AsSingle(); Container.Bind <IContext>().To <Additionals.Context>().AsSingle(); IGame[] games = GetGames(); Container.BindInstance <IGame[]>(games); Container.Bind <IGamePresenter>().To <GamePresenter>().AsSingle(); IGameView[] gameViews = new IGameView[GamePrefabs.Length]; InitGameViews(gameViews); Container.BindInstance(gameViews); IMenuElementView[] menuPrefabs = new IMenuElementView[GamePrefabs.Length]; InitMenuElementViews(menuPrefabs); Container.BindInstance(menuPrefabs); Container.Bind <IMenuPresenter>().To <MenuPresenter>().AsSingle(); }
public Game(IGameView view) { _view = view; _view.PauseButton += View_PauseButton; _view.RefreshGame += View_RefreshGame; Initiate(); PauseStartSwitcher(); }
public MainPresenter(IGameView gameview) { _gameview = gameview; // Презентер подписывается на уведомления о событиях Представления _gameview.Select_button += new EventHandler<EventArgs>(OnSelect); _gameview.Next_q += new EventHandler<EventArgs>(Next_Question); UpdateView(); }
public void OnOpen(IGameView view) { view.PlayerDeadEvent += OnPlayerDead; view.PlayerHealthChangeEvent += OnPlayerHealthChange; view.BaseHealthChangeEvent += OnBaseHealthChange; view.MenuView?.Open(new MenuController(this)); _view = view; }
/// <summary> /// Basic constructor. /// </summary> /// <param name="gameView">Game window handler.</param> /// <param name="gameRepo">Repository with games.</param> /// <param name="rules">'Game of life' rules implementation</param> public GameManager(IGameView gameView, IGameRepository gameRepo, IRules rules) { _gameView = gameView; _gameRepo = gameRepo; _rules = rules; _gamesOnScreen = new GameRepository(); SetupTimer(); }
public GamePresenter(GameSettings settings) { _model = new GameModel(settings); _view = new GameForm(); HookViewEvents(); HookModelEvents(); _model.StartGame(); }
public Game(IGameView gameView, Player computer, InteractivePlayer player, int currentCount) { _gameView = gameView; Computer = computer; Player = player; Player.GameView = gameView; CurrentCount = 0; }
public GameController(IGameView view) { this.view = view; // 初始设定级别为中级。 StaticData.Level = StaticData.Levels.Intermediate; random = new Random(); CreateBlockInfos(); }
public GameController(IGameView /*IGameView_Render*/ /*IGameView_Manual*/ gameView, IFilerView filerView, IFiler filer, IGame game, IFileable gameFileable) { GameView = gameView; FilerView = filerView; Filer = filer; Game = game; GameFileable = gameFileable; }
public MainGame(IGameView startingView) { _graphicsManager = new GraphicsDeviceManager(this); _graphicsManager.PreferredBackBufferWidth = new TileSize().Get() * 26; _graphicsManager.PreferredBackBufferHeight = new TileSize().Get() * 14; _currentView = startingView; Content.RootDirectory = "Content"; }
public MainGame(IGameView startingView) { _graphicsManager = new GraphicsDeviceManager(this); _graphicsManager.PreferredBackBufferWidth = 1408; _graphicsManager.PreferredBackBufferHeight = 1088; _currentView = startingView; Content.RootDirectory = "Content"; }
public GameStatusObserverDecorator(IGameStatusObserver gameStatusObserver, IGameView gameView, IGuiManager guiManager) { GameStatusObserver = gameStatusObserver.CheckNull(); GameView = gameView.CheckNull(); GuiManager = guiManager.CheckNull(); }
public GameController(IGameView gameView, IFilerView filerView, IFiler filer, IGame game, IFileable gameFileable) { GameView = gameView; FilerView = filerView; Filer = filer; Game = game; GameFileable = gameFileable; }
public Game(IGameConfigurator congigurator, IGameView view) { IsStarted += view.GameAction; IsMoveEnded += view.MoveAction; _robots = congigurator.GetRobots(); _field = congigurator.GetField(); foreach (var robot in _robots) { robot.MoveIsMaked += view.RobotAction; } }
private static int PlayGame(IGameApi gameApi, IGameView gameView) { Decision.IDecision d = new Decision.Decision(); // Decision.DecisionOld(); var gameId = gameApi.CreateNewGame(); GameState state; var shoots = 0; do { shoots++; var cell = d.CellToAttack(); var coords = cell.AsTuple(); state = gameApi.Shoot(gameId, coords.Item1, coords.Item2); d.UpdateWithFeedback(coords.Item1, coords.Item2, state.LastShot); gameView.AddShot(cell, state.LastShot); } while (!state.IsFinished); return shoots; }
public InGameView(string level, IGameView v) { mainMenu = v; if (File.Exists("settings.json")) settings = JsonConvert.DeserializeObject<GameSettings>(File.ReadAllText("settings.json")); else { settings = new GameSettings(); settings.EnableClouds = true; } bgFore = new Sprite(new Texture("Content/bgFore.png") { Smooth = true }); bgFore.Origin = new Vector2f(0, 256); bgFore.Scale = new Vector2f(2, 2); bgBack = new Sprite(new Texture("Content/bgBack.png") { Smooth = true }); bgBack.Origin = new Vector2f(0, 256); bgBack.Scale = new Vector2f(2, 2); world = new PhysicsWorld(); SceneDeserializer d = new SceneDeserializer(SceneLoader.Load(level)); player = new Player(d.Scene.StartCoords, world); d.AddObjects(world); player.FinishHigh = d.Scene.FinishHigh; player.FinishLow = d.Scene.FinishLow; portal = new Sprite(new Texture("Content/portal.png") { Smooth = true }); portal.Scale = new Vector2f(2, 2); portal.Position = new Vector2f(player.FinishLow.X + (player.FinishHigh.X - player.FinishLow.X) * 0.5f, player.FinishLow.Y + (player.FinishHigh.Y - player.FinishLow.Y) * 0.5f) * 10; scene = new Scene(ScrollInputs.None); listener = new GameEventListener(world, player); listener.OnWin += listener_OnWin; scene.AddComponent(listener); cloudSprite = new Sprite(); clouds = new Texture(256, 64); clouds.Smooth = true; if (settings.EnableClouds) { GenerateClouds(); } bgGradient = new Texture("Content/bg.png"); bg = new Sprite(bgGradient); }
public EmulatorApi(IGameView view) { _view = view; }
/// <summary> /// Adds a new game view /// </summary> /// <param name="view">View to add</param> public void AddView(IGameView view) { Views.Add(view); }
/// <summary> /// Removes a game view from the engine's list /// </summary> /// <param name="view">View to delete</param> /// <returns></returns> public bool RemoveView(IGameView view) { return Views.Remove(view); }