private UiPosition GetTypePosition(float startPos, float width, TypePadding padding) { UiPosition pos = new UiPosition(startPos + padding.Left, padding.Bottom, width * (1 - (padding.Left + padding.Right)), 1 - (padding.Top + padding.Bottom)); return(pos); }
private List <PanelUpdate> CreatePanel(Panel panel, PanelSetup setup, UpdateEnum update) { List <PanelUpdate> containers = new List <PanelUpdate>(); if (update == UpdateEnum.All || update == UpdateEnum.Panel) { TypePadding dockPadding = _pluginConfig.Docks[setup.PanelReg.Dock].DockPadding; UiPosition pos = GetPanelPosition(setup, dockPadding); CuiElementContainer container = Ui.Container(setup.PanelColor, pos, setup.UiParentPanel); containers.Add(new PanelUpdate { Container = container, PanelName = setup.UiParentPanel }); } List <PanelType> panelTypes = new List <PanelType>(); if (panel.Text != null) { panelTypes.Add(panel.Text); } if (panel.Image != null) { panelTypes.Add(panel.Image); } float offset = 0; foreach (PanelType type in panelTypes.Where(pt => pt.Enabled).OrderBy(pt => pt.Order)) { if (type is PanelText) { if (update == UpdateEnum.All || update == UpdateEnum.Text) { containers.Add(CreateText(panel, setup.UiParentPanel, offset)); } } else if (type is PanelImage) { if (update == UpdateEnum.All || update == UpdateEnum.Image) { containers.Add(CreateImage(panel, setup.UiParentPanel, offset)); } } offset += type.Width; } return(containers); }
private PanelUpdate CreateText(Panel panel, string panelName, float offset) { string textName = GetPanelUiTextName(panelName); UiPosition pos = GetTypePosition(offset, panel.Text.Width, panel.Text.Padding); CuiElementContainer container = Ui.Container(_clearColor, pos, textName, panelName); Ui.Label(ref container, panel.Text.Text ?? string.Empty, panel.Text.FontSize, Ui.Color(panel.Text.Color), _fullSize, panel.Text.TextAnchor); return(new PanelUpdate { Container = container, PanelName = textName }); }
private PanelUpdate CreateImage(Panel panel, string panelName, float offset) { string imageName = GetPanelUiImageName(panelName); UiPosition pos = GetTypePosition(offset, panel.Image.Width, panel.Image.Padding); CuiElementContainer container = Ui.Container(_clearColor, pos, imageName, panelName); Ui.Image(ref container, ImageLibraryGetImage(panel.Image.Url) ?? string.Empty, Ui.Color(panel.Image.Color), _fullSize); return(new PanelUpdate { Container = container, PanelName = imageName }); }
public static CuiElementContainer Container(string color, UiPosition pos, string panel, string parent = "Hud") { UiPanel = panel; return(new CuiElementContainer { { new CuiPanel { Image = { Color = color }, RectTransform = { AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax() }, CursorEnabled = false }, new CuiElement().Parent = parent, panel } }); }
public bool Equals(DestinyStatGroupDefinition input) { if (input == null) { return(false); } return (( MaximumValue == input.MaximumValue || (MaximumValue.Equals(input.MaximumValue)) ) && ( UiPosition == input.UiPosition || (UiPosition.Equals(input.UiPosition)) ) && ( ScaledStats == input.ScaledStats || (ScaledStats != null && ScaledStats.SequenceEqual(input.ScaledStats)) ) && ( Overrides == input.Overrides || (Overrides != null && Overrides.SequenceEqual(input.Overrides)) ) && ( Hash == input.Hash || (Hash.Equals(input.Hash)) ) && ( Index == input.Index || (Index.Equals(input.Index)) ) && ( Redacted == input.Redacted || (Redacted != null && Redacted.Equals(input.Redacted)) )); }
public static void Image(ref CuiElementContainer container, string png, string color, UiPosition pos) { uint value; bool isPng = uint.TryParse(png, out value); container.Add(new CuiElement { Name = CuiHelper.GetGuid(), Parent = UiPanel, Components = { new CuiRawImageComponent { Color = color, Png = isPng ? png : null, Url = !isPng ? png : null }, new CuiRectTransformComponent { AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax() } } }); }
public static void Label(ref CuiElementContainer container, string text, int size, string color, UiPosition pos, TextAnchor align = TextAnchor.MiddleCenter) { container.Add(new CuiLabel { Text = { FontSize = size, Align = align, Text = text, Color = color }, RectTransform = { AnchorMin = pos.GetMin(), AnchorMax = pos.GetMax() } }, UiPanel); }