1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using System.Collections.Generic;
33 return Children.FirstOrDefault(c => c is T) as T;
62 if (child ==
null) {
return -1; }
70 if (Equals(child.
UserData, obj)) {
return child; }
77 if (component ==
null) {
return false; }
83 if (component ==
null) {
return false; }
89 if (child ==
null) {
return; }
97 var matchingChild =
Children.FirstOrDefault(predicate);
98 if (recursive && matchingChild ==
null)
102 matchingChild = child.
FindChild(predicate, recursive);
103 if (matchingChild !=
null)
return matchingChild;
107 return matchingChild;
111 var matchingChild =
Children.FirstOrDefault(c => Equals(c.UserData, userData));
112 if (recursive && matchingChild ==
null)
116 matchingChild = child.
FindChild(userData, recursive);
117 if (matchingChild !=
null)
return matchingChild;
121 return matchingChild;
126 return Children.Where(c => Equals(c.UserData, userData));
129 public IEnumerable<GUIComponent>
FindChildren(Func<GUIComponent, bool> predicate)
131 return Children.Where(c => predicate(c));
155 private float bounceTimer;
156 private float bounceJump;
157 private bool bounceDown;
184 private bool useRectangleFlash;
185 private bool useCircularFlash;
191 private Vector2 flashRectInflate;
193 private bool ignoreLayoutGroups;
196 get {
return ignoreLayoutGroups; }
199 if (ignoreLayoutGroups == value) {
return; }
200 ignoreLayoutGroups = value;
203 layoutGroup.NeedsToRecalculate =
true;
247 get {
return new Vector2(
Rect.Center.X,
Rect.Center.Y); }
252 if (
Parent is
null) {
return r; }
254 if (parentRect.Width <= 0 || parentRect.Height <= 0) {
return Rectangle.Empty; }
255 if (parentRect.X > r.X)
257 int diff = parentRect.X - r.X;
261 if (parentRect.Y > r.Y)
263 int diff = parentRect.Y - r.Y;
267 if (parentRect.X + parentRect.Width < r.X + r.Width)
269 int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
272 if (parentRect.Y + parentRect.Height < r.Y + r.Height)
274 int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
277 if (r.Width <= 0 || r.Height <= 0) {
return Rectangle.Empty; }
298 public Dictionary<ComponentState, List<UISprite>>
sprites;
315 child.Selected = value;
334 #warning TODO: this is cursed, stop using this
347 public virtual Color Color
349 get {
return color; }
350 set {
color = value; }
381 private float spriteFadeTimer;
382 private float colorFadeTimer;
391 get {
return rectTransform; }
394 rectTransform = value;
396 if (rectTransform !=
null)
412 Font = GUIStyle.Font;
415 if (style !=
null) { GUIStyle.Apply(
this, style); }
422 Font = GUIStyle.Font;
425 if (style !=
null) { GUIStyle.Apply(
this, style); }
434 GUI.AddToUpdateList(
this);
444 GUI.RemoveFromUpdateList(
this, alsoChildren);
461 public void UpdateManually(
float deltaTime,
bool alsoChildren =
false,
bool recursive =
true)
473 protected virtual void Update(
float deltaTime)
487 if (bounceTimer > 3.0f || bounceDown)
492 bounceJump += deltaTime * 4;
493 if (bounceJump > 0.5f)
500 bounceJump -= deltaTime * 4;
501 if (bounceJump <= 0.0f)
512 bounceTimer += deltaTime;
520 if (spriteFadeTimer > 0)
522 spriteFadeTimer -= deltaTime;
524 if (colorFadeTimer > 0)
526 colorFadeTimer -= deltaTime;
538 child.ForceLayoutRecalculation();
551 child.GUIComponent.UpdateManually(deltaTime, recursive, recursive);
571 public virtual void DrawManually(SpriteBatch spriteBatch,
bool alsoChildren =
false,
bool recursive =
true)
586 public virtual void DrawChildren(SpriteBatch spriteBatch,
bool recursive)
617 protected virtual void Draw(SpriteBatch spriteBatch)
631 if (!
sprites.TryGetValue(
_previousState, out List<UISprite> previousSprites) || previousSprites.None())
641 sprites.TryGetValue(fallBackState, out previousSprites);
647 if (!
sprites.TryGetValue(
State, out List<UISprite> currentSprites) || currentSprites.None())
657 sprites.TryGetValue(fallBackState, out currentSprites);
664 if (previousSprites !=
null && previousSprites.Any())
668 foreach (
UISprite uiSprite
in previousSprites)
672 if (alphaMultiplier > 0)
679 if (currentSprites !=
null && currentSprites.Any())
682 foreach (
UISprite uiSprite
in currentSprites)
686 if (alphaMultiplier > 0)
689 Vector2 offset =
new Vector2(
710 flashRect.Inflate(flashRectInflate.X, flashRectInflate.Y);
714 if (useRectangleFlash)
716 GUI.DrawRectangle(spriteBatch, flashRect,
flashColor * (
float)Math.Sin(
flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f),
true);
720 var glow = useCircularFlash ? GUIStyle.UIGlowCircular : GUIStyle.UIGlow;
721 glow.Draw(spriteBatch,
723 flashColor * (
float)Math.Sin(
flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
737 public static void DrawToolTip(SpriteBatch spriteBatch,
RichString toolTip, Vector2 pos, Color? textColor =
null, Color? backgroundColor =
null)
739 if (ObjectiveManager.ContentRunning) {
return; }
741 int width = (int)(400 * GUI.Scale);
742 int height = (int)(18 * GUI.Scale);
743 Point padding =
new Point((
int)(10 * GUI.Scale));
747 toolTipBlock =
new GUITextBlock(
new RectTransform(
new Point(width, height),
null), toolTip, font: GUIStyle.SmallFont, wrap:
true, style:
"GUIToolTip");
748 if (textColor !=
null) { toolTipBlock.
TextColor = textColor.Value; }
749 if (backgroundColor !=
null) { toolTipBlock.
Color = backgroundColor.Value; }
751 (
int)(GUIStyle.SmallFont.MeasureString(toolTipBlock.
WrappedText).X + padding.X + toolTipBlock.
Padding.X + toolTipBlock.
Padding.Z),
752 (
int)(GUIStyle.SmallFont.MeasureString(toolTipBlock.
WrappedText).Y + padding.Y + toolTipBlock.
Padding.Y + toolTipBlock.
Padding.W));
773 if (ObjectiveManager.ContentRunning) {
return; }
775 int width = (int)(400 * GUI.Scale);
776 int height = (int)(18 * GUI.Scale);
777 Point padding =
new Point((
int)(10 * GUI.Scale));
781 toolTipBlock =
new GUITextBlock(
new RectTransform(
new Point(width, height),
null), toolTip, font: GUIStyle.SmallFont, wrap:
true, style:
"GUIToolTip");
806 void CalculateOffset()
822 public virtual void Flash(Color?
color =
null,
float flashDuration = 1.5f,
bool useRectangleFlash =
false,
bool useCircularFlash =
false, Vector2? flashRectInflate =
null)
825 this.flashRectInflate = flashRectInflate ?? Vector2.Zero;
826 this.useRectangleFlash = useRectangleFlash;
827 this.useCircularFlash = useCircularFlash;
839 public void FadeOut(
float duration,
bool removeAfter,
float wait = 0.0f, Action onRemove =
null,
bool alsoChildren =
false)
841 CoroutineManager.StartCoroutine(LerpAlpha(0.0f, duration, removeAfter, wait, onRemove));
846 child.FadeOut(duration, removeAfter, wait, onRemove, alsoChildren);
851 public void FadeIn(
float wait,
float duration,
bool alsoChildren =
false)
854 CoroutineManager.StartCoroutine(LerpAlpha(1.0f, duration,
false, wait));
859 child.FadeIn(wait, duration, alsoChildren);
874 CoroutineManager.StartCoroutine(SlideToPosition(duration, wait, Vector2.Zero));
881 Vector2 targetPos = direction
switch
890 CoroutineManager.StartCoroutine(SlideToPosition(duration, 0.0f, targetPos));
893 private IEnumerable<CoroutineStatus> SlideToPosition(
float duration,
float wait, Vector2 target)
897 var (endX, endY) = target;
900 t += CoroutineManager.DeltaTime;
907 t += CoroutineManager.DeltaTime;
909 yield
return CoroutineStatus.Running;
914 yield
return CoroutineStatus.Success;
917 private IEnumerable<CoroutineStatus> LerpAlpha(
float to,
float duration,
bool removeAfter,
float wait = 0.0f, Action onRemove =
null)
921 float startA =
color.A / 255.0f;
925 t += CoroutineManager.DeltaTime;
926 yield
return CoroutineStatus.Running;
932 t += CoroutineManager.DeltaTime;
933 SetAlpha(MathHelper.Lerp(startA, to, t / duration));
934 yield
return CoroutineStatus.Running;
939 if (removeAfter &&
Parent !=
null)
945 yield
return CoroutineStatus.Success;
948 public void Pulsate(Vector2 startScale, Vector2 endScale,
float duration)
950 if (CoroutineManager.IsCoroutineRunning(pulsateCoroutine))
954 pulsateCoroutine = CoroutineManager.StartCoroutine(DoPulsate(startScale, endScale, duration),
"Pulsate" + ToString());
957 private IEnumerable<CoroutineStatus> DoPulsate(Vector2 startScale, Vector2 endScale,
float duration)
962 t += CoroutineManager.DeltaTime;
967 yield
return CoroutineStatus.Success;
972 if (style ==
null) {
return; }
987 if (rectTransform !=
null)
997 if (style.
Width.HasValue)
1003 if (style.
Height.HasValue)
1033 foreach (var subElement
in element.Elements())
1035 if (subElement.Name.ToString().Equals(
"conditional", StringComparison.OrdinalIgnoreCase) && !CheckConditional(subElement))
1041 switch (element.Name.ToString().ToLowerInvariant())
1044 case "guitextblock":
1045 component = LoadGUITextBlock(element, parent);
1048 component = LoadLink(element, parent);
1053 component = LoadGUIFrame(element, parent);
1057 component = LoadGUIButton(element, parent);
1061 component = LoadGUIListBox(element, parent);
1063 case "guilayoutgroup":
1065 component = LoadGUILayoutGroup(element, parent);
1069 component = LoadGUIImage(element, parent);
1072 return LoadAccordion(element, parent);
1074 LoadGridText(element, parent);
1079 throw new NotImplementedException(
"Loading GUI component \"" + element.Name +
"\" from XML is not implemented.");
1082 if (component !=
null)
1084 foreach (var subElement
in element.Elements())
1086 if (subElement.Name.ToString().Equals(
"conditional", StringComparison.OrdinalIgnoreCase)) {
continue; }
1090 if (element.GetAttributeBool(
"resizetofitchildren",
false))
1092 Vector2 relativeResizeScale = element.GetAttributeVector2(
"relativeresizescale", Vector2.One);
1095 layoutGroup.RectTransform.NonScaledSize =
1096 layoutGroup.IsHorizontal ?
1097 new Point(layoutGroup.Children.Sum(c => c.Rect.Width), layoutGroup.Rect.Height) :
1098 component.RectTransform.MinSize =
new Point(layoutGroup.Rect.Width, layoutGroup.Children.Sum(c => c.Rect.Height));
1099 if (layoutGroup.CountChildren > 0)
1101 layoutGroup.RectTransform.NonScaledSize +=
1102 layoutGroup.IsHorizontal ?
1103 new Point((
int)((layoutGroup.CountChildren - 1) * (layoutGroup.AbsoluteSpacing + layoutGroup.Rect.Width * layoutGroup.RelativeSpacing)), 0) :
1104 new Point(0, (
int)((layoutGroup.CountChildren - 1) * (layoutGroup.AbsoluteSpacing + layoutGroup.Rect.Height * layoutGroup.RelativeSpacing)));
1109 listBox.RectTransform.NonScaledSize =
1110 listBox.ScrollBar.IsHorizontal ?
1111 new Point(listBox.Children.Sum(c => c.Rect.Width + listBox.Spacing), listBox.Rect.Height) :
1112 component.RectTransform.MinSize =
new Point(listBox.Rect.Width, listBox.Children.Sum(c => c.Rect.Height + listBox.Spacing));
1116 component.RectTransform.NonScaledSize =
1118 component.Children.Max(c => c.Rect.Right) - component.Children.Min(c => c.Rect.X),
1119 component.Children.Max(c => c.Rect.Bottom) - component.Children.Min(c => c.Rect.Y));
1121 component.RectTransform.NonScaledSize =
1122 component.RectTransform.NonScaledSize.Multiply(relativeResizeScale);
1128 private static bool CheckConditional(XElement element)
1130 foreach (XAttribute attribute
in element.Attributes())
1132 switch (attribute.Name.ToString().ToLowerInvariant())
1135 var languages = element.GetAttributeIdentifierArray(attribute.Name.ToString(), Array.Empty<Identifier>())
1137 if (!languages.Any(l => GameSettings.CurrentConfig.Language == l)) {
return false; }
1140 var version =
new Version(attribute.Value);
1141 if (GameMain.Version != version) {
return false; }
1143 case "mingameversion":
1144 var minVersion =
new Version(attribute.Value);
1145 if (GameMain.Version < minVersion) {
return false; }
1147 case "maxgameversion":
1148 var maxVersion =
new Version(attribute.Value);
1149 if (GameMain.Version > maxVersion) {
return false; }
1151 case "buildconfiguration":
1152 switch (attribute.Value.ToString().ToLowerInvariant())
1167 #if !DEBUG && !UNSTABLE
1180 private static GUITextBlock LoadGUITextBlock(XElement element,
RectTransform parent,
string overrideText =
null,
Anchor? anchor =
null)
1182 string text = overrideText ??
1183 (element.Attribute(
"text") ==
null ?
1184 element.ElementInnerText() :
1185 element.GetAttributeString(
"text",
""));
1186 text = text.Replace(
@"\n",
"\n");
1188 string style = element.GetAttributeString(
"style",
"");
1189 if (style ==
"null") { style =
null; }
1190 Color?
color =
null;
1191 if (element.Attribute(
"color") !=
null) {
color = element.GetAttributeColor(
"color", Color.White); }
1192 float scale = element.GetAttributeFloat(
"scale", 1.0f);
1193 bool wrap = element.GetAttributeBool(
"wrap",
true);
1195 element.GetAttributeEnum(
"alignment", text.Contains(
'\n') ? Alignment.Left : Alignment.Center);
1196 if (!GUIStyle.Fonts.TryGetValue(element.GetAttributeIdentifier(
"font",
"Font"), out GUIFont font))
1198 font = GUIStyle.Font;
1202 RichString.Rich(text),
color, font,
alignment, wrap: wrap, style: style)
1206 if (anchor.HasValue) { textBlock.RectTransform.SetPosition(anchor.Value); }
1207 textBlock.RectTransform.IsFixedSize =
true;
1208 textBlock.RectTransform.NonScaledSize =
new Point(textBlock.Rect.Width, textBlock.Rect.Height);
1212 private static GUIButton LoadLink(XElement element,
RectTransform parent)
1214 var button = LoadGUIButton(element, parent);
1215 string url = element.GetAttributeString(
"url",
"");
1216 button.OnClicked = (btn, userdata) =>
1220 if (SteamManager.IsInitialized)
1222 SteamManager.OverlayCustomUrl(url);
1226 ToolBox.OpenFileWithShell(url);
1231 DebugConsole.ThrowError(
"Failed to open url \""+url+
"\".", e);
1238 private static void LoadGridText(XElement element,
RectTransform parent)
1240 string text = element.Attribute(
"text") ==
null ?
1241 element.ElementInnerText() :
1242 element.GetAttributeString(
"text",
"");
1243 text = text.Replace(
@"\n",
"\n");
1245 string[] elements = text.Split(
',');
1247 for (
int i = 0; i < elements.Length; i++)
1252 lineContainer = LoadGUITextBlock(element, parent, elements[i],
Anchor.CenterLeft).
RectTransform;
1254 lineContainer.Pivot =
Pivot.TopCenter;
1255 lineContainer.NonScaledSize =
new Point((
int)(parent.NonScaledSize.X * 0.7f), lineContainer.NonScaledSize.Y);
1258 LoadGUITextBlock(element, lineContainer, elements[i],
Anchor.Center).
TextAlignment = Alignment.Center;
1261 LoadGUITextBlock(element, lineContainer, elements[i],
Anchor.CenterRight).
TextAlignment = Alignment.CenterRight;
1267 private static GUIFrame LoadGUIFrame(XElement element,
RectTransform parent)
1269 string style = element.GetAttributeString(
"style", element.Name.ToString().Equals(
"spacing", StringComparison.OrdinalIgnoreCase) ?
null :
"");
1270 if (style ==
"null") { style =
null; }
1274 private static GUIButton LoadGUIButton(XElement element,
RectTransform parent)
1276 string style = element.GetAttributeString(
"style",
"");
1277 if (style ==
"null") { style =
null; }
1279 Alignment textAlignment = Alignment.Center;
1280 Enum.TryParse(element.GetAttributeString(
"textalignment",
"Center"), out textAlignment);
1282 string text = element.Attribute(
"text") ==
null ?
1283 element.ElementInnerText() :
1284 element.GetAttributeString(
"text",
"");
1285 text = text.Replace(
@"\n",
"\n");
1289 textAlignment: textAlignment,
1293 private static GUIListBox LoadGUIListBox(XElement element,
RectTransform parent)
1295 string style = element.GetAttributeString(
"style",
"");
1296 if (style ==
"null") { style =
null; }
1297 bool isHorizontal = element.GetAttributeBool(
"ishorizontal", !element.GetAttributeBool(
"isvertical",
true));
1298 return new GUIListBox(
RectTransform.
Load(element, parent), isHorizontal, style: style);
1301 private static GUILayoutGroup LoadGUILayoutGroup(XElement element,
RectTransform parent)
1303 bool isHorizontal = element.GetAttributeBool(
"ishorizontal", !element.GetAttributeBool(
"isvertical",
true));
1305 Enum.TryParse(element.GetAttributeString(
"childanchor",
"TopLeft"), out
Anchor childAnchor);
1306 return new GUILayoutGroup(
RectTransform.
Load(element, parent), isHorizontal, childAnchor)
1308 Stretch = element.GetAttributeBool(
"stretch",
false),
1309 RelativeSpacing = element.GetAttributeFloat(
"relativespacing", 0.0f),
1310 AbsoluteSpacing = element.GetAttributeInt(
"absolutespacing", 0),
1314 private static GUIImage LoadGUIImage(ContentXElement element,
RectTransform parent)
1317 string url = element.GetAttributeString(
"url",
"");
1318 if (!
string.IsNullOrEmpty(url))
1320 string localFileName = Path.GetFileNameWithoutExtension(url.Replace(
"/",
"").Replace(
":",
"").Replace(
"https",
"").Replace(
"http",
""))
1322 localFileName += Path.GetExtension(url);
1323 string localFilePath = Path.Combine(
"Downloads", localFileName);
1324 if (!File.Exists(localFilePath))
1326 Uri baseAddress =
new Uri(url);
1327 Uri remoteDirectory =
new Uri(baseAddress,
".");
1328 string remoteFileName = Path.GetFileName(baseAddress.LocalPath);
1329 IRestClient client =
new RestClient(remoteDirectory);
1330 var response = client.Execute(
new RestRequest(remoteFileName, Method.GET));
1331 if (response.ResponseStatus != ResponseStatus.Completed) {
return null; }
1332 if (response.StatusCode != HttpStatusCode.OK) {
return null; }
1334 if (!Directory.Exists(
"Downloads")) { Directory.CreateDirectory(
"Downloads"); }
1335 File.WriteAllBytes(localFilePath, response.RawBytes);
1337 sprite =
new Sprite(element,
"Downloads", localFileName);
1341 sprite =
new Sprite(element);
1344 return new GUIImage(
RectTransform.
Load(element, parent), sprite, scaleToFit:
true);
1347 private static GUIButton LoadAccordion(ContentXElement element,
RectTransform parent)
1349 var button = LoadGUIButton(element, parent);
1350 List<GUIComponent> content =
new List<GUIComponent>();
1351 foreach (var subElement
in element.Elements())
1353 var contentElement =
FromXML(subElement, parent);
1354 if (contentElement !=
null)
1356 contentElement.Visible =
false;
1357 contentElement.IgnoreLayoutGroups =
true;
1358 content.Add(contentElement);
1361 button.OnClicked = (btn, userdata) =>
1363 bool visible = content.FirstOrDefault()?.Visible ??
true;
1366 contentElement.Visible = !visible;
1367 contentElement.IgnoreLayoutGroups = !contentElement.Visible;
1369 if (button.Parent is GUILayoutGroup layoutGroup)
1371 layoutGroup.Recalculate();
static CoroutineStatus Running
GUIComponent FindChild(object userData, bool recursive=false)
void ApplySizeRestrictions(GUIComponentStyle style)
void InheritTotalChildrenHeight()
Sets the minimum height of the transfrom to equal to the sum of the heights of the children (i....
GUIComponent(string style)
virtual void ForceLayoutRecalculation()
static GUIComponent FromXML(ContentXElement element, RectTransform parent)
void ImmediateFlash(Color? color=null)
IEnumerable< T > GetAllChildren< T >()
GUIComponent(string style, RectTransform rectT)
This is the new constructor.
IEnumerable< GUIComponent > FindChildren(Func< GUIComponent, bool > predicate)
void SlideIn(float wait, float duration, int amount, SlideDirection direction)
bool ClampMouseRectToParent
GUIComponent GetChild(int index)
void UpdateChildren(float deltaTime, bool recursive)
Updates all the children manually.
Color GetBlendedColor(Color targetColor, ref Color blendedColor)
virtual void RemoveChild(GUIComponent child)
virtual ComponentState State
SecondaryButtonDownHandler OnSecondaryClicked
virtual void Flash(Color? color=null, float flashDuration=1.5f, bool useRectangleFlash=false, bool useCircularFlash=false, Vector2? flashRectInflate=null)
static void DrawToolTip(SpriteBatch spriteBatch, RichString toolTip, Rectangle targetElement, Anchor anchor=Anchor.BottomCenter, Pivot pivot=Pivot.TopLeft)
void Pulsate(Vector2 startScale, Vector2 endScale, float duration)
void UpdateAuto(float deltaTime)
Only GUI should call this method. Auto updating follows the order of GUI update list....
virtual Color GetColor(ComponentState state)
virtual void AddToGUIUpdateList(bool ignoreChildren=false, int order=0)
Dictionary< ComponentState, List< UISprite > > sprites
virtual Rectangle? MouseRect
void DrawAuto(SpriteBatch spriteBatch)
Only GUI should call this method. Auto drawing follows the order of GUI update list....
virtual Color OutlineColor
Rectangle ClampRect(Rectangle r)
virtual void DrawChildren(SpriteBatch spriteBatch, bool recursive)
Draws all the children manually.
void InheritTotalChildrenMinHeight()
Sets the minimum height of the transfrom to equal to the sum of the minimum heights of the children (...
bool IsParentOf(GUIComponent component, bool recursive=true)
virtual bool PlaySoundOnSelect
delegate bool SecondaryButtonDownHandler(GUIComponent component, object userData)
TransitionMode ColorTransition
virtual Color DisabledColor
GUIComponent GetChildByUserData(object obj)
void SlideOut(float duration, int amount, SlideDirection direction)
Action< GUIComponent > OnAddedToGUIUpdateList
Identifier[] styleHierarchy
Color DefaultColor
Currently only used for the fade effect in GUIListBox, should be set to the same value as Color but o...
virtual void ApplyStyle(GUIComponentStyle style)
bool AlwaysOverrideCursor
virtual void ClearChildren()
virtual void Draw(SpriteBatch spriteBatch)
GUIComponent FindChild(Func< GUIComponent, bool > predicate, bool recursive=false)
virtual RichString ToolTip
int GetChildIndex(GUIComponent child)
void UpdateManually(float deltaTime, bool alsoChildren=false, bool recursive=true)
By default, all the gui elements are updated automatically in the same order they appear on the updat...
virtual Color SelectedColor
virtual void DrawManually(SpriteBatch spriteBatch, bool alsoChildren=false, bool recursive=true)
By default, all the gui elements are drawn automatically in the same order they appear on the update ...
void RemoveFromGUIUpdateList(bool alsoChildren=true)
void FadeIn(float wait, float duration, bool alsoChildren=false)
IEnumerable< GUIComponent > GetAllChildren()
Returns all child elements in the hierarchy.
SpriteFallBackState FallBackState
bool IsChildOf(GUIComponent component, bool recursive=true)
virtual void Update(float deltaTime)
float SpriteCrossFadeTime
virtual void SetAlpha(float a)
static void DrawToolTip(SpriteBatch spriteBatch, RichString toolTip, Vector2 pos, Color? textColor=null, Color? backgroundColor=null)
void DrawToolTip(SpriteBatch spriteBatch)
Creates and draws a tooltip.
RectTransform RectTransform
SpriteEffects SpriteEffects
IEnumerable< GUIComponent > Children
void FadeOut(float duration, bool removeAfter, float wait=0.0f, Action onRemove=null, bool alsoChildren=false)
IEnumerable< GUIComponent > FindChildren(object userData)
virtual Color PressedColor
ComponentState _previousState
readonly Color HoverColor
readonly TransitionMode TransitionMode
readonly Dictionary< GUIComponent.ComponentState, List< UISprite > > Sprites
static Identifier[] ToHierarchy(GUIComponentStyle style)
readonly Color PressedColor
SpriteFallBackState FallBackState
readonly float ColorCrossFadeTime
readonly Color OutlineColor
static GUIComponentStyle FromHierarchy(IReadOnlyList< Identifier > hierarchy)
readonly Color DisabledColor
readonly float SpriteCrossFadeTime
readonly Color SelectedColor
Vector2 MeasureString(LocalizedString str, bool removeExtraSpacing=false)
GUIFrame Content
A frame that contains the contents of the listbox. The frame itself is not rendered.
LocalizedString WrappedText
static int GraphicsHeight
TransitionMode TransitionMode
void Draw(SpriteBatch spriteBatch, RectangleF rect, Color color, SpriteEffects spriteEffects=SpriteEffects.None, Vector2? uvOffset=null)