public BattleGraphicController(ScreenConstants screen, PlayerPokemonDataView playerView, AIPokemonDataView aiView, PokemonSprite playerSprite, PokemonSprite aiSprite, BattleData data) { var player = data.PlayerId; var ai = data.Clients.First(id => !id.IsPlayer); playerSprite.IsPlayer = true; aiSprite.IsPlayer = false; dataViews[player] = playerView; dataViews[ai] = aiView; sprites[player] = playerSprite; sprites[ai] = aiSprite; foreach (var view in dataViews.Values) view.OnHPUpdated += delegate { OnHPSet(this, null); }; foreach (var sprite in sprites.Values) sprite.OnPokemonAppeared += delegate { OnPokemonSet(this, null); }; initAIGraphic(aiView, aiSprite, screen); initPlayerGraphic(playerView, playerSprite, screen); }
private void initAIGraphic(PokemonDataView aiView, PokemonSprite aiSprite, ScreenConstants screen) { aiView.XPosition = screen.ScreenWidth * 0.2f; aiView.YPosition = screen.ScreenHeight * 0.1f; aiView.Height = screen.ScreenHeight * 0.1f; aiView.Width = screen.ScreenWidth * 0.15f; aiSprite.XPosition = screen.ScreenWidth * 0.6f; aiSprite.YPosition = screen.ScreenHeight * 0.1f; aiSprite.Height = screen.ScreenHeight * 0.25f; aiSprite.Width = screen.ScreenHeight * 0.25f; }
private void initPlayerGraphic(PokemonDataView playerView, PokemonSprite playerSprite, ScreenConstants screen) { playerView.XPosition = screen.ScreenWidth * 0.55f; playerView.YPosition = screen.ScreenHeight * 0.45f; playerView.Height = screen.ScreenHeight * 0.15f; playerView.Width = screen.ScreenWidth * 0.15f; playerSprite.XPosition = screen.ScreenWidth * 0.2f; playerSprite.YPosition = screen.ScreenHeight * 0.4f; playerSprite.Height = screen.ScreenHeight * 0.25f; playerSprite.Width = screen.ScreenHeight * 0.25f; }