监听屏幕大小改变

作者:追风剑情 发布于:2016-11-10 21:02 分类:NGUI

以下为NGUI源码

UICamera.cs
void LateUpdate ()
{
#if UNITY_EDITOR
		if (!Application.isPlaying || !handlesEvents) return;
#else
		if (!handlesEvents) return;
#endif
		int w = Screen.width;
		int h = Screen.height;

		if (w != mWidth || h != mHeight)
		{
			mWidth = w;
			mHeight = h;

			UIRoot.Broadcast("UpdateAnchors");

			if (onScreenResize != null)
				onScreenResize();
		}
}

 

标签: NGUI

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号