protected override void OnConstruct()
 {
     base.OnConstruct();
     ClearChildren();
     details.Size = new SlimDX.Vector2(Size.X, details.Size.Y);
     AddChild(new Label
     {
         Text = "Program Configuration Warnings",
         Size = new SlimDX.Vector2(Size.X, 20)
     });
     AddChild(details);
     float y = details.Size.Y + details.Position.Y;
     foreach (var warn in Common.ProgramConfigurationInformation.Warnings)
     {
         var v = warn;
         Button b;
         AddChild(b = new Button
         {
             Text = "[" + v.Module + "] " + v.Text,
             Size = new SlimDX.Vector2(Size.X, 20),
             Position = new SlimDX.Vector2(0, y),
             TextAnchor = Orientation.Left
         });
         b.MouseEnter += new EventHandler((o, e) => details.Text =
             "Name: " + v.Text + "\n" +
             "Module: " + v.Module + "\nImportance: " + v.Importance + "\nType: " + v.Type +
                 "\nDescription: " + v.Description);
         b.MouseLeave += new EventHandler((o, e) => details.Text = "");
         y += 20;
     }
     Size = new SlimDX.Vector2(Size.X, y);
 }
        public override void Init()
        {
            Application.Log("Program.Init");

            ClientXmlFormatterBinder.Instance.BindClientTypes();

            LoadControls();
            SignalEvent(ProgramEventType.ProgramStarted);

#if DEBUG
            RedGate.Profiler.UserEvents.ProfilerEvent.SignalEvent("Init start");
#endif
            Content.ContentPath = Program.DataPath;
            Game.Map.GameEntity.ContentPool = Content;
            
            Bitmap b = new Bitmap(Common.FileSystem.Instance.OpenRead(Content.ContentPath + "/Interface/Cursors/MenuCursor1.png"));
            Graphics.Cursors.Arrow = NeutralCursor = Cursor = new System.Windows.Forms.Cursor(b.GetHicon());

            Graphics.Interface.InterfaceScene.DefaultFont = Fonts.Default;

            if (Settings.DeveloperMainMenu)
            {
                MainMenuDefault = MainMenuType.DeveloperMainMenu;
                ProfileMenuDefault = ProfileMenuType.DeveloperMainMenu;
            }
            else if (Settings.ChallengeMapMode)
            {
                MainMenuDefault = MainMenuType.ChallengeMap;
                ProfileMenuDefault = ProfileMenuType.ChallengeMap;
            }
            else
            {
                MainMenuDefault = MainMenuType.MainMenu;
                ProfileMenuDefault = ProfileMenuType.ProfileMenu;
            }

            if (Settings.DisplaySettingsForm)
            {
                OpenDeveloperSettings();
            }
            
            //Graphics.Content.DefaultModels.Load(Content, Device9);
            InterfaceScene = new Graphics.Interface.InterfaceScene();
            InterfaceScene.View = this;
            ((Graphics.Interface.Control)InterfaceScene.Root).Size = new Vector2(Program.Settings.GraphicsDeviceSettings.Resolution.Width, Program.Settings.GraphicsDeviceSettings.Resolution.Height);
            InterfaceScene.Add(Interface);
            InterfaceScene.Add(AchievementsContainer);
            InterfaceScene.Add(PopupContainer);
            InterfaceScene.Add(FeedackOnlineControl);
            if (!String.IsNullOrEmpty(Program.Settings.BetaSurveyLink))
            {
                var u = new Uri(Program.Settings.BetaSurveyLink);
                var s = u.ToString();
                if (!u.IsFile)
                {
                    Button survey = new Button
                    {
                        Text = "Beta survey",
                        Anchor = Orientation.BottomRight,
                        Position = new Vector2(10, 50),
                        Size = new Vector2(110, 30)
                    };
                    survey.Click += new EventHandler((o, e) =>
                    {
                        Util.StartBrowser(s);
                    });
                    InterfaceScene.Add(survey);
                }
            }
            InterfaceScene.Add(Tooltip);
            InterfaceScene.Add(MouseCursor);
            InputHandler = InterfaceManager = new Graphics.Interface.InterfaceManager { Scene = InterfaceScene };

            // Adjust the main char skin mesh; remove the dummy weapons
            var mainCharSkinMesh = Program.Instance.Content.Acquire<SkinnedMesh>(
                new SkinnedMeshFromFile("Models/Units/MainCharacter1.x"));
            mainCharSkinMesh.RemoveMeshContainerByFrameName("sword1");
            mainCharSkinMesh.RemoveMeshContainerByFrameName("sword2");
            mainCharSkinMesh.RemoveMeshContainerByFrameName("rifle");

            try
            {
                SoundManager = new Client.Sound.SoundManager(Settings.SoundSettings.AudioDevice, Settings.SoundSettings.Engine, Settings.SoundSettings.MinMaxDistance.X, Settings.SoundSettings.MinMaxDistance.Y, Common.FileSystem.Instance.OpenRead);
                SoundManager.Settings = Settings.SoundSettings;
                SoundManager.ContentPath = Program.DataPath + "/Sound/";
                SoundManager.Muted = Settings.SoundSettings.Muted;
                SoundManager.LoadSounds(!Settings.ChallengeMapMode);
                if (SoundLoaded != null)
                    SoundLoaded(SoundManager, null);

                SoundManager.Volume = Settings.SoundSettings.MasterVolume;

                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Ambient).Volume = Settings.SoundSettings.AmbientVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Music).Volume = Settings.SoundSettings.MusicVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.SoundEffects).Volume = Settings.SoundSettings.SoundVolume;
                SoundManager.GetSoundGroup(Client.Sound.SoundGroups.Interface).Volume = Settings.SoundSettings.SoundVolume;
            }
            catch (Client.Sound.SoundManagerException ex)
            {
                SendSoundFailureLog(ex);
                SoundManager = new Client.Sound.DummySoundManager();
                System.Windows.Forms.MessageBox.Show(
                    Locale.Resource.ErrorFailInitSoundDevice,
                    Locale.Resource.ErrorFailInitSoundDeviceTitle,
                    System.Windows.Forms.MessageBoxButtons.OK, 
                    System.Windows.Forms.MessageBoxIcon.Error);
            }

            //StateManager = new DummyDevice9StateManager(Device9);
            StateManager = new Device9StateManager(Device9);
            InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9)
            {
                Scene = InterfaceScene,
                StateManager = StateManager,
#if PROFILE_INTERFACERENDERER
                PeekStart = () => ClientProfilers.IRPeek.Start(),
                PeekEnd = () => ClientProfilers.IRPeek.Stop()
#endif
            };
            InterfaceRenderer.Initialize(this);

            BoundingVolumesRenderer = new BoundingVolumesRenderer
            {
                StateManager = Program.Instance.StateManager,
                View = Program.Instance
            };

#if BETA_RELEASE
            Client.Settings defaultSettings = new Settings();
            ValidateSettings("", defaultSettings, Settings);
#endif

            if (Settings.QuickStartMap != null && Settings.QuickStartMap != "" &&
                Common.FileSystem.Instance.FileExists("Maps/" + Settings.QuickStartMap + ".map"))
            {
                LoadNewState(new Game.Game("Maps/" + Settings.QuickStartMap));
                return;
            }

            UpdateFeedbackOnlineControl();
            
            System.Net.NetworkInformation.Ping p = new System.Net.NetworkInformation.Ping();
            p.PingCompleted += new System.Net.NetworkInformation.PingCompletedEventHandler((o, e) =>
            {
                FeedbackOnline = e.Reply != null && 
                    e.Reply.Status == System.Net.NetworkInformation.IPStatus.Success;
                UpdateFeedbackOnlineControl();
            });
            var statsUri = new Uri(Settings.StatisticsURI);
            p.SendAsync(statsUri.DnsSafeHost, null);

            if (Settings.DeveloperMainMenu)
                InitDeveloperMenu();
            else if (Settings.ChallengeMapMode)
                InitChallengeMapMode();
            else
                InitFullGame();

            EnterMainMenuState(false);

            if(WindowMode == WindowMode.Fullscreen)
                MouseCursor.BringToFront();

            AskAboutUpdate();

            if (!String.IsNullOrEmpty(Program.Settings.StartupMessage))
            {
                Dialog.Show(Program.Settings.StartupMessageTitle ?? "", Program.Settings.StartupMessage);
            }


            fixedFrameStepSW.Start();

            Application.Log("Program.Init completed");
#if DEBUG
            RedGate.Profiler.UserEvents.ProfilerEvent.SignalEvent("Init end");
#endif
        }
        public override void Init()
        {
            Content.ContentPath = "Data";

            InterfaceScene = new Graphics.Interface.InterfaceScene(this);

            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size = new Vector2(100, 20),
                Text = "TopRight",
                Anchor = Orientation.TopRight
            });

            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size = new Vector2(100, 20),
                Text = "BottomLeft",
                Anchor = Orientation.BottomLeft
            });

            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size = new Vector2(100, 20),
                Text = "BottomRight",
                Anchor = Orientation.BottomRight
            });

            InterfaceScene.Add(new Graphics.Interface.Button
            {
                Size = new Vector2(100, 20),
                Text = "Button",
                Anchor = Orientation.Center
            });

            InterfaceScene.Add(cb = new Graphics.Interface.Checkbox
            {
                Size = new Vector2(100, 20),
                Text = "Checkbox",
                Anchor = Orientation.Center,
                Position = new Vector2(0, 40)
            });

            InterfaceScene.Add(pb = new Graphics.Interface.ProgressBar
            {
                Size = new Vector2(100, 100),
                Text = "Button",
                Anchor = Orientation.Bottom,
                MaxValue = 100,
                Value = 50,
                ProgressGraphic = new ImageGraphic
                {
                    Texture = new TextureFromFile("cornellbox3.png"),
                        //new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(Color.Red) },
                    TextureAnchor = Orientation.BottomLeft
                },
                ProgressOrientation = Graphics.Interface.ProgressOrientation.BottomToTop
            });

            InterfaceScene.Add(dpb = new Graphics.Interface.DeltaProgressBar
            {
                Size = new Vector2(140, 10),
                Anchor = Orientation.Center,
                MaxValue = 100,
                Value = 70,
                Position = new Vector2(0, -30),
                ProgressOrientation = Graphics.Interface.ProgressOrientation.LeftToRight
            });

            Button bb;
            InterfaceScene.Add(bb = new Button
            {
                Size = new Vector2(50, 20),
                Text = "-",
                Anchor = Orientation.Center,
                Position = new Vector2(-30, -60)
            });
            bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value - 20, 0, 100); };
            InterfaceScene.Add(bb = new Button
            {
                Size = new Vector2(50, 20),
                Text = "+",
                Anchor = Orientation.Center,
                Position = new Vector2(30, -60)
            });
            bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value + 20, 0, 100); };

            InterfaceScene.Add(new Graphics.Interface.Console
            {
                Anchor = Orientation.Bottom,
                Position = new Vector2(0, 100),
                Size = new Vector2(400, 100)
            });

            var f = new Graphics.Interface.Form
            {
                Size = new Vector2(300, 300)
            };
            InterfaceScene.Add(f);
            b = new Graphics.Interface.Button
            {
                Size = new Vector2(100, 20),
                Text = "TopLeft",
                Anchor = Orientation.TopLeft
            };
            f.AddChild(b);
            Control checker;
            InterfaceScene.Add(checker = new Control
            {
                Background = new ImageGraphic
                {
                    Size = new Vector2(100, 100),
                    Texture = new TextureFromFile("checker.png")
                },
                Size = new Vector2(100, 100),
                Position = new Vector2(10, 30),
                Anchor = Orientation.TopRight,
                Clickable = true,
                PickingLocalBounding = new Common.Bounding.Chain
                {
                    Boundings = new object[]
                    {
                        new BoundingBox(Vector3.Zero, new Vector3(1, 1, 0)),
                        new MetaBoundingImageGraphic
                        {
                            Graphic = new ImageGraphic
                            {
                                Size = new Vector2(100, 100),
                                Texture = new TextureFromFile("checker.png")
                            },
                        }
                    },
                    Shallow = true
                }
            });
            InterfaceScene.Add(popupContainer);
            InterfaceScene.Add(new Form
            {
                Anchor = Orientation.Right,
                Size = new Vector2(100, 100),
                ControlBox = true
            });

            tt = new Graphics.Interface.ToolTip();
            tt.SetToolTip(pb, "This is a progress bar");
            tt.SetToolTip(checker, "Checker");
            InterfaceScene.Add(tt);

            if (Direct3DVersion == Direct3DVersion.Direct3D10)
                InterfaceRenderer = new Graphics.Interface.InterfaceRenderer10(Device10)
                { Scene = InterfaceScene };
            else
                InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9)
                { Scene = InterfaceScene, StateManager = new Device9StateManager(Device9) };
            InterfaceRenderer.Initialize(this);
            InputHandler = Manager = new Graphics.Interface.InterfaceManager { Scene = InterfaceScene };
            //bvr = new BoundingVolumesRenderer
            //{
            //    View = this,
            //    StateManager = sm
            //};
        }
        public TestMaps()
        {
            Anchor = Orientation.Right;
            Position = new Vector2(40, 0);
            Size = new Vector2(500, 700);
            ControlBox = false;
            Moveable = true;

            var g = new Grid
            {
                Size = Size,
                NWidth = (int)(Size.X / 200),
                NHeight = (int)(Size.Y / 20),
                Position = new Vector2(0, 0),
                Anchor = Orientation.TopLeft
            };

            SortedDictionary<String, System.Reflection.MethodInfo> ms = new SortedDictionary<string, System.Reflection.MethodInfo>();

            foreach (var v in typeof(Game.TestMaps).GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public))
                ms.Add(v.Name, v);
            foreach (var k in ms)
            {
                var button = new Button
                {
                    Text = k.Value.Name,
                };
                string details = "";
                foreach (var a in Attribute.GetCustomAttributes(k.Value, true))
                    if (a is System.ComponentModel.DescriptionAttribute)
                    {
                        details = ((System.ComponentModel.DescriptionAttribute)a).Description;
                        break;
                    }
                var m = k.Value;
                button.Click += new EventHandler((o, e) =>
                {
                    Program.Instance.ProgramState = new Game.Game(
                        //() => { return
                            (Game.Map.Map)m.Invoke(null, new object[] { Program.Instance.Device9 })
                        //; }
                        );
                });
                button.MouseEnter += new EventHandler((o, e) =>
                {
                    detailsBox.Text = details;
                });
                button.MouseLeave += new EventHandler((o, e) =>
                {
                    detailsBox.Text = "";
                });
                g.AddChild(button);
            }
            AddChild(g);
            AddChild(detailsBox);
            detailsBox.Size = new Vector2(Size.X - 40, 200);
        }
        public DeveloperMainMenuForm()
        {
            Anchor = Orientation.Left;
            Position = new Vector2(40, 0);
            Size = new Vector2(500, 700);
            ControlBox = false;
            Moveable = true;

            var g = new Grid
            {
                Size = Size,
                NWidth = (int)(Size.X / 200),
                NHeight = (int)(Size.Y / 20),
                Position = new Vector2(0, 0),
                Anchor = Orientation.TopLeft
            };
            AddChild(g);

            foreach (String s in Common.FileSystem.Instance.DirectoryGetFiles("Maps", "*"))
                    if (s.EndsWith(".map"))
                    {
                        string map = s.Substring("Maps/".Length);
                        var button = new Button
                        {
                            Text = map.Substring(0, map.Length - 4),
                        };
                        button.Click += new EventHandler((o, e) =>
                        {
                            Program.Instance.ProgramState = new Game.Game("Maps/" + map);
                        });
                        g.AddChild(button);

                        if (Program.Settings.DisplayMapNamesInDeveloperMenu)
                        {
                            Game.Map.MapSettings gameMap;
                            if (!loadedMaps.TryGetValue(s, out gameMap) &&
                                global::Common.FileSystem.Instance.FileExists(s))
                            {
                                try
                                {
                                    gameMap = loadedMaps[s] = Client.Game.Map.MapPersistence.Instance.LoadSettings(s);
                                }
                                catch { }
                            }
                            if (gameMap != null)
                                Program.Instance.Tooltip.SetToolTip(button, gameMap.Name);
                        }
                    }
        }
        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);
        }
Esempio n. 7
0
        public override void Init()
        {
            Content.ContentPath = "Data";

            InterfaceScene = new Graphics.Interface.InterfaceScene(this);


            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size   = new Vector2(100, 20),
                Text   = "TopRight",
                Anchor = Orientation.TopRight
            });

            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size   = new Vector2(100, 20),
                Text   = "BottomLeft",
                Anchor = Orientation.BottomLeft
            });

            InterfaceScene.Add(new Graphics.Interface.TextBox
            {
                Size   = new Vector2(100, 20),
                Text   = "BottomRight",
                Anchor = Orientation.BottomRight
            });

            InterfaceScene.Add(new Graphics.Interface.Button
            {
                Size   = new Vector2(100, 20),
                Text   = "Button",
                Anchor = Orientation.Center
            });

            InterfaceScene.Add(cb = new Graphics.Interface.Checkbox
            {
                Size     = new Vector2(100, 20),
                Text     = "Checkbox",
                Anchor   = Orientation.Center,
                Position = new Vector2(0, 40)
            });

            InterfaceScene.Add(pb = new Graphics.Interface.ProgressBar
            {
                Size            = new Vector2(100, 100),
                Text            = "Button",
                Anchor          = Orientation.Bottom,
                MaxValue        = 100,
                Value           = 50,
                ProgressGraphic = new ImageGraphic
                {
                    Texture = new TextureFromFile("cornellbox3.png"),
                    //new TextureConcretizer { TextureDescription = new Graphics.Software.Textures.SingleColorTexture(Color.Red) },
                    TextureAnchor = Orientation.BottomLeft
                },
                ProgressOrientation = Graphics.Interface.ProgressOrientation.BottomToTop
            });

            InterfaceScene.Add(dpb = new Graphics.Interface.DeltaProgressBar
            {
                Size                = new Vector2(140, 10),
                Anchor              = Orientation.Center,
                MaxValue            = 100,
                Value               = 70,
                Position            = new Vector2(0, -30),
                ProgressOrientation = Graphics.Interface.ProgressOrientation.LeftToRight
            });

            Button bb;

            InterfaceScene.Add(bb = new Button
            {
                Size     = new Vector2(50, 20),
                Text     = "-",
                Anchor   = Orientation.Center,
                Position = new Vector2(-30, -60)
            });
            bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value - 20, 0, 100); };
            InterfaceScene.Add(bb = new Button
            {
                Size     = new Vector2(50, 20),
                Text     = "+",
                Anchor   = Orientation.Center,
                Position = new Vector2(30, -60)
            });
            bb.Click += (sender, ea) => { dpb.Value = Common.Math.Clamp(dpb.Value + 20, 0, 100); };

            InterfaceScene.Add(new Graphics.Interface.Console
            {
                Anchor   = Orientation.Bottom,
                Position = new Vector2(0, 100),
                Size     = new Vector2(400, 100)
            });

            var f = new Graphics.Interface.Form
            {
                Size = new Vector2(300, 300)
            };

            InterfaceScene.Add(f);
            b = new Graphics.Interface.Button
            {
                Size   = new Vector2(100, 20),
                Text   = "TopLeft",
                Anchor = Orientation.TopLeft
            };
            f.AddChild(b);
            Control checker;

            InterfaceScene.Add(checker = new Control
            {
                Background = new ImageGraphic
                {
                    Size    = new Vector2(100, 100),
                    Texture = new TextureFromFile("checker.png")
                },
                Size                 = new Vector2(100, 100),
                Position             = new Vector2(10, 30),
                Anchor               = Orientation.TopRight,
                Clickable            = true,
                PickingLocalBounding = new Common.Bounding.Chain
                {
                    Boundings = new object[]
                    {
                        new BoundingBox(Vector3.Zero, new Vector3(1, 1, 0)),
                        new MetaBoundingImageGraphic
                        {
                            Graphic = new ImageGraphic
                            {
                                Size    = new Vector2(100, 100),
                                Texture = new TextureFromFile("checker.png")
                            },
                        }
                    },
                    Shallow = true
                }
            });
            InterfaceScene.Add(popupContainer);
            InterfaceScene.Add(new Form
            {
                Anchor     = Orientation.Right,
                Size       = new Vector2(100, 100),
                ControlBox = true
            });

            tt = new Graphics.Interface.ToolTip();
            tt.SetToolTip(pb, "This is a progress bar");
            tt.SetToolTip(checker, "Checker");
            InterfaceScene.Add(tt);

            if (Direct3DVersion == Direct3DVersion.Direct3D10)
            {
                InterfaceRenderer = new Graphics.Interface.InterfaceRenderer10(Device10)
                {
                    Scene = InterfaceScene
                }
            }
            ;
            else
            {
                InterfaceRenderer = new Graphics.Interface.InterfaceRenderer9(Device9)
                {
                    Scene = InterfaceScene, StateManager = new Device9StateManager(Device9)
                }
            };
            InterfaceRenderer.Initialize(this);
            InputHandler = Manager = new Graphics.Interface.InterfaceManager {
                Scene = InterfaceScene
            };
            //bvr = new BoundingVolumesRenderer
            //{
            //    View = this,
            //    StateManager = sm
            //};
        }

        Graphics.Interface.ToolTip tt;
        Graphics.Interface.Button b;
        public ChallengeMapMenuControl()
        {
            Dock = System.Windows.Forms.DockStyle.Fill;
            AddChild(new ChallengeBackgroundControl());
            AddChild(new GameLogoChallengeImage
            {
                Anchor = Orientation.Top,
                Position = new Vector2(-15, 50)
            });

            Control profilePanel = new FlowLayout
            {
                HorizontalFill = true,
                Newline = false,
                AutoSize = true,
                Anchor = Orientation.BottomLeft,
                Position = new Vector2(10, 10),
                Size = new Vector2(400, 20),
                Origin = FlowOrigin.BottomRight
            };
            AddChild(profilePanel);
            Control changeProfile = new ClickableTextButton
            {
                Text = "(Change)",
                AutoSize = AutoSizeMode.Full,
                Background = null,
            };
            profilePanel.AddChild(changeProfile);
            changeProfile.Click += new EventHandler(profile_Click);
            profilePanel.AddChild(profileName);

            Control buttonsPanel = new Control
            {
                Background = InterfaceScene.DefaultFormBorder,
                Size = new Vector2(400, 150),
                Anchor = Orientation.Top,
                Position = new Vector2(0, 500),
                Padding = new System.Windows.Forms.Padding(10)
            };
            AddChild(buttonsPanel);

            if (!String.IsNullOrEmpty(Program.Settings.ChallengeSurveyLink))
            {
                var u = new Uri(Program.Settings.ChallengeSurveyLink);
                var s = u.ToString();
                if (!u.IsFile)
                {
                    //Control feedback = new Control
                    //{
                    //    Background = InterfaceScene.DefaultFormBorder,
                    //    Anchor = Orientation.Top,
                    //    Position = new Vector2(300, 500),
                    //    Size=  new Vector2(300, 100),
                    //    Padding = new System.Windows.Forms.Padding(10)
                    //};
                    //AddChild(feedback);
                    //feedback.AddChild(new TextBox
                    //{
                    //    Text = "Tell us what you think of the game!",
                    //    Clickable = false,
                    //    Background = null,
                    //    AutoSize = AutoSizeMode.Full,
                    //});
                    Control survey = new ClickableTextButton
                    {
                        Text = "Tell us what you think!",
                        Anchor = Orientation.Right,
                        AutoSize = AutoSizeMode.Full,
                        Background = null,
                        Position = new Vector2(25, 45)
                    };
                    survey.Click += new EventHandler((o, e) =>
                    {
                        Util.StartBrowser(s);
                    });
                    buttonsPanel.AddChild(survey);
                }
            }

            ButtonBase challenge = new LargeStoneButton
            {
                Anchor = Orientation.Right,
                Position = new Vector2(25, 0),
                Text = "Play"
            };
            buttonsPanel.AddChild(challenge);
            challenge.Click += new EventHandler(challenge_Click);

            ButtonBase tutorial = new StoneButton
            {
                Anchor = Orientation.TopLeft,
                Position = new Vector2(0, 0),
                Text = "Tutorial"
            };
            buttonsPanel.AddChild(tutorial);
            tutorial.Click += new EventHandler(tutorial_Click);

            ButtonBase options = new StoneButton
            {
                Anchor = Orientation.TopLeft,
                Position = new Vector2(0, 45),
                Text = "Options"
            };
            buttonsPanel.AddChild(options);
            options.Click += new EventHandler(options_Click);

            ButtonBase exit = new StoneButton
            {
                Anchor = Orientation.TopLeft,
                Position = new Vector2(0, 90),
                Text = "Exit"
            };
            buttonsPanel.AddChild(exit);
            exit.Click += new EventHandler(exit_Click);

            if (!String.IsNullOrEmpty(Program.Settings.HallOfFameAddress))
            {
                var u = new Uri(Program.Settings.HallOfFameAddress);
                var s = u.ToString();
                if (!u.IsFile)
                {
                    Control hof = new Button
                    {
                        Anchor = Orientation.Top,
                        Position = new Vector2(0, 655),
                        HoverTexture = new TextureFromFile("Interface/Common/HallOfFame2Mouseover1.png") { DontScale = true },
                        NormalTexture = new TextureFromFile("Interface/Common/HallOfFame2.png") { DontScale = true },
                        ClickTexture = new TextureFromFile("Interface/Common/HallOfFame2.png") { DontScale = true },
                        Background = new ImageGraphic
                        {
                        },
                        Size = new Vector2(260, 38)
                    };
                    hof.Click += new EventHandler((o, e) =>
                    {
                        Util.StartBrowser(s);
                    });
                    AddChild(hof);
                }
            }

            fader = new Fader { State = FadeState.FadedOut };
            AddChild(fader);
            Updateable = true;
        }
        public RatingControl()
        {
            Anchor = Orientation.Left;
            normalTexture = new TextureFromFile("Interface/Common/StarGray.png") { DontScale = true };
            selectedTexture = new TextureFromFile("Interface/Common/Star.png") { DontScale = true };
            chosenTexture = new TextureFromFile("Interface/Common/StarSelected.png") { DontScale = true };

            for (int j = 0; j < 5; j++)
            {
                Button b = new Button
                {
                    Position = new Vector2(25 * j + (j + 1) * 2, 0),
                    Size = new Vector2(25, 25),
                    Anchor = Orientation.Left,
                    Background = new ImageGraphic
                    {
                        SizeMode = SizeMode.AutoAdjust,
                        Texture = normalTexture
                    },
                    Tag = j,
                    NormalTexture = null,
                    HoverTexture = null,
                    ClickTexture = null
                };
                buttons[j] = b;
                b.MouseEnter += new EventHandler((oo, ee) =>
                {
                    hoverScore = (int)b.Tag + 1;
                    InvalidateScore();
                });
                b.MouseLeave += new EventHandler((oo, ee) =>
                {
                    hoverScore = 0;
                    InvalidateScore();
                });
                b.Click += new EventHandler((oo, ee) =>
                {
                    RatedScore = (int)b.Tag + 1;
                    InvalidateScore();
                });
                AddChild(b);
            }
        }
        protected override void OnConstruct()
        {
            base.OnConstruct();
            ClearChildren();

            AddChild(title);

            int y = 0;
            int yStep = 70;
            int x = 10;

            int weaponPrice = 1000;

            Action<string, string, bool, Action> addWeapon = (text, iconName, available, purchase) =>
            {
                var pos = new Vector2(x + 13, y + 60);
                var size = new Vector2(198, 70);
                if (available)
                {
                    var cont = new Control
                    {
                        Clickable = true,
                        Position = pos,
                        Background = new ImageGraphic
                        {
                            Texture = new TextureFromFile("Interface/Common/WeaponsBackground1.png") { DontScale = true }
                        },
                        Size = new Vector2(198, 70)
                    };
                    var weapon = new Control
                    {
                        Background = new ImageGraphic
                        {
                            Texture = new TextureFromFile("Interface/Common/" + iconName + "IconOn1.png") { DontScale = true },
                        },
                        Position = new Vector2(15, 14),
                        Size = new Vector2(169, 42)
                    };
                    Program.Instance.Tooltip.SetToolTip(cont, String.Format(Locale.Resource.MenuWepAlreadyBought, text));
                    cont.AddChild(weapon);
                    AddChild(cont);
                }
                else
                {
                    var cont = new Control
                    {
                        Clickable = true,
                        Position = pos,
                        Background = new ImageGraphic
                        {
                            Texture = new TextureFromFile("Interface/Common/WeaponsBackground1.png") { DontScale = true }
                        },
                        Size = new Vector2(198, 70)
                    };
                    var weapon = new Button
                    {
                        Position = new Vector2(15, 14),
                        Size = new Vector2(169, 42),
                        Background = new ImageGraphic
                        {
                            Texture = new TextureFromFile("Interface/Common/" + iconName + "IconOff1.png") { DontScale = true },
                        },
                    };
                    weapon.NormalTexture = new TextureFromFile("Interface/Common/" + iconName + "IconOff1.png") { DontScale = true };
                    weapon.HoverTexture = new TextureFromFile("Interface/Common/" + iconName + "IconOn1.png") { DontScale = true };
                    weapon.ClickTexture = new TextureFromFile("Interface/Common/" + iconName + "IconSelected1.png") { DontScale = true };
                    weapon.Click += new EventHandler((o, e) =>
                    {
                        Dialog d = new Dialog
                        {
                            LargeWindow = false
                        };
                        if (Program.Instance.Profile.SilverCoins < weaponPrice)
                        {
                            d.Title = Locale.Resource.MenuNotEnoughCoinsTitle;
                            d.Text = Locale.Resource.MenuNotEnoughSilver;
                            d.MessageBoxButtons = System.Windows.Forms.MessageBoxButtons.OK;
                        }
                        else
                        {
                            d.Text = String.Format(Locale.Resource.MenuConfirmPurchase, text, weaponPrice);
                            d.Title = Locale.Resource.MenuConfirmPurchaseTitle;
                            d.MessageBoxButtons = System.Windows.Forms.MessageBoxButtons.YesNo;
                            d.Closed += new EventHandler((o2, e2) =>
                            {
                                if (d.DialogResult == System.Windows.Forms.DialogResult.No) return;

                                if (Program.Instance.Profile.SilverCoins >= weaponPrice)
                                {
                                    Program.Instance.Profile.SilverCoins -= weaponPrice;
                                    purchase();
                                    Program.Instance.SignalEvent(ProgramEventType.PurchasedWeapon);
                                    Program.Instance.SoundManager.GetSFX(Client.Sound.SFX.BuyWeapon1).Play(new Sound.PlayArgs());
                                    Program.Instance.Profile.Save();
                                }
                            });
                        }

                        d.Closed += new EventHandler((o2, e2) =>
                        {
                            Program.Instance.Interface.RemoveFader();
                        });
                        Program.Instance.Interface.AddFader();
                        Program.Instance.Interface.AddChild(d);
                    });
                    Program.Instance.Tooltip.SetToolTip(weapon,
                        String.Format(Locale.Resource.MenuWeaponPrice, text, weaponPrice));
                    cont.AddChild(weapon);
                    AddChild(cont);
                }
                y += yStep;
            };
            addWeapon(Util.GetLocaleResourceString(MeleeWeapons.Sword) + "\n\n" + Locale.Resource.MenuSwordDesc, WeaponsInfo.GetIconBaseName(MeleeWeapons.Sword), (Program.Instance.Profile.AvailableMeleeWeapons & MeleeWeapons.Sword) != 0, () => Program.Instance.Profile.AvailableMeleeWeapons |= MeleeWeapons.Sword);
            addWeapon(Util.GetLocaleResourceString(MeleeWeapons.MayaHammer) + "\n\n" + Locale.Resource.MenuHammerDesc, WeaponsInfo.GetIconBaseName(MeleeWeapons.MayaHammer), (Program.Instance.Profile.AvailableMeleeWeapons & MeleeWeapons.MayaHammer) != 0, () => Program.Instance.Profile.AvailableMeleeWeapons |= MeleeWeapons.MayaHammer);
            addWeapon(Util.GetLocaleResourceString(MeleeWeapons.Spear) + "\n\n" + Locale.Resource.MenuSpearDesc, WeaponsInfo.GetIconBaseName(MeleeWeapons.Spear), (Program.Instance.Profile.AvailableMeleeWeapons & MeleeWeapons.Spear) != 0, () => Program.Instance.Profile.AvailableMeleeWeapons |= MeleeWeapons.Spear);

            y = 0;
            x = 220;
            addWeapon(Util.GetLocaleResourceString(RangedWeapons.Rifle) + "\n\n" + Locale.Resource.MenuShotgunDesc, WeaponsInfo.GetIconBaseName(RangedWeapons.Rifle), (Program.Instance.Profile.AvailableRangedWeapons & RangedWeapons.Rifle) != 0, () => Program.Instance.Profile.AvailableRangedWeapons |= RangedWeapons.Rifle);
            addWeapon(Util.GetLocaleResourceString(RangedWeapons.HandCannon) + "\n\n" + Locale.Resource.MenuCannonDesc, WeaponsInfo.GetIconBaseName(RangedWeapons.HandCannon), (Program.Instance.Profile.AvailableRangedWeapons & RangedWeapons.HandCannon) != 0, () => Program.Instance.Profile.AvailableRangedWeapons |= RangedWeapons.HandCannon);
            addWeapon(Util.GetLocaleResourceString(RangedWeapons.Blaster) + "\n\n" + Locale.Resource.MenuBlasterDesc, WeaponsInfo.GetIconBaseName(RangedWeapons.Blaster), (Program.Instance.Profile.AvailableRangedWeapons & RangedWeapons.Blaster) != 0, () => Program.Instance.Profile.AvailableRangedWeapons |= RangedWeapons.Blaster);
            addWeapon(Util.GetLocaleResourceString(RangedWeapons.GatlingGun) + "\n\n" + Locale.Resource.MenuGatlingDesc, WeaponsInfo.GetIconBaseName(RangedWeapons.GatlingGun), (Program.Instance.Profile.AvailableRangedWeapons & RangedWeapons.GatlingGun) != 0, () => Program.Instance.Profile.AvailableRangedWeapons |= RangedWeapons.GatlingGun);
        }
 void Scene_EntityAdded(Graphics.Entity obj)
 {
     var cp = obj as Map.Checkpoint;
     if (cp != null)
     {
         Button b = new Button
         {
             Text = obj.Name,
             Position = new Vector2(0, y),
             Size = new Vector2(200, 20),
         };
         b.Click += new EventHandler((o, e) =>
         {
             Game.Instance.Map.MainCharacter.Position = obj.Translation;
             Game.Instance.Map.MainCharacter.AddRageLevelProgress(cp.RagePerc);
             Game.Instance.Map.MainCharacter.HitPoints = (int)(Game.Instance.Map.MainCharacter.MaxHitPoints * cp.HitPointsPerc);
             Game.Instance.Map.MainCharacter.PistolAmmo = cp.Ammo;
         });
         AddChild(b);
         y += 22;
     }
 }
 public void MessageBox(String message)
 {
     Form f = new Form
     {
         Anchor = Orientation.Center,
         Size = new Vector2(200, 150),
         Clickable = true
     };
     Label t = new Label
     {
         Text = message,
         TextAnchor = Orientation.Center,
         Anchor = Orientation.Top,
         Size = new Vector2(200, 100),
         Background = null,
         Position = new Vector2(0, 10),
     };
     f.AddChild(t);
     Button b = new Button
     {
         Text = "Ok",
         Anchor = Orientation.Bottom,
         Position = new Vector2(0, 10),
         Size = new Vector2(100, 20)
     };
     b.MouseClick += new System.Windows.Forms.MouseEventHandler((e, o) => f.Remove());
     f.AddChild(b);
     Root.AddChild(f);
 }