您的位置:首页 > 产品设计 > UI/UE

NGUI自适应屏幕

2014-08-14 12:17 211 查看
主要是改变Manual Height

制作UI时按640*960标准

一般在Awake()中调用

static private void AdaptiveUI()
{
int ManualWidth = 960;
int ManualHeight = 640;
UIRoot uiRoot = GameObject.FindObjectOfType<UIRoot>();
if (uiRoot != null)
{
if (System.Convert.ToSingle(Screen.height) / Screen.width > System.Convert.ToSingle(ManualHeight) / ManualWidth)
uiRoot.manualHeight = Mathf.RoundToInt(System.Convert.ToSingle(ManualWidth) / Screen.width * Screen.height);
else
uiRoot.manualHeight = ManualHeight;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: