コード例 #1
0
        public override void OnInspectorGUI()
        {
            // Update
            serializedObject.Update();

            // Make all EditorGUI look like regular controls
            EditorGUIUtility.LookLikeControls();

            // Draw properties
            EditorGUILayout.BeginVertical(UnityEditorUtility.kOuterContainerStyle);
            {
                if (GUILayout.Button("Push Remote Notification"))
                {
                    EditorApplication.ExecuteMenuItem(Menu.kPushNotificationServiceMenuItem);
                }

                // Draw all serializable properties
                foreach (SerializedProperty _property in m_serializableProperties)
                {
                    UnityEditorUtility.DrawPropertyField(_property);
                }

                // Local notifications
                LayoutLocalNotifications();

                // Remote notifications
                LayoutRemoteNotifications();
            }
            EditorGUILayout.EndVertical();

            // Apply modified values
            if (GUI.changed)
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
コード例 #2
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();
            }
        }