예제 #1
0
        public static void PrepAssetForScreenSize(object asset)
        {
            GameObject gameObject = asset as GameObject;

            if (gameObject == null)
            {
                return;
            }
            GameObject gameObject2 = UnityUtils.FindGameObject(gameObject, "WidgetSafeArea");

            if (gameObject2 == null)
            {
                return;
            }
            UIWidget component = gameObject2.GetComponent <UIWidget>();
            Rect     safeArea  = SafeScreenUtils.GetSafeArea();

            if (safeArea.width < (float)Screen.width || safeArea.height < (float)Screen.height || safeArea.x > 0f || safeArea.y > 0f)
            {
                if (SafeScreenUtils.useFixedAnchors)
                {
                    component.leftAnchor.absolute   = 53;
                    component.topAnchor.absolute    = 0;
                    component.rightAnchor.absolute  = -53;
                    component.bottomAnchor.absolute = 0;
                }
                else
                {
                    component.leftAnchor.absolute   = (int)safeArea.x;
                    component.topAnchor.absolute    = (int)safeArea.y;
                    component.rightAnchor.absolute  = (int)(safeArea.width - (float)Screen.width);
                    component.bottomAnchor.absolute = (int)(safeArea.height - (float)Screen.height);
                }
            }
        }
예제 #2
0
        public static GameObject FindGameObject(GameObject parent, string name)
        {
            if (parent.name == name)
            {
                return(parent);
            }
            Transform transform  = parent.transform;
            int       i          = 0;
            int       childCount = transform.childCount;

            while (i < childCount)
            {
                GameObject gameObject = UnityUtils.FindGameObject(transform.GetChild(i).gameObject, name);
                if (gameObject != null)
                {
                    return(gameObject);
                }
                i++;
            }
            return(null);
        }
예제 #3
0
 public unsafe static long $Invoke19(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(UnityUtils.FindGameObject((GameObject)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)))));
 }