private void DrawTabViews() { // Draw settings tab view Dictionary <eTabView, SerializedProperty> .Enumerator _enumerator = m_settingsCollection.GetEnumerator(); while (_enumerator.MoveNext()) { eTabView _curTabView = _enumerator.Current.Key; SerializedProperty _curProperty = _enumerator.Current.Value; if (DrawSerializedProperty(_curProperty)) { // Minimize old selection if (m_activeView != eTabView.NONE) { SerializedProperty _curActiveProperty = m_settingsCollection[m_activeView]; if (_curActiveProperty != null) { _curActiveProperty.isExpanded = false; } } // Update current active view if (_curProperty.isExpanded) { m_activeView = _curTabView; } else { m_activeView = eTabView.NONE; } } } }
public override void OnInspectorGUI() { // Update object serializedObject.Update(); // Make all EditorGUI look like regular controls EditorGUIUtility.LookLikeControls(); // Drawing tabs EditorGUILayout.BeginVertical(UnityEditorUtility.kOuterContainerStyle); { base.OnInspectorGUI(); Dictionary<eTabView, SerializedProperty>.Enumerator _enumerator = m_settingsProperties.GetEnumerator(); while (_enumerator.MoveNext()) { eTabView _curTab = _enumerator.Current.Key; SerializedProperty _property = _enumerator.Current.Value; if (_property == null) continue; bool _initallyExpanded = (_curTab == m_activeView); // Set expanded status _property.isExpanded = _initallyExpanded; // Draw property if (_property != null) UnityEditorUtility.DrawPropertyField(_property); // Check expanded status if (!_initallyExpanded) { if (_property.isExpanded) m_activeView = _curTab; } else { if (!_property.isExpanded) m_activeView = eTabView.NONE; } } } EditorGUILayout.EndVertical(); // Apply modifications if (GUI.changed) serializedObject.ApplyModifiedProperties(); }
protected override void OnEnable() { base.OnEnable(); // Initialise m_settingsCollection.Add(eTabView.APPLICATION_SETTINGS, serializedObject.FindProperty("m_applicationSettings")); m_settingsCollection.Add(eTabView.BILLING_SETTINGS, serializedObject.FindProperty("m_billingSettings")); m_settingsCollection.Add(eTabView.MEDIA_LIBRARY_SETTINGS, serializedObject.FindProperty("m_mediaLibrarySettings")); m_settingsCollection.Add(eTabView.GAME_SERVICES_SETTINGS, serializedObject.FindProperty("m_gameServicesSettings")); m_settingsCollection.Add(eTabView.NETWORK_CONNECTVITY_SETTINGS, serializedObject.FindProperty("m_networkConnectivitySettings")); m_settingsCollection.Add(eTabView.NOTIFICATION_SERVICE_SETTINGS, serializedObject.FindProperty("m_notificationSettings")); m_settingsCollection.Add(eTabView.SOCIAL_NETWORK_SETTINGS, serializedObject.FindProperty("m_socialNetworkSettings")); m_settingsCollection.Add(eTabView.UTILITY_SETTINGS, serializedObject.FindProperty("m_utilitySettings")); // Restoring last selection m_activeView = (eTabView)EditorPrefs.GetInt(kActiveView, 0); }
protected override void OnEnable () { base.OnEnable(); // Add settings serializable properties m_settingsProperties.Add(eTabView.APPLICATION, serializedObject.FindProperty("m_applicationSettings")); m_settingsProperties.Add(eTabView.BILLING, serializedObject.FindProperty("m_billingSettings")); m_settingsProperties.Add(eTabView.CONNECTVITY, serializedObject.FindProperty("m_networkConnectivitySettings")); m_settingsProperties.Add(eTabView.MEDIA_LIBRARY, serializedObject.FindProperty("m_mediaLibrarySettings")); m_settingsProperties.Add(eTabView.NOTIFICATION, serializedObject.FindProperty("m_notificationSettings")); m_settingsProperties.Add(eTabView.SOCIAL_NETWORK, serializedObject.FindProperty("m_socialNetworkSettings")); m_settingsProperties.Add(eTabView.UTILITY, serializedObject.FindProperty("m_utilitySettings")); m_settingsProperties.Add(eTabView.GAME_SERVICES, serializedObject.FindProperty("m_gameServicesSettings")); // Restoring last selection m_activeView = (eTabView)EditorPrefs.GetInt(kActiveView, 0); }
protected override void OnEnable() { base.OnEnable(); // Toolbar items System.Array _viewNames = System.Enum.GetNames(typeof(eTabView)); m_toolbarItems = new string[_viewNames.Length]; for (int _iter = 0; _iter < _viewNames.Length; _iter++) { string _viewName = _viewNames.GetValue(_iter).ToString().Replace('_', ' ').ToLower(); string _displayName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_viewName); m_toolbarItems[_iter] = _displayName; } // Restoring last selection m_activeView = (eTabView)EditorPrefs.GetInt(kActiveView, 0); }
protected override void OnEnable () { base.OnEnable(); // Toolbar items System.Array _viewNames = System.Enum.GetNames(typeof(eTabView)); m_toolbarItems = new string[_viewNames.Length]; for (int _iter = 0; _iter < _viewNames.Length; _iter++) { string _viewName = _viewNames.GetValue(_iter).ToString().Replace('_', ' ').ToLower(); string _displayName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(_viewName); m_toolbarItems[_iter] = _displayName; } // Restoring last selection m_activeView = (eTabView)EditorPrefs.GetInt(kActiveView, 0); }
public override void OnInspectorGUI() { // Update object serializedObject.Update(); // Make all EditorGUI look like regular controls EditorGUIUtility.LookLikeControls(); // Drawing tabs EditorGUILayout.BeginVertical(UnityEditorUtility.kOuterContainerStyle); { base.OnInspectorGUI(); Dictionary <eTabView, SerializedProperty> .Enumerator _enumerator = m_settingsProperties.GetEnumerator(); while (_enumerator.MoveNext()) { eTabView _curTab = _enumerator.Current.Key; SerializedProperty _property = _enumerator.Current.Value; if (_property == null) { continue; } bool _initallyExpanded = (_curTab == m_activeView); // Set expanded status _property.isExpanded = _initallyExpanded; // Draw property if (_property != null) { UnityEditorUtility.DrawPropertyField(_property); } // Check expanded status if (!_initallyExpanded) { if (_property.isExpanded) { m_activeView = _curTab; } } else { if (!_property.isExpanded) { m_activeView = eTabView.NONE; } } } } EditorGUILayout.EndVertical(); // Apply modifications if (GUI.changed) { serializedObject.ApplyModifiedProperties(); } }
private void DrawTabViews () { // Draw settings tab view Dictionary<eTabView, SerializedProperty>.Enumerator _enumerator = m_settingsCollection.GetEnumerator(); while (_enumerator.MoveNext()) { eTabView _curTabView = _enumerator.Current.Key; SerializedProperty _curProperty = _enumerator.Current.Value; if (DrawSerializedProperty(_curProperty)) { // Minimize old selection if (m_activeView != eTabView.NONE) { SerializedProperty _curActiveProperty = m_settingsCollection[m_activeView]; if (_curActiveProperty != null) _curActiveProperty.isExpanded = false; } // Update current active view if (_curProperty.isExpanded) m_activeView = _curTabView; else m_activeView = eTabView.NONE; } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // Update object serializedObject.Update(); // Settings toolbar GUIStyle _toolbarStyle = new GUIStyle(kToolBarButtonStyle); _toolbarStyle.fontSize = 12; // Make all EditorGUI look like regular controls EditorGUIUtility.LookLikeControls(); m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition); { eTabView _selectedView = (eTabView)GUILayout.Toolbar((int)m_activeView, m_toolbarItems, _toolbarStyle); if (_selectedView != m_activeView) { m_activeView = _selectedView; // Remove current focus GUIUtility.keyboardControl = 0; // Reset scrollview position m_scrollPosition = Vector2.zero; } // Drawing tabs EditorGUILayout.BeginVertical(UnityEditorUtility.kOuterContainerStyle); { // Draw active view switch (m_activeView) { case eTabView.APPLICATION: ShowApplicationSettings(); break; case eTabView.BILLING: ShowBillingSettings(); break; case eTabView.CONNECTVITY: ShowNetworkConnectivitySettings(); break; case eTabView.NOTIFICATION: ShowNotificationSettings(); break; case eTabView.SOCIAL_NETWORK: ShowSocialNetworkSettings(); break; case eTabView.MEDIA_LIBRARY: ShowMediaLibrarySettings(); break; case eTabView.UTILITY: ShowUtilitySettings(); break; case eTabView.GAME_SERVICES: ShowGameServicesSettings(); break; default: throw new Exception(string.Format("[NPSettings] {0} settings view is not implemented.", m_activeView)); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndScrollView(); // Apply modifications if (GUI.changed) { serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); // Update object serializedObject.Update(); // Settings toolbar GUIStyle _toolbarStyle = new GUIStyle(kToolBarButtonStyle); _toolbarStyle.fontSize = 12; // Make all EditorGUI look like regular controls EditorGUIUtility.LookLikeControls(); m_scrollPosition = EditorGUILayout.BeginScrollView(m_scrollPosition); { eTabView _selectedView = (eTabView)GUILayout.Toolbar((int)m_activeView, m_toolbarItems, _toolbarStyle); if (_selectedView != m_activeView) { m_activeView = _selectedView; // Remove current focus GUIUtility.keyboardControl = 0; // Reset scrollview position m_scrollPosition = Vector2.zero; } // Drawing tabs EditorGUILayout.BeginVertical(UnityEditorUtility.kOuterContainerStyle); { // Draw active view switch (m_activeView) { case eTabView.APPLICATION: ShowApplicationSettings(); break; case eTabView.BILLING: ShowBillingSettings(); break; case eTabView.CONNECTVITY: ShowNetworkConnectivitySettings(); break; case eTabView.NOTIFICATION: ShowNotificationSettings(); break; case eTabView.SOCIAL_NETWORK: ShowSocialNetworkSettings(); break; case eTabView.MEDIA_LIBRARY: ShowMediaLibrarySettings(); break; case eTabView.UTILITY: ShowUtilitySettings(); break; case eTabView.GAME_SERVICES: ShowGameServiesSettings(); break; default: throw new Exception(string.Format("[NPSettings] {0} settings view is not implemented.", m_activeView)); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndScrollView(); // Apply modifications if (GUI.changed) serializedObject.ApplyModifiedProperties(); }