首页 > 其他 > 详细

NGUI适配问题

时间:2016-05-27 15:04:07      阅读:200      评论:0      收藏:0      [点我收藏+]
适配问题:

ui原有的适配也只是绑了上下左右的锚点

更该ngui的设置,只能完成按高等比缩放

那么只能自己动手更改了,ngui控制缩放的功能在UIroot下的activeHeight属性

在UIRoot下做如下修改
//设置是的宽高
   public const int ManualWidth = 1920;
   public const int ManualHeight = 1080;
 
  public int activeHeight
   {
       get
       {
           AdaptiveUI();
           //不需要缩放的范围
           if (manualHeight < 950 || manualHeight > 1100)
           {
               return manualHeight;
           }
 
           //原先的正常逻辑
       }
   }
 
   private void AdaptiveUI()
   {
       if (System.Convert.ToSingle(Screen.height) / Screen.width > System.Convert.ToSingle(ManualHeight) / ManualWidth)
           manualHeight = Mathf.CeilToInt(System.Convert.ToSingle(ManualWidth) / Screen.width * Screen.height);
       else
           manualHeight = ManualHeight;
   }


本文出自 “Unity_3D技术探讨” 博客,谢绝转载!

NGUI适配问题

原文:http://myselfdream.blog.51cto.com/9944020/1783707

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!