static public IUIElementText TitleElementText(this IModuleButtonTooltip tooltip) { var tooltipHorizontalCenter = tooltip?.RegionCenter()?.A; var setLabelIntersectingHorizontalCenter = tooltip?.LabelText ?.Where(label => label?.Region.Min0 < tooltipHorizontalCenter && tooltipHorizontalCenter < label?.Region.Max0); return (setLabelIntersectingHorizontalCenter ?.OrderByCenterVerticalDown()?.FirstOrDefault()); }
static public BotEngine.EveOnline.Interface.MemoryStruct.ModuleButtonTooltip AsOld( this IModuleButtonTooltip moduleButtonTooltip) { if (moduleButtonTooltip == null) { return(null); } var listRow = new List <BotEngine.EveOnline.Interface.MemoryStruct.ModuleButtonTooltipRow>(); var listElementToGroup = new[] { (IEnumerable <IUIElement>)moduleButtonTooltip.LabelText, moduleButtonTooltip.Sprite, } .ConcatNullable().WhereNotDefault() .OrderByCenterVerticalDown() .ToArray(); var rowContainer = new List <IUIElement>(); var rowContainerToRow = new Action(() => { if (rowContainer.Count < 1) { return; } // order elements horizontally var rowContainerListElement = rowContainer?.OrderBy(elem => elem.Region.Center().A)?.ToArray(); listRow.Add(new BotEngine.EveOnline.Interface.MemoryStruct.ModuleButtonTooltipRow { ListLabelString = rowContainerListElement?.OfType <IUIElementText>()?.AsOldUIElementLabelString()?.ToArray(), IconTextureId = rowContainerListElement?.OfType <ISprite>()?.Select(sprite => sprite.Texture0Id.AsOld())?.ToArray(), ShortcutText = rowContainerListElement.Contains(moduleButtonTooltip.ToggleKeyTextLabel) ? moduleButtonTooltip?.ToggleKeyTextLabel?.Text : null, }); rowContainer.Clear(); }); // group UIElements into rows dependent on overlapping. foreach (var item in listElementToGroup) { if (0 < rowContainer.Count) { if (rowContainer.Last().Region.Max1 < item.Region.Center().B) { rowContainerToRow(); } } rowContainer.Add(item); } rowContainerToRow(); return(new BotEngine.EveOnline.Interface.MemoryStruct.ModuleButtonTooltip(moduleButtonTooltip.AsOldUIElement()) { ListLabelString = moduleButtonTooltip?.LabelText?.AsOldUIElementLabelString()?.ToArray(), ListRow = listRow?.ToArray(), }); }
static public IUIElementText TitleElementText(this IModuleButtonTooltip tooltip) => tooltip?.LabelText?.OrderByCenterVerticalDown()?.FirstOrDefault();