private HudElement(string elementType, string defName, HudTarget targets) { _elementType = elementType; DefName = defName; Targets = targets; HudTimings.Add(this); }
public override bool Draw(HudComponent component, Rect rect) { HudTimings.Update(component)?.Start(); var result = DoDraw(rect); HudTimings.Update(component)?.Finish(rect); return(result); }
private HudLayout(XElement xe) : base(xe, true) { HudTimings.Add(this); bool docked; if (xe.Name == DockedElementName) { docked = true; } else if (xe.Name == FloatingElementName) { docked = false; } else { return; } var height = xe.Attribute(HeightAttributeName)?.Value.ToInt() ?? -1; var width = xe.Attribute(WidthAttributeName)?.Value.ToInt() ?? -1; var tabs = xe.Attribute(TabsAttributeName)?.Value.ToInt() ?? -1; if (height > 0) { if (docked) { Theme.InspectPaneHeight.Value = height; } else { Theme.HudHeight.Value = height; } } if (width > 0) { if (docked) { Theme.InspectPaneTabWidth.Value = width; } else { Theme.HudWidth.Value = width; } } if (docked && tabs > 0) { Theme.InspectPaneMinTabs.Value = tabs; } }
public void Draw(Rect rect, PawnModel model) { HudTimings.Update(this)?.Start(); try { if (model == null) { return; } if (model.Base != _lastPawn || _lastRefresh == default || (DateTime.Now - _lastRefresh).TotalMilliseconds > Theme.RefreshRate.Value * 100) { Prepare(model); _lastPawn = model.Base; _lastRefresh = DateTime.Now; } Draw(rect); } catch (Exception exception) { Mod.HandleError(exception); } HudTimings.Update(this)?.Finish(rect, true); }