public void AddFader() { var p = new Fader { AlphaMax = 0.6f, FadeLength = 0.5f, State = global::Graphics.Interface.FadeState.FadeingOut, Clickable = true, Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height) }; pauseFaders.Push(p); Program.Instance.Interface.AddChild(p); }
public ChallengeMapMenuControl() { Dock = System.Windows.Forms.DockStyle.Fill; AddChild(new ChallengeBackgroundControl()); AddChild(new GameLogoChallengeImage { Anchor = Orientation.Top, Position = new Vector2(-15, 50) }); Control profilePanel = new FlowLayout { HorizontalFill = true, Newline = false, AutoSize = true, Anchor = Orientation.BottomLeft, Position = new Vector2(10, 10), Size = new Vector2(400, 20), Origin = FlowOrigin.BottomRight }; AddChild(profilePanel); Control changeProfile = new ClickableTextButton { Text = "(Change)", AutoSize = AutoSizeMode.Full, Background = null, }; profilePanel.AddChild(changeProfile); changeProfile.Click += new EventHandler(profile_Click); profilePanel.AddChild(profileName); Control buttonsPanel = new Control { Background = InterfaceScene.DefaultFormBorder, Size = new Vector2(400, 150), Anchor = Orientation.Top, Position = new Vector2(0, 500), Padding = new System.Windows.Forms.Padding(10) }; AddChild(buttonsPanel); if (!String.IsNullOrEmpty(Program.Settings.ChallengeSurveyLink)) { var u = new Uri(Program.Settings.ChallengeSurveyLink); var s = u.ToString(); if (!u.IsFile) { //Control feedback = new Control //{ // Background = InterfaceScene.DefaultFormBorder, // Anchor = Orientation.Top, // Position = new Vector2(300, 500), // Size= new Vector2(300, 100), // Padding = new System.Windows.Forms.Padding(10) //}; //AddChild(feedback); //feedback.AddChild(new TextBox //{ // Text = "Tell us what you think of the game!", // Clickable = false, // Background = null, // AutoSize = AutoSizeMode.Full, //}); Control survey = new ClickableTextButton { Text = "Tell us what you think!", Anchor = Orientation.Right, AutoSize = AutoSizeMode.Full, Background = null, Position = new Vector2(25, 45) }; survey.Click += new EventHandler((o, e) => { Util.StartBrowser(s); }); buttonsPanel.AddChild(survey); } } ButtonBase challenge = new LargeStoneButton { Anchor = Orientation.Right, Position = new Vector2(25, 0), Text = "Play" }; buttonsPanel.AddChild(challenge); challenge.Click += new EventHandler(challenge_Click); ButtonBase tutorial = new StoneButton { Anchor = Orientation.TopLeft, Position = new Vector2(0, 0), Text = "Tutorial" }; buttonsPanel.AddChild(tutorial); tutorial.Click += new EventHandler(tutorial_Click); ButtonBase options = new StoneButton { Anchor = Orientation.TopLeft, Position = new Vector2(0, 45), Text = "Options" }; buttonsPanel.AddChild(options); options.Click += new EventHandler(options_Click); ButtonBase exit = new StoneButton { Anchor = Orientation.TopLeft, Position = new Vector2(0, 90), Text = "Exit" }; buttonsPanel.AddChild(exit); exit.Click += new EventHandler(exit_Click); if (!String.IsNullOrEmpty(Program.Settings.HallOfFameAddress)) { var u = new Uri(Program.Settings.HallOfFameAddress); var s = u.ToString(); if (!u.IsFile) { Control hof = new Button { Anchor = Orientation.Top, Position = new Vector2(0, 655), HoverTexture = new TextureFromFile("Interface/Common/HallOfFame2Mouseover1.png") { DontScale = true }, NormalTexture = new TextureFromFile("Interface/Common/HallOfFame2.png") { DontScale = true }, ClickTexture = new TextureFromFile("Interface/Common/HallOfFame2.png") { DontScale = true }, Background = new ImageGraphic { }, Size = new Vector2(260, 38) }; hof.Click += new EventHandler((o, e) => { Util.StartBrowser(s); }); AddChild(hof); } } fader = new Fader { State = FadeState.FadedOut }; AddChild(fader); Updateable = true; }
public override void Enter() { base.Enter(); Program.Instance.Interface.AddChild(new Control { Background = new StretchingImageGraphic { Texture = new TextureFromFile("mainmenubackground.png"), Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height) }, Dock = System.Windows.Forms.DockStyle.Fill }); if (Common.ProgramConfigurationInformation.Warnings.Count > 0) Program.Instance.Interface.AddChild( new Graphics.Interface.ProgramConfigurationInformationControl { Position = new Vector2(0, 150) }); form = new DeveloperMainMenuForm(); Program.Instance.Interface.AddChild(form); Program.Instance.Interface.AddChild(new TestMaps()); var buttonsGrid = new Grid { Size = new Vector2(800, 200), Anchor = Orientation.BottomLeft, NWidth = 4, NHeight = 8 }; Program.Instance.Interface.AddChild(buttonsGrid); var videoSettings = new Button { Size = new Vector2(200, 20), Text = "Options", Position = new Vector2(200, 60) }; buttonsGrid.AddChild(videoSettings); videoSettings.Click += new EventHandler(videoSettings_Click3); videoSettings = new Button { Text = "Fullscreen", }; buttonsGrid.AddChild(videoSettings); videoSettings.Click += new EventHandler((o, e) => { Program.Settings.WindowMode = WindowMode.Fullscreen; Program.UpdateWindowMode(); }); Button exitGameButton = new Button { Position = new Vector2(200, 40), Size = new Vector2(200, 20), Text = "Exit", }; buttonsGrid.AddChild(exitGameButton); exitGameButton.Click += new EventHandler(exitGameButton_Click); Button ratingTestPopup = new Button { Position = new Vector2(200, 0), Size = new Vector2(200, 20), Text = "Rating Test" }; buttonsGrid.AddChild(ratingTestPopup); ratingTestPopup.Click += new EventHandler((o, e) => { Client.Game.Interface.ScoreScreenControl ssc = new Client.Game.Interface.ScoreScreenControl { GameState = new Client.Game.GameState { }, Map = new Client.Game.Map.Map { Settings = new Client.Game.Map.MapSettings { Name = "asdf" } }, GameTime = 123, Statistics = new Client.Game.Statistics { }, EarnedGoldCoins = 1, SilverEnabled = Program.Settings.SilverEnabled, HideStats = Program.Settings.HideStats }; ssc.AddChild(new Client.Game.Interface.RatingBox { Anchor = Orientation.TopRight, Position = new Vector2(0, 45) }); Program.Instance.Interface.AddChild(ssc); }); Button helpPopup = new Button { Position = new Vector2(200, 40), Size = new Vector2(200, 20), Text = "Help", }; buttonsGrid.AddChild(helpPopup); helpPopup.Click += new EventHandler(helpPopup_Click); Button button = new Button { Text = "NormalWindow", }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { Program.Instance.Interface.AddChild( new Window { Anchor = Orientation.Center, Moveable = true }); }); button = new Button { Text = "LargeWindow", }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { Program.Instance.Interface.AddChild( new Window { Anchor = Orientation.Center, Moveable = true, LargeWindow = true }); }); button = new Button { Text = "Display settings form" }; buttonsGrid.AddChild(button); button.Click += new EventHandler(button_Click); var currentStages = new Client.Game.Interface.StageInfo[] { new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600, }, null, null, null }; var bestStages = new Client.Game.Interface.StageInfo[] { new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 100, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3f, Time = 150, MaxHitPoints = 600, }, null }; Action<String, Func<Graphics.Entity>> addDialogTest = (text, dialog) => { button = new Button { Text = text, }; buttonsGrid.AddChild(button); button.Click += new EventHandler((o, e) => { var d = dialog(); Program.Instance.Interface.AddChild(d); System.Windows.Forms.Form f = new System.Windows.Forms.Form { Size = new System.Drawing.Size(200, 500) }; var pg = new System.Windows.Forms.PropertyGrid { SelectedObject = d, Dock = System.Windows.Forms.DockStyle.Fill }; f.Controls.Add(pg); pg.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler((o2, e2) => { d.Invalidate(); }); f.Show(); }); }; addDialogTest("StartScreenControl", () => new Game.Interface.StartScreenControl { Anchor = Orientation.Center, Moveable = true, MapSettings = new Client.Game.Map.MapSettings { Name = "The test map", }, AvailableRangedWeapons = Program.Instance.Profile.AvailableRangedWeapons, AvailableMeleeWeapons = Program.Instance.Profile.AvailableMeleeWeapons }); addDialogTest("CreditsText", () => new Game.Interface.CreditsText { Title = "Entertainment", Text = "The muppets", }); addDialogTest("LargeStoneButton", () => new LargeStoneButton { Text = "Button", Anchor = Orientation.Center }); addDialogTest("StoneButton", () => new StoneButton { Text = "Button", Anchor = Orientation.Center }); Random random = new Random(); var stats = new Client.Game.Statistics(); stats.CharacterActions.ShotgunFired = 40; stats.CharacterActions.ShotgunSlugHits = 67; stats.CharacterActions.GhostRifleFired = 20; stats.CharacterActions.GhostRifleHits = 18; stats.Actions.DamageDealt = random.Next(950); stats.Actions.DamageTaken = random.Next(340); stats.Actions.HitsTaken = random.Next(34); stats.Actions.TimesNetted = random.Next(40); stats.Kills.TotalKills = random.Next(12031); addDialogTest("ScoreScreenControl", () => new Game.Interface.ScoreScreenControl { Anchor = Orientation.Center, Map = new Client.Game.Map.Map { Settings = new Client.Game.Map.MapSettings { Name = "The Challenge", Stages = 5 } }, Statistics = stats, Moveable = true, EarnedGoldCoins = 1, LostGameReason = "You were killed by a grunt", GameState = Client.Game.GameState.Won, AchievementsEarned = new List<Achievement> { new Achievements.Make5TriesOnASingleMap(), new Achievements.Kill70ZombiesInUnder10Seconds(), new Achievements.Make10TriesOnASingleMap(), new Achievements.Make20TriesOnASingleMap(), new Achievements.Kill100ZombiesInUnder10Seconds(), }, CurrentStages = currentStages, BestStages = bestStages, SilverEnabled = Program.Settings.SilverEnabled, HideStats = Program.Settings.HideStats }); addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu { Anchor = Orientation.Center, MapSettings = new Client.Game.Map.MapSettings { Name = "The test map", }, }); addDialogTest("StoneDropDownBar", () => { var r = new StoneDropDownBar { Anchor = Orientation.Center, }; r.AddItem("hello"); r.AddItem("cruel"); r.AddItem("world which sdlf jdsf klsdfadsflksda jödaskfj lsdjf lksafdjdöf kl sdkj\n\nslkfj"); return r; }); addDialogTest("AchievementUnlockedPopup", () => new AchievementUnlockedPopup { DisplayName = "O needs medical attention?", Description = "Complete \"Reverse Gauntlet\" without killing any regular chests." }); addDialogTest("UnlockButton", () => new UnlockButton { }); addDialogTest("MapButton", () => { var mb = new MapButton { Map = "LevelA", }; Program.Instance.Tooltip.SetToolTip(mb, new MapToolTip { Title = "Jahman", Objective = "Killin them zombies", Yield = 2 }); return mb; }); addDialogTest("RatingBox", () => new Game.Interface.RatingBox { }); addDialogTest("ActionTipText", () => new Game.Interface.WarningFlashText { Text = "Press space!" }); addDialogTest("TutorialText", () => new Game.Interface.TutorialText { Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission to obliterate the evil, by fighting your way through the islands and liberating the villagers before they are all consumed by a mystic plague. You'll have to act, think and move fast if you want to survive the horrors of these wicked parts of the world, and do not hope for any rescue or help, it's all up to you and you alone!", Title = "Tutorial" }); addDialogTest("Dialog", () => new Dialog { Title = "Hello", Text = "Applications that load assemblies with this method will be affected by upgrades of those assemblies. Therefore, do not use this method; redesign the application to use the Load(String) method overload or the LoadFrom(String) method overload.", }); addDialogTest("InGameMenu", () => new Game.Interface.InGameMenu { }); addDialogTest("SpeachBubble", () => new Game.Interface.SpeachBubble { Text = "Dead Meets Lead is every bit and piece of what a zombie slaying, fast paced action game should be. Enter the role of the 18th century commander who's on a mission..." }); addDialogTest("Rating", () => new Game.Interface.RatingControl { Anchor = global::Graphics.Orientation.Center }); addDialogTest("StageInfo", () => new Game.Interface.StageInfoControl { Anchor = global::Graphics.Orientation.Center, Background = InterfaceScene.DefaultSlimBorder, CurrentStage = new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Time = 200, MaxHitPoints = 600 }, BestStage = new Client.Game.Interface.StageInfo { HitPoints = 500, Rage = 3, Time = 150, MaxHitPoints = 600 } }); addDialogTest("StageCompleted", () => { var s = new Game.Interface.StageControl { Anchor = global::Graphics.Orientation.Center, CurrentStage = new Client.Game.Interface.StageInfo { HitPoints = 300, Rage = 2.3f, Ammo = 15, Time = 200, MaxHitPoints = 600, Stage = 2 }, BestStage = new Client.Game.Interface.StageInfo { HitPoints = 200, Rage = 3, Ammo = 5, Time = 150, MaxHitPoints = 600 }, Stage = 1, Clickable = true }; s.Click += new EventHandler((o, e) => { if (s.State == Client.Game.Interface.StageCompletedState.Maximized) s.State = Client.Game.Interface.StageCompletedState.Minimizing; else s.State = Client.Game.Interface.StageCompletedState.Maximizing; }); return s; } ); addDialogTest("ArrowIndicator", () => new ArrowIndicator { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(100, 100) }); addDialogTest("DefaultFormBorderOutlined", () => new Form { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(250, 140), Background = InterfaceScene.DefaultFormBorderOutlined, Moveable = true }); addDialogTest("Stages", () => { var s = new Client.Game.Interface.StagesControl { Anchor = global::Graphics.Orientation.Center, Size = new Vector2(1000, 140), NStages = 5 }; for (int i = 0; i < s.NStages; i++) { s.SetBestStage(i + 1, bestStages[i]); s.SetCurrentStage(i + 1, currentStages[i]); } s.SetActive(1, true); Program.Instance.Timeout(2, () => s.Maximize(2)); Program.Instance.Timeout(10, () => s.Minimize(2)); return s; }); addDialogTest("Scaling", () => { var s = new Graphics.Interface.Control { Background = new Graphics.Content.ImageGraphic { SizeMode= SizeMode.AutoAdjust, Texture = new TextureFromFile("checker.png") }, Size = new Vector2(512, 512), Position = new Vector2(100, 100), Updateable = true }; var c = new Graphics.Interface.Control { Background = new Graphics.Content.ImageGraphic { SizeMode = SizeMode.AutoAdjust, Texture = new TextureFromFile("cornell.png") }, Size = new Vector2(128, 128), Position = new Vector2(100, 100), }; s.AddChild(c); float v = 0; s.Update += new UpdateEventHandler((o, d) => { v += d.Dtime; s.Scale = new Vector3((float)Math.Abs(Math.Sin(v)), (float)Math.Abs(Math.Sin(v)), 1); }); return s; }); addDialogTest("VideoOptionsWindow", () => new VideoOptionsWindow { AvailableAnimationQualities = new Graphics.Renderer.Settings.AnimationQualities[] { Graphics.Renderer.Settings.AnimationQualities.Low, Graphics.Renderer.Settings.AnimationQualities.Medium, Graphics.Renderer.Settings.AnimationQualities.High }, AnimationQuality = Program.Settings.RendererSettings.AnimationQuality, AvailableVideoQualities = new VideoQualities[] { VideoQualities.Custom, VideoQualities.Low, VideoQualities.Medium, VideoQualities.High, VideoQualities.Ultra }, OverallVideoQuality = Program.Settings.VideoQuality, }); deviceRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(0, 50) }; clientRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(80, 50) }; windowRes = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(240, 50) }; fps = new Label { Anchor = Orientation.BottomRight, Size = new Vector2(70, 70), Position = new Vector2(160, 50) }; mousePos = new Label { Anchor = Orientation.TopLeft, Size = new Vector2(70, 70), Position = new Vector2(320, 50) }; #if DEBUG_DEVELOPERMAINMENU i++; s[i] = new System.IO.StreamWriter("debugRESOLUTION" + i + ".txt"); #endif Program.Instance.Interface.AddChild(deviceRes); Program.Instance.Interface.AddChild(clientRes); Program.Instance.Interface.AddChild(windowRes); Program.Instance.Interface.AddChild(fps); Program.Instance.Interface.AddChild(mousePos); fader = new Fader { State = FadeState.FadedOut }; Program.Instance.Interface.AddChild(fader); }
public MainMenuControl() { Dock = System.Windows.Forms.DockStyle.Fill; AddChild(new MenuBackgroundControl()); AddChild(new GameLogoImage { Anchor = Orientation.Center, Position = new Vector2(-220, -150) }); AddChild(new SelectProfileControl { Anchor = Orientation.Center, Position = new Vector2(-200, 100), }); CustomMapControl customMapsControl = new CustomMapControl { Anchor = Orientation.Center, Position = new Vector2(-200, 290) }; customMapsControl.OpenCustomMap += new Action<string>(customMapsControl_OpenCustomMap); AddChild(customMapsControl); fader = new Fader { State = FadeState.FadedOut }; AddChild(fader); Updateable = true; }