private void ChangeOrientation()
{
UIRoot mRoot = NGUITools.FindInParents<UIRoot>(transform);
int backup = mRoot.manualWidth;
mRoot.manualWidth = mRoot.manualHeight;
mRoot.manualHeight = backup;
UnityEngine.Screen.autorotateToLandscapeLeft = !UnityEngine.Screen.autorotateToLandscapeLeft;
UnityEngine.Screen.autorotateToLandscapeRight = !UnityEngine.Screen.autorotateToLandscapeRight;
UnityEngine.Screen.autorotateToPortrait = !UnityEngine.Screen.autorotateToPortrait;
UnityEngine.Screen.autorotateToPortraitUpsideDown = !UnityEngine.Screen.autorotateToPortraitUpsideDown;
if (UnityEngine.Screen.orientation != ScreenOrientation.Portrait)
{
UnityEngine.Screen.orientation = ScreenOrientation.Portrait;
}
else
{
UnityEngine.Screen.orientation = ScreenOrientation.Landscape;
UnityEngine.Screen.orientation = ScreenOrientation.AutoRotation;
}
}