Ejemplo n.º 1
0
        public SelectProfileControl()
        {
            Background       = InterfaceScene.DefaultFormBorder;
            Size             = new Vector2(500, 200);
            Padding          = new System.Windows.Forms.Padding(20);
            Background.Alpha = 0.2f;

            Control right = new Control
            {
                Dock = System.Windows.Forms.DockStyle.Fill
            };
            Control left = new Control
            {
                Dock = System.Windows.Forms.DockStyle.Left,
                Size = new Vector2(140, 0)
            };

            Control profileContainer = new Control
            {
                Size   = new Vector2(243, 70),
                Anchor = Orientation.Top
            };

            profileContainer.AddChild(new Label
            {
                Text       = Locale.Resource.GenProfile,
                AutoSize   = AutoSizeMode.Full,
                Font       = Fonts.Default,
                Anchor     = Orientation.TopLeft,
                Background = null,
            });
            profiles = new StoneDropDownBar
            {
                Position = new Vector2(0, 15),
                Anchor   = Orientation.TopLeft
            };
            profileContainer.AddChild(profiles);
            PopuplateProfiles();

            Control newRemoveFlow = new FlowLayout
            {
                HorizontalFill = true,
                Newline        = false,
                AutoSize       = true,
                Position       = new Vector2(0, 45),
                Anchor         = Orientation.TopRight,
            };

            profileContainer.AddChild(newRemoveFlow);

            var newProfile = new ClickableTextButton
            {
                Text       = Locale.Resource.GenNew,
                AutoSize   = AutoSizeMode.Full,
                TextAnchor = Orientation.Center,
                Margin     = new System.Windows.Forms.Padding(3, 0, 3, 0)
            };

            newProfile.Click += new EventHandler(newProfile_Click);
            newRemoveFlow.AddChild(newProfile);

            var removeProfile = new ClickableTextButton
            {
                Text       = Locale.Resource.GenRemove,
                AutoSize   = AutoSizeMode.Full,
                TextAnchor = Orientation.Center,
                Margin     = new System.Windows.Forms.Padding(3, 0, 3, 0)
            };

            removeProfile.Click += new EventHandler(removeProfile_Click);
            newRemoveFlow.AddChild(removeProfile);

            var start = new LargeStoneButton
            {
                Text     = Locale.Resource.GenLogin,
                Position = new Vector2(0, 90),
                Anchor   = Orientation.Top,
                Size     = new Vector2(230, 62)
            };

            start.Click += new EventHandler(start_Click);
            right.AddChild(start);

            FlowLayout leftFlow = new FlowLayout
            {
                AutoSize       = true,
                HorizontalFill = false,
                Newline        = false,
                Anchor         = Orientation.Center
            };

            left.AddChild(leftFlow);


            var support = new StoneButton
            {
                Text   = Locale.Resource.GenSupport,
                Margin = new System.Windows.Forms.Padding(5)
            };

            support.Click += new EventHandler(support_Click);
            leftFlow.AddChild(support);

            var options = new StoneButton
            {
                Text   = Locale.Resource.GenOptions,
                Margin = new System.Windows.Forms.Padding(5)
            };

            options.Click += new EventHandler(options_Click);
            leftFlow.AddChild(options);

            var quit = new StoneButton
            {
                Text   = Locale.Resource.GenQuit,
                Margin = new System.Windows.Forms.Padding(5)
            };

            quit.Click += new EventHandler(quit_Click);
            leftFlow.AddChild(quit);

            right.AddChild(profileContainer);
            AddChild(left);

            AddChild(new Control
            {
                Background = new StretchingImageGraphic
                {
                    Texture = new TextureConcretizer
                    {
                        TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255))
                    },
                    SizeMode = SizeMode.AutoAdjust
                },
                Dock = System.Windows.Forms.DockStyle.Left,
                Size = new Vector2(1, 1)
            });

            AddChild(right);
        }
        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);
        }
Ejemplo n.º 4
0
        public SelectProfileControl()
        {
            Background = InterfaceScene.DefaultFormBorder;
            Size = new Vector2(500, 200);
            Padding = new System.Windows.Forms.Padding(20);
            Background.Alpha = 0.2f;

            Control right = new Control
            {
                Dock = System.Windows.Forms.DockStyle.Fill
            };
            Control left = new Control
            {
                Dock = System.Windows.Forms.DockStyle.Left,
                Size = new Vector2(140, 0)
            };

            Control profileContainer = new Control
            {
                Size = new Vector2(243, 70),
                Anchor = Orientation.Top
            };
            profileContainer.AddChild(new Label
            {
                Text = Locale.Resource.GenProfile,
                AutoSize = AutoSizeMode.Full,
                Font = Fonts.Default,
                Anchor = Orientation.TopLeft,
                Background = null,
            });
            profiles = new StoneDropDownBar
            {
                Position = new Vector2(0, 15),
                Anchor = Orientation.TopLeft
            };
            profileContainer.AddChild(profiles);
            PopuplateProfiles();

            Control newRemoveFlow = new FlowLayout
            {
                HorizontalFill = true,
                Newline = false,
                AutoSize = true,
                Position = new Vector2(0, 45),
                Anchor = Orientation.TopRight,
            };
            profileContainer.AddChild(newRemoveFlow);

            var newProfile = new ClickableTextButton
            {
                Text = Locale.Resource.GenNew,
                AutoSize = AutoSizeMode.Full,
                TextAnchor = Orientation.Center,
                Margin = new System.Windows.Forms.Padding(3, 0, 3, 0)
            };
            newProfile.Click += new EventHandler(newProfile_Click);
            newRemoveFlow.AddChild(newProfile);

            var removeProfile = new ClickableTextButton
            {
                Text = Locale.Resource.GenRemove,
                AutoSize = AutoSizeMode.Full,
                TextAnchor = Orientation.Center,
                Margin = new System.Windows.Forms.Padding(3, 0, 3, 0)
            };
            removeProfile.Click += new EventHandler(removeProfile_Click);
            newRemoveFlow.AddChild(removeProfile);

            var start = new LargeStoneButton
            {
                Text = Locale.Resource.GenLogin,
                Position = new Vector2(0, 90),
                Anchor = Orientation.Top,
                Size = new Vector2(230, 62)
            };
            start.Click += new EventHandler(start_Click);
            right.AddChild(start);

            FlowLayout leftFlow = new FlowLayout
            {
                AutoSize = true,
                HorizontalFill = false,
                Newline = false,
                Anchor = Orientation.Center
            };
            left.AddChild(leftFlow);

            var support = new StoneButton
            {
                Text = Locale.Resource.GenSupport,
                Margin = new System.Windows.Forms.Padding(5)
            };
            support.Click += new EventHandler(support_Click);
            leftFlow.AddChild(support);

            var options = new StoneButton
            {
                Text = Locale.Resource.GenOptions,
                Margin = new System.Windows.Forms.Padding(5)
            };
            options.Click += new EventHandler(options_Click);
            leftFlow.AddChild(options);

            var quit = new StoneButton
            {
                Text = Locale.Resource.GenQuit,
                Margin = new System.Windows.Forms.Padding(5)
            };
            quit.Click += new EventHandler(quit_Click);
            leftFlow.AddChild(quit);

            right.AddChild(profileContainer);
            AddChild(left);

            AddChild(new Control
            {
                Background = new StretchingImageGraphic
                {
                    Texture = new TextureConcretizer
                    {
                        TextureDescription = new Graphics.Software.Textures.SingleColorTexture(System.Drawing.Color.FromArgb(50, 255, 255, 255))
                    },
                    SizeMode = SizeMode.AutoAdjust
                },
                Dock = System.Windows.Forms.DockStyle.Left,
                Size = new Vector2(1, 1)
            });

            AddChild(right);
        }