Ejemplo n.º 1
0
        public static void ChangeGameViewSize(GameViewSizeGroupType groupType, GameViewSize gameViewSize)
        {
            _gameViewSize = gameViewSize;
//            EditorWindow gameView = EditorWindow.GetWindow(Types.gameView);
            EditorWindow          gameView             = EditorWindow.GetWindow(typeof(EditorWindow).Assembly.GetType("UnityEditor.GameView"));
            PropertyInfo          currentSizeGroupType = Types.gameView.GetProperty("currentSizeGroupType", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Static);
            GameViewSizeGroupType currentType          = (GameViewSizeGroupType)currentSizeGroupType.GetValue(gameView, null);

            if (groupType != currentType)
            {
                if (currentType == GameViewSizeGroupType.HMD)
                {
                    Debug.LogError("Please unplug HMD");
                }
                else
                {
                    Debug.LogError(string.Format("GameViewSizeGroupType is {0}. but Current GameViewSizeGroupType is {1}.", groupType, currentType));
                }
                return;
            }
            object group              = GetGroup(groupType, instance);
            int    totalCount         = GetTotalCount(group);
            int    gameViewSizeLength = GetCustomCount(group);
            int    index              = -1;

            for (int i = totalCount - gameViewSizeLength; i < totalCount; i++)
            {
                object other_gameViewSize = GetGameViewSize(group, i);
                if (GameViewSize_Equals(_gameViewSize, other_gameViewSize))
                {
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                PropertyInfo selectedSizeIndex = Types.gameView.GetProperty("selectedSizeIndex", BindingFlags.Instance | BindingFlags.NonPublic);
                selectedSizeIndex.SetValue(gameView, index, null);
            }
        }
Ejemplo n.º 2
0
 public static bool RemoveCustomSize(GameViewSizeGroupType groupType, GameViewSize gameViewSize)
 {
     _gameViewSize = gameViewSize;
     return(Remove(GetGroup(groupType, instance)));
 }
Ejemplo n.º 3
0
 public static bool Contains(GameViewSizeGroupType groupType, GameViewSize gameViewSize)
 {
     _gameViewSize = gameViewSize;
     return(Contains(GetGroup(groupType, instance)));
 }