public WinScreen(Game game, Library.Colors.ColorName player) : base(Library.WinScreens.Background, game) { WinType = TypeOfWin.TeamVictory; SplashTime = TimeSpan.FromSeconds(5); switch (player) { case Synced.Content.Library.Colors.ColorName.Blue: GameComponents.Add(new Sprite(Library.WinScreens.BlueTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game)); break; case Synced.Content.Library.Colors.ColorName.Green: GameComponents.Add(new Sprite(Library.WinScreens.GreenTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game)); break; case Synced.Content.Library.Colors.ColorName.Red: GameComponents.Add(new Sprite(Library.WinScreens.RedTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game)); break; case Synced.Content.Library.Colors.ColorName.Yellow: GameComponents.Add(new Sprite(Library.WinScreens.YellowTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Color.White, Static_Classes.DrawingHelper.DrawingLevel.Top, true, Game)); break; default: break; } }
public GameScreen(Game game, List <Library.Character.Name> playerinfo) // TODO: tmp added world to parameters, might solve in a different way later. : base(game) { SyncedGameCollection.InitializeSyncedGameCollection(game); world = new World(Vector2.Zero); GameComponents.Add(SyncedGameCollection.Instance); _map = new Map(Library.Map.Path[Library.Map.Name.Paper], game, world); GameComponents.Add(_map); Rectangle[] rectangles = new Rectangle[] { new Rectangle(140, 20, 40, 40), new Rectangle(1700, 20, 40, 40), new Rectangle(140, 1020, 40, 40), new Rectangle(1700, 1020, 40, 40) }; // Controls for (int i = 0; i < playerinfo.Count; i++) { GameComponents.Add(new ScoreLabel((PlayerIndex)i, rectangles[i], Game)); } // Audio Library.Audio.PlaySong(Library.Audio.Songs.GameSong3); _map.LoadMap(game, playerinfo); // send in player information foreach (var ob in SyncedGameCollection.ComponentCollection) { if (ob is Goal) { (ob as Goal).Scored += GameScreen_Scored; } } }
public WinScreen(Game game) : base(Library.WinScreens.Background, game) { WinType = TypeOfWin.SuddenDeath; SplashTime = new TimeSpan(10000); GameComponents.Add(new Sprite(Library.WinScreens.SuddenTeam, new Vector2(ResolutionManager.GetCenterPointWidth, ResolutionManager.GetCenterPointHeight), Static_Classes.DrawingHelper.DrawingLevel.Top, Game)); }
//Default Utopia Init method. private void NormalInit() { #region Debug Components #if DEBUG _axis = new Axis(this, 10); // Use to display the X,Y,Z axis GameComponents.Add(_axis); DebugEffect.Init(this); // Default Effect used by debug componant (will be shared) #endif #endregion _clock = new GameClock.Clock(this, 120, GameClock.GameTimeMode.Automatic, (float)Math.PI * 1f, InputHandler); // Clock creation, manage Utopia time GameComponents.Add(_clock); ICamera camera = new FirstPersonCamera(this); // Create a firstPersonCAmera viewer TerraCubeProfile.InitCubeProfiles(); // Init the cube factory WorldFocus = (IWorldFocus)camera; //Set the World Focus on my Camera //Create an entity, link to camera to it. _player = new Entities.Living.Player(this, "s33m3", camera, InputHandler, new DVector3((TerraWorld.Worldsize.X / 2.0) + TerraWorld.WorldStartUpX, 90, (TerraWorld.Worldsize.Z / 2.0f) + TerraWorld.WorldStartUpZ), new Vector3(0.5f, 1.9f, 0.5f), 5f, 30f, 10f) { Mode = Entities.Living.LivingEntityMode.FreeFirstPerson //Defaulted to "Flying" mode }; GameComponents.Add(_player); //Attached the Player to the camera =+> The player will be used as Camera Holder ! camera.CameraPlugin = _player; //The camera is using the _player to get it's world positions and parameters, so the _player updates must be done BEFORE the camera ! GameComponents.Add(camera); _universe = new Univers.Universe(this, _clock, _player, "S33m3's World"); GameComponents.Add(_universe); _fps = new FPS(this); GameComponents.Add(_fps); _gui = new Sprites2D.GUI(this); GameComponents.Add(_gui); _debugInfo = new DebugInfo(this); _debugInfo.Activated = true; _debugInfo.SetComponants(_fps, _clock, _universe, _player); GameComponents.Add(_debugInfo); GameConsole.Initialize(this); //Set Default Camera ! base.ActivCamera = camera; }
/// <summary> /// Make component enabled and visible if possible /// </summary> /// <param name="gc"></param> protected void AddComponent(GameComponent gc) { if (gc == null) { return; } //Should only be called "once", but doesn't hurt to check the collection state before each modification CleanUpComponents(); //Add a component only if not already added if (GameComponents.Contains(gc) == false) { GameComponents.Add(gc); } }
public SplashScreen(Texture2D texture, Game game) : base(game) { //How long to fade in & out DrawOrder = (int)DrawingHelper.DrawingLevel.Top; FadeInTime = TimeSpan.FromSeconds(0.5); FadeOutTime = TimeSpan.FromSeconds(0.5); SplashTime = TimeSpan.FromSeconds(2.1); // Temporary screen variables (Half of screen) int w = ResolutionManager.GetCenterPointWidth; int h = ResolutionManager.GetCenterPointHeight; GameComponents.Add(new Sprite(texture, new Vector2(w, h), Color.White, DrawingHelper.DrawingLevel.Top, true, game)); }
public override void Initialize(SharpDX.Direct3D11.DeviceContext context) { var gui = _iocContainer.Get <GuiManager>(); var selection = _iocContainer.Get <ServerSelectionComponent>(); var webApi = _iocContainer.Get <ClientWebApi>(); GameComponents.Add(gui); GameComponents.Add(selection); selection.BackPressed += SelectionBackPressed; selection.ConnectPressed += SelectionConnectPressed; webApi.ServerListReceived += WebApiServerListReceived; base.Initialize(context); }
//SpriteBatch _spriteBatch //{ // get { return (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch)); } //} #endregion public MenuScreen(Game game) : base(game) { //Menu background DrawOrder = (int)DrawingHelper.DrawingLevel.Back; // Temporary screen variables (Half of screen) int w = ResolutionManager.GetCenterPointWidth; int h = ResolutionManager.GetCenterPointHeight; // Add character selectors GameComponents.Add(new CharacterSelector(PlayerIndex.One, new Rectangle(0, 0, w, h), Color.Blue, Game)); GameComponents.Add(new CharacterSelector(PlayerIndex.Two, new Rectangle(w, 0, w, h), Color.Green, Game)); GameComponents.Add(new CharacterSelector(PlayerIndex.Three, new Rectangle(0, h, w, h), Color.Red, Game)); GameComponents.Add(new CharacterSelector(PlayerIndex.Four, new Rectangle(w, h, w, h), Color.Yellow, Game)); // Background GameComponents.Add(new Sprite(Library.Interface.MenuBackground, Vector2.Zero, DrawingHelper.DrawingLevel.Back, game)); Library.Audio.PlaySong(Library.Audio.Songs.MenuSong1); }
public override void LoadContent() { ResourceManager.LoadResource <Texture2D>(this, "ExplosionTexture", "Textures/Explosion"); ResourceManager.LoadResource <Texture2D>(this, "Background", "Textures/Background"); ResourceManager.LoadResource <Texture2D>(this, "Unpowered", "Textures/Unpowered"); ResourceManager.LoadResource <Texture2D>(this, "Powered", "Textures/Powered"); ResourceManager.LoadResource <Texture2D>(this, "Unowned", "Textures/Default"); ResourceManager.LoadResource <Texture2D>(this, "ButtonMenu", "Textures/ButtonMenu"); ResourceManager.LoadResource <Texture2D>(this, "ButtonMenuHovered", "Textures/ButtonMenuHovered"); ResourceManager.LoadResource <Texture2D>(this, "ButtonSettings", "Textures/ButtonSettings"); ResourceManager.LoadResource <Texture2D>(this, "ButtonSettingsHovered", "Textures/ButtonMenuHovered"); ResourceManager.LoadResource <SpriteFont>(this, "ButtonFont", "Fonts/ButtonFont"); ResourceManager.LoadResource <SpriteFont>(this, "DefaultFont", "Fonts/Default"); ResourceManager.LoadResource <Texture2D>(this, "ButtonExit", "Textures/ButtonExit"); ResourceManager.LoadResource <Texture2D>(this, "ButtonExitHovered", "Textures/ButtonExitHovered"); ResourceManager.LoadResource <Texture2D>(this, "ButtonHowToPlay", "Textures/ButtonHTP"); ResourceManager.LoadResource <Texture2D>(this, "ButtonHowToPlayHovered", "Textures/ButtonHTPHovered"); ResourceManager.LoadResource <TextFile>(this, "HowToPlay", "Others/howtoplay"); ResourceManager.LoadResource <SpriteFont>(this, "WinnerFont", "Fonts/WinnerFont"); ResourceManager.LoadResource <SpriteFont>(this, "BoldFont", "Fonts/Bold"); ResourceManager.LoadResource <Sound>(this, "ExplosionSound", "Sounds/ExplosionSound"); _singleplayerGame = new SingleplayerComponent(this, _input, Get <GameWindow>().ClientSize) { DrawOrder = 1, UpdateOrder = 1, Visible = true, Enabled = true }; _mainMenuComponent = new MainMenuComponent(this, _input) { DrawOrder = 2, UpdateOrder = 2, Visible = true, Enabled = true }; GameComponents.Add(_singleplayerGame); GameComponents.Add(_mainMenuComponent); var controlFromHandle = Control.FromHandle(GameWindow.Default.Handle); var form = controlFromHandle as FrmLoading; form?.DestroyControls(); }
public void RegisterNewComponent(DrawableGameComponent component) { GameComponents.Add(component); }
public LoadingScreen(Game game) : base(game) { GameComponents.Add(new Sprite(Library.Screens.LoadScreen, Vector2.Zero, DrawingHelper.DrawingLevel.Top, game)); }