private bool CanDrawTab(eSettingsType _tab) { Features _supportedFeatures = ((NPSettings)target).GetApplicationSettings().SupportedFeatures; switch (_tab) { case eSettingsType.BILLING_SETTINGS: return(_supportedFeatures.UsesBilling); case eSettingsType.CLOUD_SERVICES_SETTINGS: return(_supportedFeatures.UsesCloudServices); case eSettingsType.GAME_SERVICES_SETTINGS: return(_supportedFeatures.UsesGameServices); case eSettingsType.MEDIA_LIBRARY_SETTINGS: return(_supportedFeatures.UsesMediaLibrary); case eSettingsType.NETWORK_CONNECTVITY_SETTINGS: return(_supportedFeatures.UsesNetworkConnectivity); case eSettingsType.NOTIFICATION_SERVICE_SETTINGS: return(_supportedFeatures.UsesNotificationService); case eSettingsType.SOCIAL_NETWORK_SETTINGS: return(_supportedFeatures.UsesTwitter); default: break; } return(true); }
private void DrawMainMenu(eSettingsType[] _options) { // GUILayout.Label("Native Plugins Settings", // style: CreateBoldLabel(_size: kTitleFontSize, _alignement: TextAnchor.MiddleCenter)); // get menu button content GUIContent[] _contents = Array.ConvertAll(_options, (_option) => { SerializedProperty _property = m_settingsCollection[_option]; return(new GUIContent(text: _property.displayName, tooltip: _property.tooltip, image: null)); }); // display grid buttons GUILayout.BeginVertical(); GUILayout.Space(2f); int _selectedIndex = GUILayout.SelectionGrid(selected: -1, contents: _contents, xCount: kGridRowCount, style: "LargeButton", options: GUILayout.MinHeight(220f)); if (_selectedIndex != -1) { m_activeType = _options[_selectedIndex]; } GUILayout.EndVertical(); }
protected override void OnEnable() { base.OnEnable(); // Initialise m_settingsCollection.Add(eSettingsType.APPLICATION_SETTINGS, serializedObject.FindProperty("m_applicationSettings")); m_settingsCollection.Add(eSettingsType.BILLING_SETTINGS, serializedObject.FindProperty("m_billingSettings")); m_settingsCollection.Add(eSettingsType.CLOUD_SERVICES_SETTINGS, serializedObject.FindProperty("m_cloudServicesSettings")); m_settingsCollection.Add(eSettingsType.MEDIA_LIBRARY_SETTINGS, serializedObject.FindProperty("m_mediaLibrarySettings")); m_settingsCollection.Add(eSettingsType.GAME_SERVICES_SETTINGS, serializedObject.FindProperty("m_gameServicesSettings")); m_settingsCollection.Add(eSettingsType.NETWORK_CONNECTVITY_SETTINGS, serializedObject.FindProperty("m_networkConnectivitySettings")); m_settingsCollection.Add(eSettingsType.NOTIFICATION_SERVICE_SETTINGS, serializedObject.FindProperty("m_notificationSettings")); m_settingsCollection.Add(eSettingsType.SOCIAL_NETWORK_SETTINGS, serializedObject.FindProperty("m_socialNetworkSettings")); m_settingsCollection.Add(eSettingsType.UTILITY_SETTINGS, serializedObject.FindProperty("m_utilitySettings")); m_settingsCollection.Add(eSettingsType.ADDON_SERVICES_SETTINGS, serializedObject.FindProperty("m_addonServicesSettings")); // Restoring last selection m_activeType = (eSettingsType)EditorPrefs.GetInt(kActiveView, 0); }
private void DrawDetailedView() { SerializedProperty _settingsProperty = m_settingsCollection[m_activeType]; // title section GUILayout.BeginHorizontal(); GUILayout.Space(4f); if (GUILayout.Button("NP Settings", "GUIEditor.BreadcrumbLeft")) { m_activeType = eSettingsType.NONE; } // GUILayout.FlexibleSpace(); // GUILayout.BeginVertical(); GUILayout.Label(_settingsProperty.displayName, "GUIEditor.BreadcrumbMid"); // GUILayout.EndVertical(); // GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.Space(10f); // property detail screen _settingsProperty.isExpanded = true; UnityEditorUtility.ForEach(_settingsProperty, (_childProperty) => { if (_childProperty.hasChildren && _childProperty.propertyType != SerializedPropertyType.String) { GUILayout.Label(_childProperty.displayName, "OL Minus"); UnityEditorUtility.ForEach(_childProperty, (_innerChildProperty) => { EditorGUI.indentLevel++; EditorGUILayout.PropertyField(_innerChildProperty, true); EditorGUI.indentLevel--; }); } else { EditorGUILayout.PropertyField(_childProperty); } }); }