NGUI等比缩放

    /// <summary>
/// UI 等比缩放
/// </summary>
static private void AdaptiveUI()
{
int ManualWidth = ;
int ManualHeight = ;
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;
}
}

NGUI等比缩放

上一篇:【React Native 实战】商品分类


下一篇:解密电子书之一:电子墨水(eink)