コード例 #1
0
        protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args)
        {
            DragAndDropVisualMode visualMode = DragAndDropVisualMode.None;

            var draggedIDs = DragAndDrop.GetGenericData("BuildPlayerSceneTreeViewItem") as List <int>;

            if (draggedIDs != null && draggedIDs.Count > 0)
            {
                visualMode = DragAndDropVisualMode.Move;
                if (args.performDrop)
                {
                    int newIndex = FindDropAtIndex(args);

                    var result   = new List <TreeViewItem>();
                    int toInsert = 0;
                    foreach (var item in rootItem.children)
                    {
                        if (toInsert == newIndex)
                        {
                            foreach (var id in draggedIDs)
                            {
                                result.Add(FindItem(id, rootItem));
                            }
                        }
                        toInsert++;
                        if (!draggedIDs.Contains(item.id))
                        {
                            result.Add(item);
                        }
                    }

                    if (result.Count < rootItem.children.Count) //must be appending.
                    {
                        foreach (var id in draggedIDs)
                        {
                            result.Add(FindItem(id, rootItem));
                        }
                    }
                    rootItem.children          = result;
                    EditorBuildSettings.scenes = GetSceneList();
                    ReloadAndSelect(draggedIDs);
                    Repaint();
                }
            }
            else if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
            {
                visualMode = DragAndDropVisualMode.Copy;
                if (args.performDrop)
                {
                    var scenes      = new List <EditorBuildSettingsScene>(EditorBuildSettings.scenes);
                    var scenesToAdd = new List <EditorBuildSettingsScene>();
                    var selection   = new List <int>();

                    foreach (var path in DragAndDrop.paths)
                    {
                        if (AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(SceneAsset))
                        {
                            var guid = new GUID(AssetDatabase.AssetPathToGUID(path));
                            selection.Add(guid.GetHashCode());

                            bool unique = true;
                            foreach (var scene in scenes)
                            {
                                if (scene.path == path)
                                {
                                    unique = false;
                                    break;
                                }
                            }
                            if (unique)
                            {
                                scenesToAdd.Add(new EditorBuildSettingsScene(path, true));
                            }
                        }
                    }


                    int newIndex = FindDropAtIndex(args);
                    scenes.InsertRange(newIndex, scenesToAdd);
                    EditorBuildSettings.scenes = scenes.ToArray();
                    ReloadAndSelect(selection);
                    Repaint();
                }
            }
            return(visualMode);
        }
コード例 #2
0
 public static GameObjectConversionSettings FromGUID(UnityEditor.GUID guid, BlobAssetStore blobAssetStore) => new GameObjectConversionSettings
 {
     SceneGUID = guid, BlobAssetStore = blobAssetStore
 };
コード例 #3
0
 private extern void HexToGUIDInternal(string hex, ref GUID guid);
コード例 #4
0
 public EditorBuildSettingsScene(string path, bool enabled)
 {
     this.m_path    = path.Replace("\\", "/");
     this.m_enabled = enabled;
     GUID.TryParse(AssetDatabase.AssetPathToGUID(path), out this.m_guid);
 }
コード例 #5
0
 public void SetTransitionTypeOverride(GUID guid, ParameterTransitionType type)
 {
     INTERNAL_CALL_SetTransitionTypeOverride(this, guid, type);
 }
コード例 #6
0
			public ParameterTransitionOverrideContext(AudioMixerController controller, GUID parameter, ParameterTransitionType type)
			{
				this.controller = controller;
				this.parameter = parameter;
				this.type = type;
			}
コード例 #7
0
 public static extern Texture GetPreviewTexture(GUID id);
コード例 #8
0
 private static extern void INTERNAL_CALL_ClearTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid);
コード例 #9
0
 public static extern void PausePreview(GUID id);
コード例 #10
0
 public static extern bool IsPreviewPlaying(GUID id);
コード例 #11
0
 public static extern void PlayPreview(GUID id, bool loop);
コード例 #12
0
 public static extern void StopPreview(GUID id);
コード例 #13
0
 public AudioEffectParameterPath(AudioMixerGroupController group, AudioMixerEffectController effect, GUID parameter) : base(group, parameter)
 {
     this.effect = effect;
 }
コード例 #14
0
 public extern bool ContainsParameterGUID(GUID guid);
コード例 #15
0
 private extern unsafe static bool TrySendMessageInternal(int playerId, GUID messageId, byte *data, int dataSize);
コード例 #16
0
 public bool GetTransitionTypeOverride(GUID guid, out ParameterTransitionType type)
 {
     return INTERNAL_CALL_GetTransitionTypeOverride(this, guid, out type);
 }
コード例 #17
0
 private extern unsafe static void SendMessageInternal(int playerId, GUID messageId, byte *data, int dataSize, GeneralConnectionSendMode sendMode);
コード例 #18
0
 private static extern void INTERNAL_CALL_SetTransitionTypeOverride(AudioMixerSnapshotController self, GUID guid, ParameterTransitionType type);
コード例 #19
0
 public extern static Type GetImporterType(GUID guid);
コード例 #20
0
ファイル: GUID.cs プロジェクト: CarlosHBC/UnityDecompiled
 private extern void HexToGUIDInternal(string hex, ref GUID guid);
コード例 #21
0
 extern public static void SaveAssetIfDirty(GUID guid);
コード例 #22
0
 public AudioGroupParameterPath(AudioMixerGroupController group, GUID parameter)
 {
     this.group = group;
     base.parameter = parameter;
 }
コード例 #23
0
 extern private static string[] GetLabelsInternal(GUID guid);
コード例 #24
0
 private void PlayPreview()
 {
     m_PreviewID = VideoUtil.StartPreview(m_PlayingClip);
     VideoUtil.PlayPreview(m_PreviewID, true);
 }
コード例 #25
0
 public static string[] GetLabels(GUID guid)
 {
     return(GetLabelsInternal(guid));
 }
コード例 #26
0
 public EditorBuildSettingsScene(GUID guid, bool enabled)
 {
     this.m_guid    = guid;
     this.m_enabled = enabled;
     this.m_path    = AssetDatabase.GUIDToAssetPath(guid.ToString());
 }
コード例 #27
0
 extern internal static System.Type GetTypeFromVisibleGUIDAndLocalFileIdentifier(GUID guid, long localId);
コード例 #28
0
 extern internal static Object LoadMainAssetAtGUID(GUID assetGUID);
コード例 #29
0
 private extern static ArtifactInfo[] GetArtifactInfos_Internal(GUID guid);
コード例 #30
0
ファイル: EZGuidGenerator.cs プロジェクト: zjytra/EZUnity
 public void RefreshGuid()
 {
     systemGuid = System.Guid.NewGuid();
     unityGuid  = UnityEditor.GUID.Generate();
 }
コード例 #31
0
        internal static ArtifactInfo[] GetArtifactInfos(GUID guid)
        {
            var artifactInfos = GetArtifactInfos_Internal(guid);

            return(artifactInfos);
        }
コード例 #32
0
 public void ClearTransitionTypeOverride(GUID guid)
 {
     INTERNAL_CALL_ClearTransitionTypeOverride(this, guid);
 }
コード例 #33
0
 internal SpriteRect GetSpriteData(GUID guid)
 {
     return(spriteImportMode == SpriteImportMode.Multiple ? m_SpritesMultiple.FirstOrDefault(x => x.spriteID == guid) : m_SpriteSingle);
 }
コード例 #34
0
 public bool GetValue(GUID guid, out float value)
 {
     return INTERNAL_CALL_GetValue(this, guid, out value);
 }
コード例 #35
0
 extern internal static string GUIDToAssetPath_Internal(GUID guid);
コード例 #36
0
 private static extern bool INTERNAL_CALL_GetValue(AudioMixerSnapshotController self, GUID guid, out float value);
コード例 #37
0
 public static string GUIDToAssetPath(GUID guid)
 {
     return(GUIDToAssetPath_Internal(guid));
 }
コード例 #38
0
 private static extern void INTERNAL_CALL_SetValue(AudioMixerSnapshotController self, GUID guid, float value);
コード例 #39
0
 extern public static Hash128 GetAssetDependencyHash(GUID guid);
コード例 #40
0
 public void SetValue(GUID guid, float value)
 {
     INTERNAL_CALL_SetValue(this, guid, value);
 }
コード例 #41
0
 extern private static bool GetGUIDAndLocalIdentifierInFile(int instanceID, out GUID outGuid, out long outLocalId);
コード例 #42
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                ScenePathAttribute pathAttribute = attribute as ScenePathAttribute;
                Rect propertyRect = position;
                propertyRect.height = EditorGUIUtility.singleLineHeight;

                string[] searchFolders;
                if (pathAttribute.Folders == null ||
                    pathAttribute.Folders.Length == 0)
                {
                    searchFolders = new string[] { Internal.ScenePathSettings.GetDefaultScenePathFolder() };
                }
                else
                {
                    searchFolders = pathAttribute.Folders;
                }

                string[] sceneGUIDs = AssetDatabase.FindAssets($"{pathAttribute.Filter} t:Scene", searchFolders);
                if (sceneGUIDs != null &&
                    sceneGUIDs.Length > 0)
                {
                    string[] scenePaths = sceneGUIDs.Select(ConvertGUIDToFilename).ToArray();

                    int selectedIndex = Mathf.Max(Array.IndexOf(scenePaths, property.stringValue), 0);

                    EditorGUI.BeginChangeCheck();
                    selectedIndex = EditorGUI.Popup(propertyRect,
                                                    label,
                                                    selectedIndex,
                                                    scenePaths.Select(x => new GUIContent(x)).ToArray());
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (selectedIndex >= 0 &&
                            selectedIndex < scenePaths.Length)
                        {
                            property.stringValue = Path.GetFileNameWithoutExtension(scenePaths[selectedIndex]);
                        }
                    }

                    if (IsSceneValid(property.stringValue) == false)
                    {
                        propertyRect.y     += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                        propertyRect.height = EditorGUIUtility.singleLineHeight * c_warningHeightScale;

                        DrawWarningBox(rect: propertyRect,
                                       warningText: "Scene is not included in editor build settings\n",

                                       leftButtonText: "Build Settings",
                                       leftButtonCallback: () =>
                        {
                            EditorApplication.ExecuteMenuItem("File/Build Settings...");
                        },

                                       rightButtonText: "Add it",
                                       rightButtonCallback: () =>
                        {
                            if (selectedIndex >= 0 &&
                                selectedIndex < sceneGUIDs.Length)
                            {
                                EditorBuildSettingsScene scene = new EditorBuildSettingsScene(new UnityEditor.GUID(sceneGUIDs[selectedIndex]), true);

                                var scenesList = new EditorBuildSettingsScene[EditorBuildSettings.scenes.Length + 1];
                                Array.Copy(EditorBuildSettings.scenes, scenesList, scenesList.Length - 1);
                                scenesList[scenesList.Length - 1] = scene;

                                EditorBuildSettings.scenes = scenesList;

                                // force gui repaint
                                EditorUtility.SetDirty(property.serializedObject.targetObject);
                            }
                        });
                    }
                    else if (IsSceneEnabled(property.stringValue) == false)
                    {
                        propertyRect.y     += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
                        propertyRect.height = EditorGUIUtility.singleLineHeight * c_warningHeightScale;

                        DrawWarningBox(rect: propertyRect,
                                       warningText: "Scene is not enabled in editor build settings\n",

                                       leftButtonText: "Build Settings",
                                       leftButtonCallback: () =>
                        {
                            EditorApplication.ExecuteMenuItem("File/Build Settings...");
                        },

                                       rightButtonText: "Enable it",
                                       rightButtonCallback: () =>
                        {
                            if (selectedIndex >= 0 &&
                                selectedIndex < sceneGUIDs.Length)
                            {
                                UnityEditor.GUID sceneGUID = new UnityEditor.GUID(sceneGUIDs[selectedIndex]);
                                var scenesList             = new EditorBuildSettingsScene[EditorBuildSettings.scenes.Length];
                                Array.Copy(EditorBuildSettings.scenes, scenesList, scenesList.Length);

                                foreach (var scene in scenesList)
                                {
                                    if (scene.guid == sceneGUID)
                                    {
                                        scene.enabled = true;
                                        break;
                                    }
                                }

                                EditorBuildSettings.scenes = scenesList;

                                // force gui repaint
                                EditorUtility.SetDirty(property.serializedObject.targetObject);
                            }
                        });
                    }
                }
            }
            else
            {
                EditorGUI.PropertyField(position, property, label);
            }
        }
コード例 #43
0
        public override bool Equals(object obj)
        {
            GUID guid = (GUID)obj;

            return(guid == this);
        }
コード例 #44
0
			public ParameterTransitionOverrideRemoveContext(AudioMixerController controller, GUID parameter)
			{
				this.controller = controller;
				this.parameter = parameter;
			}
コード例 #45
0
 public ParameterTransitionOverrideRemoveContext(AudioMixerController controller, GUID parameter)
 {
     this.controller = controller;
     this.parameter  = parameter;
 }