Example #1
0
 void SingleStageCompleted(int stage)
 {
     Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.StageCompleted1).Play(new Client.Sound.PlayArgs {
     });
     CurrentStageInfos[stage - 1] = new Client.Game.Interface.StageInfo
     {
         HitPoints    = Map.MainCharacter.HitPoints,
         MaxHitPoints = Map.MainCharacter.MaxHitPoints,
         Rage         = Map.MainCharacter.RageLevel + Map.MainCharacter.RageLevelProgress,
         Ammo         = Map.MainCharacter.PistolAmmo,
         Time         = GameTime,
         Stage        = stage
     };
     stagesControl.SetCurrentStage(stage, CurrentStageInfos[stage - 1]);
     stagesControl.Maximize(stage);
     stagesControl.SetActive(stage, false);
     if (stage < Map.Settings.Stages)
     {
         stagesControl.SetActive(stage + 1, true);
     }
     Timeout(10, () => stagesControl.Minimize(stage));
     Program.Instance.SignalEvent(new ProgramEvents.StageCompleted
     {
         Stage = CurrentStageInfos[stage - 1]
     });
 }
        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 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);
        }
Example #4
0
 void SingleStageCompleted(int stage)
 {
     Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.StageCompleted1).Play(new Client.Sound.PlayArgs { });
     CurrentStageInfos[stage - 1] = new Client.Game.Interface.StageInfo
     {
         HitPoints = Map.MainCharacter.HitPoints,
         MaxHitPoints = Map.MainCharacter.MaxHitPoints,
         Rage = Map.MainCharacter.RageLevel + Map.MainCharacter.RageLevelProgress,
         Ammo = Map.MainCharacter.PistolAmmo,
         Time = GameTime,
         Stage = stage
     };
     stagesControl.SetCurrentStage(stage, CurrentStageInfos[stage - 1]);
     stagesControl.Maximize(stage);
     stagesControl.SetActive(stage, false);
     if(stage < Map.Settings.Stages)
         stagesControl.SetActive(stage + 1, true);
     Timeout(10, () => stagesControl.Minimize(stage));
     Program.Instance.SignalEvent(new ProgramEvents.StageCompleted
     {
         Stage = CurrentStageInfos[stage - 1]
     });
 }