Example #1
0
    public static Transform FindWidgetOnUI(int widgetId, bool activeSelf = true)
    {
        Transform result = null;
        string    text   = WidgetSystem.FindNameOfUIByWidget(widgetId);

        string[] array = WidgetSystem.FindNameOfWidgetById(widgetId);
        if (!string.IsNullOrEmpty(text) && array != null && array.Length >= 1)
        {
            UIBase uIIfExist = UIManagerControl.Instance.GetUIIfExist(text);
            if (uIIfExist != null)
            {
                if (activeSelf && !uIIfExist.get_gameObject().get_activeSelf())
                {
                    return(null);
                }
                if (array.Length == 1)
                {
                    result = WidgetSystem.FindTransformOfuibase(uIIfExist, GameDataUtils.SplitString4Dot0(array[0]));
                }
                else if (array.Length == 2)
                {
                    Transform transform = WidgetSystem.FindTransformOfuibase(uIIfExist, GameDataUtils.SplitString4Dot0(array[0]));
                    if (transform != null)
                    {
                        result = XUtility.RecursiveFindTransform(transform, GameDataUtils.SplitString4Dot0(array[1]));
                    }
                }
            }
        }
        return(result);
    }
Example #2
0
    public static bool IsStaticWidget(int widgetId)
    {
        string text = WidgetSystem.FindNameOfUIByWidget(widgetId);

        string[] array = WidgetSystem.FindNameOfWidgetById(widgetId);
        if (!string.IsNullOrEmpty(text) && array != null && array.Length >= 1)
        {
            UIBase uIIfExist = UIManagerControl.Instance.GetUIIfExist(text);
            if (uIIfExist != null && array.Length == 1)
            {
                return(WidgetSystem.IsStatic(uIIfExist, GameDataUtils.SplitString4Dot0(array[0])));
            }
        }
        return(false);
    }