Esempio n. 1
0
        static public ISquadronsUI AsSquadronsUI(this UINodeInfoInTree squadronsNode)
        {
            if (!(squadronsNode?.VisibleIncludingInheritance ?? false))
            {
                return(null);
            }

            var squadronsContainer = squadronsNode?.AlsContainer();

            var setSquadronUINode =
                squadronsNode?.MatchingNodesFromSubtreeBreadthFirst(node => node.PyObjTypNameMatchesRegexPatternIgnoreCase("SquadronUI"));

            var buttonFromPyTypeName = new Func <string, IUIElement>(pyTypeNameRegexPattern =>
                                                                     squadronsNode?.FirstMatchingNodeFromSubtreeBreadthFirst(node => node.PyObjTypNameMatchesRegexPatternIgnoreCase(pyTypeNameRegexPattern))?.AsUIElementIfVisible());

            return(new SquadronsUI(squadronsContainer)
            {
                SetSquadron = setSquadronUINode?.Select(node => node?.AsSquadronUI())?.WhereNotDefault()?.OrderBy(squadronUI => squadronUI?.RegionCenter()?.A)?.ToArrayIfNotEmpty(),
                LaunchAllButton = buttonFromPyTypeName("ButtonLaunchAll"),
                OpenBayButton = buttonFromPyTypeName("ButtonOpenBay"),
                RecallAllButton = buttonFromPyTypeName("ButtonRecallAll"),
            });
        }
Esempio n. 2
0
        static public ISquadronContainer AsSquadronContainer(this UINodeInfoInTree squadronContainerNode)
        {
            if (!(squadronContainerNode?.VisibleIncludingInheritance ?? false))
            {
                return(null);
            }

            var squadronNumberLabel =
                squadronContainerNode?.FirstMatchingNodeFromSubtreeBreadthFirst(node => node.PyObjTypNameMatchesRegexPatternIgnoreCase("SquadronNumber"))
                ?.LargestLabelInSubtree();

            var isSelected =
                squadronContainerNode
                ?.FirstMatchingNodeFromSubtreeBreadthFirst(n => n?.Name?.RegexMatchSuccessIgnoreCase("SelectHilight") ?? false)
                ?.VisibleIncludingInheritance;

            return(new SquadronContainer(squadronContainerNode.AlsContainer())
            {
                SquadronNumber = squadronNumberLabel?.LabelText()?.TryParseInt(),
                Health = squadronContainerNode?.FirstMatchingNodeFromSubtreeBreadthFirst(node => node.PyObjTypNameMatchesRegexPatternIgnoreCase(FightersHealthGaugePyTypeName)).AsSquadronHealth(),
                IsSelected = isSelected,
                Hint = squadronContainerNode?.Hint,
            });
        }