【背景适配】优化宽屏下背景显示错误
parent
2d8d632436
commit
d89d4427c1
|
@ -24,7 +24,7 @@ public class UIBgAdaptive : MonoBehaviour
|
||||||
//float curHeight = 1920 * (Screen.height / Screen.width) / (1920 / 1080);
|
//float curHeight = 1920 * (Screen.height / Screen.width) / (1920 / 1080);
|
||||||
//float curWidth = (1080f / 1920f) * curHeight;
|
//float curWidth = (1080f / 1920f) * curHeight;
|
||||||
//bgList[i].GetComponent<RectTransform>().sizeDelta = new Vector2(curWidth, curHeight);
|
//bgList[i].GetComponent<RectTransform>().sizeDelta = new Vector2(curWidth, curHeight);
|
||||||
if (Screen.height >= 1920)
|
if (Screen.height/Screen.width >= 1920/1080f)
|
||||||
{
|
{
|
||||||
//--计算比例因子 比例因子 = 10 ^ ((lg(屏幕宽 / 开发宽) + lg(屏幕高 / 开发高) / 2))
|
//--计算比例因子 比例因子 = 10 ^ ((lg(屏幕宽 / 开发宽) + lg(屏幕高 / 开发高) / 2))
|
||||||
//local log = math.log(Screen.width / 1080, 10) + math.log(Screen.height / 1920, 10)
|
//local log = math.log(Screen.width / 1080, 10) + math.log(Screen.height / 1920, 10)
|
||||||
|
|
Loading…
Reference in New Issue