screen.width 按像素计算,和unity 的窗口有关
root.activeheight NGUI真实大小
static public float calWinScale(int winW, int winH, bool isFullScreen, float screenW, float screenH)
{
float mobileW = screenW - (isFullScreen ? 0 : widthGap);
float mobileH = screenH - (isFullScreen ? 0 : heightGap);
float _num = mobileH / winH;
float acturyW = _num * winW;
float acturyH = mobileH;
if (acturyW > mobileW)
{
float _num2 = mobileW / acturyW;
acturyW = mobileW;
acturyH = acturyH * _num2;
}
float scY;
scY = acturyH / winH;
return scY;
}