internal SkillLabelSet(Label label, LinkLabel linkLabel, Label countLabel) { Label = label; LinkLabel = linkLabel; CountLabel = countLabel; Value = 0; }
protected override void LoadContent() { ContentManager content = GameRef.Content; _background = content.Load<Texture2D>(@"Backgrounds\NewTitle"); base.LoadContent(); _startLabel = new LinkLabel { Text = "Press ENTER to begin", Color = Color.White, TabStop = true, HasFocus = true }; _startLabel.CenterHorizontal(GameRef.ScreenRectangle.Width, 600); _startLabel.Selected += StartLabelSelected; ControlManager.Add(_startLabel); var smallFont = content.Load<SpriteFont>(@"Fonts\SmallFont"); var copyLabel = new Label { Text = "Copyright (c) 2012 by Adam Hellberg", Color = Color.White, Font = smallFont }; copyLabel.CenterHorizontal(GameRef.ScreenRectangle.Width, 690); ControlManager.Add(copyLabel); var musicLabel = new Label { Text = "Music Copyright (c) 2012 by Kevin van der Laan [Diseased Flame]", Color = Color.White, Font = smallFont }; musicLabel.CenterHorizontal(GameRef.ScreenRectangle.Width, 720); ControlManager.Add(musicLabel); //GameRef.AudioManager.AddSong(new XRpgLibrary.Audio.Song("TitleScreen", content.Load<Song>(@"Music\TitleScreen"))); //GameRef.AudioManager.PlaySong("TitleScreen"); var song = GameRef.AudioManager.Song.GetSong("MenuTheme"); song.SetStartFade(new FadeInfo(0.0f, 1.0f)); song.SetEndFade(new FadeInfo(1.0f, 0.0f, -0.01f, TimeSpan.FromMilliseconds(15))); //GameRef.AudioManager.PlaySong(GameRef.AudioManager.AddSong(new F16Gaming.Game.RPGLibrary.Audio.Song("TitleScreen", content.Load<Song>(@"Music\TitleScreen"))).Name); GameRef.AudioManager.Song.Play(song); }
private void CreateControls() { Log.Debug("Loading controls..."); var leftTexture = Game.Content.Load<Texture2D>(@"GUI\LeftArrowUp"); var rightTexture = Game.Content.Load<Texture2D>(@"GUI\RightArrowUp"); var stopTexture = Game.Content.Load<Texture2D>(@"GUI\StopBar"); _background = new PictureBox(Game.Content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle); ControlManager.Add(_background); var label1 = new Label {Text = "Who will search for the Eyes of the Dragon?"}; label1.AutoSize(); label1.Position = new Vector2((GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 150); ControlManager.Add(label1); _genderSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); _genderSelector.SetItems(Genders, 125); _genderSelector.Position = new Vector2(label1.Position.X, 200); _genderSelector.SelectionChanged += SelectionChanged; ControlManager.Add(_genderSelector); _classSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture); _classSelector.SetItems(_classes, 125); _classSelector.Position = new Vector2(label1.Position.X, 250); _classSelector.SelectionChanged += SelectionChanged; ControlManager.Add(_classSelector); var acceptLabel = new LinkLabel {Text = "Accept this character", Position = new Vector2(label1.Position.X, 300)}; acceptLabel.Selected += AcceptLabelSelected; ControlManager.Add(acceptLabel); _characterImage = new PictureBox(_characterImages[0, 0], new Rectangle(500, 200, 96, 96), new Rectangle(0, 0, 32, 32)); ControlManager.Add(_characterImage); ControlManager.NextControl(); Log.Debug("Loaded controls!"); }
protected override void LoadContent() { base.LoadContent(); _map = GameRef.World.CurrentLevel.Map; _player.SetMapSize(_map.PixelsWide, _map.PixelsHigh); var spawn = _map.FindObject((l, o) => l.Name == "player" && o.Name == "spawn" && o.ObjectType == MapObjectType.Plain); //string pos = _map.GetProperty("spawn"); if (spawn != null) { //string[] splitPos = pos.Split(';'); float x = spawn.Bounds.X; float y = spawn.Bounds.Y; _player.Sprite.Position = new Vector2(x, y); _player.Camera.LockToSprite(_player.Sprite); } _pointer = Game.Content.Load<Texture2D>(@"GUI\pointer"); var emptyBar = Game.Content.Load<Texture2D>(@"GUI\EmptyBar"); int barYPos = Game.GraphicsDevice.Viewport.Height - (emptyBar.Height + BarVerticalOffset); _healthBar = new Bar(Game.Content.Load<Texture2D>(@"GUI\HealthBar"), emptyBar, new Vector2(BarLeftOffset, barYPos)); _manaBar = new Bar(Game.Content.Load<Texture2D>(@"GUI\ManaBar"), emptyBar, new Vector2(_healthBar.Position.X + emptyBar.Width + BarHorizontalOffset, barYPos)); _staminaBar = new Bar(Game.Content.Load<Texture2D>(@"GUI\StaminaBar"), emptyBar, new Vector2(_manaBar.Position.X + emptyBar.Width + BarHorizontalOffset, barYPos)); _zoneLabel = new Label { Enabled = true, Visible = true, Font = Game.Content.Load<SpriteFont>(@"Fonts\ControlFont"), Name = "ZoneLabel", Position = new Vector2(20, 100), Text = "%ZONE_NAME%", TabStop = false }; _zoneLabel.AutoSize(); #if DEBUG _debugFont = Game.Content.Load<SpriteFont>(@"Fonts\DebugFont"); _posLabel = new Label { Enabled = true, Visible = true, Font = _debugFont, Name = "PositionLabel", Position = new Vector2(10, 10), Text = PositionFormat, TabStop = false }; _posLabel.AutoSize(); _levelLabel = new Label { Enabled = true, Visible = true, Font = _debugFont, Name = "LevelLabel", Position = new Vector2(10, _posLabel.Position.Y + _posLabel.Size.Y + 5), Text = LevelFormat, TabStop = false }; _levelLabel.AutoSize(); _playerLabel = new Label { Enabled = true, Visible = true, Font = _debugFont, Name = "PlayerLabel", Position = new Vector2(10, _levelLabel.Position.Y + _levelLabel.Size.Y + 5), Text = PlayerFormat, TabStop = false }; _playerLabel.AutoSize(); _infoLabel = new Label { Enabled = true, Visible = true, Font = _debugFont, Name = "InfoLabel", Position = new Vector2(10, 500), Text = "KEYS: B = Battle Theme, M = Normal Theme", TabStop = false }; _infoLabel.AutoSize(); _helpLabel = new Label { Font = _debugFont, Name = "HelpLabel", Position = new Vector2(10, 700), Text = "H = Toggle Help" }; _helpLabel.AutoSize(); #endif var song = GameRef.AudioManager.Song.GetSong("Level0_bgm"); song.SetStartFade(new FadeInfo(0.0f, 0.1f)); song.SetEndFade(new FadeInfo(0.1f, 0.0f, -0.01f)); //GameRef.AudioManager.AddSong(new Song("Level0_bgm", Game.Content.Load<Microsoft.Xna.Framework.Media.Song>(@"Music\Level0_bgm"), 0.1f)); //GameRef.AudioManager.AddSong(new Song("BattleTest", Game.Content.Load<Microsoft.Xna.Framework.Media.Song>(@"Music\BattleTest"))); var bSong = GameRef.AudioManager.Song.GetSong("BattleTest"); bSong.SetStartFade(new FadeInfo(0.0f, 1.0f)); bSong.SetEndFade(new FadeInfo(1.0f, 0.0f, -0.01f)); song.SetNext(bSong); bSong.SetNext(song); song.BeginStartFade(); GameRef.AudioManager.Song.Play(song); }
private void CreateControls(ContentManager content) { Log.Info("Creating controls..."); _background = new PictureBox(content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle); ControlManager.Add(_background); var nextControlPosition = new Vector2(300, 150); _pointsRemaining = new Label { Text = "Skill Points: " + _unassignedPoints, Position = nextControlPosition }; nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f; ControlManager.Add(_pointsRemaining); /*string skillPath = @"Game\Skills\"; string[] skillFiles = Directory.GetFiles(skillPath, "*.skill"); var skillData = new List<SkillData>(); foreach (var file in skillFiles) { var data = Serializer.Deserialize<SkillData>(file); var label = new Label {Text = data.Name, Type = data.Name, Position = nextControlPosition}; var linkLabel = new LinkLabel {Text = "+", Type = data.Name, TabStop = true, Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y)}; var countLabel = new Label {Text = "0", Type = data.Name, Position = new Vector2(linkLabel.Position.X + 50, nextControlPosition.Y)}; nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f; linkLabel.Selected += AddSkillLabelSelected; ControlManager.Add(label); ControlManager.Add(linkLabel); ControlManager.Add(countLabel); _skillLabels.Add(new SkillLabelSet(label, linkLabel, countLabel)); }*/ foreach (var key in DataManager.SkillData.Keys) { var data = DataManager.SkillData[key]; var label = new Label { Text = data.Name, Type = data.Name, Position = nextControlPosition }; var countLabel = new Label { Text = "0", Position = new Vector2(nextControlPosition.X + 300, nextControlPosition.Y) }; var linkLabel = new LinkLabel { TabStop = true, Text = "+", Type = data.Name, Position = new Vector2(nextControlPosition.X + 390, nextControlPosition.Y) }; linkLabel.Selected += AddSkillLabelSelected; nextControlPosition.Y += ControlManager.Font.LineSpacing + 10f; ControlManager.Add(label); ControlManager.Add(countLabel); ControlManager.Add(linkLabel); _skillLabels.Add(new SkillLabelSet(label, linkLabel, countLabel)); } nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f; var undoLabel = new LinkLabel {Text = "Undo", Position = nextControlPosition, TabStop = true}; undoLabel.Selected += UndoLabelSelected; nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f; ControlManager.Add(undoLabel); var acceptLabel = new LinkLabel {Text = "Accept", Position = nextControlPosition, TabStop = true}; acceptLabel.Selected += AcceptLabelSelected; ControlManager.Add(acceptLabel); ControlManager.NextControl(); Log.Debug("Controls created!"); }