void Start() { if (ViewManager.myInstance != null) { m_GameScreenWidth = ViewManager.myInstance.m_GameScreenWidth; m_GameScreenHeight = ViewManager.myInstance.m_GameScreenHeight; viewrotation = ViewManager.myInstance.ViewRateMode; } GetXRate(); SetViewRate(); }
void Awake() { if (ViewManager.myInstance != null) { m_GameScreenWidth = ViewManager.myInstance.m_GameScreenWidth; m_GameScreenHeight = ViewManager.myInstance.m_GameScreenHeight; viewrotation = ViewManager.myInstance.ViewRateMode; } PhoneRealWidthSize = Screen.width; PhoneRealHeightSize = Screen.height; }
void Awake() { #if AUTO_VIEWROTATION if (Screen.orientation == ScreenOrientation.Portrait) { ViewRateMode = VIEWROTATION.PORTRAIT; } else { ViewRateMode = VIEWROTATION.LANDSCAPE; } #endif if (myInstance == null) { myInstance = this; } if (this.transform.parent == null) { DontDestroyOnLoad(this); } }
// 최대 공략수와 이것 저것을 이용하여 가로의 비율의 길이를 구하는 방법. float RateScale(int sw, int sh, float GameWidthRate, float GameHeightRate) { if (viewrotation == VIEWROTATION.NONE) { if (sw >= sh) { viewrotation = VIEWROTATION.LANDSCAPE; } else { viewrotation = VIEWROTATION.PORTRAIT; } } int nLcm = GetLCM(sw, sh); float fW_Rate = sw / nLcm; float fH_Rate = sh / nLcm; float fRateScale = (fW_Rate / GameWidthRate * GameHeightRate / fH_Rate); float fWidht = (float)m_GameScreenWidth * fRateScale; float fGameScreen = (float)m_GameScreenWidth; if (fGameScreen < fWidht) { float temp; temp = fGameScreen; fGameScreen = fWidht; fWidht = temp; } float rateX = fWidht / fGameScreen; return(rateX); }