Пример #1
0
        void SimpleMerge(ResolveMethod resolveMethod)
        {
            AssetList selAssets = resolveList.SelectedAssets;

            Provider.Resolve(selAssets, resolveMethod).Wait();

            DoOpen(assetList);

            if (assetList.Count == 0)
            {
                Close();
            }
        }
Пример #2
0
 private static extern Task Internal_Resolve(Asset[] assets, ResolveMethod resolveMethod);
 public Pair(PropertyInfo propertyInfo, int resourceId)
 {
     _resourceId = resourceId;
     _methodInfo = ResolveMethod.MakeGenericMethod(propertyInfo.PropertyType);
     _setValue   = propertyInfo.SetValue;
 }
Пример #4
0
 static public Task Resolve(AssetList assets, ResolveMethod resolveMethod)
 {
     return(Internal_Resolve(assets.ToArray(), resolveMethod));
 }
 public Pair(FieldInfo fieldInfo, int resourceId)
 {
     _resourceId = resourceId;
     _methodInfo = ResolveMethod.MakeGenericMethod(fieldInfo.FieldType);
     _setValue   = fieldInfo.SetValue;
 }
Пример #6
0
 /// <summary>
 /// <para>Start a task that will resolve conflicting assets in version control.</para>
 /// </summary>
 /// <param name="assets">The list of asset to mark as resolved.</param>
 /// <param name="resolveMethod">How the assets should be resolved.</param>
 public static Task Resolve(AssetList assets, ResolveMethod resolveMethod) =>
 Internal_Resolve(assets.ToArray(), resolveMethod);
Пример #7
0
        void OnGUI()
        {
            cancelled = false;
            GUILayout.Label("Conflicting files to resolve", EditorStyles.boldLabel);
            GUILayout.FlexibleSpace();

            // I would use GUIUtility.GetLastRect() here after the box but that seems to have wierd side effects.
            Rect r1 = new Rect(6, 40, position.width - 12, position.height - 112);  // 82

            GUILayout.BeginArea(r1);
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
            GUILayout.EndArea();

            bool repaint = resolveList.OnGUI(new Rect(r1.x + 2, r1.y + 2, r1.width - 4, r1.height - 4), true);

            GUILayout.FlexibleSpace();

            GUILayout.BeginHorizontal();
            GUI.enabled = assetList.Count > 0;

            GUILayout.Label("Resolve selection by:");

            using (new EditorGUI.DisabledScope(resolveList.SelectedAssets.Count == 0))
            {
                bool          methodWasSelected = false;
                ResolveMethod resolveMethod     = ResolveMethod.UseMine;

                if (GUILayout.Button("using local version"))
                {
                    methodWasSelected = true;
                    resolveMethod     = ResolveMethod.UseMine;
                }

                if (GUILayout.Button("using incoming version"))
                {
                    methodWasSelected = true;
                    resolveMethod     = ResolveMethod.UseTheirs;
                }

                if (GUILayout.Button("merging"))
                {
                    methodWasSelected = true;
                    resolveMethod     = ResolveMethod.UseMerged;
                }

                //                        We don't want to prompt the user about saving the current scene when using the local or incoming versions
                if (methodWasSelected && ((resolveMethod != ResolveMethod.UseMerged) || WindowChange.PromptUserToSaveDirtyScenes(assetList)))
                {
                    if (resolveMethod == ResolveMethod.UseMerged)
                    {
                        Task t = Provider.Merge(resolveList.SelectedAssets);
                        t.Wait();

                        if (t.success)
                        {
                            t = Provider.Resolve(t.assetList, ResolveMethod.UseMerged);
                            t.Wait();
                            if (t.success)
                            {
                                // Check that there are not more conflicts for the specified
                                // asset. This is possible in e.g. perforce where you handle
                                // one version conflict at a time.
                                t = Provider.Status(assetList);
                                t.Wait();

                                DoOpen(t.assetList);

                                if (t.success && assetList.Count == 0)
                                {
                                    Close();
                                }

                                // The view will be updated with the new conflicts
                            }
                            else
                            {
                                EditorUtility.DisplayDialog("Error resolving", "Error during resolve of files. Inspect log for details", "Close");
                                AssetDatabase.Refresh();
                            }
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("Error merging", "Error during merge of files. Inspect log for details", "Close");
                            AssetDatabase.Refresh();
                        }
                    }
                    else
                    {
                        SimpleMerge(resolveMethod);
                    }
                }
            }

            GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();
            GUILayout.Space(12);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUI.enabled = true;

            if (GUILayout.Button("Cancel"))
            {
                cancelled = true;
                Close();
            }

            GUILayout.EndHorizontal();
            GUILayout.Space(12);
            if (repaint)
            {
                Repaint();
            }
        }
Пример #8
0
 /// <summary>
 /// <para>Start a task that will resolve conflicting assets in version control.</para>
 /// </summary>
 /// <param name="assets">The list of asset to mark as resolved.</param>
 /// <param name="resolveMethod">How the assets should be resolved.</param>
 public static Task Resolve(AssetList assets, ResolveMethod resolveMethod)
 {
     return Internal_Resolve(assets.ToArray(), resolveMethod);
 }
Пример #9
0
 private static extern Task Internal_Resolve(Asset[] assets, ResolveMethod resolveMethod);