UGUI对话框自适应
来源:互联网 发布:守望先锋先锋大神数据 编辑:程序博客网 时间:2024/05/22 02:11
using UnityEngine;using System.Collections;public class WinAdaptiveComponent : MonoBehaviour { private float mReferenceWidth = 1334f; private float mReferenceHeight = 750f; /// <summary> /// Canvas Scaler Match Width Or Height /// </summary> public bool mIsAdaptiveWidth = true; private RectTransform mRect;// Use this for initializationvoid Start () { mRect = GetComponent<RectTransform>(); mReferenceWidth = mRect.sizeDelta.x; mReferenceHeight = mRect.sizeDelta.y; Adaptive();} void Adaptive() { float pex = 1.0f; if (mIsAdaptiveWidth) { float tmpHeight = Screen.height * (mReferenceWidth / Screen.width); if (tmpHeight < mReferenceHeight) { pex = tmpHeight / mReferenceHeight; } } else { float tmpWidth = Screen.width * (mReferenceHeight / Screen.height); if (tmpWidth < mReferenceWidth) { pex = tmpWidth / mReferenceWidth; } } mRect.localScale = new Vector3(mRect.localScale.x * pex, mRect.localScale.y * pex, 1); }}
0 0
- UGUI对话框自适应
- Unity uGUI设置自适应
- [UnityUI]UGUI自适应
- unity ugui自适应
- UGUI自适应分辨率
- UGUI自适应屏幕
- UGUI自适应笔记
- UGUI屏幕自适应
- Unity UGUI 自适应
- 【UGUI】UGUI 文字背景根据文字大小自适应
- unity3d 4.6 UGUI自适应屏幕
- UGUI 字体背景尺寸自适应
- 控件自适应对话框大小
- 对话框自适应大小ReSize
- MFC实现对话框自适应
- unity5.4 UGUI 手机屏幕自适应分辨率
- unity5x+UGUI屏幕自适应(多分配率适配)
- Unity3D 实例化UGUI自适应的预设
- 系统默认安装路径修改方法
- FanChat学习笔记(一)——MVP模式的应用
- Redis Sentinel机制与用法(一)
- Flask学习总结笔记(6) -- Flask-Moment本地化日期和时间
- SpringMVC上传、解析Excel
- UGUI对话框自适应
- 控制台在指定位置画矩形,写字符串,画直线
- java transient关键字
- 进程间通信方式有哪些?以及在什么情况下用什么通信方式?以及各自优缺点
- Android设计模式之策略模式
- C语言大总结
- TutorialsPoint NumPy 教程
- ubuntu中gcc、g++版本切换
- apt-get 安装失败的一个案例