ngui NGUI panel使用soft clip时,屏幕缩放问题
来源:互联网 发布:网络连接线 编辑:程序博客网 时间:2024/06/05 23:55
using UnityEngine;
using System.Collections;
public class SubPanelPosition : MonoBehaviour {
public ScreenDirection screenDirection;
//horizontal表示水平滑动;vertical表示垂直滑动。
public enum ScreenDirection
{
horizontal,
vertical
}
public float size;
private Transform parent;
private Transform child;
private float ScaleSize;
private float rateX;
private float rateY;
UIPanel PanelScript;
void Start()
{
Invoke("SetPanel",0.5f);
}
void SetPanel()
{
parent = transform.parent;
child = transform.GetChild(0);
PanelScript = transform.GetComponent<UIPanel>();
transform.parent = null;
child.parent = null;
if(screenDirection == ScreenDirection.vertical)
{
rateX = Screen.width/size;
rateY = 1;
ScaleSize = transform.localScale.y;
}
else if(screenDirection == ScreenDirection.horizontal)
{
rateX = 1;
rateY = Screen.height/size;
ScaleSize = transform.localScale.x;
}
transform.localScale = new Vector4(ScaleSize,ScaleSize,ScaleSize,ScaleSize);
transform.parent = parent;
child.parent = transform;
PanelScript.clipRange = new Vector4(PanelScript.clipRange.x,PanelScript.clipRange.y,PanelScript.clipRange.z * rateX,PanelScript.clipRange.w * rateY);
}
}
using System.Collections;
public class SubPanelPosition : MonoBehaviour {
public ScreenDirection screenDirection;
//horizontal表示水平滑动;vertical表示垂直滑动。
public enum ScreenDirection
{
horizontal,
vertical
}
public float size;
private Transform parent;
private Transform child;
private float ScaleSize;
private float rateX;
private float rateY;
UIPanel PanelScript;
void Start()
{
Invoke("SetPanel",0.5f);
}
void SetPanel()
{
parent = transform.parent;
child = transform.GetChild(0);
PanelScript = transform.GetComponent<UIPanel>();
transform.parent = null;
child.parent = null;
if(screenDirection == ScreenDirection.vertical)
{
rateX = Screen.width/size;
rateY = 1;
ScaleSize = transform.localScale.y;
}
else if(screenDirection == ScreenDirection.horizontal)
{
rateX = 1;
rateY = Screen.height/size;
ScaleSize = transform.localScale.x;
}
transform.localScale = new Vector4(ScaleSize,ScaleSize,ScaleSize,ScaleSize);
transform.parent = parent;
child.parent = transform;
PanelScript.clipRange = new Vector4(PanelScript.clipRange.x,PanelScript.clipRange.y,PanelScript.clipRange.z * rateX,PanelScript.clipRange.w * rateY);
}
}
0 0
- ngui NGUI panel使用soft clip时,屏幕缩放问题
- NGUI panel使用soft clip时,屏幕缩放问题
- 解决NGUI panel使用soft clip时 屏幕缩放问题
- NGUI 在Panel使用soft clip时,滚动显示异常问题
- NGUI Panel Soft Clip原理分析
- 小聊聊NGUI中Panel的Clip功能(之一)
- unity 使用Ngui 屏幕适配问题
- unity 使用Ngui 屏幕适配问题
- NGUI UIStretch自适应时 ScrollView使用panel滑动时出现问题的解决方案
- 小聊聊NGUI中Panel的Clip功能(之二)
- Unity3D开发之NGUI分辨率适配的UIStretch中Clipping的屏幕缩放问题
- NGUI移动平台屏幕自适应问题
- NGUI
- NGUI
- NGUI
- NGUI
- NGUI
- NGUI
- bat批处理注册dll
- 马云致信员工 警惕资本市场的压力
- T-SQL入门攻略之8-數據庫文件
- 求出离新坐标最近的旧坐标
- Java抓取网页数据(原网页+Javascript返回数据)
- ngui NGUI panel使用soft clip时,屏幕缩放问题
- 1
- 蚂蚁爬杆问题的扩展
- Stack and Heap Objects in Objective-C
- UIGestureRecognizer使用
- T-SQL入門攻略之9-创建与查看数据库
- centos6.5 搭建nginx1.6.0 +gridfs +mongodb2.4..10环境
- BMP图像文件格式
- 最长回文子串