public TerraformWindow(GUISystem system, GUITheme theme) : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Terraform Options", theme, false) { Position = new UDim2(0, 0, 0.75f, 0); MinSize = new UDim2(0, 200, 0, 250); MaxSize = new UDim2(0, 475, 0, 350); GUIForm form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme); GUILabel brushSizeLabel; GUITextField brushSizeField; form.AddLabledTextField("Brush Size:", BrushSize.ToString(), new UDim2(0, 5, 0, 25), out brushSizeLabel, out brushSizeField); brushSizeField.OnTextChanged += BrushSizeField_OnTextChanged; GUILabel riseHeightLabel; GUITextField riseHeightField; form.AddLabledTextField("Rise Height:", RiseHeight.ToString(), new UDim2(0, 5, 0, 30 + brushSizeLabel.Size.Y.Offset), out riseHeightLabel, out riseHeightField); riseHeightField.OnTextChanged += RiseHeightField_OnTextChanged; AddTopLevel(form); }
public PlayerFrame(NetworkPlayer player, bool isOurPlayer, UDim2 position, UDim2 size, GUITheme theme) : base(position, size, Image.CreateBlank(Color.White)) { Theme = theme; NetPlayer = player; this.isOurPlayer = isOurPlayer; nameLabel = new GUILabel(UDim2.Zero, UDim2.Fill, "", TextAlign.Left, theme) { Parent = this }; nameLabel.Font = Theme.GetField <BMPFont>(null, "Leaderboard.PlayerLabel.Font"); nameLabel.TextPadding.X = 6; scoreLabel = new GUILabel(UDim2.Zero, new UDim2(1f, -50, 1f, 0), "0", TextAlign.Right, theme) { Parent = this }; scoreLabel.Font = Theme.GetField <BMPFont>(null, "Leaderboard.PlayerLabel.Font"); scoreLabel.TextPadding.Z = 6; pingLabel = new GUILabel(UDim2.Zero, UDim2.Fill, "0ms", TextAlign.Right, theme) { Parent = this }; pingLabel.Font = Theme.GetField <BMPFont>(null, "Leaderboard.PlayerLabel.Font"); pingLabel.TextPadding.Z = 6; SetName(player.Name); SetScore(player.Score); }
public static GUITheme CreateDefaultGameTheme() { GUITheme theme = GUITheme.Basic; string guiPalette = "Textures/Gui/gui-palette.png"; theme.SetField("Button.NormalImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(0, 0, 66, 66))); theme.SetField("Button.HoverImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(66, 0, 66, 66))); theme.SetField("Button.ActiveImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(132, 0, 66, 66))); theme.SetField("Button.ToggledImage", Image.CreateBlank(new Color(194, 37, 37))); theme.SetField("Button.TextColor", Color.White); theme.SetField("TextField.NormalImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(0, 66, 66, 66))); theme.SetField("TextField.HoverImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(66, 66, 66, 66))); theme.SetField("TextField.ActiveImage", new BorderedImage(GLoader.LoadTexture(guiPalette), new Rectangle(132, 66, 66, 66))); theme.SetField("Label.TextColor", Color.White); theme.SetField("Label.TextShadowColor", new Color(0, 0, 0, 0.6f)); theme.SetField("Frame.Image", Image.CreateBlank(new Color(30, 30, 30, 240))); theme.SetField("Window.BackgroundImage", Image.CreateBlank(new Color(30, 30, 30, 200))); theme.SetField("Window.TitleBar.BackgroundImage", Image.CreateBlank(new Color(31, 47, 70))); theme.SetField("Window.TitleBar.CloseButton.NormalImage", Image.CreateBlank(new Color(152, 34, 34))); theme.SetField("Window.TitleBar.CloseButton.HoverImage", Image.CreateBlank(new Color(135, 15, 15))); theme.SetField("Window.TitleBar.CloseButton.ActiveImage", Image.CreateBlank(new Color(188, 84, 84))); theme.SetField("SmallFont", LoadFont("arial-bold-12")); theme.SetField("Font", LoadFont("arial-14")); theme.SetField("BigFont", LoadFont("arial-18")); return(theme); }
public GUIColorPickerWindow(GUISystem system, UDim2 size, GUITheme theme, bool closable = true) : base(system, size, "Color Picker", theme, closable) { ColorPicker = new GUIColorPicker(new UDim2(0, 5, 0, 25), new UDim2(1f, -10, 1f, -30), theme); AddTopLevel(ColorPicker); }
public SingleplayerMenu(GUISystem system, GUITheme theme, MainWindow mainWindow) : base(system, new UDim2(0.35f, 0, 0.3f, 0), "Ace of Spades", theme) { IsDraggable = false; MaxSize = new UDim2(0, 400, 1f, 0); MinSize = new UDim2(0, 220, 0, 100); GUIButton backBtn = new GUIButton(new UDim2(0, 0, 0, 25), new UDim2(1f, 0, 0, 30), "Back to Main Menu", TextAlign.Center, theme); backBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { mainWindow.SwitchScreen("MainMenu"); } }; GUIButton controlsBtn = new GUIButton(new UDim2(0, 0, 0, 60), new UDim2(1f, 0, 0, 30), "View Controls", TextAlign.Center, theme); controlsBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { mainWindow.StaticGui.ToggleControlsWindow(true); } }; AddTopLevel(backBtn, controlsBtn); }
public StaticGui(MainWindow window, MasterRenderer renderer) { this.window = window; this.renderer = renderer; gsys = renderer.Sprites.GUISystem; area = new GUIArea(gsys); renderer.Sprites.Add(area); BMPFont smallFont = AssetManager.LoadFont("arial-bold-12"); BMPFont normalFont = AssetManager.LoadFont("arial-bold-14"); BMPFont bigFont = AssetManager.LoadFont("arial-bold-20"); BMPFont tinyFont = AssetManager.LoadFont("arial-bold-10"); GUITheme theme = AssetManager.CreateDefaultGameTheme(); theme.SetField("SmallFont", smallFont); theme.SetField("Font", normalFont); theme.SetField("TinyFont", tinyFont); controls = new ControlsWindow(gsys, theme); controls.ZIndex = 200; // Overlay fpsLabel = new GUILabel(UDim2.Zero, UDim2.Zero, "FPS: --", TextAlign.TopLeft, theme); timeLabel = new GUILabel(new UDim2(1f, 0, 0, 0), UDim2.Zero, "Time: --", TextAlign.TopRight, theme); versionLabel = new GUILabel(new UDim2(0, 0, 1f, 0), UDim2.Zero, GameVersion.Current.ToString(), TextAlign.BottomLeft, theme); fpsLabel.Font = smallFont; timeLabel.Font = smallFont; versionLabel.Font = bigFont; if (screenshots == null) { string[] mainMenuFiles = Directory.GetFiles("Content/Textures/MainMenu"); screenshots = new List <Texture>(); foreach (string file in mainMenuFiles) { // Skip thumbs.db if (file.EndsWith(".db")) { continue; } try { screenshots.Add(GLoader.LoadTexture(file, TextureMinFilter.Linear, TextureMagFilter.Linear, true)); } catch (Exception e) { DashCMD.WriteError("Failed to load main menu background '{1}'. \n{0}", e, file); } } } background = new GUIFrame(UDim2.Zero, new UDim2(1f, 0, 1f, 0), Image.Blank); background.ZIndex = -100; area.AddTopLevel(background, fpsLabel, timeLabel, versionLabel); gsys.Add(controls); }
public ControlsWindow(GUISystem system, GUITheme theme) : base(system, UDim2.Zero, "Controls", theme) { labels = new List <GUILabel>(); Setup(); ZIndex = 100; font = theme.GetField <BMPFont>(null, "SmallFont"); }
public SingleplayerScreen(MainWindow window) : base(window, "Singleplayer") { GUITheme theme = AssetManager.CreateDefaultGameTheme(); theme.SetField("Font", AssetManager.LoadFont("arial-14")); menu = new SingleplayerMenu(GUISystem, theme, Window); menu.OnClosed += Menu_OnClosed; GUISystem.Add(menu); Windows.Add(menu); }
public MultiplayerLoadingBar(GUISystem system, GUITheme theme) : base(system, new UDim2(0.8f, 0, 0, 120), "", theme, false) { IsDraggable = false; barAnim = new FloatAnim(); byteAnim = new FloatAnim(); statusLabel = new GUILabel(new UDim2(0.5f, 0, 0.4f, 0), UDim2.Zero, "0/0 bytes", theme); bar = new GUIFrame(new UDim2(0, 5, 1f, -35), new UDim2(0, -10, 0, 30), Image.Blank); AddTopLevel(statusLabel, bar); }
public ObjectEditWindow(GUISystem system, GUITheme theme) : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Edit <Object>", theme, false) { Position = new UDim2(0, 0, 0.75f, 0); MinSize = new UDim2(0, 200, 0, 250); MaxSize = new UDim2(0, 475, 0, 350); elements = new List <GUIElement>(); form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme); AddTopLevel(form); Visible = false; }
//bool showGameItems; public HUD(MasterRenderer renderer) { this.renderer = renderer; font = AssetManager.LoadFont("karmasuture-26"); feed = new List <FeedItem>(); hitIndications = new List <HitIndication>(); if (palletTex == null) { palletTex = GLoader.LoadTexture("Textures/Gui/palette.png"); Texture crosshairTex = GLoader.LoadTexture("Textures/Gui/crosshair.png"); Texture hitmarkerTex = GLoader.LoadTexture("Textures/Gui/hitmarker.png"); crosshairImage = new Image(crosshairTex); hitmarkerImage = new Image(hitmarkerTex); hurtRingTex = GLoader.LoadTexture("Textures/Gui/hurt-ring.png"); intelTex = GLoader.LoadTexture("Textures/Gui/intel.png", TextureMinFilter.Nearest, TextureMagFilter.Nearest); } GUISystem gsys = renderer.Sprites.GUISystem; area = new GUIArea(gsys); area.ZIndex = -1; theme = GUITheme.Basic; theme.SetField("Font", font); theme.SetField("SmallFont", AssetManager.LoadFont("arial-bold-14")); theme.SetField("Label.TextColor", Color.White); theme.SetField("Label.TextShadowColor", new Color(0, 0, 0, 0.6f)); healthLabel = new GUILabel(new UDim2(0, 40, 1, -20), UDim2.Zero, "Health: --", TextAlign.BottomLeft, theme); ammoLabel = new GUILabel(new UDim2(1, -50, 1, -25), UDim2.Zero, "", TextAlign.BottomRight, theme); crosshair = new GUIFrame(new UDim2(0.5f, -28, 0.5f, -28), new UDim2(0, 56, 0, 56), crosshairImage); hitmarker = new GUIFrame(new UDim2(0.5f, -43, 0.5f, -43), new UDim2(0, 86, 0, 86), hitmarkerImage); hitmarker.Visible = false; intelInHand = new GUIFrame(new UDim2(0.5f, -20, 0, 100), new UDim2(0, 40, 0, 40), new Image(intelTex)); intelPickedUpNotification = new GUILabel(new UDim2(0.5f, 0, 0, 150), UDim2.Zero, "You have picked up the intel!", TextAlign.TopCenter, theme); intelInHand.Visible = false; intelPickedUpNotification.Visible = false; crosshair.CapturesMouseClicks = false; hitmarker.CapturesMouseClicks = false; ammoLabel.CapturesMouseClicks = false; healthLabel.CapturesMouseClicks = false; area.AddTopLevel(ammoLabel, healthLabel, crosshair, hitmarker, intelInHand, intelPickedUpNotification); }
public ChatBox(UDim2 position, UDim2 size, GUITheme theme, MultiplayerScreen screen) : base(position, size, theme) { this.screen = screen; items = new List <ChatItem>(); Image = null; font = AssetManager.LoadFont("arial-bold-11"); textField = new GUITextField(new UDim2(0, 0, 1f, -15), new UDim2(1f, 0, 0, 30), theme) { Parent = this }; textField.OnEnterPressed += TextField_OnEnterPressed; }
public ChatItem(GUITheme theme, float height, int numFeed, string text, BMPFont font) : base(UDim2.Zero, UDim2.Zero, image: null) { Position = new UDim2(0, 0, 0, 20 + (height * numFeed)); Size = new UDim2(0, 1f, 0, height); label = new GUILabel(UDim2.Zero, new UDim2(0, 1, 1f, 0), text, TextAlign.Left, Color.White, theme) { Parent = this }; label.Font = font; TimeLeft = 60f; }
public PaintWindow(GUISystem system, GUITheme theme) : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Paint Options", theme, false) { Position = new UDim2(0, -10, 0.7f, -10); MinSize = new UDim2(0, 200, 0, 250); MaxSize = new UDim2(0, 475, 0, 350); GUIForm form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme); GUILabel grainLabel; GUITextField grainField; form.AddLabledTextField("Grainy Factor:", Grain.ToString(), new UDim2(0, 5, 0, 25), out grainLabel, out grainField); grainField.OnTextChanged += GrainField_OnTextChanged; AddTopLevel(form); }
public TranslateTerrainWindow(GUISystem system, GUITheme theme) : base(system, new UDim2(0.2f, 0, 0, 175), "Translate Terrain", theme) { MinSize = new UDim2(0.2f, 0, 0, 175); GUIForm form = new GUIForm(new UDim2(0, 5, 0, 25), new UDim2(1f, -5, 1f, -25), theme); form.AddLabledTextField("X:", "0", new UDim2(0, 0, 0, 0), out xField); form.AddLabledTextField("Y:", "0", new UDim2(0, 0, 0, 35), out yField); form.AddLabledTextField("Z:", "0", new UDim2(0, 0, 0, 70), out zField); GUIButton applyBtn = new GUIButton(new UDim2(0, 5, 1f, -40), new UDim2(0, 100, 0, 30), "Apply", theme); GUIButton cancelBtn = new GUIButton(new UDim2(1f, -105, 1f, -35), new UDim2(0, 100, 0, 30), "Cancel", theme); applyBtn.OnMouseClick += ApplyBtn_OnMouseClick; cancelBtn.OnMouseClick += CancelBtn_OnMouseClick; AddTopLevel(form, applyBtn, cancelBtn); }
public GUIWindow(GUISystem system, UDim2 position, UDim2 size, string title, GUITheme theme, bool closable = true, bool createTitleBar = true) : base(system, position, size) { Theme = theme; if (createTitleBar) { TitleBar = new GUILabel(UDim2.Zero, new UDim2(1f, 0, 0, 20), title, theme.GetField <Color>(Color.White, "Window.TitleBar.TextColor"), theme); TitleBar.CapturesMouseClicks = true; TitleBar.ZIndex = 100; TitleBar.BackgroundImage = theme.GetField <Image>(Image.CreateBlank(new Color(40, 40, 40)), "Window.TitleBar.BackgroundImage"); if (closable) { ExitButton = new GUIButton(new UDim2(1f, -20, 0, 0), new UDim2(0, 20, 0, 20), theme.GetField <string>("X", "Window.TitleBar.CloseButton.Text"), TextAlign.Center, theme, theme.GetField <Image>(Image.CreateBlank(new Color(230, 0, 0)), "Window.TitleBar.CloseButton.NormalImage"), theme.GetField <Image>(Image.CreateBlank(new Color(255, 0, 0)), "Window.TitleBar.CloseButton.HoverImage"), theme.GetField <Image>(Image.CreateBlank(new Color(200, 0, 0)), "Window.TitleBar.CloseButton.ActiveImage"), null); ExitButton.Parent = TitleBar; ExitButton.OnMouseClick += (btn, mbtn) => { Visible = false; }; } } BackgroundFrame = new GUIFrame(new UDim2(0, 0, 0, createTitleBar ? 20 : 0), new UDim2(1f, 0, 1f, createTitleBar ? -20 : 0), theme.GetField <Image>(Image.CreateBlank(new Color(70, 70, 70, 200)), "Window.BackgroundImage")); BackgroundFrame.ZIndex = -100; if (createTitleBar) { SetDragHandle(TitleBar); AddTopLevel(TitleBar); } AddTopLevel(BackgroundFrame); }
public EditorUI(MasterRenderer renderer, EditorScreen screen) { this.renderer = renderer; this.screen = screen; GUISystem gsys = renderer.Sprites.GUISystem; area = new GUIArea(gsys); renderer.Sprites.Add(area); theme = EditorTheme.Glass; GenBar(renderer.ScreenWidth); openFileWindow = new FileBrowserWindow(gsys, theme, new UDim2(0.75f, 0, 0.75f, 0), "Open Model", FileBrowserMode.OpenFile, new string[] { ".aosm" }, (window) => { if (File.Exists(window.FileName)) { screen.LoadModel(window.FileName); } }); saveFileWindow = new FileBrowserWindow(gsys, theme, new UDim2(0.75f, 0, 0.75f, 0), "Save Model", FileBrowserMode.Save, new string[] { ".aosm" }, (window) => { string fullPath = Path.Combine(window.CurrentDirectory, window.FileName); if (!Path.HasExtension(fullPath)) { fullPath += ".aosm"; } screen.SaveModel(fullPath); }); gsys.Add(openFileWindow, saveFileWindow); }
public ConnectWindow(GUISystem system, GUITheme theme, UDim2 size) : base(system, size, "Connect to server", theme) { GUILabel endPointLabel = new GUILabel(new UDim2(0, 10, 0, 50), UDim2.Zero, "Server Address:", TextAlign.Left, theme); Vector2 labelSize = endPointLabel.Font.MeasureString(endPointLabel.Text); endPointField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 35), new UDim2(1f, -labelSize.X - 30, 0, 30), "", TextAlign.Left, theme); GUILabel nameLabel = new GUILabel(new UDim2(0, 10, 0, 100), UDim2.Zero, "Player Name:", TextAlign.Left, theme); labelSize = nameLabel.Font.MeasureString(nameLabel.Text); playerField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 85), new UDim2(1f, -labelSize.X - 30, 0, 30), "Player", TextAlign.Left, theme); playerField.MaxLength = 60; connectBtn = new GUIButton(new UDim2(0, 10, 1f, -40), new UDim2(0, 100, 0, 30), "Connect", theme); connectBtn.OnMouseClick += (btn, mbtn) => { TryConnect(); }; AddTopLevel(endPointLabel, endPointField, nameLabel, playerField, connectBtn); }
public HUD(MasterRenderer renderer, Player player, DashFont font) { this.renderer = renderer; this.player = player; this.font = font; surface = new GUISurface2D(renderer.ScreenWidth, renderer.ScreenHeight); renderer.Gui.Add(surface); GUITheme theme = new GUITheme() { Font = font, LabelTextColor = Color.White, }; healthLabel = new GUILabel(new UDim2(0, 40, 1, -20), UDim2.Zero, theme, "Health: --", TextAlign.BottomLeft); ammoLabel = new GUILabel(new UDim2(1, -50, 1, -25), UDim2.Zero, theme, "", TextAlign.BottomRight); crosshairDot = new GUIImage(GUISurface.BlankTexture, new UDim2(0.5f, -1, 0.5f, -1), new UDim2(0, 2, 0, 2), theme); surface.Add(ammoLabel, healthLabel, crosshairDot); }
public MultiplayerScreen(MainWindow window) : base(window, "Multiplayer") { debugRenderer = Renderer.GetRenderer3D <DebugRenderer>(); gamemodes = new Dictionary <GamemodeType, NetworkedGamemode>() { { GamemodeType.TDM, new TDMGamemode(this) }, { GamemodeType.CTF, new CTFGamemode(this) } }; // Build the UI elements theme = AssetManager.CreateDefaultGameTheme(); font = theme.GetField <BMPFont>(null, "SmallFont"); hud = new HUD(Renderer); loadingBar = new MultiplayerLoadingBar(GUISystem, theme); chat = new ChatBox(new UDim2(0, 40, 1f, -240), new UDim2(0, 350, 0, 165), theme, this); menu = new MultiplayerMenu(GUISystem, theme, Window); menu.OnClosed += Menu_OnClosed; announcementLabel = new GUILabel(new UDim2(0.5f, 0, 0.5f, 0), UDim2.Zero, "", TextAlign.Center, theme); announcementLabel.Font = AssetManager.LoadFont("karmasuture-32"); announcementLabel.Visible = false; // Add each UI element GUIArea.AddTopLevel(chat, announcementLabel); GUISystem.Add(loadingBar, menu); Windows.Add(loadingBar); Windows.Add(menu); // Setup default multiplayer cvars DashCMD.SetCVar("cl_impacts", false); DashCMD.SetCVar("cl_interp", 0.5f); // Client interpolation with server position DashCMD.SetCVar("cl_interp_movement_smooth", 1f); // Client player movement smoothing (1f = no smoothing) DashCMD.SetCVar("cl_interp_rep", 20f); // Replicated entities interpolation DashCMD.SetCVar("cl_max_error_dist", 12f); // Max distance the client's position can be off from the server's }
public FeedItem(GUITheme theme, float height, int numFeed, string left, Color leftColor, string middle, string right, Color rightColor, BMPFont font) : base(UDim2.Zero, UDim2.Zero, image: null) { float leftLen = font.MeasureString(left).X; float midLen = font.MeasureString(middle).X; float rightLen = font.MeasureString(right).X; float fullLen = leftLen + midLen + rightLen + 20; float midX = ((leftLen + 10) + (fullLen - rightLen - 10)) / 2f; Position = new UDim2(1f, -fullLen - 10, 0, 20 + (height * numFeed)); Size = new UDim2(0, fullLen, 0, 25); leftLabel = new GUILabel(UDim2.Zero, new UDim2(0, 1, 1f, 0), left, TextAlign.Left, leftColor, theme) { Parent = this }; rightLabel = new GUILabel(new UDim2(1, 0, 0, 0), new UDim2(0, 1, 1f, 0), right, TextAlign.Right, rightColor, theme) { Parent = this }; centerLabel = new GUILabel(new UDim2(0, midX, 0, 0), new UDim2(0, 1, 1f, 0), middle, TextAlign.Center, theme) { Parent = this }; leftLabel.Font = font; rightLabel.Font = font; centerLabel.Font = font; TimeLeft = 5f; }
public MainMenuScreen(MainWindow mainWindow) : base(mainWindow, "MainMenu") { theme = AssetManager.CreateDefaultGameTheme(); theme.SetField("SmallFont", AssetManager.LoadFont("arial-bold-14")); theme.SetField("Font", AssetManager.LoadFont("arial-16")); theme.SetField("BigFont", AssetManager.LoadFont("arial-20")); popup = new MessageWindow(GUISystem, theme, new UDim2(0.1f, 0, 0.3f, 0), "Alert!"); popup.MinSize = new UDim2(0, 215, 0, 200); popup.MaxSize = new UDim2(1f, 0, 0, 275); connectWindow = new ConnectWindow(GUISystem, theme, new UDim2(1f, 0, 1f, 0)); connectWindow.MinSize = new UDim2(0, 375, 0, 200); connectWindow.MaxSize = new UDim2(0, 700, 0, 200); connectWindow.OnConnectPressed += ConnectWindow_OnConnectPressed; GUIFrame title = new GUIFrame(new UDim2(0.5f, -260, 0.2f, -40), new UDim2(0, 520, 0, 80), new Image(GLoader.LoadTexture("Textures/title.png"))); GUIFrame btnFrame = new GUIFrame(new UDim2(0.5f, -200, 0.5f, -50), new UDim2(0, 400, 0, 110), theme); btnFrame.Image = null; GUIButton connectBtn = new GUIButton(new UDim2(0, 0, 0, 0), new UDim2(1f, 0, 0, 30), "Connect to a Server", TextAlign.Center, theme) { Parent = btnFrame }; connectBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { connectWindow.Visible = true; } }; GUIButton controlsBtn = new GUIButton(new UDim2(0, 0, 0, 40), new UDim2(1f, 0, 0, 30), "View Controls", TextAlign.Center, theme) { Parent = btnFrame }; controlsBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { Window.StaticGui.ToggleControlsWindow(true); } }; GUIButton spBtn = new GUIButton(new UDim2(0, 0, 0, 80), new UDim2(1f, 0, 0, 30), "Start Singleplayer Test", TextAlign.Center, theme) { Parent = btnFrame }; spBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { Window.SwitchScreen("Singleplayer"); } }; GUIButton randomImageButton = new GUIButton(new UDim2(1f, -160, 1f, -40), new UDim2(0, 150, 0, 30), "Random Image", theme); randomImageButton.OnMouseClick += (btn, mbtn) => { Window.StaticGui.ShowRandomBackgroundImage(); }; GUIArea.AddTopLevel(title, randomImageButton, btnFrame); GUISystem.Add(connectWindow, popup); Windows.Add(connectWindow); Windows.Add(popup); }
/// <summary> /// Create new helper /// </summary> /// <param name="WindowWidth"></param> /// <param name="theme"></param> public ToolBarCreator(GUITheme theme) { this.theme = theme; this.countDiv = 0; this.bar = new GUIFrame(UDim2.Zero, new UDim2(1, 0, 0, 40), this.theme); }
public GUIWindow(GUISystem system, UDim2 size, string title, GUITheme theme, bool closable = true, bool createTitleBar = true) : this(system, UDim2.Zero, size, title, theme, closable, createTitleBar) { Center(); }
public Leaderboard(GUISystem gsys, GUITheme theme, NetPlayerComponent netPlayerComponent) : base(gsys, new UDim2(0.65f, 0, 0.65f, 0), "Leaderboard", theme, false, false) { MinSize = new UDim2(0, 300, 0, 400); this.netPlayerComponent = netPlayerComponent; IsDraggable = false; playerFrames = new Dictionary <ushort, PlayerFrame>(); orderedTeamA = new List <PlayerFrame>(); orderedTeamB = new List <PlayerFrame>(); bigFont = AssetManager.LoadFont("karmasuture-26"); theme.SetField("Leaderboard.PlayerLabel.Font", AssetManager.LoadFont("arial-14")); teamAFrame = new GUIFrame(UDim2.Zero, new UDim2(0.5f, 0, 1f, 0), image: null); teamBFrame = new GUIFrame(new UDim2(0.5f, 0, 0, 0), new UDim2(0.5f, 0, 1f, 0), image: null); footerFrame = new GUIFrame(new UDim2(0, 0, 1f, -30), new UDim2(1f, 0, 0, 30), theme); gamemodeLabel = new GUILabel(UDim2.Zero, new UDim2(0.5f, 0, 1f, 0), "Current Gamemode: --", TextAlign.Left, theme) { Parent = footerFrame }; gamemodeInfoLabel = new GUILabel(new UDim2(0.5f, 0, 0, 0), new UDim2(0.5f, 0, 1f, 0), "", TextAlign.Right, theme) { Parent = footerFrame }; GUILabel teamALabel = new GUILabel(new UDim2(0, 0, 0, 0), new UDim2(1f, 0, 0, 40), "Red Team", TextAlign.Left, Theme) { Parent = teamAFrame }; GUILabel teamBLabel = new GUILabel(new UDim2(0, 0, 0, 0), new UDim2(1f, 0, 0, 40), "Blue Team", TextAlign.Left, Theme) { Parent = teamBFrame }; teamAScoreLabel = new GUILabel(new UDim2(1f, 0, 0, 0), new UDim2(0, 1, 0, 40), "0", TextAlign.Right, Theme) { Parent = teamAFrame }; teamBScoreLabel = new GUILabel(new UDim2(1f, 0, 0, 0), new UDim2(0, 1, 0, 40), "0", TextAlign.Right, Theme) { Parent = teamBFrame }; GUILabel teamAPlayerNameLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, 0, 0, 20), "Name", TextAlign.Left, theme) { Parent = teamAFrame }; GUILabel teamAPlayerScoreLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, -50, 0, 20), "Score", TextAlign.Right, theme) { Parent = teamAFrame }; GUILabel teamAPlayerPingLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, 0, 0, 20), "Ping", TextAlign.Right, theme) { Parent = teamAFrame }; GUILabel teamBPlayerNameLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, 0, 0, 20), "Name", TextAlign.Left, theme) { Parent = teamBFrame }; GUILabel teamBPlayerScoreLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, -50, 0, 20), "Score", TextAlign.Right, theme) { Parent = teamBFrame }; GUILabel teamBPlayerPingLabel = new GUILabel(new UDim2(0, 0, 0, 40), new UDim2(1f, 0, 0, 20), "Ping", TextAlign.Right, theme) { Parent = teamBFrame }; teamALabel.TextPadding.X = 6; teamBLabel.TextPadding.X = 6; teamAScoreLabel.TextPadding.Z = 6; teamBScoreLabel.TextPadding.Z = 6; teamAPlayerNameLabel.TextPadding.X = 6; teamAPlayerScoreLabel.TextPadding.Z = 6; teamAPlayerPingLabel.TextPadding.Z = 6; teamBPlayerNameLabel.TextPadding.X = 6; teamBPlayerScoreLabel.TextPadding.Z = 6; teamBPlayerPingLabel.TextPadding.Z = 6; teamALabel.BackgroundImage = Image.CreateBlank(new Color(186, 52, 52, 127)); teamBLabel.BackgroundImage = Image.CreateBlank(new Color(39, 78, 194, 127)); teamAPlayerNameLabel.BackgroundImage = theme.GetField <Image>(null, "Frame.Image"); teamBPlayerNameLabel.BackgroundImage = theme.GetField <Image>(null, "Frame.Image"); teamALabel.Font = bigFont; teamBLabel.Font = bigFont; teamAScoreLabel.Font = bigFont; teamBScoreLabel.Font = bigFont; teamAScoreLabel.ZIndex = 1; teamBScoreLabel.ZIndex = 1; teamAPlayerScoreLabel.ZIndex = 1; teamBPlayerScoreLabel.ZIndex = 1; teamAPlayerPingLabel.ZIndex = 1; teamBPlayerPingLabel.ZIndex = 1; AddTopLevel(teamAFrame, teamBFrame, footerFrame); }
public NewWorldWindow(GUISystem system, EditorScreen screen, GUITheme theme) : base(system, new UDim2(0.4f, 0, 0.3f, 0), "New World", theme, true) { this.screen = screen; MinSize = new UDim2(0, 400, 0, 300); MaxSize = new UDim2(0, 575, 0, 475); GUIForm form = new GUIForm(new UDim2(0, 5, 0, 25), new UDim2(1f, -10, 1f, -30), Theme); GUILabel useNoiseLabel; GUICheckbox useNoiseCheckBox; form.AddLabledCheckbox("Use Noise:", false, UDim2.Zero, out useNoiseLabel, out useNoiseCheckBox); GUILabel sizeLabel = new GUILabel(new UDim2(0, 0, 0, 45), UDim2.Zero, "World Size:", TextAlign.TopLeft, Theme) { Parent = form }; GUILabel xSizeLabel, ySizeLabel, zSizeLabel; GUITextField xSizeField, ySizeField, zSizeField; form.AddLabledTextField("X:", "8", new UDim2(0, 0, 0, 70), out xSizeLabel, out xSizeField, new UDim(0, 40)); float sizeInputLength = xSizeField.Position.X.Offset + xSizeField.Size.X.Offset; form.AddLabledTextField("Y:", "3", new UDim2(0, sizeInputLength + 5, 0, 70), out ySizeLabel, out ySizeField, new UDim(0, 40)); form.AddLabledTextField("Z:", "8", new UDim2(0, (sizeInputLength + 5) * 2, 0, 70), out zSizeLabel, out zSizeField, new UDim(0, 40)); xSizeField.Label.TextAlign = TextAlign.Center; ySizeField.Label.TextAlign = TextAlign.Center; zSizeField.Label.TextAlign = TextAlign.Center; GUIButton cancelBtn = new GUIButton(new UDim2(1f, -100, 1f, -30), new UDim2(0, 100, 0, 30), "Cancel", theme) { Parent = form }; cancelBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { Visible = false; } }; GUIButton createBtn = new GUIButton(new UDim2(1f, -205, 1f, -30), new UDim2(0, 100, 0, 30), "Create", theme) { Parent = form }; createBtn.OnMouseClick += (btn, mbtn) => { if (mbtn == MouseButton.Left) { int x = 1, y = 1, z = 1; if (int.TryParse(xSizeField.Text, out x)) { x = Math.Max(x, 0); } if (int.TryParse(ySizeField.Text, out y)) { y = Math.Max(y, 0); } if (int.TryParse(zSizeField.Text, out z)) { z = Math.Max(z, 0); } if (!useNoiseCheckBox.IsChecked) { screen.LoadNewFlatWorld(x, y, z); } else { screen.LoadNewWorld(x, y, z); } Visible = false; } }; AddTopLevel(form); }
public GUIForm(UDim2 position, UDim2 size, GUITheme theme) : base(position, size, image: null) { Theme = theme; }