示例#1
0
        private void DisplayPlatformHeader()
        {
            GUIStyle labelStyle = new GUIStyle(GUI.skin.label);

            labelStyle.richText = true;

            GUIStyle dropdownStyle = new GUIStyle(GUI.skin.FindStyle("dropdownButton"));

            dropdownStyle.fixedHeight = 0;

            BuildPlatformLists();

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel("<b>Platforms</b>", dropdownStyle, labelStyle);

            EditorGUI.BeginDisabledGroup(MissingPlatforms.Count == 0);

            bool showPlatforms = EditorGUILayout.DropdownButton(new GUIContent("Add Platform"), FocusType.Passive, dropdownStyle);

            EditorGUI.EndDisabledGroup();

            if (Event.current.type == EventType.Repaint)
            {
                AddPlatformButtonRect = GUILayoutUtility.GetLastRect();
            }

            if (GUILayout.Button(new GUIContent("Add Group")))
            {
                Settings settings = target as Settings;
                settings.AddPlatformGroup("Group");
                MissingPlatforms = null;
            }

            EditorGUILayout.EndHorizontal();

            if (showPlatforms)
            {
                GenericMenu menu = new GenericMenu();

                foreach (Platform platform in MissingPlatforms)
                {
                    menu.AddItem(new GUIContent(platform.DisplayName), false, AddPlatformProperties, platform.Identifier);
                }

                menu.DropDown(AddPlatformButtonRect);
            }
        }