protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); ngui = Gui as NeoforceGui; manager = ngui.Manager; Window window = new Window(manager); window.Init(); window.Text = "Options"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; Button button = new Button(manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); manager.Add(window); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Methods /////////// //////////////////////////////////////////////////////////////////////////// protected override void Initialize() { base.Initialize(); // Create and setup Window control. window = new Window(Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. button = new Button(Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; // Add the window control to the manager processing queue. Manager.Add(window); }
public override void Initialize() { creditWindow = new Window(manager); creditWindow.Init(); creditWindow.Width = 300; creditWindow.Height = 200; creditWindow.Center(); creditWindow.Text = "Credits"; creditWindow.Visible = false; creditWindow.IconVisible = false; manager.Add(creditWindow); textBox = new TextBox(manager); textBox.Init(); textBox.Parent = creditWindow; textBox.Left = 8; textBox.Top = 8; textBox.Width = creditWindow.ClientArea.Width - 16; textBox.Height = creditWindow.Height - 48; textBox.Anchor = Anchors.All; textBox.Mode = TextBoxMode.Multiline; textBox.ReadOnly = true; string text = "Makers of The Little Cheese Boy Editor:\n"+ GetCreators(); text += "\n\nSpecial Thanks to Alexander Brodén and \nMattias Liljeson for their great work \non The Little Cheese Boy!"; textBox.Text = text; textBox.ScrollBars = ScrollBars.None; textBox.CanFocus = false; textBox.TextColor = Color.White; }
public override void LoadContent(ContentManager contentloader) { _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default"); _guiman.Initialize(); _settingsmenu = new Window(_guiman); _settingsmenu.Init(); _settingsmenu.Resizable = false; _settingsmenu.Movable = false; _settingsmenu.CloseButtonVisible = false; _settingsmenu.Text = "Settings Menu"; _settingsmenu.Width = 300; _settingsmenu.Height = 400; _settingsmenu.Center(); _settingsmenu.Visible = true; _settingsmenu.BorderVisible = true; _settingsmenu.Cursor = _guiman.Skin.Cursors["Default"].Resource; _back = new Button(_guiman); _back.Init(); _back.Text = "Go Back"; _back.Width = 200; _back.Height = 50; _back.Left = 50; _back.Top = 300; _back.Anchor = Anchors.Bottom; _back.Parent = _settingsmenu; _playername = new TextBox(_guiman); _playername.Init(); _playername.Text = _gamemanager.Pbag.Player.Name; _playername.Width = 200; _playername.Height = 50; _playername.Left = 50; _playername.Top = 0; _playername.Anchor = Anchors.Bottom; _playername.Parent = _settingsmenu; _volume = new ScrollBar(_guiman, Orientation.Horizontal); _volume.Init(); //Todo check why volume.value is reseting it to 50 :S _volume.Value = _gamemanager.Audiomanager.GetVolume(); _volume.Range = 100; _volume.PageSize = 10; _volume.StepSize = 1; _volume.Width = 200; _volume.Height = 50; _volume.Left = 50; _volume.Top = 50; _volume.Anchor = Anchors.Bottom; _volume.Parent = _settingsmenu; _guiman.Add(_settingsmenu); _gamemanager.Game.IsMouseVisible = true; }
public override void LoadContent(ContentManager contentloader) { _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default"); _guiman.Initialize(); _mainmenu = new Window(_guiman); _mainmenu.Init(); _mainmenu.Resizable = false; _mainmenu.Movable = false; _mainmenu.CloseButtonVisible = false; _mainmenu.Text = "Main Menu"; _mainmenu.Width = 300; _mainmenu.Height = 400; _mainmenu.Center(); _mainmenu.Visible = true; _mainmenu.BorderVisible = true; //mainmenu.Cursor = guiman.Skin.Cursors["Default"].Resource; _play = new Button(_guiman); _play.Init(); _play.Text = "Play"; _play.Width = 200; _play.Height = 50; _play.Left = 50; _play.Top = 0; _play.Anchor = Anchors.Bottom; _play.Parent = _mainmenu; _settings = new Button(_guiman); _settings.Init(); _settings.Text = "Settings"; _settings.Width = 200; _settings.Height = 50; _settings.Left = 50; _settings.Top = 50; _settings.Anchor = Anchors.Bottom; _settings.Parent = _mainmenu; _exit = new Button(_guiman); _exit.Init(); _exit.Text = "Exit"; _exit.Width = 200; _exit.Height = 50; _exit.Left = 50; _exit.Top = 100; _exit.Anchor = Anchors.Bottom; _exit.Parent = _mainmenu; _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource; _guiman.Add(_mainmenu); _gamemanager.Game.IsMouseVisible = true; }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo,factory, contentManager); { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); // Add the window control to the manager processing queue. guiManager.Manager.Add(window); this.World.CameraManager.AddCamera(new CameraFirstPerson(false,GraphicInfo)); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
public ConsoleControl(StackEngine engine, ConsoleMessageEventHandler messageSent, KeyEventHandler keyUp) { Manager = engine.Renderer.GUIManager; WindowUIControl = new TomShane.Neoforce.Controls.Window(Manager); WindowUIControl.Init(); WindowUIControl.Text = "STACK Engine Console"; WindowUIControl.Width = 480; WindowUIControl.Resizable = true; WindowUIControl.MinimumHeight = 240; WindowUIControl.MinimumWidth = 320; WindowUIControl.Height = 200; WindowUIControl.IconVisible = false; WindowUIControl.Alpha = 215; WindowUIControl.CloseButtonVisible = false; WindowUIControl.Closing += (object sender, WindowClosingEventArgs e) => e.Cancel = true; WindowUIControl.Visible = false; WindowUIControl.Color = Color.Black; WindowUIControl.Center(engine.Game.VirtualResolution); ConsoleUIControl = new TomShane.Neoforce.Controls.Console(Manager); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.System, "System", Color.White)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Debug, "Debug", Color.LightGray)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Error, "Error", Color.IndianRed)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Notice, "Notice", Color.DimGray)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.Warning, "Warning", Color.DeepPink)); ConsoleUIControl.Channels.Add(new ConsoleChannel((byte)Console.Channel.User, "User", Color.Gray)); ConsoleUIControl.SelectedChannel = (byte)Console.Channel.User; ConsoleUIControl.ChannelsVisible = false; ConsoleUIControl.ClientArea.Left = 10; ConsoleUIControl.Color = Color.Black; ConsoleUIControl.MessageFormat = ConsoleMessageFormats.TimeStamp; ConsoleUIControl.TextBox.Color = Color.Black; ConsoleUIControl.Sender = "User"; ConsoleUIControl.TextBox.KeyUp += keyUp; ConsoleUIControl.TextBox.AutoSelection = false; ConsoleUIControl.Width = WindowUIControl.ClientWidth - ConsoleUIControl.Left; ConsoleUIControl.Height = WindowUIControl.ClientHeight; ConsoleUIControl.Parent = WindowUIControl; ConsoleUIControl.MessageSent += messageSent; WindowUIControl.Resize += new ResizeEventHandler(OnWindowResize); Manager.Add(WindowUIControl); }
//////////////////////////////////////////////////////////////////////////// public void Init() { // Create and setup Window control. window = new Window(manager); window.Init(); window.Text = "Please Wait"; window.Width = 300; window.Height = 175; window.Center(); window.Visible = true; window.CloseButtonVisible = false; text = new Label(manager); text.Init(); text.Text = ""; text.Width = 250; text.Height = 24; text.Left = 20; text.Top = 20; text.Anchor = Anchors.Left; text.Parent = window; bar = new ProgressBar(manager); bar.Init(); bar.Width = 260; bar.Height = 15; bar.Left = 20; bar.Top = 60; bar.Anchor = Anchors.Left; bar.Parent = window; bar.Value = 0; bar.Mode = ProgressBarMode.Default; cancel = new Button(manager); cancel.Init(); cancel.Left = window.Width - cancel.Width - 20; cancel.Top = 110; cancel.Text = "Cancel"; cancel.Anchor = Anchors.Right; cancel.Parent = window; }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Methods /////////// //////////////////////////////////////////////////////////////////////////// protected override void Initialize() { base.Initialize(); // Controls setup. window = new Window(manager); window.Init(); window.Text = "Addon Controls"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; button = new Button(manager); button.Init(); button.Text = "DEFAULT"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - 4 - button.Width; button.Top = window.ClientHeight - button.Height - 32; button.Anchor = Anchors.Bottom; button.Parent = window; button.Focused = true; // Here we construct our custom button. custom = new CustomButton(manager); custom.Init(); custom.Text = "CUSTOM"; custom.Width = 72; custom.Height = 24; custom.Left = (window.ClientWidth / 2) + 4; custom.Top = window.ClientHeight - button.Height - 32; custom.Anchor = Anchors.Bottom; custom.Parent = window; custom.Cursor = manager.Skin.Cursors["Custom.Cursor"].Resource; manager.Add(window); }
public override void Initialize() { Point screenSize = ((ContentSystem)world.SystemManager.GetSystem<ContentSystem>()[0]).GetViewportSize(); confirmWindow = new Window(manager); confirmWindow.Init(); confirmWindow.Text = "Would you like to exit?"; confirmWindow.Width = 248; confirmWindow.Height = 48; confirmWindow.Center(); confirmWindow.Visible = false; confirmWindow.Resizable = false; confirmWindow.IconVisible = false; confirmWindow.CloseButtonVisible = false; confirmWindow.Closing += new WindowClosingEventHandler(WindowCloseBehavior); manager.Add(confirmWindow); acceptButton = new Button(manager); acceptButton.Init(); acceptButton.Parent = confirmWindow; acceptButton.Width = 100; acceptButton.Height = 24; acceptButton.Click +=new TomShane.Neoforce.Controls.EventHandler(ConfirmedExit); acceptButton.Left = 12; acceptButton.Top = 8; acceptButton.Text = "Yes"; cancelButton = new Button(manager); cancelButton.Init(); cancelButton.Parent = confirmWindow; cancelButton.Width = 100; cancelButton.Height = 24; cancelButton.Click += new TomShane.Neoforce.Controls.EventHandler(CancelExit); cancelButton.Left = 124; cancelButton.Top = 8; cancelButton.Text = "No thanks"; }
void AddSettingsWindow(Manager gui) { SettingsWindow = new Window(gui); SettingsWindow.Width = 300; SettingsWindow.Height = 200; SettingsWindow.CloseButtonVisible = false; SettingsWindow.Text = GlblRes.Settings; SettingsWindow.Parent = MainMenuBackground; SettingsWindow.Init(); SettingsWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); SettingsWindow.Visible = false; SettingsWindow.Resizable = false; SettingsWindow.IconVisible = false; SettingsWindow.DragAlpha = 255; SettingsWindow.Movable = false; var MusicVolumeLabel = new Label(gui); MusicVolumeLabel.Init(); MusicVolumeLabel.Width = 120; MusicVolumeLabel.Parent = SettingsWindow; MusicVolumeLabel.Text = GlblRes.Music_Volume; MusicVolumeLabel.Top = 5; MusicVolumeLabel.Left = 5; var MusicVolumeBar = new TrackBar(gui); MusicVolumeBar.Init(); MusicVolumeBar.Width = 160; MusicVolumeBar.Value = (int)(GameSettings.MusicVolume * 100); MusicVolumeBar.ValueChanged += (o, e) => { GameSettings.MusicVolume = (float)MusicVolumeBar.Value / 100f; Engine.ApplyGameSettingsVolume(); MediaPlayer.Volume = MathHelper.Clamp(GameSettings.MusicVolume, 0.0f, 1.0f); MainMenuLabel.Text = string.Empty; }; MusicVolumeBar.Top = 5; MusicVolumeBar.Left = 120; MusicVolumeBar.Parent = SettingsWindow; var SoundVolumeLabel = new Label(gui); SoundVolumeLabel.Init(); SoundVolumeLabel.Width = 120; SoundVolumeLabel.Parent = SettingsWindow; SoundVolumeLabel.Text = GlblRes.Sound_Volume; SoundVolumeLabel.Top = 30; SoundVolumeLabel.Left = 5; var SoundVolumeBar = new TrackBar(gui); SoundVolumeBar.Init(); SoundVolumeBar.Width = 160; SoundVolumeBar.Value = (int)(GameSettings.SoundEffectVolume * 100); SoundVolumeBar.ValueChanged += (o, e) => { GameSettings.SoundEffectVolume = (float)SoundVolumeBar.Value / 100f; Engine.ApplyGameSettingsVolume(); MainMenuLabel.Text = string.Empty; }; SoundVolumeBar.Top = 30; SoundVolumeBar.Left = 120; SoundVolumeBar.Parent = SettingsWindow; var BloomLabel = new Label(gui); BloomLabel.Init(); BloomLabel.Width = 120; BloomLabel.Parent = SettingsWindow; BloomLabel.Text = GlblRes.Bloom; BloomLabel.Top = 55; BloomLabel.Left = 5; var BloomCheckBox = new CheckBox(gui); BloomCheckBox.Init(); BloomCheckBox.Parent = SettingsWindow; BloomCheckBox.Text = string.Empty; BloomCheckBox.Checked = GameSettings.Bloom; BloomCheckBox.CheckedChanged += (o, e) => { GameSettings.Bloom = BloomCheckBox.Checked; MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; BloomCheckBox.Top = 55; BloomCheckBox.Left = 120; var VSyncLabel = new Label(gui); VSyncLabel.Init(); VSyncLabel.Width = 120; VSyncLabel.Parent = SettingsWindow; VSyncLabel.Text = GlblRes.VSync; VSyncLabel.Top = 80; VSyncLabel.Left = 5; var VSyncCheckBox = new CheckBox(gui); VSyncCheckBox.Init(); VSyncCheckBox.Parent = SettingsWindow; VSyncCheckBox.Text = string.Empty; VSyncCheckBox.Checked = GameSettings.VSync; VSyncCheckBox.CheckedChanged += (o, e) => { GameSettings.VSync = VSyncCheckBox.Checked; MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; VSyncCheckBox.Top = 80; VSyncCheckBox.Left = 120; var DisplayModeLabel = new Label(gui); DisplayModeLabel.Init(); DisplayModeLabel.Width = 120; DisplayModeLabel.Parent = SettingsWindow; DisplayModeLabel.Text = GlblRes.Display_Mode; DisplayModeLabel.Top = 105; DisplayModeLabel.Left = 5; var DisplayModeCombo = new ComboBox(gui); DisplayModeCombo.Init(); DisplayModeCombo.Items = GetDisplayModes(); DisplayModeCombo.Width = 120; DisplayModeCombo.Parent = SettingsWindow; DisplayModeCombo.Width = 160; DisplayModeCombo.Text = DisplayModeToString(GameSettings.DisplayMode); DisplayModeCombo.ItemIndexChanged += (o, e) => { GameSettings.DisplayMode = StringToDisplayMode(DisplayModeCombo.Text); MainMenuLabel.Text = GlblRes.Restart_the_game_for_this_setting_to_take_effect; }; DisplayModeCombo.Top = 105; DisplayModeCombo.Left = 120; var Bevel = new Bevel(gui); Bevel.Parent = SettingsWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = SettingsWindow.ClientHeight - Bevel.Height; Bevel.Width = SettingsWindow.ClientWidth; var OKButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); OKButton.Init(); OKButton.Parent = Bevel; OKButton.Text = GlblRes.OK; OKButton.Click += (s, e) => { SettingsWindow.Close(); ShowLogo(true); GameSettings.Save(Engine.Game.SaveGameFolder); }; OKButton.Width = 130; OKButton.Left = 150; OKButton.Top = 5; gui.Add(SettingsWindow); }
public override void Initialize() { ContentSystem contentSystem = ((ContentSystem)world.SystemManager.GetSystem<ContentSystem>()[0]); Viewport viewport = contentSystem.GetViewport(); overlay = new HalfTransparentOverlay(manager); overlay.Init(); overlay.Width = manager.ScreenWidth; overlay.Height = manager.ScreenHeight; overlay.BackGroundTexture = contentSystem.LoadTexture("white_dot"); manager.Add(overlay); startupDialog = new Window(manager); startupDialog.Init(); startupDialog.ShowModal(); startupDialog.Width = 400; startupDialog.Height = 158; startupDialog.Center(); startupDialog.Text = "Select what you would like to do..."; startupDialog.CloseButtonVisible = false; startupDialog.Resizable = false; startupDialog.Movable = false; startupDialog.IconVisible = false; startupDialog.VisibleChanged +=new TomShane.Neoforce.Controls.EventHandler(startupDialog_VisibleChanged); startupDialog.Closing += new WindowClosingEventHandler(WindowCloseBehavior); manager.Add(startupDialog); //LEFT PANEL possibleMaps = new GroupPanel(manager); possibleMaps.Init(); possibleMaps.Parent = startupDialog; possibleMaps.Width = 189; possibleMaps.Height = 122; possibleMaps.Text = "Select a Theme?"; possibleMaps.Top = 1; int buttonSize = 80; tileMapGarden = new ImageBasedButton(manager); tileMapGarden.Init(); tileMapGarden.Parent = possibleMaps; tileMapGarden.Width = buttonSize; tileMapGarden.Height = buttonSize; tileMapGarden.Top = buttonSize * 0 + 8; tileMapGarden.Left = buttonSize * 0 + 8 * 1; tileMapGarden.tilemap = textures["tilemap_garden"]; tileMapGarden.tilemap.Name = "tilemap_garden"; tileMapGarden.Click += new TomShane.Neoforce.Controls.EventHandler(OnTilemapButtonClickBehavior); tileMapGarden.MouseOver += new MouseEventHandler(OnTilemapButtonMouseOverBehavior); tileMapGarden.FocusGained += new TomShane.Neoforce.Controls.EventHandler(OnTilemapButtonMouseOverBehavior); tileMapGarden.GenerateFirstTile(contentSystem); tileMapGarden.Focused = true; tileMapCellar = new ImageBasedButton(manager); tileMapCellar.Init(); tileMapCellar.Parent = possibleMaps; tileMapCellar.Width = buttonSize; tileMapCellar.Height = buttonSize; tileMapCellar.Top = buttonSize * 0 + 8; tileMapCellar.Left = buttonSize * 1 + 8 * 2; tileMapCellar.tilemap = textures["tilemap_winecellar"]; tileMapCellar.tilemap.Name = "tilemap_winecellar"; tileMapCellar.Click += new TomShane.Neoforce.Controls.EventHandler(OnTilemapButtonClickBehavior); tileMapCellar.MouseOver += new MouseEventHandler(OnTilemapButtonMouseOverBehavior); tileMapCellar.FocusGained += new TomShane.Neoforce.Controls.EventHandler(OnTilemapButtonMouseOverBehavior); tileMapCellar.GenerateFirstTile(contentSystem); tilemap = tileMapGarden.tilemap; //RIGHT PANEL recentMaps = new GroupPanel(manager); recentMaps.Init(); recentMaps.Parent = startupDialog; recentMaps.Width = possibleMaps.Width; recentMaps.Height = possibleMaps.Height; recentMaps.Text = "Load a recent Map?"; recentMaps.Left = possibleMaps.Width + 8; recentMaps.Top = 1; openMap = new Button(manager); openMap.Init(); openMap.Parent = recentMaps; openMap.Width = 150; openMap.Height = 24; openMap.Top = recentMaps.Height/2 - openMap.Height; openMap.Left = recentMaps.Width/2 - openMap.Width/2; openMap.Text = "Load Saved Map"; openMap.Click += new TomShane.Neoforce.Controls.EventHandler(LoadMapFromFile); }
public void Initialize() { base.Initialize(); image = GameServices.GetService<ContentManager>().Load<Texture2D>(@"folder"); image2 = GameServices.GetService<ContentManager>().Load<Texture2D>(@"music1"); directoryList = new List<string>(); musicFiles = new List<FileInfo>(); // Creates and initializes window window = new Window(manager); window.Init(); window.Width = 600; window.Height = 500; window.Center(); window.Visible = true; window.CaptionVisible = false; window.Resizable = false; window.Movable = false; window.BorderVisible = false; window.AutoScroll = true; // Add window to manager processing manager.Add(window); gpList.Add(new GroupPanel(manager)); gpList.Add(new GroupPanel(manager)); gp = gpList[0]; gp.Text = "File Browser"; gp.AutoScroll = true; gp.Width = window.Width; gp.Height = window.Height; gp.Left = 0; gp.Top = 0; gp.Parent = window; currentSelectedFile = new Label(manager); backButton = new Button(manager); backButton.Init(); backButton.Top = 5; backButton.Text = "Back"; backButton.Parent = gp; //backButton.Enabled = false; backButton.Click += new TomShane.Neoforce.Controls.EventHandler(EnterPreviousDirectory); selectAudio = new Button(manager); selectAudio.Init(); selectAudio.Top = 5; selectAudio.Left = backButton.Width + 10; //selectAudio.Width = 150; selectAudio.Text = "Select"; selectAudio.Parent = gp; selectAudio.Enabled = false; selectAudio.Click += new TomShane.Neoforce.Controls.EventHandler(StartGame); previousDirectory = @"C:\"; directory = @"C:\"; directoryList.Add(directory); subDirectories = new List<string>(); var directories = Directory.EnumerateDirectories(directory); //System.Console.WriteLine(subDirectories.Count); foreach (string dir in directories) { subDirectories.Add((string)dir); } createBrowserControls(); System.Console.WriteLine(subDirectories.Count); manager.Add(window); }
private void ConfigMenu() { NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "PloobsEngine Config"; window.Width = 350; window.Height = 300; window.Center(); window.Visible = true; Label lab1 = new Label(guiManager.Manager); lab1.Text = "Resolução"; lab1.Top = 20; lab1.Left = 20; lab1.Parent = window; List<string> colors = new List<string>(); foreach (var item in GraphicInfo.GraphicsAdapter.SupportedDisplayModes) { if (item.Format == Microsoft.Xna.Framework.Graphics.SurfaceFormat.Color) { colors.Add(item.Width + "x" + item.Height); } } lb1 = new ComboBox(guiManager.Manager); lb1.Init(); lb1.Parent = window; lb1.Left = lab1.Left; lb1.Top = lab1.Top + lab1.Height; lb1.Width = 200; lb1.ItemIndex = 0; lb1.Height = 20; lb1.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(lb1_ItemIndexChanged); lb1.Anchor = Anchors.Left | Anchors.Top | Anchors.Right; lb1.Items.AddRange(colors); lb1.Text = "800x600"; lb1.SelectionStart = 0; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "Apply"; button.Width = button.Text.Length * 10; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); CheckBox ck1 = new CheckBox(guiManager.Manager); ck1.Text = "FullScreen"; ck1.Checked = false; ck1.Click += new TomShane.Neoforce.Controls.EventHandler(ck1_Click); ck1.Top = lb1.Top + lb1.Height + 10; ck1.Parent = window; ck1.Left = lb1.Left; ck1.Width = ck1.Text.Length*10; CheckBox ms1 = new CheckBox(guiManager.Manager); ms1.Text = "MultiSampling"; ms1.Checked = false; ms1.Top = ck1.Top + ck1.Height + 10; ms1.Parent = window; ms1.Click += new TomShane.Neoforce.Controls.EventHandler(ms1_Click); ms1.Left = lb1.Left; ms1.Width = ms1.Text.Length * 10; CheckBox vsy = new CheckBox(guiManager.Manager); vsy.Text = "Vertical Sincronization"; vsy.Checked = false; vsy.Top = ms1.Top + ms1.Height + 10; vsy.Parent = window; vsy.Click += new TomShane.Neoforce.Controls.EventHandler(vsy_Click); vsy.Left = lb1.Left; vsy.Width = vsy.Text.Length * 10; CheckBox mip = new CheckBox(guiManager.Manager); mip.Text = "Use MipMap"; mip.Checked = false; mip.Top = vsy.Top + vsy.Height + 10; mip.Parent = window; mip.Click += new TomShane.Neoforce.Controls.EventHandler(mip_Click); mip.Left = lb1.Left; mip.Width = mip.Text.Length * 10; CheckBox ans = new CheckBox(guiManager.Manager); ans.Text = "Use Anisotropic Filtering"; ans.Checked = false; ans.Top = mip.Top + mip.Height + 10; ans.Parent = window; ans.Click += new TomShane.Neoforce.Controls.EventHandler(ans_Click); ans.Left = lb1.Left; ans.Width = ans.Text.Length * 10; // Add the window control to the manager processing queue. guiManager.Manager.Add(window); }
/// <summary> /// Initialize the components that make up the window, including the window itself. /// </summary> private void Initialize() { Window = new Window(manager); Window.Init(); Window.Text = "Console"; Window.Left = windowFrame.X; Window.Top = windowFrame.Y; Window.Width = windowFrame.Width; Window.Height = windowFrame.Height; Window.Alpha = 200; Window.BorderVisible = true; Window.CaptionVisible = false; Window.BackColor = Color.Black; Window.Center(); TextArea = new ConsoleArea(manager); TextArea.Init(); TextArea.Text = ""; TextArea.Width = windowFrame.Width - 15; TextArea.Height = windowFrame.Height - 40; TextArea.Enabled = true; TextArea.CanFocus = false; TextArea.BackgroundColor = Color.Black; TextArea.TextColor = Color.Green; TextArea.TextPosition = ConsoleArea.TextOrigin.BOTTOM; TextArea.Parent = Window; Input = new TextBox(manager); Input.Init(); Input.Text = ""; Input.Color = Color.Black; Input.TextColor = Color.Green; Input.Top = TextArea.Top + TextArea.Height + 2; Input.Width = windowFrame.Width - 15; Input.Height = 20; Input.Enabled = true; Input.Parent = Window; }
public override void Initialize() { ContentSystem sys = (ContentSystem)world.SystemManager.GetSystem<ContentSystem>()[0]; Viewport viewport = sys.GetViewport(); toolbarWindow = new Window(manager); toolbarWindow.Init(); toolbarWindow.Text = "Toolbar"; toolbarWindow.Width = 160; toolbarWindow.Height = 360; toolbarWindow.Top = 0; toolbarWindow.IconVisible = false; toolbarWindow.Left = viewport.Width - toolbarWindow.Width; toolbarWindow.Resizable = false; toolbarWindow.AutoScroll = false; toolbarWindow.CloseButtonVisible = false; toolbarWindow.BorderVisible = true; toolbarWindow.Click += new TomShane.Neoforce.Controls.EventHandler(OnWindowClickBehavior); toolbarWindow.Movable = true; manager.Add(toolbarWindow); int toolHeight = 50; int clientW = toolbarWindow.ClientWidth; int toolWidth = toolHeight; int toolMargin = 5; roadTool = new ImageBasedButton(manager); roadTool.Init(); roadTool.Parent = toolbarWindow; roadTool.Width = toolWidth; roadTool.Height = toolHeight; roadTool.Left = clientW / 2 - toolWidth / 2; roadTool.Top = toolMargin; roadTool.Text = ""; roadTool.image = sys.LoadTexture("RoadIcon"); roadTool.Click += new TomShane.Neoforce.Controls.EventHandler(RoadToolBehavior); roadTool.Pushed = true; roadTool.Mode = ButtonMode.PushButton; eraserTool = new ImageBasedButton(manager); eraserTool.Init(); eraserTool.Parent = toolbarWindow; eraserTool.Width = toolWidth; eraserTool.Height = toolHeight; eraserTool.Left = clientW / 2 - toolWidth/2; eraserTool.Top = toolHeight + toolMargin*2; eraserTool.Text = ""; eraserTool.image = sys.LoadTexture("EraserIcon"); eraserTool.Click += new TomShane.Neoforce.Controls.EventHandler(EraseToolBehavior); paintTool = new ImageBasedButton(manager); paintTool.Init(); paintTool.Parent = toolbarWindow; paintTool.Width = toolWidth; paintTool.Height = toolHeight; paintTool.Left = clientW / 2 - toolWidth / 2; paintTool.Top = (toolHeight*2 + toolMargin * 3); paintTool.Text = ""; paintTool.image = sys.LoadTexture("PaintingIcon"); paintTool.Click += new TomShane.Neoforce.Controls.EventHandler(PaintToolBehavior); // int top = (toolHeight * 3 + toolMargin * 4) +10; pathsValid = new CheckBox(manager); pathsValid.Init(); pathsValid.Parent = toolbarWindow; pathsValid.Text = ""; pathsValid.Left = clientW/2 - 15/2 - 16; pathsValid.Top = top; pathsValid.Width = 15; pathsValid.Enabled = false; pathsValid.TextColor = Color.Red; pathsValid.ToolTip = new CustomToolTip(manager); pathsValid.ToolTip.Parent = pathsValid; pathsValid.ToolTip.Init(); pathsValid.ToolTip.Text = "0"; pathsValid.ToolTip.TextColor = Color.White; pathsValid.ToolTip.Visible = false; pathsValid.ToolTip.Color = Color.Red; playerValid = new CheckBox(manager); playerValid.Init(); playerValid.Parent = toolbarWindow; playerValid.Text = ""; playerValid.Left = clientW / 2 - 15/2; playerValid.Top = top; playerValid.Width = 15; playerValid.Enabled = false; playerValid.TextColor = Color.Red; playerValid.ToolTip = new CustomToolTip(manager); playerValid.ToolTip.Parent = playerValid; playerValid.ToolTip.Init(); playerValid.ToolTip.Text = "1"; playerValid.ToolTip.TextColor = Color.White; playerValid.ToolTip.Visible = false; playerValid.ToolTip.Color = Color.Red; switchesValid = new CheckBox(manager); switchesValid.Init(); switchesValid.Parent = toolbarWindow; switchesValid.Text = ""; switchesValid.Left = clientW/2 - 15/2 +16; switchesValid.Top = top; switchesValid.Width = 15; switchesValid.Enabled = false; switchesValid.TextColor = Color.Red; switchesValid.ToolTip = new CustomToolTip(manager); switchesValid.ToolTip.Parent = switchesValid; switchesValid.ToolTip.Init(); switchesValid.ToolTip.Text = "2"; switchesValid.ToolTip.TextColor = Color.White; switchesValid.ToolTip.Visible = false; switchesValid.ToolTip.Color = Color.Red; // int btnW = (int)(toolbarWindow.ClientWidth * 0.8f); exportMap = new Button(manager); exportMap.Init(); exportMap.Parent = toolbarWindow; exportMap.Text = "Export Map"; exportMap.Width = btnW; exportMap.Height = 24; exportMap.Left = clientW / 2 - btnW / 2; exportMap.Top = toolbarWindow.ClientHeight - 26 * 5; exportMap.Click += new TomShane.Neoforce.Controls.EventHandler(ExportMapBehavior); saveMap = new Button(manager); saveMap.Init(); saveMap.Parent = toolbarWindow; saveMap.Text = "Save Map"; saveMap.Width = btnW; saveMap.Height = 24; saveMap.Left = clientW / 2 - btnW / 2; saveMap.Top = toolbarWindow.ClientHeight - 26 * 4; saveMap.Click += new TomShane.Neoforce.Controls.EventHandler(SaveMapBehavior); newMap = new Button(manager); newMap.Init(); newMap.Parent = toolbarWindow; newMap.Text = "New Map"; newMap.Width = btnW; newMap.Height = 24; newMap.Left = clientW / 2 - btnW / 2; newMap.Top = toolbarWindow.ClientHeight - 26 * 3; newMap.Click += new TomShane.Neoforce.Controls.EventHandler(NewMapBehavior); backToStartScreen = new Button(manager); backToStartScreen.Init(); backToStartScreen.Parent = toolbarWindow; backToStartScreen.Text = "To Start Screen"; backToStartScreen.Width = btnW; backToStartScreen.Height = 24; backToStartScreen.Left = clientW / 2 - btnW / 2; backToStartScreen.Top = toolbarWindow.ClientHeight - 26 * 2; backToStartScreen.Click += new TomShane.Neoforce.Controls.EventHandler(BackToStartScreenBehavior); exitButton = new Button(manager); exitButton.Init(); exitButton.Parent = toolbarWindow; exitButton.Text = "Exit"; exitButton.Width = btnW; exitButton.Height = 24; exitButton.Left = clientW / 2 - btnW/2; exitButton.Top = toolbarWindow.ClientHeight - 26; exitButton.Click += new TomShane.Neoforce.Controls.EventHandler(ExitBehavior); newMapConfirmationWindow = new Window(manager); newMapConfirmationWindow.Init(); newMapConfirmationWindow.Text = "Start a new map?"; newMapConfirmationWindow.Width = 248; newMapConfirmationWindow.Height = 48; newMapConfirmationWindow.Center(); newMapConfirmationWindow.CloseButtonVisible = false; newMapConfirmationWindow.IconVisible = false; newMapConfirmationWindow.Visible = false; newMapConfirmationWindow.Resizable = false; manager.Add(newMapConfirmationWindow); accept = new Button(manager); accept.Init(); accept.Parent = newMapConfirmationWindow; accept.Width = 100; accept.Height = 24; accept.Click += new TomShane.Neoforce.Controls.EventHandler(ConfirmedNewMapBehavior); accept.Left = 12; accept.Top = 8; accept.Text = "Yes"; cancel = new Button(manager); cancel.Init(); cancel.Parent = newMapConfirmationWindow; cancel.Width = 100; cancel.Height = 24; cancel.Click += new TomShane.Neoforce.Controls.EventHandler(CancelNewMapBehavior); cancel.Left = 124; cancel.Top = 8; cancel.Text = "No thanks"; }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Methods /////////// //////////////////////////////////////////////////////////////////////////// protected override void Initialize() { base.Initialize(); // Create sprite batch for ploting texture with rendered UI. sprite = new SpriteBatch(GraphicsDevice); // Initialize manager. manager.Initialize(); // Create and assign render target for UI rendering. manager.RenderTarget = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.DiscardContents); // Maximum of frames we want to render per second (applies only for Neoforce, not Game itself) manager.TargetFrames = 60; // Create and setup Window control. window = new Window(manager); window.Init(); window.Text = "Render Targets"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. button = new Button(manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; // Add the window control to the manager processing queue. manager.Add(window); }
void AddCreepsButton_Click(object sender, EventArgs e) { try { int health = Convert.ToInt32(_healthOfCreeps.Text); int speed = Convert.ToInt32(_speedOfCreeps.Text); int number = Convert.ToInt32(_numberOfCreeps.Text); string texture = _creepTexture.Text.Substring(0, 3).ToLower(); for (int i = 0; i < number; i++) { _currentCreepList.Add(new Creep(health, speed, texture)); } UpdateCreepBox(); } catch (Exception) { _isEditorActive = false; var msg = new Window(_manager); msg.Init(); msg.Text = "Fehler"; msg.Visible = true; msg.Width = 255; msg.Height = 100; msg.Center(); msg.Closed += delegate { _isEditorActive = true; }; var lbl = new Label(_manager); lbl.Init(); lbl.Text = "Bitte verwenden Sie korrekte Eingaben!"; lbl.Parent = msg; lbl.Width = 230; lbl.Left = 5; lbl.Top = 5; var close = new Button(_manager); close.Init(); close.Text = "Schließen"; close.Width = 100; close.Parent = msg; close.Left = (msg.ClientWidth / 2) - (close.Width / 2); close.Top = msg.ClientHeight - close.Height - 8; close.Anchor = Anchors.Bottom; close.Click += delegate { msg.Close(); }; _manager.Add(msg); } }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo,factory, contentManager); { ///Create the xml file model extractor ///Loads a XML file that was export by our 3DS MAX plugin ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//"); this.AttachCleanUpAble(ext); ///Extract all the XML info (Model,Cameras, ...) ModelLoaderData data = ext.Load(factory, GraphicInfo, "ilha"); ///Create the WOrld Loader ///Convert the ModelLoaderData in World Entities WorldLoader wl = new WorldLoader(); ///all default wl.LoadWorld(factory, GraphicInfo, World, data); } NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; button.Click += new TomShane.Neoforce.Controls.EventHandler(button_Click); // Add the window control to the manager processing queue. guiManager.Manager.Add(window); #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.5f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion this.World.CameraManager.AddCamera(new CameraFirstPerson(false,GraphicInfo)); this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker()); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grassCube"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo,factory, contentManager); { SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; // Add the window control to the manager processing queue. guiManager.Manager.Add(window); #region NormalLight DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.5f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion this.World.CameraManager.AddCamera(new CameraFirstPerson(true,GraphicInfo)); SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//cubemap"); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc); }
//////////////////////////////////////////////////////////////////////////// public void Init() { // Create and setup Window control. window = new Window(manager); window.Init(); window.Text = "Login"; window.Width = 300; window.Height = 225; window.Center(); window.Visible = true; window.CloseButtonVisible = false; unLbl = new Label(manager); unLbl.Init(); unLbl.Text = "User Name: "; unLbl.Width = 72; unLbl.Height = 24; unLbl.Left = 40; unLbl.Top = 40; unLbl.Anchor = Anchors.Left; unLbl.Parent = window; pwLbl = new Label(manager); pwLbl.Init(); pwLbl.Text = "Password: "******""; unTxt.Width = 124; unTxt.Height = 24; unTxt.Left = 125; unTxt.Top = 40; unTxt.Anchor = Anchors.Right; unTxt.Parent = window; unTxt.KeyPress += new KeyEventHandler(Txt_KeyPress); pwTxt = new TextBox(manager); pwTxt.Init(); pwTxt.Text = ""; pwTxt.Width = 124; pwTxt.Height = 24; pwTxt.Left = 125; pwTxt.Top = 70; pwTxt.Anchor = Anchors.Right; pwTxt.Mode = TextBoxMode.Password; pwTxt.Parent = window; pwTxt.KeyPress += new KeyEventHandler(Txt_KeyPress); login = new Button(manager); login.Init(); login.Text = "Login"; login.Width = 80; login.Height = 24; login.Left = window.ClientWidth - pwTxt.Width + 7; login.Top = window.ClientHeight - login.Height - 50; login.Anchor = Anchors.Top; login.Parent = window; exit = new Button(manager); exit.Init(); exit.Text = "Exit"; exit.Width = 80; exit.Height = 24; exit.Left = unLbl.Left; exit.Top = login.Top; exit.Anchor = Anchors.Top; exit.Parent = window; regArea = new CursorChangeArea(manager); regArea.Init(); regArea.Text = "Register"; regArea.Width = 58; regArea.Height = 16; regArea.Color = new Color(80, 80, 80, 255); regArea.TextColor = Color.LightBlue; regArea.Left = exit.Left; regArea.Top = exit.Top + exit.Height + 15; regArea.Anchor = Anchors.Left; regArea.Parent = window; regArea.MousePress += new MouseEventHandler(reg_MousePress); regArea.ToolTip.Text = "Visit VTank registration site"; passArea = new CursorChangeArea(manager); passArea.Init(); passArea.Text = "Forgot password?"; passArea.Width = 110; passArea.Height = 16; passArea.Color = new Color(80, 80, 80, 255); passArea.TextColor = Color.LightBlue; passArea.Left = login.Left + login.Width - passArea.Width; passArea.Top = exit.Top + exit.Height + 15; passArea.Anchor = Anchors.Left; passArea.Parent = window; passArea.MousePress += new MouseEventHandler(pass_MousePress); passArea.ToolTip.Text = "Visit password recovery site"; }
public void Init() { texture = new Texture2D(manager.GraphicsDevice, 1, 1); texture.SetData<Color>(new Color[] { Color.White }); window = new Window(manager) ; window.Init(); window.Text = "Tank List"; window.Width = 600; window.Height = 500; window.Center(); window.Visible = true; window.CloseButtonVisible = false; play = new Button(manager); play.Init(); play.Text = "Play"; play.Width = 100; play.Height = 24; play.Left = window.Width - play.Width - 40; play.Top = window.Height - 90; play.Anchor = Anchors.Right; play.Parent = window; create = new Button(manager); create.Init(); create.Text = "Create New Tank"; create.Width = 150; create.Height = 24; create.Left = 30; create.Top = window.Height - 160; create.Anchor = Anchors.Left; create.Parent = window; edit = new Button(manager); edit.Init(); edit.Text = "Edit Tank"; edit.Width = 100; edit.Height = 24; edit.Left = 30; edit.Top = window.Height - 125; edit.Anchor = Anchors.Left; edit.Parent = window; delete = new Button(manager); delete.Init(); delete.Text = "Delete Tank"; delete.Width = 100; delete.Height = 24; delete.Left = edit.Left + edit.Width + 30; delete.Top = edit.Top; delete.Anchor = Anchors.Left; delete.Parent = window; back = new Button(manager); back.Init(); back.Text = "Back"; back.Width = 150; back.Height = 24; back.Left = 30; back.Top = play.Top; back.Anchor = Anchors.Left; back.Parent = window; listbox = new ListBox(manager); listbox.Init(); listbox.Width = 225; listbox.Height = 275; listbox.Left = 30; listbox.Top = 40; listbox.Anchor = Anchors.Left; listbox.HideSelection = false; listbox.Parent = window; listbox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(listbox_ItemIndexChanged); image = new ImageBox(manager); image.Init(); image.Image = texture; image.SizeMode = SizeMode.Stretched; image.Width = 200; image.Height = 150; image.Left = window.Width - image.Width - 70; image.Top = 40; image.Anchor = Anchors.Right; image.Parent = window; RankImage = new ImageBox(manager); RankImage.Init(); //RankImage.Image = null; RankImage.SizeMode = SizeMode.Stretched; RankImage.Width = 32; RankImage.Height = 32; RankImage.Top = window.Height - 280; RankImage.Left = window.Width - RankImage.Width - 240; RankImage.Anchor = Anchors.Left; RankImage.Parent = window; rankLbl = new Label(manager); rankLbl.Init(); rankLbl.Text = "Unknown"; rankLbl.Top = window.Height - 275; rankLbl.Anchor = Anchors.Left; rankLbl.Width = 232 - RankImage.Width; rankLbl.Left = window.Width - rankLbl.Width - RankImage.Width; rankLbl.Height = 24; rankLbl.Parent = window; RankProgressBar = new ProgressBar(manager); RankProgressBar.Init(); RankProgressBar.Value = 0; RankProgressBar.Top = window.Height - 243; RankProgressBar.Anchor = Anchors.Left; RankProgressBar.Width = 200; RankProgressBar.Left = window.Width - rankLbl.Width - 69; RankProgressBar.Height = 25; RankProgressBar.ToolTip = new ToolTip(manager); RankProgressBar.ToolTip.Text = "0 / 0"; RankProgressBar.Parent = window; RankNextLabel = new Label(manager); RankNextLabel.Init(); RankNextLabel.Top = window.Height - 215; RankNextLabel.Width = 200; RankNextLabel.Height = 15; RankNextLabel.Left = window.Width - RankImage.Width - 235; RankNextLabel.Text = "Progress is loading..."; RankNextLabel.Parent = window; armorBar = new ProgressBar(manager); armorBar.Init(); armorBar.Width = 150; armorBar.Height = 24; armorBar.Left = window.Width - armorBar.Width - 50; ; armorBar.Top = window.Height - 180; armorBar.Anchor = Anchors.Left; armorBar.Parent = window; armorBar.Value = 50; armorLbl = new Label(manager); armorLbl.Init(); armorLbl.Text = "Armor: "; armorLbl.Width = 50; armorLbl.Height = 24; armorLbl.Left = armorBar.Left - armorLbl.Width - 20; armorLbl.Top = armorBar.Top; armorLbl.Anchor = Anchors.Left; armorLbl.Parent = window; speedBar = new ProgressBar(manager); speedBar.Init(); speedBar.Width = 150; speedBar.Height = 24; speedBar.Left = window.Width - speedBar.Width - 50; ; speedBar.Top = window.Height - 150; speedBar.Anchor = Anchors.Left; speedBar.Parent = window; speedBar.Value = 50; speedLbl = new Label(manager); speedLbl.Init(); speedLbl.Text = "Speed: "; speedLbl.Width = 50; speedLbl.Height = 24; speedLbl.Left = speedBar.Left - speedLbl.Width - 20; speedLbl.Top = speedBar.Top; speedLbl.Anchor = Anchors.Left; speedLbl.Parent = window; }
//////////////////////////////////////////////////////////////////////////// public void Init() { // Create and setup Window control. window = new Window(manager); window.Init(); window.Text = "Login"; window.Width = 300; window.Height = 400; window.Center(); window.Visible = true; window.CloseButtonVisible = false; // Create Button control and set the previous window as its parent. title = new Label(manager); title.Init(); title.Text = "VTank"; title.Width = 260; title.Height = 24; title.Left = 20; title.Top = 40; title.Anchor = Anchors.Top; title.Parent = window; resume = new Button(manager); resume.Init(); resume.Text = "Resume"; resume.Width = 200; resume.Height = 35; resume.Left = title.Left + 30; resume.Top = title.Top + title.Height + 20; resume.Anchor = Anchors.Top; resume.Parent = window; logoff = new Button(manager); logoff.Init(); logoff.Text = "Log Off"; logoff.Width = 200; logoff.Height = 35; logoff.Left = title.Left + 30; logoff.Top = resume.Top + resume.Height + 20; logoff.Anchor = Anchors.Top; logoff.Parent = window; options = new Button(manager); options.Init(); options.Text = "Resume"; options.Width = 200; options.Height = 35; options.Left = title.Left + 30; options.Top = logoff.Top + logoff.Height + 20; options.Anchor = Anchors.Top; options.Parent = window; exit = new Button(manager); exit.Init(); exit.Text = "Resume"; exit.Width = 200; exit.Height = 35; exit.Left = title.Left + 30; exit.Top = options.Top + options.Height + 20; exit.Anchor = Anchors.Top; exit.Parent = window; }
void AddSaveGameWindow(Manager gui) { var SaveButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); var NameTextBox = new TextBox(gui); SaveGameWindow = new Window(gui); SaveGameWindow.Width = 300; SaveGameWindow.Height = 240; SaveGameWindow.CloseButtonVisible = false; SaveGameWindow.Text = GlblRes.Save; SaveGameWindow.IconVisible = false; SaveGameWindow.Parent = MainMenuBackground; SaveGameWindow.Init(); SaveGameWindow.Visible = false; SaveGameWindow.Resizable = false; SaveGameWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); SaveGameWindow.Movable = false; SaveGameWindow.Closed += (s, e) => { SaveGameListbox.ItemIndex = -1; }; SaveGameListbox = new ListBox(gui); SaveGameListbox.Width = SaveGameWindow.ClientWidth; SaveGameListbox.Parent = SaveGameWindow; SaveGameListbox.Height = SaveGameWindow.ClientHeight - 35 - 30; SaveGameListbox.ItemIndexChanged += (s, e) => { ClickSound.Play(GameSettings.SoundEffectVolume, 0f, 0f); if (SaveGameListbox.ItemIndex > -1) { NameTextBox.Text = SaveGames[SaveGames.Keys.ElementAt(SaveGameListbox.ItemIndex)].Name; } }; var Bevel = new Bevel(gui); Bevel.Parent = SaveGameWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = SaveGameWindow.ClientHeight - Bevel.Height; Bevel.Width = SaveGameWindow.ClientWidth; SaveButton.Init(); SaveButton.Parent = Bevel; SaveButton.Enabled = false; SaveButton.Text = GlblRes.Save; SaveButton.Click += (s, e) => { Engine.SaveState(NameTextBox.Text); ShowLogo(true); SaveGameWindow.Close(); RefreshSaveGames(); }; SaveButton.Width = 130; SaveButton.Left = 5; SaveButton.Top = 5; var CancelButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); CancelButton.Init(); CancelButton.Parent = Bevel; CancelButton.Text = GlblRes.Cancel; CancelButton.Click += (s, e) => { SaveGameWindow.Close(); ShowLogo(true); }; CancelButton.Width = 130; CancelButton.Left = Bevel.ClientWidth - 130 - 5; CancelButton.Top = 5; gui.Add(SaveGameWindow); var SaveGameNameLabel = new Label(gui); SaveGameNameLabel.Parent = SaveGameWindow; SaveGameNameLabel.Top = SaveGameListbox.Height + 5; SaveGameNameLabel.Left = 5; SaveGameNameLabel.Width = 95; SaveGameNameLabel.Text = GlblRes.Name; NameTextBox.Parent = SaveGameWindow; NameTextBox.Init(); NameTextBox.Left = 60; NameTextBox.Top = SaveGameListbox.Height + 5; NameTextBox.Width = 220; NameTextBox.Height = 20; NameTextBox.TextChanged += (s, e) => { SaveButton.Enabled = !string.IsNullOrWhiteSpace(NameTextBox.Text); }; NameTextBox.KeyPress += (s, e) => { if (e.Key == Microsoft.Xna.Framework.Input.Keys.Enter) { Engine.SaveState(NameTextBox.Text); SaveGameWindow.Close(); ShowLogo(true); RefreshSaveGames(); } }; gui.Add(SaveGameWindow); }
void AddExitConfirmationWindow(Manager gui) { ExitConfirmationWindow = new Window(gui); ExitConfirmationWindow.Init(); ExitConfirmationWindow.Text = GlblRes.Really_quit; ExitConfirmationWindow.Width = 290; ExitConfirmationWindow.Height = 130; ExitConfirmationWindow.Resizable = false; ExitConfirmationWindow.IconVisible = false; ExitConfirmationWindow.Movable = false; ExitConfirmationWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); ExitConfirmationWindow.Visible = false; ExitConfirmationWindow.CloseButtonVisible = false; var Bevel = new Bevel(gui); Bevel.Parent = ExitConfirmationWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = ExitConfirmationWindow.ClientHeight - Bevel.Height; Bevel.Width = ExitConfirmationWindow.ClientWidth; var Text = new Label(gui); Text.Text = GlblRes.Do_you_really_want_to_quit_the_game; Text.Parent = ExitConfirmationWindow; Text.Top = 10; Text.Left = 10; Text.Width = ExitConfirmationWindow.ClientWidth - 20; Text.Height = 20; var Yes = new MenuButton(gui, ClickSound, FocusSound, GameSettings); Yes.Parent = Bevel; Yes.Width = 100; Yes.Text = GlblRes.Yes; Yes.Left = 10; Yes.Top = 5; Yes.Click += (se, ve) => { Engine.Exit(); }; var No = new MenuButton(gui, ClickSound, FocusSound, GameSettings); No.Parent = Bevel; No.Text = GlblRes.Menu_AddExitConfirmationWindow_No; No.Width = 100; No.Left = 165; No.Top = 5; No.Click += (se, ev) => { ExitConfirmationWindow.Close(); ShowLogo(true); }; gui.Add(ExitConfirmationWindow); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); diagnostics = new DiagnosticInfo("System Performance"); // Add the content to the textures singleton Textures.Instance.Graphics = GraphicsDevice; Textures.Instance.Content = Content; world = new GameWorld(); world.Systems.Add(world.Input); world.Systems.Add(new CameraSystem()); world.Systems.Add(new InspectionSystem()); world.Systems.Add(new ControlSystem()); world.Systems.Add(new DateTimeSystem()); world.Systems.Add(new BehaviorSystem()); world.Systems.Add(new ImmigrationSystem()); world.Systems.Add(new ProductionSystem()); world.Systems.Add(new CityInformationSystem()); world.Systems.Add(new HousingUpgradeSystem()); world.Systems.Add(new OverlaySystem() { Graphics = GraphicsDevice }); world.Systems.Add(new CollapsibleSystem()); world.Systems.Add(new IsometricMapSystem() { Graphics = GraphicsDevice }); world.Renderer = new DefaultRenderSystem() { Graphics = GraphicsDevice, ClearColor = Color.Black }; world.Systems.Add(world.Renderer); world.UI = new Manager(this, "Pixel") { AutoCreateRenderTarget = false, AutoUnfocus = true, TargetFrames = 60 }; world.UI.Initialize(); world.UI.RenderTarget = world.UI.CreateRenderTarget(); Window w = new TomShane.Neoforce.Controls.Window(world.UI) { Text = "My Quick Test Window" }; w.Init(); w.Center(); // Load the scenario // TODO: put this in a method somewhere string s = File.ReadAllText("Content/Data/Scenarios/alpha.json"); Scenario scenario = JsonConvert.DeserializeObject <Scenario>(s); // Load textures from config Textures.Instance.LoadFromJson(scenario.Textures, true); // Load the drawables world.Prototypes.LoadFromFile( new DrawablesLoader(), scenario.Drawables, true); world.City = scenario.City; // Load in entities world.Prototypes.LoadFromFile( new CustomEntityLoader() { Converter = new CustomComponentConverter() }, scenario.Entities, true); // load scenario data world.Prototypes.LoadFromFile( new DataLoader <Item>(), scenario.Items, true); world.Prototypes.LoadFromFile( new DataLoader <Recipe>(), scenario.Recipes, true); //GameData.Instance.LoadItemsFromJson(scenario.Items, true); //GameData.Instance.LoadRecipesFromJson(scenario.Recipes, true); CustomEntityLoader cel = new CustomEntityLoader() { Library = world.Prototypes, Converter = new CustomComponentConverter() }; foreach (JObject o in scenario.DefaultEntities) { Entity e = (Entity)cel.LoadPrototype(o); world.Entities.Add(e); } // start up the pathfinder thread PathfinderSystem pfs = new PathfinderSystem() { Map = world.Map, Collisions = world.Collisions }; pathThread = new Thread(new ThreadStart(pfs.Run)); pathThread.Start(); pfs = new PathfinderSystem() { Map = world.Map, Collisions = world.Collisions }; pathThread2 = new Thread(new ThreadStart(pfs.Run)); //pathThread2.Start(); // TODO: create a settings file to read any key bindings from inputControlEntity = new Entity(); inputControlEntity.AddComponent(new PositionComponent()); inputControlEntity.AddComponent(new CameraController()); world.Entities.Add(inputControlEntity); DrawableComponent diagDrawable = new DrawableComponent(); diagDrawable.Add("Text", new DrawableText() { Text = "", Color = Color.White, Visible = true, Layer = "Text", Static = true }); diagnosticEntity = new Entity(); diagnosticEntity.AddComponent(new PositionComponent() { X = 0, Y = 50f }); diagnosticEntity.AddComponent(diagDrawable); world.Entities.Add(diagnosticEntity); }
void AddLoadGameWindow(Manager gui) { var LoadButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); LoadGameWindow = new Window(gui); LoadGameWindow.Width = 300; LoadGameWindow.Height = 200; LoadGameWindow.CloseButtonVisible = false; LoadGameWindow.Text = GlblRes.Load_Savegame; LoadGameWindow.Parent = MainMenuBackground; LoadGameWindow.Init(); LoadGameWindow.Center(new Point(Game.VIRTUAL_WIDTH, Game.VIRTUAL_HEIGHT)); LoadGameWindow.Visible = false; LoadGameWindow.Resizable = false; LoadGameWindow.IconVisible = false; LoadGameWindow.DragAlpha = 255; LoadGameWindow.Movable = false; var SaveGameScreenshot = new ImageBox(gui); SaveGameScreenshot.Parent = MainMenuBackground; SaveGameScreenshot.Width = MainMenuBackground.Width; SaveGameScreenshot.Height = MainMenuBackground.Height; SaveGameScreenshot.Visible = false; SaveGameScreenshot.SizeMode = SizeMode.Stretched; LoadGameWindow.Closed += (s, e) => { LoadGameListbox.ItemIndex = -1; }; LoadGameListbox = new ListBox(gui); LoadGameListbox.Width = LoadGameWindow.ClientWidth; LoadGameListbox.Parent = LoadGameWindow; LoadGameListbox.Height = LoadGameWindow.ClientHeight - 35; LoadGameListbox.ItemIndexChanged += (s, e) => { ClickSound.Play(GameSettings.SoundEffectVolume, 0f, 0f); MainMenuLabel.Text = string.Empty; if (LoadGameListbox.ItemIndex > -1) { if (SaveGameScreenshot.Image != null) { SaveGameScreenshot.Image.Dispose(); } var Screenshot = SaveGames[SaveGames.Keys.ElementAt(LoadGameListbox.ItemIndex)].Screenshot; if (Screenshot != null) { using (Stream ScreenshotStream = new MemoryStream(Screenshot)) { SaveGameScreenshot.Image = Texture2D.FromStream(Engine.Renderer.GraphicsDevice, ScreenshotStream); } } SaveGameScreenshot.Show(); LoadButton.Enabled = true; } else { SaveGameScreenshot.Hide(); LoadButton.Enabled = false; } }; var Bevel = new Bevel(gui); Bevel.Parent = LoadGameWindow; Bevel.Anchor = Anchors.Bottom | Anchors.Left | Anchors.Right; Bevel.Height = 35; Bevel.Style = BevelStyle.Raised; Bevel.Top = LoadGameWindow.ClientHeight - Bevel.Height; Bevel.Width = LoadGameWindow.ClientWidth; LoadButton.Init(); LoadButton.Parent = Bevel; LoadButton.Enabled = false; LoadButton.Text = GlblRes.Load_Savegame; LoadButton.Click += (s, e) => { MainMenuLabel.Text = string.Empty; try { Engine.LoadState(SaveGames.Keys.ElementAt(LoadGameListbox.ItemIndex)); } catch { MainMenuLabel.Text = GlblRes.Could_not_load_save_game_Maybe_it_was_created_in_an_earlier_game_version; return; } LoadGameWindow.Close(); MainMenuBackground.Hide(); Engine.Resume(); Engine.Renderer.GUIManager.ShowSoftwareCursor = false; }; LoadButton.Width = 130; LoadButton.Left = 5; LoadButton.Top = 5; var CancelButton = new MenuButton(gui, ClickSound, FocusSound, GameSettings); CancelButton.Init(); CancelButton.Parent = Bevel; CancelButton.Text = GlblRes.Cancel; CancelButton.Click += (s, e) => { LoadGameWindow.Close(); ShowLogo(true); }; CancelButton.Width = 130; CancelButton.Left = 150; CancelButton.Top = 5; gui.Add(LoadGameWindow); }
public void Init() { texture = new Texture2D(manager.GraphicsDevice, 1, 1); texture.SetData<Color>(new Color[] { Color.White }); #region Window window = new Window(manager) ; window.Init(); window.Text = "Tank Creation"; window.Width = 600; window.Height = 500; window.Center(); window.Visible = true; window.CloseButtonVisible = false; #endregion #region ListBoxes #region Tank tankBoxLbl = new Label(manager); tankBoxLbl.Init(); tankBoxLbl.Text = "Tanks: "; tankBoxLbl.Width = 100; tankBoxLbl.Height = 10; tankBoxLbl.Left = 20; tankBoxLbl.Top = 10; tankBoxLbl.Anchor = Anchors.Left; tankBoxLbl.Parent = window; tankBox = new ListBox(manager); tankBox.Init(); tankBox.Width = 200; tankBox.Height = 75; tankBox.Left = 30; tankBox.Top = 30; tankBox.Anchor = Anchors.Left; tankBox.HideSelection = false; tankBox.Parent = window; foreach (String s in tanks) { tankBox.Items.Add(s); } tankBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(tankBox_ItemIndexChanged); #endregion #region Turret turretBoxLbl = new Label(manager); turretBoxLbl.Init(); turretBoxLbl.Text = "Turrets: "; turretBoxLbl.Width = 50; turretBoxLbl.Height = 10; turretBoxLbl.Left = tankBoxLbl.Left; turretBoxLbl.Top = tankBox.Top + tankBox.Height + 20; turretBoxLbl.Anchor = Anchors.Left; turretBoxLbl.Parent = window; turretBox = new ListBox(manager); turretBox.Init(); turretBox.Width = 200; turretBox.Height = 100; turretBox.Left = 30; turretBox.Top = turretBoxLbl.Top + turretBoxLbl.Height + 10; turretBox.Anchor = Anchors.Left; turretBox.HideSelection = false; turretBox.Parent = window; foreach (String s in tanks) { turretBox.Items.Add(s); } turretBox.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(turretBox_ItemIndexChanged); tPowerLbl = new Label(manager); tPowerLbl.Init(); tPowerLbl.Text = "Power: "; tPowerLbl.Width = 50; tPowerLbl.Height = 10; tPowerLbl.Left = turretBox.Left; tPowerLbl.Top = turretBox.Top + turretBox.Height + 10; tPowerLbl.Anchor = Anchors.Left; tPowerLbl.Parent = window; tPower = new ProgressBar(manager); tPower.Init(); tPower.Width = 75; tPower.Height = 10; tPower.Left = tPowerLbl.Left + tPowerLbl.Width + 5; tPower.Top = tPowerLbl.Top; tPower.Anchor = Anchors.Left; tPower.Parent = window; tPower.Value = 50; tRateLbl = new Label(manager); tRateLbl.Init(); tRateLbl.Text = "Rate: "; tRateLbl.Width = 50; tRateLbl.Height = 10; tRateLbl.Left = turretBox.Left; tRateLbl.Top = tPowerLbl.Top + tPowerLbl.Height; tRateLbl.Anchor = Anchors.Left; tRateLbl.Parent = window; tRate = new ProgressBar(manager); tRate.Init(); tRate.Width = 75; tRate.Height = 10; tRate.Left = tRateLbl.Left + tRateLbl.Width + 5; tRate.Top = tRateLbl.Top; tRate.Anchor = Anchors.Left; tRate.Parent = window; tRate.Value = 50; tRangeLbl = new Label(manager); tRangeLbl.Init(); tRangeLbl.Text = "Range: "; tRangeLbl.Width = 50; tRangeLbl.Height = 15; tRangeLbl.Left = turretBox.Left; tRangeLbl.Top = tRateLbl.Top + tRateLbl.Height; tRangeLbl.Anchor = Anchors.Left; tRangeLbl.Parent = window; tRange = new ProgressBar(manager); tRange.Init(); tRange.Width = 75; tRange.Height = 10; tRange.Left = tRangeLbl.Left + tRangeLbl.Width + 5; tRange.Top = tRangeLbl.Top; tRange.Anchor = Anchors.Left; tRange.Parent = window; tRange.Value = 50; #endregion #endregion #region TankStats armorLbl = new Label(manager); armorLbl.Init(); armorLbl.Text = "Armor: "; armorLbl.Width = 50; armorLbl.Height = 24; armorLbl.Left = 20; armorLbl.Top = window.Height - 160; ; armorLbl.Anchor = Anchors.Left; armorLbl.Parent = window; armorBar = new ProgressBar(manager); armorBar.Init(); armorBar.Width = 150; armorBar.Height = 24; armorBar.Left = armorLbl.Left + armorLbl.Width + 20; ; armorBar.Top = armorLbl.Top; armorBar.Anchor = Anchors.Left; armorBar.Parent = window; armorBar.Value = 50; speedLbl = new Label(manager); speedLbl.Init(); speedLbl.Text = "Speed: "; speedLbl.Width = 50; speedLbl.Height = 24; speedLbl.Left = armorLbl.Left; speedLbl.Top = armorLbl.Top + armorLbl.Height; speedLbl.Anchor = Anchors.Left; speedLbl.Parent = window; speedBar = new ProgressBar(manager); speedBar.Init(); speedBar.Width = 150; speedBar.Height = 24; speedBar.Left = speedLbl.Left + speedLbl.Width + 20; ; speedBar.Top = speedLbl.Top; speedBar.Anchor = Anchors.Left; speedBar.Parent = window; speedBar.Value = 50; ratioLbl = new Label(manager); ratioLbl.Init(); ratioLbl.Text = "Ratio: "; ratioLbl.Width = 50; ratioLbl.Height = 24; ratioLbl.Left = armorLbl.Left; ratioLbl.Top = speedLbl.Top + speedLbl.Height + 20; ratioLbl.Anchor = Anchors.Left; ratioLbl.Parent = window; ratioSlide = new SliderBar(manager); ratioSlide.Init(); ratioSlide.Width = 150; ratioSlide.Height = 20; ratioSlide.Left = ratioLbl.Left + ratioLbl.Width + 20; ; ratioSlide.Top = ratioLbl.Top + 3; ratioSlide.Anchor = Anchors.Left; ratioSlide.Parent = window; ratioSlide.Value = 50; ratioSlide.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(ratioSlide_ValueChanged); #endregion #region Render Region image = new ImageBox(manager); image.Init(); image.SizeMode = SizeMode.Stretched; image.Width = 200; image.Height = 150; image.Left = window.Width - image.Width - 70; image.Top = 40; image.Anchor = Anchors.Right; image.Parent = window; image.Image = texture; #endregion #region Skin Scrolling (Left/Right) ScrollSkinLeft = new Button(manager); ScrollSkinLeft.Init(); ScrollSkinLeft.Width = 25; ScrollSkinLeft.Height = 25; ScrollSkinLeft.Left = window.Width - image.Width - 70; ScrollSkinLeft.Top = image.Top + image.Height + 10; ScrollSkinLeft.Text = " < "; ScrollSkinLeft.Parent = window; ScrollSkinRight = new Button(manager); ScrollSkinRight.Init(); ScrollSkinRight.Width = 25; ScrollSkinRight.Height = 25; ScrollSkinRight.Left = image.Left + image.Width - ScrollSkinRight.Width; ScrollSkinRight.Top = image.Top + image.Height + 10; ScrollSkinRight.Text = " > "; ScrollSkinRight.Parent = window; #endregion #region Skin Label SkinLabel = new Label(manager); SkinLabel.Init(); SkinLabel.Alignment = Alignment.MiddleCenter; SkinLabel.Height = 15; SkinLabel.Width = 100; SkinLabel.Left = ScrollSkinRight.Left - 120; SkinLabel.Top = image.Top + image.Width - 33; SkinLabel.Text = "Skin"; SkinLabel.Parent = window; #endregion #region Color Choosing redLbl = new Label(manager); redLbl.Init(); redLbl.Text = "Red: "; redLbl.Width = 50; redLbl.Height = 24; redLbl.Left = image.Left; redLbl.Top = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 20; redLbl.Anchor = Anchors.Left; redLbl.Parent = window; red = new SliderBar(manager); red.Init(); red.Width = 120; red.Height = 15; red.Left = redLbl.Left + redLbl.Width + 20; red.Top = ScrollSkinLeft.Top + ScrollSkinLeft.Height + 25; red.Anchor = Anchors.Left; red.Parent = window; red.Value = 50; red.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed); greenLbl = new Label(manager); greenLbl.Init(); greenLbl.Text = "Green: "; greenLbl.Width = 50; greenLbl.Height = 24; greenLbl.Left = redLbl.Left; greenLbl.Top = redLbl.Top + redLbl.Height; greenLbl.Anchor = Anchors.Left; greenLbl.Parent = window; green = new SliderBar(manager); green.Init(); green.Width = red.Width; green.Height = red.Height; green.Left = greenLbl.Left + greenLbl.Width + 20; green.Top = greenLbl.Top + 5; green.Anchor = Anchors.Left; green.Parent = window; green.Value = 50; green.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed); blueLbl = new Label(manager); blueLbl.Init(); blueLbl.Text = "Blue: "; blueLbl.Width = 50; blueLbl.Height = 24; blueLbl.Left = redLbl.Left; blueLbl.Top = greenLbl.Top + greenLbl.Height; blueLbl.Anchor = Anchors.Left; blueLbl.Parent = window; blue = new SliderBar(manager); blue.Init(); blue.Width = red.Width; blue.Height = red.Height; blue.Left = blueLbl.Left + blueLbl.Width + 20; ; blue.Top = blueLbl.Top + 5; blue.Anchor = Anchors.Left; blue.Parent = window; blue.Value = 50; blue.ValueChanged += new TomShane.Neoforce.Controls.EventHandler(Color_Changed); #endregion #region Tank Name name = new Label(manager); name.Init(); name.Text = "Tank Name: "; name.Width = 100; name.Height = 24; name.Left = redLbl.Left; name.Top = blueLbl.Top + blueLbl.Height + 20; name.Anchor = Anchors.Left; name.Parent = window; nameBox = new TextBox(manager); nameBox.Init(); nameBox.Text = ""; nameBox.Width = 180; nameBox.Height = 24; nameBox.Left = name.Left + 10; nameBox.Top = name.Top + name.Height; nameBox.Anchor = Anchors.Left; nameBox.Parent = window; #endregion #region Buttons create = new Button(manager); create.Init(); create.Text = "Create"; create.Width = 90; create.Height = 24; create.Left = window.Width - create.Width - 40; ; create.Top = ratioLbl.Top; create.Anchor = Anchors.Left; create.Parent = window; cancel = new Button(manager); cancel.Init(); cancel.Text = "Cancel"; cancel.Width = 80; cancel.Height = 24; cancel.Left = create.Left - cancel.Width - 60; cancel.Top = create.Top; cancel.Anchor = Anchors.Right; cancel.Parent = window; #endregion }
public override void Init() { base.Init(); window = new Window(Manager); window.Init(); window.Text = title; window.Width = 375; window.Height = 200; window.Center(); window.Visible = true; box = new ImageBox(Manager); box.Init(); box.Height = 32; box.Width = 32; box.Top = 100-40; box.Left = 20; box.SizeMode = SizeMode.Stretched; box.Parent = window; label = new Label(Manager); label.Init(); label.Width = window.Width - 80; label.Height = 150; label.Top = 0; label.Left = box.Left + box.Width + 10; label.Text = FormatString(message); label.Parent = window; if (Type == MessageBoxType.OKAY) { buttons.Add(new Button(Manager)); buttons[0].Init(); buttons[0].Width = 50; buttons[0].Height = 24; buttons[0].Top = (int)(window.Height * .62); buttons[0].Left = (window.Width / 2) - (buttons[0].Width / 2); buttons[0].Text = "Okay"; buttons[0].Parent = window; buttons[0].Click += new TomShane.Neoforce.Controls.EventHandler(OkayButtonClick); box.Image = Manager.Skin.Images["Icon.Information"].Resource; } else if (Type == MessageBoxType.ERROR) { buttons.Add(new Button(Manager)); buttons[0].Init(); buttons[0].Width = 50; buttons[0].Height = 24; buttons[0].Top = (int)(window.Height * .62); buttons[0].Left = (window.Width / 2) - (buttons[0].Width / 2); buttons[0].Text = "Okay"; buttons[0].Parent = window; buttons[0].Click += new TomShane.Neoforce.Controls.EventHandler(OkayButtonClick); box.Image = Manager.Skin.Images["Icon.Error"].Resource; } else if (Type == MessageBoxType.YES_NO) { buttons.Add(new Button(Manager)); buttons[0].Init(); buttons[0].Width = 50; buttons[0].Height = 24; buttons[0].Top = (int)(window.Height * .62); buttons[0].Left = (window.Width / 2) + 10; buttons[0].Text = "No"; buttons[0].Parent = window; buttons[0].Click += new TomShane.Neoforce.Controls.EventHandler(NoButtonClick); buttons.Add(new Button(Manager)); buttons[1].Init(); buttons[1].Width = 50; buttons[1].Height = 24; buttons[1].Top = buttons[0].Top; buttons[1].Left = (window.Width / 2) - (buttons[1].Width) - 10; buttons[1].Text = "Yes"; buttons[1].Parent = window; buttons[1].Click += new TomShane.Neoforce.Controls.EventHandler(YesButtonClick); box.Image = Manager.Skin.Images["Icon.Question"].Resource; } else if (Type == MessageBoxType.YES_NO_CANCEL) { buttons.Add(new Button(Manager)); buttons[0].Init(); buttons[0].Width = 50; buttons[0].Height = 24; buttons[0].Text = "Yes"; buttons[0].Top = (int)(window.Height * .62); buttons[0].Left = (window.Width / 2) - (buttons[0].Width) - 40; buttons[0].Parent = window; buttons[0].Click += new TomShane.Neoforce.Controls.EventHandler(YesButtonClick); buttons.Add(new Button(Manager)); buttons[1].Init(); buttons[1].Width = 50; buttons[1].Height = 24; buttons[1].Text = "No"; buttons[1].Top = buttons[0].Top; buttons[1].Left = (window.Width / 2) - (buttons[1].Width /2); buttons[1].Parent = window; buttons[1].Click += new TomShane.Neoforce.Controls.EventHandler(NoButtonClick); buttons.Add(new Button(Manager)); buttons[2].Init(); buttons[2].Width = 50; buttons[2].Height = 24; buttons[2].Text = "Cancel"; buttons[2].Top = buttons[0].Top; buttons[2].Left = (window.Width / 2) + 40; buttons[2].Parent = window; buttons[2].Click += new TomShane.Neoforce.Controls.EventHandler(CancelButtonClick); box.Image = Manager.Skin.Images["Icon.Question"].Resource; } foreach (Button btn in buttons) { window.Add(btn); } }
/// <summary> /// Код дизайнера всех базовых окон /// </summary> private void WindowsDesigner() { Manager = new Manager(this, graphics, "Default"); Manager.Initialize(); #region mainmenu mainmenu = new Window(Manager) {BackColor = Color.Black}; mainmenu.Init(); mainmenu.Text = ""; mainmenu.SetPosition(resx/3, resy/4); mainmenu.Width = resx/3; mainmenu.Height = resy/2; mainmenu.Visible = true; mainmenu.BorderVisible = false; mainmenu.Movable = false; mainmenu.Resizable = false; mainmenucloseB = new Button(Manager); mainmenucloseB.Init(); mainmenucloseB.Text = "Quit"; mainmenucloseB.Width = resx/5; mainmenucloseB.Height = 25; mainmenucloseB.Left = (resx/3 - resx/5)/2; mainmenucloseB.Top = mainmenu.ClientHeight - mainmenucloseB.Height - 8; mainmenucloseB.Anchor = Anchors.Bottom; mainmenucloseB.Parent = mainmenu; mainmenucloseB.Click += button_Click; mainmenugeneratenewB = new Button(Manager); mainmenugeneratenewB.Init(); mainmenugeneratenewB.Text = "Создать новый мир и начать игру"; mainmenugeneratenewB.Width = resx/5; mainmenugeneratenewB.Height = 25; mainmenugeneratenewB.Left = (resx/3 - resx/5)/2; mainmenugeneratenewB.Top = 50; mainmenugeneratenewB.Anchor = Anchors.Bottom; mainmenugeneratenewB.Parent = mainmenu; mainmenugeneratenewB.Click += mainmenugeneratenewB_Click; mainmenuloadmapB = new Button(Manager) {Text = "Начать игру в созданном мире", Width = resx/5}; mainmenuloadmapB.Init(); mainmenuloadmapB.Height = 25; mainmenuloadmapB.Left = (resx/3 - resx/5)/2; mainmenuloadmapB.Top = 100; mainmenuloadmapB.Anchor = Anchors.Bottom; mainmenuloadmapB.Parent = mainmenu; mainmenuloadmapB.Click += mainmenuloadmapB_Click; mainmenuloadgameB = new Button(Manager); mainmenuloadgameB.Init(); mainmenuloadgameB.Text = "Загрузить игру"; mainmenuloadgameB.Width = resx/5; mainmenuloadgameB.Height = 25; mainmenuloadgameB.Left = (resx/3 - resx/5)/2; mainmenuloadgameB.Top = 150; mainmenuloadgameB.Anchor = Anchors.Bottom; mainmenuloadgameB.Parent = mainmenu; mainmenuloadgameB.Click += mainmenuloadgameB_Click; mainmenuoptionsB = new Button(Manager); mainmenuoptionsB.Init(); mainmenuoptionsB.Text = "Опции"; mainmenuoptionsB.Width = resx/5; mainmenuoptionsB.Height = 25; mainmenuoptionsB.Left = (resx/3 - resx/5)/2; mainmenuoptionsB.Top = 200; mainmenuoptionsB.Anchor = Anchors.Bottom; mainmenuoptionsB.Parent = mainmenu; mainmenuoptionsB.Click += mainmenuoptionsB_Click; Manager.Add(mainmenu); #endregion #region generateoptionsmenu generateoptionsmenu = new Window(Manager) {BackColor = Color.Black}; generateoptionsmenu.Init(); generateoptionsmenu.Text = ""; generateoptionsmenu.SetPosition(resx/3, resy/4); generateoptionsmenu.Width = resx/3; generateoptionsmenu.Height = resy/2; generateoptionsmenu.Visible = false; generateoptionsmenu.BorderVisible = false; generateoptionsmenu.Movable = false; generateoptionsmenu.Resizable = false; generateoptionnextB = new Button(Manager); generateoptionnextB.Init(); generateoptionnextB.Text = "Продолжить"; generateoptionnextB.Width = resx/5; generateoptionnextB.Height = 25; generateoptionnextB.Left = (resx/3 - resx/5)/2; generateoptionnextB.Top = 50; generateoptionnextB.Anchor = Anchors.Bottom; generateoptionnextB.Parent = generateoptionsmenu; generateoptionnextB.Click += generateoptionnextB_Click; generateoptionbackB = new Button(Manager); generateoptionbackB.Init(); generateoptionbackB.Text = "Назад"; generateoptionbackB.Width = resx/5; generateoptionbackB.Height = 25; generateoptionbackB.Left = (resx/3 - resx/5)/2; generateoptionbackB.Top = generateoptionsmenu.ClientHeight - generateoptionbackB.Height - 8; generateoptionbackB.Anchor = Anchors.Bottom; generateoptionbackB.Parent = generateoptionsmenu; generateoptionbackB.Click += generateoptionbackB_Click; Manager.Add(generateoptionsmenu); #endregion #region generationMenu generationMenu = new Window(Manager) {BackColor = Color.Black}; generationMenu.Init(); generationMenu.Text = ""; generationMenu.SetPosition(20, 20); generationMenu.Width = resx/6; generationMenu.Height = 300; generationMenu.Visible = false; generationMenu.BorderVisible = false; generationMenu.Movable = false; generationMenu.Resizable = false; generationbegingameB = new Button(Manager); generationbegingameB.Init(); generationbegingameB.Text = "Начать игру"; generationbegingameB.Width = resx/8; generationbegingameB.Height = 25; generationbegingameB.Left = (resx/6 - resx/8)/2; generationbegingameB.Top = 50; generationbegingameB.Anchor = Anchors.Bottom; generationbegingameB.Parent = generationMenu; generationbegingameB.Click += generationbegingameB_Click; generationgenerateB = new Button(Manager); generationgenerateB.Init(); generationgenerateB.Text = "Генерировать"; generationgenerateB.Width = resx/8; generationgenerateB.Height = 25; generationgenerateB.Left = (resx/6 - resx/8)/2; generationgenerateB.Top = 80; generationgenerateB.Anchor = Anchors.Bottom; generationgenerateB.Parent = generationMenu; generationgenerateB.Click += generationgenerateB_Click; generationNormalMapB = new Button(Manager); generationNormalMapB.Init(); generationNormalMapB.Text = "Обычная карта"; generationNormalMapB.Width = resx/8; generationNormalMapB.Height = 25; generationNormalMapB.Left = (resx/6 - resx/8)/2; generationNormalMapB.Top = 110; generationNormalMapB.Anchor = Anchors.Bottom; generationNormalMapB.Parent = generationMenu; generationNormalMapB.Click += generationnormalmapB_Click; generationheightmapB = new Button(Manager); generationheightmapB.Init(); generationheightmapB.Text = "Карта высот"; generationheightmapB.Width = resx/8; generationheightmapB.Height = 25; generationheightmapB.Left = (resx/6 - resx/8)/2; generationheightmapB.Top = 140; generationheightmapB.Anchor = Anchors.Bottom; generationheightmapB.Parent = generationMenu; generationheightmapB.Click += generationheightmapB_Click; generationtempmapB = new Button(Manager); generationtempmapB.Init(); generationtempmapB.Text = "Карта температур"; generationtempmapB.Width = resx/8; generationtempmapB.Height = 25; generationtempmapB.Left = (resx/6 - resx/8)/2; generationtempmapB.Top = 170; generationtempmapB.Anchor = Anchors.Bottom; generationtempmapB.Parent = generationMenu; generationtempmapB.Click += generationtempmapB_Click; generationbackB = new Button(Manager); generationbackB.Init(); generationbackB.Text = "Назад"; generationbackB.Width = resx/8; generationbackB.Height = 25; generationbackB.Left = (resx/6 - resx/8)/2; generationbackB.Top = 200; generationbackB.Anchor = Anchors.Bottom; generationbackB.Parent = generationMenu; generationbackB.Click += generationbackB_Click; generateoption = new TrackBar(Manager); generateoption.Init(); generateoption.Top = 230; generateoption.Left = (resx/6 - resx/8)/2; generateoption.Width = resx/8; generateoption.Height = 25; generateoption.Parent = generationMenu; generateoption.ValueChanged += generateoption_ValueChanged; generateoptionlabel = new Label(Manager); generateoptionlabel.Init(); generateoptionlabel.Top = 250; generateoptionlabel.Left = (resx/6 - resx/8)/2; generateoptionlabel.Width = resx/8; generateoptionlabel.Height = 25; generateoptionlabel.Parent = generationMenu; Manager.Add(generationMenu); #endregion #region mapload maploadmenu = new Window(Manager) {Color = Color.Black}; maploadmenu.Init(); maploadmenu.Text = ""; maploadmenu.SetPosition(resx/3, resy/4); maploadmenu.Width = resx/3; maploadmenu.Height = resy/2; maploadmenu.Visible = false; maploadmenu.BorderVisible = false; maploadmenu.Movable = false; maploadmenu.Resizable = false; maploadmenuLoad = new Button(Manager); maploadmenuLoad.Init(); maploadmenuLoad.Text = "Назад"; maploadmenuLoad.Width = resx/5; maploadmenuLoad.Height = 25; maploadmenuLoad.Left = (resx/3 - resx/5)/2; maploadmenuLoad.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8; maploadmenuLoad.Anchor = Anchors.Bottom; maploadmenuLoad.Parent = maploadmenu; maploadmenuLoad.Click += maploadmenuLoad_Click; maploadmenuLoadNext = new Button(Manager); maploadmenuLoadNext.Init(); maploadmenuLoadNext.Text = "Далее"; maploadmenuLoadNext.Width = resx/5; maploadmenuLoadNext.Height = 25; maploadmenuLoadNext.Left = (resx/3 - resx/5)/2; maploadmenuLoadNext.Top = maploadmenu.ClientHeight - maploadmenuLoad.Height - 8 - 30; maploadmenuLoadNext.Anchor = Anchors.Bottom; maploadmenuLoadNext.Parent = maploadmenu; maploadmenuLoadNext.Click += maploadmenuLoadNext_Click; maploadmenulistbox = new ListBox(Manager); maploadmenulistbox.Init(); maploadmenulistbox.Text = ""; maploadmenulistbox.Width = resx/5; maploadmenulistbox.Height = resy/3; maploadmenulistbox.Left = (resx/3 - resx/5)/2; maploadmenulistbox.Top = 50; maploadmenulistbox.Anchor = Anchors.Bottom; maploadmenulistbox.Parent = maploadmenu; maploadmenulistbox.DoubleClick += maploadmenulistbox_DoubleClick; Manager.Add(maploadmenu); #endregion #region Summary Window SummaryWindow = new Window(Manager) {Color = Color.Black}; SummaryWindow.Init(); SummaryWindow.Text = ""; SummaryWindow.SetPosition(100, 100); SummaryWindow.Width = resx/4; SummaryWindow.Height = resy/4; SummaryWindow.Visible = false; SummaryWindow.BorderVisible = true; SummaryWindow.Movable = true; SummaryWindow.Resizable = false; summarytb = new TextBox(Manager); summarytb.Init(); summarytb.Text = ""; summarytb.Width = resx/4 - 30; summarytb.Height = resy/4 - 60; summarytb.Left = (20)/2; summarytb.CaretVisible = false; summarytb.Passive = true; summarytb.Mode = TextBoxMode.Multiline; summarytb.Top = (20)/2; summarytb.Anchor = Anchors.Bottom; summarytb.Parent = SummaryWindow; Manager.Add(SummaryWindow); #endregion #region ingameUIpartLeft ingameUIpartLeft = new Window(Manager) {Color = Color.Black}; ingameUIpartLeft.Init(); ingameUIpartLeft.Text = ""; ingameUIpartLeft.SetPosition(resx/5*4, 0); ingameUIpartLeft.Width = resx/5; ingameUIpartLeft.Height = resy; ingameUIpartLeft.Visible = false; ingameUIpartLeft.BorderVisible = false; ingameUIpartLeft.Movable = false; ingameUIpartLeft.Resizable = false; ingameshowOrdersB = new Button(Manager); ingameshowOrdersB.Init(); ingameshowOrdersB.Text = "Приказы (O)"; ingameshowOrdersB.Width = resx/5 - 20; ingameshowOrdersB.Height = 25; ingameshowOrdersB.Left = (20)/2; ingameshowOrdersB.Top = 10; ingameshowOrdersB.Anchor = Anchors.Bottom; ingameshowOrdersB.Parent = ingameUIpartLeft; ingameshowOrdersB.Click += ingameshowOrdersB_Click; ingameshowZonesB = new Button(Manager); ingameshowZonesB.Init(); ingameshowZonesB.Text = "Зоны (Z)"; ingameshowZonesB.Width = resx/5 - 20; ingameshowZonesB.Height = 25; ingameshowZonesB.Left = (20)/2; ingameshowZonesB.Top = 40; ingameshowZonesB.Anchor = Anchors.Bottom; ingameshowZonesB.Parent = ingameUIpartLeft; ingameshowZonesB.Click += ingameshowZonesB_Click; ingameshowBuildingsB = new Button(Manager); ingameshowBuildingsB.Init(); ingameshowBuildingsB.Text = "Постройки (Z)"; ingameshowBuildingsB.Width = resx/5 - 20; ingameshowBuildingsB.Height = 25; ingameshowBuildingsB.Left = (20)/2; ingameshowBuildingsB.Top = 70; ingameshowBuildingsB.Anchor = Anchors.Bottom; ingameshowBuildingsB.Parent = ingameUIpartLeft; ingameshowBuildingsB.Click += ingameshowBuildingsB_Click; ingameshowallinfo = new Button(Manager); ingameshowallinfo.Init(); ingameshowallinfo.Text = "Подробная информация"; ingameshowallinfo.Width = resx/5 - 20; ingameshowallinfo.Height = 25; ingameshowallinfo.Left = (20)/2; ingameshowallinfo.Top = 100; ingameshowallinfo.Anchor = Anchors.Bottom; ingameshowallinfo.Parent = ingameUIpartLeft; ingameshowallinfo.Click += ingameshowallinfo_Click; ingameUIpartLeftlistbox = new ListBox(Manager); ingameUIpartLeftlistbox.Init(); ingameUIpartLeftlistbox.Text = ""; ingameUIpartLeftlistbox.Width = resx/5 - 20; ingameUIpartLeftlistbox.Height = 90; ingameUIpartLeftlistbox.Left = 10; ingameUIpartLeftlistbox.Top = 200; ingameUIpartLeftlistbox.Anchor = Anchors.Bottom; ingameUIpartLeftlistbox.Parent = ingameUIpartLeft; ingameUIpartLeftlistbox.DoubleClick += maploadmenulistbox_DoubleClick; ingameUIpartLeftlistbox2 = new ListBox(Manager); ingameUIpartLeftlistbox2.Init(); ingameUIpartLeftlistbox2.Text = ""; ingameUIpartLeftlistbox2.Width = resx/5 - 20; ingameUIpartLeftlistbox2.Height = 200; ingameUIpartLeftlistbox2.Left = 10; ingameUIpartLeftlistbox2.Top = 300; ingameUIpartLeftlistbox2.Anchor = Anchors.Bottom; ingameUIpartLeftlistbox2.Parent = ingameUIpartLeft; Manager.Add(ingameUIpartLeft); #endregion #region orderssubmenu orderssubmenu = new Window(Manager); orderssubmenu.Init(); orderssubmenu.Text = ""; orderssubmenu.Width = 150; orderssubmenu.Height = 200; orderssubmenu.Center(); orderssubmenu.Visible = false; orderssubmenu.Resizable = false; digorder = new Button(Manager); digorder.Init(); digorder.Text = "Выкопать"; digorder.Width = orderssubmenu.Width - 40; digorder.Height = 24; digorder.Left = 20; digorder.Top = 20; digorder.Anchor = Anchors.Bottom; digorder.Parent = orderssubmenu; digorder.Click += digorder_Click; supplyorder = new Button(Manager); supplyorder.Init(); supplyorder.Text = "Обеспечить ресурсами"; supplyorder.Width = orderssubmenu.Width - 40; supplyorder.Height = 24; supplyorder.Left = 20; supplyorder.Top = 50; supplyorder.Anchor = Anchors.Bottom; supplyorder.Parent = orderssubmenu; supplyorder.Click += supplyorder_Click; cancelorder = new Button(Manager); cancelorder.Init(); cancelorder.Text = "Отменить все приказы"; cancelorder.Width = orderssubmenu.Width - 40; cancelorder.Height = 24; cancelorder.Left = 20; cancelorder.Top = 80; cancelorder.Anchor = Anchors.Bottom; cancelorder.Parent = orderssubmenu; cancelorder.Click += cancelorder_Click; collectorder = new Button(Manager); collectorder.Init(); collectorder.Text = "Cобрать"; collectorder.Width = orderssubmenu.Width - 40; collectorder.Height = 24; collectorder.Left = 20; collectorder.Top = 110; collectorder.Anchor = Anchors.Bottom; collectorder.Parent = orderssubmenu; collectorder.Click += collectorder_Click; orderslabel = new Label(Manager); orderslabel.Left = 5; orderslabel.Top = 5; orderslabel.Text = "Приказы"; orderslabel.Parent = orderssubmenu; Manager.Add(orderssubmenu); #endregion #region Buildings window buildinsgwindow = new Window(Manager) {BackColor = Color.Black}; buildinsgwindow.Init(); buildinsgwindow.Text = ""; buildinsgwindow.SetPosition(20, 20); buildinsgwindow.Width = 42*6 + 20; buildinsgwindow.Height = 300; buildinsgwindow.Visible = false; buildinsgwindow.Resizable = false; buildingssb = new ScrollBar(Manager, Orientation.Vertical); buildingssb.Init(); buildingssb.Top = 0; buildingssb.Width = 20; buildingssb.Left = buildinsgwindow.Width - buildingssb.Width - 20; buildingssb.Height = buildinsgwindow.Height - 40; buildingssb.Parent = buildinsgwindow; buildingssb.ValueChanged += buildingssb_ValueChanged; buildingsbuttons = new Button[dbobject.Data.Count]; buildingsbuttonslabel = new Label[dbobject.Data.Count]; int i = 0; foreach (var dbo in dbobject.Data) { buildingsbuttons[i] = new Button(Manager); buildingsbuttons[i].Init(); buildingsbuttons[i].Text = dbo.Value.Name; buildingsbuttons[i].Width = 40; buildingsbuttons[i].Height = 40; buildingsbuttons[i].Left = i%5*42; buildingsbuttons[i].Top = i/5*42; int[] tg = {buildingsbuttons[i].Top, dbo.Key}; buildingsbuttons[i].Tag = tg; buildingsbuttons[i].Anchor = Anchors.Bottom; buildingsbuttons[i].Parent = buildinsgwindow; buildingsbuttons[i].Glyph = new Glyph(object_tex, GetTexRectFromN(dbo.Value.MetatexN)); buildingsbuttons[i].ToolTip = new ToolTip(Manager); buildingsbuttons[i].ToolTip.Text = dbo.Value.Name + " id " + dbo.Key; buildingsbuttons[i].Click += Buildingsbutton_Click; iss.n.Add(dbo.Key, new LocalItem {id = dbo.Key, count = 0}); buildingsbuttonslabel[i] = new Label(Manager); buildingsbuttonslabel[i].Init(); buildingsbuttonslabel[i].Text = "0"; buildingsbuttonslabel[i].Width = 40; buildingsbuttonslabel[i].Height = 40; buildingsbuttonslabel[i].Left = i%5*42; buildingsbuttonslabel[i].Top = i/5*42; buildingsbuttonslabel[i].Parent = buildinsgwindow; i++; } Manager.Add(buildinsgwindow); #endregion #region Ingamemesages Ingamemesages = new Window(Manager); Ingamemesages.Init(); Ingamemesages.Text = ""; Ingamemesages.Width = 480; Ingamemesages.Height = 200; Ingamemesages.Center(); Ingamemesages.Visible = false; Ingamemesages.Resizable = false; IngamemesagesOk = new Button(Manager); IngamemesagesOk.Init(); IngamemesagesOk.Text = "OK"; IngamemesagesOk.Width = 72; IngamemesagesOk.Height = 24; IngamemesagesOk.Left = (Ingamemesages.ClientWidth/2) - (IngamemesagesOk.Width/2); IngamemesagesOk.Top = Ingamemesages.ClientHeight - IngamemesagesOk.Height - 8; IngamemesagesOk.Anchor = Anchors.Bottom; IngamemesagesOk.Parent = Ingamemesages; IngamemesagesOk.Click += IngamemesagesOk_Click; Ingamemesageslabel = new Label(Manager); Ingamemesageslabel.Left = 5; Ingamemesageslabel.Top = 5; Ingamemesageslabel.Text = "Text"; Ingamemesageslabel.Parent = Ingamemesages; Manager.Add(Ingamemesages); #endregion }
public void Init() { window = new Window(manager) ; window.Init(); window.Text = "Server List"; window.Width = 700; window.Height = 500; window.Center(); window.Visible = true; window.CloseButtonVisible = false; play = new Button(manager); play.Init(); play.Text = "Play"; play.Width = 100; play.Height = 24; play.Left = window.Width - play.Width - 40; play.Top = window.Height - 80; play.Anchor = Anchors.Right; play.Parent = window; refresh = new Button(manager); refresh.Init(); refresh.Text = "Refresh Server List"; refresh.Width = 150; refresh.Height = 24; refresh.Left = 30; refresh.Top = window.Height - 130; refresh.Anchor = Anchors.Left; refresh.Parent = window; back = new Button(manager); back.Init(); back.Text = "Back"; back.Width = 75; back.Height = 24; back.Left = 30; back.Top = window.Height - 80; back.Anchor = Anchors.Left; back.Parent = window; listview = new ListView(manager, headers); listview.Init(); listview.Width = 630; listview.Height = 300; listview.Left = 30; listview.Top = 40; listview.Anchor = Anchors.All; listview.HideSelection = false; listview.Parent = window; listview.Items = data; listview.ItemIndexChanged += new TomShane.Neoforce.Controls.EventHandler(listview_ItemIndexChanged); }
//////////////////////////////////////////////////////////////////////////// #endregion #region //// Methods /////////// //////////////////////////////////////////////////////////////////////////// protected override void Initialize() { base.Initialize(); // Load image image = Content.Load<Texture2D>("Content\\Image"); // Creates and initializes window window = new Window(manager); window.Init(); window.Text = "ScrollBars"; window.Width = 360; window.Height = 360; window.Center(); window.Visible = true; // Setup of the vertical scrollbar vert = new ScrollBar(manager, Orientation.Vertical); vert.Init(); vert.Parent = window; vert.Top = 0; vert.Left = window.ClientWidth - vert.Width ; vert.Height = window.ClientHeight - vert.Width; vert.Value = 0; vert.Anchor = Anchors.Top | Anchors.Right | Anchors.Bottom; // Setup of the horizontal scrollbar horz = new ScrollBar(manager, Orientation.Horizontal); horz.Init(); horz.Parent = window; horz.Left = 0; horz.Top = window.ClientHeight - horz.Height; horz.Width = window.ClientWidth - vert.Width; horz.Value = 0; horz.Anchor = Anchors.Left | Anchors.Right | Anchors.Bottom; // Creates imagebox in the client area box = new ImageBox(manager); box.Init(); box.Parent = window; box.Left = 0; box.Top = 0; box.Width = window.ClientWidth - vert.Width; box.Height = window.ClientHeight - horz.Height; box.Image = image; box.Anchor = Anchors.All; // Add window to manager processing manager.Add(window); // Bind events window.Resize += new ResizeEventHandler(Recalc); vert.ValueChanged += new EventHandler(ValueChanged); horz.ValueChanged += new EventHandler(ValueChanged); Recalc(this, null); // Calculates initial properties of the scrollbars }
protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, PloobsEngine.SceneControl.IContentManager contentManager) { tile = factory.GetTexture2D("Textures/tile"); FarseerWorld fworld = this.World.PhysicWorld as FarseerWorld; ///border border = new Border(fworld, factory, GraphicInfo, factory.CreateTexture2DColor(1, 1, Color.Red)); ///from texture { Texture2D tex = factory.GetTexture2D("Textures//goo"); IModelo2D model = new SpriteFarseer(tex); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model); I2DObject o = new I2DObject(fs, mat, model); o.PhysicObject.Position = new Vector2(200, 0); this.World.AddObject(o); } ///from texture, scale usage sample { Texture2D tex = factory.GetTexture2D("Textures//goo"); tex = factory.GetScaledTexture(tex, new Vector2(2)); IModelo2D model = new SpriteFarseer(tex); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model); I2DObject o = new I2DObject(fs, mat, model); o.OnHasMoved += new PloobsEngine.SceneControl._2DScene.OnHasMoved(o_OnHasMoved); this.World.AddObject(o); } ///rectangle Vertices verts = PolygonTools.CreateRectangle(50, 50); { IModelo2D model = new SpriteFarseer(factory, verts, Color.Orange); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model); I2DObject o = new I2DObject(fs, mat, model); o.PhysicObject.Position = new Vector2(-200, 0); this.World.AddObject(o); } ///circle CircleShape circle = new CircleShape(50, 1); { IModelo2D model = new SpriteFarseer(factory, circle, Color.Orange); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); FarseerObject fs = new FarseerObject(fworld, model); I2DObject o = new I2DObject(fs, mat, model); o.PhysicObject.Position = new Vector2(200, -100); this.World.AddObject(o); } ///animated sprite { Texture2D tex = factory.GetTexture2D("Textures//DudeSheet"); SpriteAnimated sa = new SpriteAnimated(tex, 8, 2); sa.AddAnimation("ANIM1", 1, 8, 0); sa.AddAnimation("ANIM2", 2, 4, MathHelper.PiOver2); Basic2DTextureMaterial mat = new Basic2DTextureMaterial(); Texture2D frame = factory.GetTexturePart(tex, sa.GetFrameRectangle("ANIM1", 0)); FarseerObject fs = new FarseerObject(fworld, frame); //GhostObject fs = new GhostObject(Vector2.Zero); sheet = new I2DObject(fs, mat, sa); sheet.PhysicObject.Position = new Vector2(500, 0); this.World.AddObject(sheet); } { PointLight2D l = new PointLight2D(new Vector2(-GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Red, 1); this.World.AddLight(l); } { SpotLight2D l = new SpotLight2D(new Vector2(+GraphicInfo.BackBufferWidth / 4, -GraphicInfo.BackBufferWidth / 4), Color.Blue, new Vector2(0, 1), MathHelper.ToRadians(45)); this.World.AddLight(l); } { SimpleConcreteKeyboardInputPlayable sc = new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space); sc.KeyStateChange += new KeyStateChange(sc_KeyStateChange); this.BindInput(sc); } ///camera this.World.Camera2D = new Camera2D(GraphicInfo); DPFSParticleSystem ps = new DPFSParticleSystem("TESTE", new SpriteParticleSystem(null)); this.World.ParticleManager.AddAndInitializeParticleSystem(ps); ///add a post effect =P //this.RenderTechnic.AddPostEffect(new WigglePostEffect()); ///updateable JointUpdateable ju = new JointUpdateable(this, fworld, this.World.Camera2D); base.LoadContent(GraphicInfo, factory, contentManager); { NeoforceGui guiManager = this.Gui as NeoforceGui; System.Diagnostics.Debug.Assert(guiManager != null); // Create and setup Window control. Window window = new Window(guiManager.Manager); window.Init(); window.Text = "Getting Started"; window.Width = 480; window.Height = 200; window.Center(); window.Visible = true; // Create Button control and set the previous window as its parent. Button button = new Button(guiManager.Manager); button.Init(); button.Text = "OK"; button.Width = 72; button.Height = 24; button.Left = (window.ClientWidth / 2) - (button.Width / 2); button.Top = window.ClientHeight - button.Height - 8; button.Anchor = Anchors.Bottom; button.Parent = window; // Add the window control to the manager processing queue. guiManager.Manager.Add(window); } }
public override void LoadContent(ContentManager contentloader) { _guiman = new Manager(_gamemanager.Game, _gamemanager.Graphics, "Default"); _guiman.Initialize(); _serverbrowsingmenu = new Window(_guiman); _serverbrowsingmenu.Init(); _serverbrowsingmenu.Resizable = false; _serverbrowsingmenu.Movable = false; _serverbrowsingmenu.CloseButtonVisible = false; _serverbrowsingmenu.Text = "Server Browser"; _serverbrowsingmenu.Width = 300; _serverbrowsingmenu.Height = 400; _serverbrowsingmenu.Center(); _serverbrowsingmenu.Visible = true; _serverbrowsingmenu.BorderVisible = true; _serversbox = new ListBox(_guiman); _serversbox.Init(); //servers.SetPosition(50, 50); _serversbox.Left = 50; _serversbox.Top = 150; _serversbox.Width = 200; _serversbox.Height = 200; _serversbox.Anchor = Anchors.Bottom; _serversbox.Parent = _serverbrowsingmenu; _join = new Button(_guiman); _join.Init(); _join.Text = "Join"; _join.Width = 200; _join.Height = 50; _join.Left = 50; _join.Top = 0; _join.Anchor = Anchors.Bottom; _join.Parent = _serverbrowsingmenu; _refresh = new Button(_guiman); _refresh.Init(); _refresh.Text = "Refresh"; _refresh.Width = 200; _refresh.Height = 50; _refresh.Left = 50; _refresh.Top = 50; _refresh.Anchor = Anchors.Bottom; _refresh.Parent = _serverbrowsingmenu; _back = new Button(_guiman); _back.Init(); _back.Text = "Back"; _back.Width = 200; _back.Height = 50; _back.Left = 50; _back.Top = 100; _back.Anchor = Anchors.Bottom; _back.Parent = _serverbrowsingmenu; _guiman.Cursor = _guiman.Skin.Cursors["Default"].Resource; _guiman.Add(_serverbrowsingmenu); _gamemanager.Game.IsMouseVisible = true; }