Inheritance: Behaviour
Example #1
0
        public Rect GetScreenRect()
        {
            Rect rect;

            GUIElement.INTERNAL_CALL_GetScreenRect(this, (Camera)null, out rect);
            return(rect);
        }
Example #2
0
        public Rect GetScreenRect([DefaultValue("null")] Camera camera)
        {
            Rect result;

            GUIElement.INTERNAL_CALL_GetScreenRect(this, camera, out result);
            return(result);
        }
	static public int HitTest(IntPtr l) {
		try {
			int argc = LuaDLL.lua_gettop(l);
			if(argc==2){
				UnityEngine.GUIElement self=(UnityEngine.GUIElement)checkSelf(l);
				UnityEngine.Vector3 a1;
				checkType(l,2,out a1);
				var ret=self.HitTest(a1);
				pushValue(l,true);
				pushValue(l,ret);
				return 2;
			}
			else if(argc==3){
				UnityEngine.GUIElement self=(UnityEngine.GUIElement)checkSelf(l);
				UnityEngine.Vector3 a1;
				checkType(l,2,out a1);
				UnityEngine.Camera a2;
				checkType(l,3,out a2);
				var ret=self.HitTest(a1,a2);
				pushValue(l,true);
				pushValue(l,ret);
				return 2;
			}
			pushValue(l,false);
			LuaDLL.lua_pushstring(l,"No matched override function to call");
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
Example #4
0
 static public int GetScreenRect(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.GUIElement self = (UnityEngine.GUIElement)checkSelf(l);
             var ret = self.GetScreenRect();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.GUIElement self = (UnityEngine.GUIElement)checkSelf(l);
             UnityEngine.Camera     a1;
             checkType(l, 2, out a1);
             var ret = self.GetScreenRect(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
        public Rect GetScreenRect()
        {
            Camera camera = null;
            Rect   result;

            GUIElement.INTERNAL_CALL_GetScreenRect(this, camera, out result);
            return(result);
        }
		void DoHitTest()
		{
			var go = Fsm.GetOwnerDefaultTarget(gameObject);

			if (go == null)
			{
				return;
			}

			// cache GUIElement component

			if (go != gameObjectCached)
			{
				guiElement = go.GetComponent<GUITexture>() ?? (GUIElement) go.GetComponent<GUIText>();

				gameObjectCached = go;
			}

			if (guiElement == null)
			{
				Finish();
				return;
			}

			// get screen point to test

			var testPoint = screenPoint.IsNone ? new Vector3(0, 0) : screenPoint.Value;
			
			if (!screenX.IsNone)
			{
				testPoint.x = screenX.Value;
			}

			if (!screenY.IsNone)
			{
				testPoint.y = screenY.Value;
			}

			if (normalized.Value)
			{
				testPoint.x *= Screen.width;
				testPoint.y *= Screen.height;
			}

			// perform hit test

			if (guiElement.HitTest(testPoint, camera))
			{
				storeResult.Value = true;
				Fsm.Event(hitEvent);
			}
			else
			{
				storeResult.Value = false;
			}
		}
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.GUIElement o;
			o=new UnityEngine.GUIElement();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	static public int constructor(IntPtr l) {
		try {
			UnityEngine.GUIElement o;
			o=new UnityEngine.GUIElement();
			pushValue(l,true);
			pushValue(l,o);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
 public static int constructor(IntPtr l)
 {
     try {
         UnityEngine.GUIElement o;
         o=new UnityEngine.GUIElement();
         pushValue(l,o);
         return 1;
     }
     catch(Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return 0;
     }
 }
Example #10
0
        private static void HitTestLegacyGUI(Camera camera, Vector3 mousePosition, ref SendMouseEvents.HitInfo hitInfo)
        {
            GUILayer component = camera.GetComponent <GUILayer>();

            if (component)
            {
                GUIElement gUIElement = component.HitTest(mousePosition);
                if (gUIElement)
                {
                    hitInfo.target = gUIElement.gameObject;
                    hitInfo.camera = camera;
                }
                else
                {
                    hitInfo.target = null;
                    hitInfo.camera = null;
                }
            }
        }
Example #11
0
        private static void DoSendMouseEvents(int skipRTCameras)
        {
            Vector3 mousePosition   = Input.mousePosition;
            int     allCamerasCount = Camera.allCamerasCount;

            if (m_Cameras == null || m_Cameras.Length != allCamerasCount)
            {
                m_Cameras = new Camera[allCamerasCount];
            }
            Camera.GetAllCameras(m_Cameras);
            for (int i = 0; i < m_CurrentHit.Length; i++)
            {
                m_CurrentHit[i] = default(HitInfo);
            }
            if (!s_MouseUsed)
            {
                Camera[] cameras = m_Cameras;
                foreach (Camera camera in cameras)
                {
                    if (camera == null || (skipRTCameras != 0 && camera.targetTexture != null))
                    {
                        continue;
                    }
                    int     targetDisplay = camera.targetDisplay;
                    Vector3 vector        = Display.RelativeMouseAt(mousePosition);
                    if (vector != Vector3.zero)
                    {
                        int num = (int)vector.z;
                        if (num != targetDisplay)
                        {
                            continue;
                        }
                        float num2 = Screen.width;
                        float num3 = Screen.height;
                        if (targetDisplay > 0 && targetDisplay < Display.displays.Length)
                        {
                            num2 = Display.displays[targetDisplay].systemWidth;
                            num3 = Display.displays[targetDisplay].systemHeight;
                        }
                        Vector2 vector2 = new Vector2(vector.x / num2, vector.y / num3);
                        if (vector2.x < 0f || vector2.x > 1f || vector2.y < 0f || vector2.y > 1f)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        vector = mousePosition;
                        if (!camera.pixelRect.Contains(vector))
                        {
                            continue;
                        }
                    }
                    GUILayer component = camera.GetComponent <GUILayer>();
                    if ((bool)component)
                    {
                        GUIElement gUIElement = component.HitTest(vector);
                        if ((bool)gUIElement)
                        {
                            m_CurrentHit[0].target = gUIElement.gameObject;
                            m_CurrentHit[0].camera = camera;
                        }
                        else
                        {
                            m_CurrentHit[0].target = null;
                            m_CurrentHit[0].camera = null;
                        }
                    }
                    if (camera.eventMask != 0)
                    {
                        Ray        ray        = camera.ScreenPointToRay(vector);
                        Vector3    direction  = ray.direction;
                        float      z          = direction.z;
                        float      distance   = (!Mathf.Approximately(0f, z)) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity;
                        GameObject gameObject = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask);
                        if (gameObject != null)
                        {
                            m_CurrentHit[1].target = gameObject;
                            m_CurrentHit[1].camera = camera;
                        }
                        else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                        {
                            m_CurrentHit[1].target = null;
                            m_CurrentHit[1].camera = null;
                        }
                        GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask);
                        if (gameObject2 != null)
                        {
                            m_CurrentHit[2].target = gameObject2;
                            m_CurrentHit[2].camera = camera;
                        }
                        else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                        {
                            m_CurrentHit[2].target = null;
                            m_CurrentHit[2].camera = null;
                        }
                    }
                }
            }
            for (int k = 0; k < m_CurrentHit.Length; k++)
            {
                SendEvents(k, m_CurrentHit[k]);
            }
            s_MouseUsed = false;
        }
Example #12
0
 public bool HitTest(Vector3 screenPosition)
 {
     GUIElement.FeatureRemoved();
     return(false);
 }
Example #13
0
 private static extern void INTERNAL_CALL_GetScreenRect(GUIElement self, Camera camera, out Rect value);
Example #14
0
        private static void DoSendMouseEvents(int skipRTCameras)
        {
            Vector3 mousePosition   = Input.mousePosition;
            int     allCamerasCount = Camera.allCamerasCount;

            if (SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount)
            {
                SendMouseEvents.m_Cameras = new Camera[allCamerasCount];
            }
            Camera.GetAllCameras(SendMouseEvents.m_Cameras);
            for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; i++)
            {
                SendMouseEvents.m_CurrentHit[i] = default(SendMouseEvents.HitInfo);
            }
            if (!SendMouseEvents.s_MouseUsed)
            {
                Camera[] cameras = SendMouseEvents.m_Cameras;
                for (int j = 0; j < cameras.Length; j++)
                {
                    Camera camera = cameras[j];
                    if (!(camera == null) && (skipRTCameras == 0 || !(camera.targetTexture != null)))
                    {
                        if (camera.pixelRect.Contains(mousePosition))
                        {
                            GUILayer component = camera.GetComponent <GUILayer>();
                            if (component)
                            {
                                GUIElement gUIElement = component.HitTest(mousePosition);
                                if (gUIElement)
                                {
                                    SendMouseEvents.m_CurrentHit[0].target = gUIElement.gameObject;
                                    SendMouseEvents.m_CurrentHit[0].camera = camera;
                                }
                                else
                                {
                                    SendMouseEvents.m_CurrentHit[0].target = null;
                                    SendMouseEvents.m_CurrentHit[0].camera = null;
                                }
                            }
                            if (camera.eventMask != 0)
                            {
                                Ray        ray        = camera.ScreenPointToRay(mousePosition);
                                float      z          = ray.direction.z;
                                float      distance   = (!Mathf.Approximately(0f, z)) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity;
                                GameObject gameObject = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask);
                                if (gameObject != null)
                                {
                                    SendMouseEvents.m_CurrentHit[1].target = gameObject;
                                    SendMouseEvents.m_CurrentHit[1].camera = camera;
                                }
                                else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                                {
                                    SendMouseEvents.m_CurrentHit[1].target = null;
                                    SendMouseEvents.m_CurrentHit[1].camera = null;
                                }
                                GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask);
                                if (gameObject2 != null)
                                {
                                    SendMouseEvents.m_CurrentHit[2].target = gameObject2;
                                    SendMouseEvents.m_CurrentHit[2].camera = camera;
                                }
                                else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                                {
                                    SendMouseEvents.m_CurrentHit[2].target = null;
                                    SendMouseEvents.m_CurrentHit[2].camera = null;
                                }
                            }
                        }
                    }
                }
            }
            for (int k = 0; k < SendMouseEvents.m_CurrentHit.Length; k++)
            {
                SendMouseEvents.SendEvents(k, SendMouseEvents.m_CurrentHit[k]);
            }
            SendMouseEvents.s_MouseUsed = false;
        }
Example #15
0
 private static bool INTERNAL_CALL_HitTest(GUIElement self, ref Vector3 screenPosition, Camera camera)
 {
     throw new NotImplementedException("ăȘă«ă“ă‚Œ");
 }
Example #16
0
 private static extern void INTERNAL_CALL_GetScreenRect(GUIElement self, Camera camera, out Rect value);
        void DoTouchGUIEvent()
        {
            if (Input.touchCount > 0)
            {
                var go = Fsm.GetOwnerDefaultTarget(gameObject);
                if (go == null)
                {
                    return;
                }

                guiElement = go.guiTexture ?? (GUIElement) go.guiText;

                if (guiElement == null)
                {
                    return;
                }

                foreach (var touch in Input.touches)
                {
                    DoTouch(touch);
                }
            }
        }
Example #18
0
 private static extern bool INTERNAL_CALL_HitTest(GUIElement self, ref Vector3 screenPosition, Camera camera);
Example #19
0
 private static extern bool INTERNAL_CALL_HitTest(GUIElement self, ref Vector3 screenPosition, Camera camera);
Example #20
0
 public Rect GetScreenRect()
 {
     GUIElement.FeatureRemoved();
     return(new Rect(0f, 0f, 0f, 0f));
 }
Example #21
0
 public bool HitTest(Vector3 screenPosition, [UnityEngine.Internal.DefaultValue("null")] Camera camera)
 {
     GUIElement.FeatureRemoved();
     return(false);
 }
Example #22
0
 public Rect GetScreenRect([UnityEngine.Internal.DefaultValue("null")] Camera camera)
 {
     GUIElement.FeatureRemoved();
     return(new Rect(0f, 0f, 0f, 0f));
 }
Example #23
0
        private static void DoSendMouseEvents(int skipRTCameras)
        {
            Vector3 mousePosition   = Input.mousePosition;
            int     allCamerasCount = Camera.allCamerasCount;

            if ((m_Cameras == null) || (m_Cameras.Length != allCamerasCount))
            {
                m_Cameras = new Camera[allCamerasCount];
            }
            Camera.GetAllCameras(m_Cameras);
            for (int i = 0; i < m_CurrentHit.Length; i++)
            {
                m_CurrentHit[i] = new HitInfo();
            }
            if (!s_MouseUsed)
            {
                foreach (Camera camera in m_Cameras)
                {
                    if (((camera != null) && ((skipRTCameras == 0) || (camera.targetTexture == null))) && camera.pixelRect.Contains(mousePosition))
                    {
                        GUILayer component = camera.GetComponent <GUILayer>();
                        if (component != null)
                        {
                            GUIElement element = component.HitTest(mousePosition);
                            if (element != null)
                            {
                                m_CurrentHit[0].target = element.gameObject;
                                m_CurrentHit[0].camera = camera;
                            }
                            else
                            {
                                m_CurrentHit[0].target = null;
                                m_CurrentHit[0].camera = null;
                            }
                        }
                        if (camera.eventMask != 0)
                        {
                            Ray        ray      = camera.ScreenPointToRay(mousePosition);
                            float      z        = ray.direction.z;
                            float      distance = !Mathf.Approximately(0f, z) ? Mathf.Abs((float)((camera.farClipPlane - camera.nearClipPlane) / z)) : float.PositiveInfinity;
                            GameObject obj2     = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask);
                            if (obj2 != null)
                            {
                                m_CurrentHit[1].target = obj2;
                                m_CurrentHit[1].camera = camera;
                            }
                            else if ((camera.clearFlags == CameraClearFlags.Skybox) || (camera.clearFlags == CameraClearFlags.Color))
                            {
                                m_CurrentHit[1].target = null;
                                m_CurrentHit[1].camera = null;
                            }
                            GameObject obj3 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask);
                            if (obj3 != null)
                            {
                                m_CurrentHit[2].target = obj3;
                                m_CurrentHit[2].camera = camera;
                            }
                            else if ((camera.clearFlags == CameraClearFlags.Skybox) || (camera.clearFlags == CameraClearFlags.Color))
                            {
                                m_CurrentHit[2].target = null;
                                m_CurrentHit[2].camera = null;
                            }
                        }
                    }
                }
            }
            for (int j = 0; j < m_CurrentHit.Length; j++)
            {
                SendEvents(j, m_CurrentHit[j]);
            }
            s_MouseUsed = false;
        }
Example #24
0
        public bool HitTest(Vector3 screenPosition)
        {
            Camera camera = null;

            return(GUIElement.INTERNAL_CALL_HitTest(this, ref screenPosition, camera));
        }
        private static void DoSendMouseEvents(int skipRTCameras)
        {
            Vector3 mousePosition   = Input.mousePosition;
            int     allCamerasCount = Camera.allCamerasCount;

            if (SendMouseEvents.m_Cameras == null || SendMouseEvents.m_Cameras.Length != allCamerasCount)
            {
                SendMouseEvents.m_Cameras = new Camera[allCamerasCount];
            }
            Camera.GetAllCameras(SendMouseEvents.m_Cameras);
            for (int index = 0; index < SendMouseEvents.m_CurrentHit.Length; ++index)
            {
                SendMouseEvents.m_CurrentHit[index] = new SendMouseEvents.HitInfo();
            }
            if (!SendMouseEvents.s_MouseUsed)
            {
                foreach (Camera camera in SendMouseEvents.m_Cameras)
                {
                    if (!((Object)camera == (Object)null) && (skipRTCameras == 0 || !((Object)camera.targetTexture != (Object)null)) && camera.pixelRect.Contains(mousePosition))
                    {
                        GUILayer component = camera.GetComponent <GUILayer>();
                        if ((bool)((Object)component))
                        {
                            GUIElement guiElement = component.HitTest(mousePosition);
                            if ((bool)((Object)guiElement))
                            {
                                SendMouseEvents.m_CurrentHit[0].target = guiElement.gameObject;
                                SendMouseEvents.m_CurrentHit[0].camera = camera;
                            }
                            else
                            {
                                SendMouseEvents.m_CurrentHit[0].target = (GameObject)null;
                                SendMouseEvents.m_CurrentHit[0].camera = (Camera)null;
                            }
                        }
                        if (camera.eventMask != 0)
                        {
                            Ray        ray         = camera.ScreenPointToRay(mousePosition);
                            float      z           = ray.direction.z;
                            float      distance    = !Mathf.Approximately(0.0f, z) ? Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / z) : float.PositiveInfinity;
                            GameObject gameObject1 = camera.RaycastTry(ray, distance, camera.cullingMask & camera.eventMask);
                            if ((Object)gameObject1 != (Object)null)
                            {
                                SendMouseEvents.m_CurrentHit[1].target = gameObject1;
                                SendMouseEvents.m_CurrentHit[1].camera = camera;
                            }
                            else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                            {
                                SendMouseEvents.m_CurrentHit[1].target = (GameObject)null;
                                SendMouseEvents.m_CurrentHit[1].camera = (Camera)null;
                            }
                            GameObject gameObject2 = camera.RaycastTry2D(ray, distance, camera.cullingMask & camera.eventMask);
                            if ((Object)gameObject2 != (Object)null)
                            {
                                SendMouseEvents.m_CurrentHit[2].target = gameObject2;
                                SendMouseEvents.m_CurrentHit[2].camera = camera;
                            }
                            else if (camera.clearFlags == CameraClearFlags.Skybox || camera.clearFlags == CameraClearFlags.Color)
                            {
                                SendMouseEvents.m_CurrentHit[2].target = (GameObject)null;
                                SendMouseEvents.m_CurrentHit[2].camera = (Camera)null;
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < SendMouseEvents.m_CurrentHit.Length; ++i)
            {
                SendMouseEvents.SendEvents(i, SendMouseEvents.m_CurrentHit[i]);
            }
            SendMouseEvents.s_MouseUsed = false;
        }
Example #26
0
 public bool HitTest(Vector3 screenPosition, [DefaultValue("null")] Camera camera)
 {
     return(GUIElement.INTERNAL_CALL_HitTest(this, ref screenPosition, camera));
 }
Example #27
0
 public sGUIElement(GUIElement g)
 {
 }