public void destroyGui(Plugin plugin, GuiContainer container, string name = null) { if (container == null) { return; } if (name == null) { List <GuiContainer> garbage = new List <GuiContainer>(); destroyGuiContainer(plugin, container, garbage); foreach (GuiContainer cont in garbage) { activeGuiContainers.Remove(cont); } } else { name = safeName(name); List <CuiElement> eGarbage = new List <CuiElement>(); destroyGuiElement(plugin, container, name, eGarbage); foreach (CuiElement element in eGarbage) { container.Remove(element); } } }
public void SetScenario( Scenario Scenario, UnitConfigurationRenderer UnitRenderer, FactionRenderer FactionRenderer) { _ScenarioDisplay.Clear(); foreach (ArmyConfiguration army in Scenario.ArmyConfigurations) { _ScenarioDisplay.Add( new Button("scenario-army-header") { DisplayedString = ObjectDescriber.Describe(army.Faction) }); var factionMount = new GuiContainer <GuiItem>("scenario-faction-mount"); Vector2f size = factionMount.Size - factionMount.LeftPadding * 2; var faction = new FactionView(army.Faction, FactionRenderer, Math.Min(size.X, size.Y)); faction.Position = .5f * (factionMount.Size - faction.Size) - factionMount.LeftPadding; factionMount.Add(faction); _ScenarioDisplay.Add(factionMount); foreach (DeploymentConfiguration deployment in army.DeploymentConfigurations) { _ScenarioDisplay.Add(new DeploymentRow(deployment, army.Faction, UnitRenderer)); } foreach (ObjectiveSuccessTrigger trigger in army.VictoryCondition.Triggers) { _ScenarioDisplay.Add(new VictoryConditionRow(trigger)); } } _DetailDisplay.Clear(); AddDetail("Environment", ObjectDescriber.Describe(Scenario.Environment)); AddDetail("Turns", Scenario.TurnConfiguration.Turns.ToString()); AddSequence("Deploy Order", Scenario.TurnConfiguration.DeploymentOrder, Scenario.ArmyConfigurations.ToArray()); AddSequence("Turn Order", Scenario.TurnConfiguration.TurnOrder, Scenario.ArmyConfigurations.ToArray()); AddDetail("Strength", Scenario.ArmyConfigurations.Select(i => DescribeStrength(i)).ToArray()); }
private void MouseListner_MouseDragStart(object sender, MonoGame.Extended.Input.InputListeners.MouseEventArgs e) { List <GuiContainer> windows = new List <GuiContainer>(); foreach (GuiContainer item in BoundHandler.GUIWindows) { //If the container contains the mouse position if (item.DrawingBounds.Contains(e.Position.X, e.Position.Y)) { //If the mouse position is within the drag zone if (item.DrawingBounds.Y - 40 < e.Position.Y) { //If the GUI is dragable if (item.IsMovable) { windows.Add(item); } } } } if (windows.Count > 0) { GuiContainer windowToMove = this.GetHighestPriority(windows); this.LastDragged = windowToMove; this.StillDraggingLast = true; } }
private void SendHuePicker() { GuiContainer c = new GuiContainer(PluginInstance, "HuePicker", nameof(ColorPicker)); int baseX = 610; int y = 732; double width = 700d / hueRes; int height = 30; double hueIncrement = 360d / hueRes; for (int i = 0; i < hueRes; i++) { Rectangle pos = new Rectangle(baseX + i * width, y, width, height, resX, resY, true); GuiColor color = new GuiColor(i * hueIncrement, 1, 1, 1); int hue = (int)(i * hueIncrement); int index = i; Action <BasePlayer, string[]> callback = (p, a) => { Hue = hue; SendHueSelector(index); SendVSPicker(); }; c.addPlainButton($"hue_{i}", pos, layer, color, fadeIn, fadeOut, callback: callback); } c.display(Player); SendHueSelector(0); SendVSPicker(); }
protected GuiDialogBase() { AddChild(ContentContainer = new GuiContainer() { Anchor = Alignment.MiddleCenter }); }
public ScoreboardElement(string left, uint value) { //Orientation = Orientation.Horizontal; //ChildAnchor = Alignment.FillCenter; Left = new GuiTextElement() { Text = left, Anchor = Alignment.TopLeft, // Margin = new Thickness(0, 0, 2, 0), //ParentElement = this }; Right = new GuiContainer() { Padding = new Thickness(2, 0, 0, 0), Anchor = Alignment.TopRight }; Right.AddChild(new GuiTextElement() { Anchor = Alignment.TopRight, Text = $" {value.ToString()}", //ParentElement = this }); AddChild(Left); AddChild(Right); }
public void destroyGui(Plugin plugin, GuiContainer container, string name = null) { if (container == null) { return; } if (name == null) { List <GuiContainer> garbage = new List <GuiContainer>(); destroyGuiContainer(plugin, container, garbage); foreach (GuiContainer cont in garbage) { activeGuiContainers.Remove(cont); } } else { name = removeWhiteSpaces(name); name = PluginInstance.prependContainerName(container, name); List <GuiElement> eGarbage = new List <GuiElement>(); destroyGuiElement(plugin, container, name, eGarbage); foreach (GuiElement element in eGarbage) { container.Remove(element); } } }
public VictoryConditionPane(Match Match, FactionRenderer FactionRenderer) : base("victory-condition-pane") { _CloseButton.Position = new Vector2f(Size.X - _CloseButton.Size.X - LeftPadding.X * 2, 0); _CloseButton.OnClick += HandleClose; _VictoryConditionDisplay.Position = new Vector2f(0, _CloseButton.Size.Y + 24); foreach (ArmyConfiguration army in Match.Scenario.ArmyConfigurations) { _VictoryConditionDisplay.Add( new Button("scenario-army-header") { DisplayedString = ObjectDescriber.Describe(army.Faction) }); var factionMount = new GuiContainer <GuiItem>("scenario-faction-mount"); Vector2f size = factionMount.Size - factionMount.LeftPadding * 2; var faction = new FactionView(army.Faction, FactionRenderer, Math.Min(size.X, size.Y)); faction.Position = .5f * (factionMount.Size - faction.Size) - factionMount.LeftPadding; factionMount.Add(faction); _VictoryConditionDisplay.Add(factionMount); foreach (ObjectiveSuccessTrigger trigger in army.VictoryCondition.Triggers) { _VictoryConditionDisplay.Add(new VictoryConditionRow(trigger)); } } Add(_CloseButton); Add(_VictoryConditionDisplay); }
public void dropdown(Plugin plugin, BasePlayer player, List <string> options, Rectangle rectangle, GuiContainer.Layer layer, string parent, GuiColor panelColor, GuiColor textColor, Action <string> callback, bool allowNew = false, int page = 0, Predicate <string> predicate = null) { if (allowNew) { options.Add("(add new)"); } int maxItems = 5; rectangle.H *= ((float)options.Count / (float)maxItems); List <List <string> > ListOfLists = SplitIntoChunks <string>(options, maxItems); GuiContainer container = new GuiContainer(plugin, "dropdown_API", parent); double cfX = rectangle.W / 300; double cfY = rectangle.H / 570; Action <BasePlayer, string[]> up = (bPlayer, input) => { dropdown(plugin, player, options, rectangle, layer, parent, panelColor, textColor, callback, allowNew, page - 1, predicate); }; Action <BasePlayer, string[]> down = (bPlayer, input) => { dropdown(plugin, player, options, rectangle, layer, parent, panelColor, textColor, callback, allowNew, page + 1, predicate); }; if (page > 0) { container.addPlainButton("dropdown_up", new Rectangle(0, 1, 298, 36, 300, 570, true), new GuiColor(1, 1, 1, 0.4f), 0, 0, new GuiText("<b>∧</b>", (int)Math.Floor(22 * cfY), new GuiColor("black")), up, parent: "dropdown_background"); } if (page < ListOfLists.Count - 1) { container.addPlainButton("dropdown_up", new Rectangle(0, 533, 298, 37, 300, 570, true), new GuiColor(1, 1, 1, 0.4f), 0, 0, new GuiText("<b>∨</b>", (int)Math.Floor(22 * cfY), new GuiColor("black")), down, parent: "dropdown_background"); } int count = 0; foreach (string option in ListOfLists[page]) { int hEach = (int)(rectangle.H / ListOfLists[page].Count); Rectangle pos = new Rectangle(0, 0 + (count * hEach), rectangle.W, hEach, rectangle.W, rectangle.H, true).WithParent(rectangle); Action <BasePlayer, string[]> btnCallback = null; if (option == "(add new)") { btnCallback = (bPlayer, input) => dropdownAddNew(plugin, player, pos, callback, predicate); } else { string selected = option; btnCallback = (bPlayer, input) => { callback(selected); }; } container.addPlainButton($"dropdown_option_{option}", pos, layer, panelColor, 0, 0, new GuiText(option, color: textColor), btnCallback, blur: GuiContainer.Blur.strong); count++; } container.display(player); }
public LibraryState() : base("Library") { Util.Assert(CoM.AllDataLoaded, "Data must be loaded before LibraryState can be created."); MainWindow.Width = 600; MainWindow.Height = 480; // -------------------------------------- ItemsWindow = new LibraryItemsView(); MonstersWindow = new LibraryMonstersView(); RecordsWindow = new LibraryRecordsView(); // -------------------------------------- var buttonGroup = new GuiRadioButtonGroup(); buttonGroup.EnableBackground = true; buttonGroup.OnValueChanged += delegate { ItemsWindow.Visible = buttonGroup.SelectedIndex == 0; MonstersWindow.Visible = buttonGroup.SelectedIndex == 1; RecordsWindow.Visible = buttonGroup.SelectedIndex == 2; }; buttonGroup.AddItem("Items"); buttonGroup.AddItem("Monsters"); buttonGroup.AddItem("Records"); buttonGroup.ButtonSize = new Vector2(120, 28); buttonGroup.Height = 45; buttonGroup.Style = Engine.GetStyleCopy("Solid"); buttonGroup.Color = Color.black.Faded(0.5f); buttonGroup.Width = MainWindow.Width; buttonGroup.Height = 45; MainWindow.Add(buttonGroup); buttonGroup.SelectedIndex = 0; // -------------------------------------- var BodySection = new GuiContainer(MainWindow.Width, MainWindow.Height - buttonGroup.Height) { Y = buttonGroup.Height }; MainWindow.Add(BodySection); BodySection.Add(ItemsWindow); BodySection.Add(MonstersWindow); BodySection.Add(RecordsWindow); // -------------------------------------- RepositionControls(); MainWindow.Background.Sprite = ResourceManager.GetSprite("Gui/InnerWindow"); MainWindow.Background.Color = new Color(0.4f, 0.42f, 0.62f); }
private string decodeName(GuiContainer container, string name) { if (GuiContainer.layers.Contains(name)) { return(name); } return(name.Substring(container.name.Length + 1)); }
private string prependContainerName(GuiContainer container, string name) { if (GuiContainer.layers.Contains(name)) { return(name); } return($"{container.name}_{removeWhiteSpaces(name)}"); }
private string encodeName(GuiContainer container, string name) { if (GuiContainer.layers.Contains(name)) { return(name); } return($"{container.name}_{safeName(name)}"); }
public void sendBounty(BasePlayer player, Bounty bounty) { #if DEBUG player.ChatMessage($"sendBounty: {bounty.placerName} -> {bounty.targetName}"); #endif closeBounty(player); GuiContainer c = new GuiContainer(this, "bountyPreview"); //template Rectangle templatePos = new Rectangle(623, 26, 673, 854, resX, resY, true); c.addImage("template", templatePos, "bounty_template", GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); //targetName Rectangle targetNamePos = new Rectangle(680, 250, 560, 65, resX, resY, true); int fontsize = guiCreator.getFontsizeByFramesize(bounty.targetName.Length, targetNamePos); GuiText targetNameText = new GuiText(bounty.targetName, fontsize); c.addText("targetName", targetNamePos, GuiContainer.Layer.hud, targetNameText, FadeIn, FadeOut); //image if (config.showSteamImage) { Rectangle imagePos = new Rectangle(828, 315, 264, 264, resX, resY, true); c.addImage("image", imagePos, bounty.targetID.ToString(), GuiContainer.Layer.hud, FadeIn: FadeIn, FadeOut: FadeOut); } //reward Rectangle rewardPos = new Rectangle(680, 579, 560, 53, resX, resY, true); string reward = $"{bounty.rewardAmount} {bounty.reward.info.displayName.english}"; GuiText rewardText = new GuiText(reward, guiCreator.getFontsizeByFramesize(reward.Length, rewardPos)); c.addText("reward", rewardPos, GuiContainer.Layer.hud, rewardText, FadeIn, FadeOut); //reason Rectangle reasonPos = new Rectangle(680, 681, 560, 53, resX, resY, true); GuiText reasonText = new GuiText(bounty.reason, 14); c.addText("reason", reasonPos, GuiContainer.Layer.hud, reasonText, FadeIn, FadeOut); //placerName Rectangle placerNamePos = new Rectangle(680, 771, 560, 36, resX, resY, true); GuiText placerNameText = new GuiText(bounty.placerName, guiCreator.getFontsizeByFramesize(bounty.placerName.Length, placerNamePos)); c.addText("placerName", placerNamePos, GuiContainer.Layer.hud, placerNameText, FadeIn, FadeOut); //exitButton Rectangle closeButtonPos = new Rectangle(1296, 52, 60, 60, resX, resY, true); c.addButton("close", closeButtonPos, GuiContainer.Layer.hud, darkRed, FadeIn, FadeOut, new GuiText("X", 24, lightRed), blur: GuiContainer.Blur.medium); c.display(player); //button if (bounty.hunt != null) { huntButton(player, bounty, huntErrorType.huntActive); } else { huntButton(player, bounty); } }
public static T FindDescendantByProperty <T>(this GuiContainer Container, Func <T, bool> Property = null) where T : class { if (Property == null) { Property = new Func <T, bool>(t => true); } return(findDescendantByPropertyTemplate <T>(Container.Children, Property)); }
/// <summary> /// Removes a container. /// </summary> /// <param name="container"></param> public static void RemoveContainer(GuiContainer container) { GUIWindows.Remove(container); if (container.Visible) { ShowLast(); } }
public void activateMaterialCtrls(bool active) { GuiContainer parent = this.findObjectByInternalName("matSettingsParent", true); int count = parent.getCount(); for (uint i = 0; i < count; i++) { ((GuiControl)parent.getObject(i)).setActive(active); } }
public void AddString(string text) { GuiContainer container = new GuiContainer(); container.AddChild(new GuiTextElement(text) { Anchor = Alignment.CenterX }); AddChild(container); }
public PlayingHud(Alex game, Player player, TitleComponent titleComponent) : base() { Title = titleComponent; Alex = game; Player = player; Player.OnInventoryChanged += OnInventoryChanged; Anchor = Alignment.Fill; Padding = Thickness.One; _playerController = player.Controller; InputManager.AddListener(new MouseInputListener(InputManager.PlayerIndex)); _healthAndHotbar = new GuiStackContainer() { Orientation = Orientation.Vertical, ChildAnchor = Alignment.Fill }; _bottomContainer = new GuiMultiStackContainer(); _bottomContainer.ChildAnchor = Alignment.BottomFill; _bottomContainer.Anchor = Alignment.BottomCenter; _bottomContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink; _bottomContainer.Orientation = Orientation.Vertical; //BottomContainer. _hotbar = new GuiItemHotbar(player.Inventory); _hotbar.Anchor = Alignment.BottomCenter; _hotbar.Padding = Thickness.Zero; Chat = new ChatComponent(); Chat.Enabled = false; Chat.Anchor = Alignment.BottomLeft; _healthContainer = new GuiContainer(); _healthContainer.Anchor = Alignment.Fill; _healthContainer.Margin = new Thickness(0, 0, 0, 1); _healthComponent = new HealthComponent(player); _healthComponent.Anchor = Alignment.TopLeft; _hungerComponent = new HungerComponent(player); _hungerComponent.Anchor = Alignment.TopRight; _tipPopupComponent = new TipPopupComponent(); _tipPopupComponent.Anchor = Alignment.BottomCenter; _tipPopupComponent.AutoSizeMode = AutoSizeMode.GrowAndShrink; Scoreboard = new ScoreboardView(); Scoreboard.Anchor = Alignment.MiddleRight; }
/// <summary> /// Adds a container. /// </summary> /// <param name="container"></param> public static void AddContainer(GuiContainer container) { int index = GUIWindows.BinarySearch(container, containerSorter); if (index < 0) { index = ~index; } GUIWindows.Insert(index, container); }
public void addGuiToTracker(Plugin plugin, GuiContainer container) { #if DEBUG player.ChatMessage($"adding {container.name} to tracker"); #endif if (getContainer(plugin, container.name) != null) { destroyGui(plugin, container.name); } activeGuiContainers.Add(container); }
private void SendPreview() { GuiContainer c = new GuiContainer(PluginInstance, "Preview", nameof(ColorPicker)); Rectangle pos = new Rectangle(1160, 368, 150, 150, resX, resY, true); GuiColor color = new GuiColor(Hue, Saturation, Value, 1); c.addPlainPanel("panel", pos, layer, color, fadeIn, fadeOut); c.display(Player); }
public void prompt(BasePlayer player, string header, string msg, Action <BasePlayer, string[]> Callback = null) { GuiContainer containerGUI = new GuiContainer(this, "prompt"); containerGUI.addPlainButton("close", new Rectangle(), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0.3f), 0.1f, 0.1f, blur: GuiContainer.Blur.medium); containerGUI.addPlainPanel("background", new Rectangle(710, 390, 500, 300, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0.6f), 0.1f, 0.1f, GuiContainer.Blur.medium); containerGUI.addPanel("header", new Rectangle(710, 390, 500, 60, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0), 0.1f, 0.1f, new GuiText(header, 25, new GuiColor(1, 1, 1, 0.7f))); containerGUI.addPanel("msg", new Rectangle(735, 400, 450, 150, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0), 0.1f, 0.1f, new GuiText(msg, 14, new GuiColor(1, 1, 1, 0.7f))); containerGUI.addPlainButton("ok", new Rectangle(860, 520, 200, 50, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 1, 0.6f), 0.1f, 0.1f, new GuiText("OK", 20, new GuiColor(1, 1, 1, 0.7f)), Callback, "prompt"); containerGUI.display(player); }
public void SmallConfirmPrompt(BasePlayer player, string header, Action <BasePlayer, string[]> yesCallback, Action <BasePlayer, string[]> noCallback) { GuiContainer containerGUI = new GuiContainer(this, "prompt"); containerGUI.addPlainButton("close", new Rectangle(), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0.3f), 0.1f, 0.1f, callback: noCallback, blur: GuiContainer.Blur.medium); containerGUI.addPlainPanel("background", new Rectangle(710, 465, 500, 150, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0.6f), 0.1f, 0.1f, GuiContainer.Blur.medium); containerGUI.addPanel("header", new Rectangle(710, 465, 500, 60, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 0, 0, 0), 0.1f, 0.1f, new GuiText(header, 25, new GuiColor(1, 1, 1, 0.7f))); containerGUI.addPlainButton("yes", new Rectangle(740, 545, 200, 50, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(0, 1, 0, 0.6f), 0.1f, 0.1f, new GuiText("YES", 20, new GuiColor(1, 1, 1, 0.7f)), yesCallback, "prompt"); containerGUI.addPlainButton("no", new Rectangle(980, 545, 200, 50, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor(1, 0, 0, 0.6f), 0.1f, 0.1f, new GuiText("NO", 20, new GuiColor(1, 1, 1, 0.7f)), noCallback, "prompt"); containerGUI.display(player); }
public void creatorButton(BasePlayer player, createErrorType error = createErrorType.none, BountyBP bp = null) { GuiContainer c = new GuiContainer(this, "createButton", "bountyCreator"); Rectangle ButtonPos = new Rectangle(710, 856, 500, 100, resX, resY, true); List <GuiText> textOptions = new List <GuiText> { new GuiText("Create Bounty", guiCreator.getFontsizeByFramesize(13, ButtonPos), lightGreen), new GuiText("Target not found!", guiCreator.getFontsizeByFramesize(17, ButtonPos), lightRed), new GuiText("Invalid reward!", guiCreator.getFontsizeByFramesize(15, ButtonPos), lightRed), new GuiText("Can't afford reward!", guiCreator.getFontsizeByFramesize(20, ButtonPos), lightRed), new GuiText("Reason missing!", guiCreator.getFontsizeByFramesize(15, ButtonPos), lightRed) }; Action <BasePlayer, string[]> cb = (p, a) => { if (bp.target == null) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.missingTarget, bp); } else if (bp.reward == 0) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.badReward, bp); } else if (config.requireReason && string.IsNullOrEmpty(bp.reason)) { Effect.server.Run(errorSound, player.transform.position); creatorButton(player, createErrorType.missingReason, bp); } else { Effect.server.Run(successSound, player.transform.position); bp.init(player); GuiTracker.getGuiTracker(player).destroyGui(this, "bountyCreator"); } }; c.addPlainButton("button", ButtonPos, GuiContainer.Layer.hud, (error == createErrorType.none) ? darkGreen : darkRed, FadeIn, FadeOut, textOptions[(int)error], cb, blur: GuiContainer.Blur.medium); c.display(player); if (error != createErrorType.none) { PluginInstance.timer.Once(2f, () => { if (GuiTracker.getGuiTracker(player).getContainer(this, "bountyCreator") != null) { creatorButton(player, bp: bp); } }); } }
public void sendTargetIndicator(BasePlayer player, Hunt hunt) { if (!config.showTargetIndicator) { return; } #if DEBUG player.ChatMessage($"sendTargetIndicator: {hunt.hunterName} -> {hunt.bounty.targetName}"); #endif if (player == null) { return; } if (player.IsSleeping()) { return; } GuiContainer c = new GuiContainer(this, "targetIndicator"); //Background Rectangle bgPos = new Rectangle(50, 250, 350, 100, resX, resY, true); float distance = config.safeDistance; if (hunt.hunter?.transform != null && hunt.target?.transform != null) { distance = Vector3.Distance(hunt.hunter.transform.position, hunt.target.transform.position); } GuiColor bgColor = config.showDistance?gradientRedYellowGreen(Mathf.Clamp((distance / config.safeDistance), 0, 1)):lightGrey; bgColor.setAlpha(0.5f); c.addPlainPanel("Background", bgPos, GuiContainer.Layer.hud, bgColor, 0, 0, GuiContainer.Blur.medium); //TopLine Rectangle topLinePos = new Rectangle(50, 250, 350, 50, resX, resY, true); string TopLineString = $"You are being hunted{(config.showHunter?$" by {hunt.hunterName}":"")}!"; int topLineFontsize = guiCreator.getFontsizeByFramesize(TopLineString.Length, topLinePos); GuiText topLineText = new GuiText(TopLineString, topLineFontsize, opaqueWhite); c.addText("topline", topLinePos, GuiContainer.Layer.hud, topLineText); //BottomLine Rectangle bottomLinePos = new Rectangle(50, 300, 350, 20, resX, resY, true); string bottomLineString = "You can run, but you can't hide!"; int bottomLineFontsize = guiCreator.getFontsizeByFramesize(bottomLineString.Length, bottomLinePos); GuiText bottomLineText = new GuiText(bottomLineString, bottomLineFontsize, opaqueWhite); c.addText("bottomLine", bottomLinePos, GuiContainer.Layer.hud, bottomLineText); //Countdown Rectangle CountdownPos = new Rectangle(50, 320, 350, 30, resX, resY, true); string CountdownString = hunt.remaining.ToString(@"hh\:mm\:ss"); int CountdownFontsize = guiCreator.getFontsizeByFramesize(CountdownString.Length, CountdownPos); GuiText CountdownText = new GuiText(CountdownString, CountdownFontsize, opaqueWhite); c.addText("Countdown", CountdownPos, GuiContainer.Layer.hud, CountdownText); c.display(player); }
private void demoCommand(BasePlayer player, string command, string[] args) { if (!permission.UserHasPermission(player.UserIDString, "gui.demo")) { PrintToChat(player, lang.GetMessage("noPermission", this, player.UserIDString)); return; } if (args.Length == 0) { GuiContainer container = new GuiContainer(this, "demo"); container.addPanel("demo_panel", new Rectangle(0.25f, 0.5f, 0.25f, 0.25f), GuiContainer.Layer.hud, new GuiColor(0, 1, 0, 1), 1, 1, new GuiText("This is a regular panel", 30)); container.addPanel("demo_img", new Rectangle(0.25f, 0.25f, 0.25f, 0.25f), FadeIn: 1, FadeOut: 1, text: new GuiText("this is an image with writing on it", 30, color: new GuiColor(1, 1, 1, 1)), imgName: "flower"); Action <BasePlayer, string[]> heal = (bPlayer, input) => { bPlayer.Heal(10); }; container.addButton("demo_healButton", new Rectangle(0.5f, 0.5f, 0.25f, 0.25f), GuiContainer.Layer.hud, null, 1, 1, new GuiText("heal me", 40), heal, null, false, "flower"); Action <BasePlayer, string[]> hurt = (bPlayer, input) => { bPlayer.Hurt(10); }; container.addButton("demo_hurtButton", new Rectangle(0.5f, 0.25f, 0.25f, 0.25f), new GuiColor(1, 0, 0, 0.5f), 1, 1, new GuiText("hurt me", 40), hurt); container.addText("demo_inputLabel", new Rectangle(0.375f, 0.85f, 0.25f, 0.1f), new GuiText("Print to chat:", 30, null, TextAnchor.LowerCenter), 1, 1); Action <BasePlayer, string[]> inputCallback = (bPlayer, input) => { PrintToChat(bPlayer, string.Concat(input)); }; container.addInput("demo_input", new Rectangle(0.375f, 0.75f, 0.25f, 0.1f), inputCallback, GuiContainer.Layer.hud, null, new GuiColor("white"), 100, new GuiText("", 50), 1, 1); container.addButton("close", new Rectangle(0.1f, 0.1f, 0.1f, 0.1f), new GuiColor("red"), 1, 0, new GuiText("close", 50)); container.display(player); GuiContainer container2 = new GuiContainer(this, "demo_child", "demo"); container2.addPanel("layer1", new Rectangle(1400, 800, 300, 100, 1920, 1080, true), GuiContainer.Layer.overall, new GuiColor("red"), 1, 1, new GuiText("overall", align: TextAnchor.LowerLeft)); container2.addPanel("layers_label", new Rectangle(1400, 800, 300, 100, 1920, 1080, true), GuiContainer.Layer.overall, null, 1, 1, new GuiText("Available layers:", 20, align: TextAnchor.UpperLeft)); container2.addPanel("layer2", new Rectangle(1425, 825, 300, 100, 1920, 1080, true), GuiContainer.Layer.overlay, new GuiColor("yellow"), 1, 1, new GuiText("overlay", align: TextAnchor.LowerLeft)); container2.addPanel("layer3", new Rectangle(1450, 850, 300, 100, 1920, 1080, true), GuiContainer.Layer.menu, new GuiColor("green"), 1, 1, new GuiText("menu", align: TextAnchor.LowerLeft)); container2.addPanel("layer4", new Rectangle(1475, 875, 300, 100, 1920, 1080, true), GuiContainer.Layer.hud, new GuiColor("blue"), 1, 1, new GuiText("hud", align: TextAnchor.LowerLeft)); container2.addPanel("layer5", new Rectangle(1500, 900, 300, 100, 1920, 1080, true), GuiContainer.Layer.under, new GuiColor("purple"), 1, 1, new GuiText("under", align: TextAnchor.LowerLeft)); container2.display(player); GuiContainer container3 = new GuiContainer(this, "demo_anchors", "demo"); container3.addPlainPanel("bl", new Rectangle(20, 960, 100, 100, 1920, 1080, true, Rectangle.Anchors.BottomLeft), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("cl", new Rectangle(20, 490, 100, 100, 1920, 1080, true, Rectangle.Anchors.CenterLeft), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("ul", new Rectangle(20, 20, 100, 100, 1920, 1080, true, Rectangle.Anchors.UpperLeft), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("uc", new Rectangle(910, 20, 100, 100, 1920, 1080, true, Rectangle.Anchors.UpperCenter), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("ur", new Rectangle(1800, 20, 100, 100, 1920, 1080, true, Rectangle.Anchors.UpperRight), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("cr", new Rectangle(1800, 490, 100, 100, 1920, 1080, true, Rectangle.Anchors.CenterRight), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("br", new Rectangle(1800, 960, 100, 100, 1920, 1080, true, Rectangle.Anchors.BottomRight), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.addPlainPanel("bc", new Rectangle(910, 960, 100, 100, 1920, 1080, true, Rectangle.Anchors.BottomCenter), GuiContainer.Layer.menu, new GuiColor("white"), 1, 1); container3.display(player); customGameTip(player, "This is a custom gametip!", 5); return; } else if (args.Length >= 3) { if (args[0] == "gametip") { customGameTip(player, args[2], 3f, (gametipType)Enum.Parse(typeof(gametipType), args[1])); } } }
void MakeSection(string SectionName, GuiItem Input, SingleColumnTable Display) { var header = new Button("header-2") { DisplayedString = SectionName }; var container = new GuiContainer <Pod>("scenario-builder-parameters-section"); container.Add(Input); Display.Add(header); Display.Add(container); }
public FormBase(uint formId, BedrockFormManager parent, InputManager inputManager) { FormId = formId; Parent = parent; InputManager = inputManager; Background = new Color(Color.Black, 0.5f); Container = new GuiContainer(); Container.Anchor = Alignment.FillCenter; AddChild(Container); }
private void imgrawPreviewCommand(BasePlayer player, string command, string[] args) { if (!permission.UserHasPermission(player.UserIDString, "gui.demo")) { PrintToChat(player, lang.GetMessage("noPermission", this, player.UserIDString)); return; } GuiContainer container = new GuiContainer(this, "imgPreview"); container.addRawImage("img", new Rectangle(710, 290, 500, 500, 1920, 1080, true), args[0], GUICreator.GuiContainer.Layer.hud); container.addPlainButton("close", new Rectangle(0.15f, 0.15f, 0.1f, 0.1f), new GuiColor(1, 0, 0, 0.8f), 0, 0, new GuiText("close")); container.display(player); }