[Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(NGUI2.2.2対å¿ç)
2013/5/4 è¿½è¨ : ã¹ã¯ãªãã㯠[Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(NGUI2.3.0対å¿ç) ãææ°ã§ã。
以å [Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(ãã®2) ã§æ¸ããã¹ã¯ãªããã、NGUI ã®ãã¼ã¸ã§ã³ã¢ããã«ããæ©è½è¿½å ã¨ã®å ¼ãåãã§æ£ããåããªããªã£ã¦ããã®ã§、ãã®æ«å®å¯¾å¿çã§ã。
NGUI 2.2.2 : http://www.tasharen.com/forum/index.php?topic=11.msg9404#msg9404 ã«
ãã®æ¡ä»¶ä¸ã§ä»¥åã®ã¹ã¯ãªãããæ£ããåããªããªã£ã¦ããã®ã§、åãæ¥ããã®æ©è½è¿½å ãå®è³ªç¡è¦ãããããªæ¹åã§ã®å¯¾å¿ãå ãããã®ã以ä¸ã§ã。
NGUI ã®æ©è½è¿½å ãæ´»ãããããã«å¯¾å¿ããã®ããã¹ããã¨ã¯æãã¾ããã、æ¬å®¶ NGUI ã«ã解å度調æ´æ©è½ãå ¥ããã?(>ã²ã¼ã ã¯åå¿è ã«ãããã: NGUI 解å度調æ´æ©è½ã縦(Height)ã«ãã対å¿ãã¦ãªã)ã¨ãããã¨ã§ä¸è¨ã®ã¹ã¯ãªããã¯é ãããä¸è¦ã«ãªãããããã¾ããã®ã§(ããããªã£ã¦ã»ãã)、ã¨ããããã¯ããã§。
2013/5/4 è¿½è¨ : [Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(NGUI2.3.0対å¿ç) ãæ¸ãã¾ãã。
以å [Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(ãã®2) ã§æ¸ããã¹ã¯ãªããã、NGUI ã®ãã¼ã¸ã§ã³ã¢ããã«ããæ©è½è¿½å ã¨ã®å ¼ãåãã§æ£ããåããªããªã£ã¦ããã®ã§、ãã®æ«å®å¯¾å¿çã§ã。
NGUI 2.2.2 : http://www.tasharen.com/forum/index.php?topic=11.msg9404#msg9404 ã«
- NEW: You can now specify a minimum and maximum height on UIRoot.ã¨ããéã、UIRoot ã« minimumHeight 㨠maximumHeight ã追å ããã¾ãã。ã½ã¼ã¹ã®ã³ã¡ã³ããã
If the screen height goes below this value, it will be as if 'automatic' is turned off with the 'manualHeight' set to this value.ã¨ã®ãã¨ã§、ç»é¢ãµã¤ãºã minimunHeight ãä¸åã£ãå ´åã«ç»é¢ãµã¤ãºã«åããã¦ç¸®å°ããã®ã諦ãã¦ã¯ã¿åºãããã、maximumHeight ãä¸åã£ãå ´åã«æ¡å¤§ããã®ãããã¦ä½ç½ãä½ãããã®æ©è½ã®ããã§ã。
ãã®æ¡ä»¶ä¸ã§ä»¥åã®ã¹ã¯ãªãããæ£ããåããªããªã£ã¦ããã®ã§、åãæ¥ããã®æ©è½è¿½å ãå®è³ªç¡è¦ãããããªæ¹åã§ã®å¯¾å¿ãå ãããã®ã以ä¸ã§ã。
using UnityEngine; using System.Collections; [ExecuteInEditMode] public class NGUIUtilScalableUIRoot : MonoBehaviour { public int manualWidth = 1280; public int manualHeight = 720; UIRoot uiRoot_; void Awake() { uiRoot_ = GetComponent<UIRoot>(); } void Update () { if(!uiRoot_ || manualWidth <= 0 || manualHeight <= 0){ return; } int h = manualHeight; float r = (float)(Screen.height * manualWidth) / (Screen.width * manualHeight); // (Screen.height / manualHeight) / (Screen.width / manualWidth) if(r > 1){ h = (int)(h * r); } // to pretend target height is more high, because screen width is too smaller to show all UI if(uiRoot_.automatic){ uiRoot_.automatic = false; } if(uiRoot_.manualHeight != h){ uiRoot_.manualHeight = h; } if(uiRoot_.minimumHeight > 1){ uiRoot_.minimumHeight = 1; } if(uiRoot_.maximumHeight < System.Int32.MaxValue){ uiRoot_.maximumHeight = System.Int32.MaxValue; } } }
NGUI ã®æ©è½è¿½å ãæ´»ãããããã«å¯¾å¿ããã®ããã¹ããã¨ã¯æãã¾ããã、æ¬å®¶ NGUI ã«ã解å度調æ´æ©è½ãå ¥ããã?(>ã²ã¼ã ã¯åå¿è ã«ãããã: NGUI 解å度調æ´æ©è½ã縦(Height)ã«ãã対å¿ãã¦ãªã)ã¨ãããã¨ã§ä¸è¨ã®ã¹ã¯ãªããã¯é ãããä¸è¦ã«ãªãããããã¾ããã®ã§(ããããªã£ã¦ã»ãã)、ã¨ããããã¯ããã§。
2013/5/4 è¿½è¨ : [Unity]NGUIã§ç»é¢ãµã¤ãºã«åããã(NGUI2.3.0対å¿ç) ãæ¸ãã¾ãã。
ã³ã¡ã³ã
ã³ã¡ã³ããæ稿