private Vector2Int GetTargetSize(RectSource rectSource) { switch (rectSource) { case RectSource.Screen: return(new Vector2Int(Screen.width, Screen.height)); case RectSource.Delegate: if (GetNewSizeInt != null) { return(GetNewSizeInt.Invoke()); } if (GetNewSize != null) { return(RoundToInt(GetNewSize.Invoke())); } return(Vector2Int.one); default: throw new ArgumentOutOfRangeException(); } }
private static void OnGUI() { if (OSXEditor) { EditorGUILayout.HelpBox("Due to OS X system limitations, the plugin will only be fullscreen if the main window is maximized and the dock is set to auto-hide, and it'll still show a thin bar at the bottom.", MessageType.Warning); } else if (LinuxEditor) { EditorGUILayout.HelpBox("This plugin was not tested on Linux and its behaviour is unknown.", MessageType.Warning); } EditorGUILayout.Separator(); scroll.Value = EditorGUILayout.BeginScrollView(scroll); GameViewInputFix.DoGUI(); EditorGUILayout.Separator(); ToolbarVisible.DoGUI(); FullscreenOnPlayEnabled.DoGUI(); EditorGUI.indentLevel++; using (new EditorGUI.DisabledGroupScope(!FullscreenOnPlayEnabled)) FullscreenOnPlayGiveWay.DoGUI(); EditorGUI.indentLevel--; EditorGUILayout.Separator(); MutipleWindowMode.DoGUI(); if (WindowsEditor || LinuxEditor || !IsRectModeSupported(RectSource)) { RectSource.DoGUI(); } if (!IsRectModeSupported(RectSource)) { EditorGUILayout.HelpBox("The selected Rect Source mode is not supported on this platform", MessageType.Warning); } switch (RectSource.Value) { case RectSourceMode.CustomRect: EditorGUI.indentLevel++; CustomRect.DoGUI(); var customRect = CustomRect.Value; if (customRect.width < 300f) { customRect.width = 300f; } if (customRect.height < 300f) { customRect.height = 300f; } CustomRect.Value = customRect; EditorGUI.indentLevel--; break; } EditorGUILayout.Separator(); Shortcut.DoShortcutsGUI(); EditorGUILayout.Separator(); EditorGUILayout.HelpBox("Each item has a tooltip explaining its behaviour", MessageType.Info); EditorGUILayout.EndScrollView(); using (new EditorGUILayout.HorizontalScope()) if (GUILayout.Button(resetSettingsContent, GUILayout.Width(120f))) { DeleteSavedValues(); } EditorGUILayout.Separator(); }