浏览代码

Sujith :) ->
1. Added layout settings - just to test

Arbitrator Tool User 1 月之前
父节点
当前提交
4caadeb94c

+ 7 - 0
Assets/Arbitrator/Editor/GUI/BetterGitSettingsProvider.cs

@@ -0,0 +1,7 @@
+namespace Terra.Arbitrator.GUI
+{
+    public class BetterGitSettingsProvider
+    {
+        
+    }
+}

+ 3 - 0
Assets/Arbitrator/Editor/GUI/BetterGitSettingsProvider.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: f0e3cf0ea4464590962e73baf98a1d10
+timeCreated: 1750424055

+ 0 - 124
Assets/Arbitrator/Editor/GUI/DiffWindow.cs

@@ -1,124 +0,0 @@
-// Copyright (c) 2025 TerraByte Inc.
-//
-// A modal editor window for displaying text differences (diffs) and
-// confirming an action with the user.
-
-using System;
-using System.IO;
-using UnityEditor;
-using UnityEngine;
-
-namespace Terra.Arbitrator.GUI
-{
-    public class DiffWindow : EditorWindow
-    {
-        private string _filePath;
-        private string _diffContent;
-        private Action<bool> _onCloseCallback;
-        private Vector2 _scrollPosition;
-        private bool _callbackInvoked;
-        private GUIStyle _diffStyle;
-
-        /// <summary>
-        /// Shows a modal window to display the diff and get user confirmation.
-        /// </summary>
-        /// <param name="filePath">The path of the file being diffed.</param>
-        /// <param name="diffContent">The diff text to display.</param>
-        /// <param name="onCloseCallback">A callback that returns true if the user confirmed, otherwise false.</param>
-        public static void ShowWindow(string filePath, string diffContent, Action<bool> onCloseCallback)
-        {
-            var window = GetWindow<DiffWindow>(true, "Diff Viewer", true);
-            window.titleContent = new GUIContent($"Diff: {Path.GetFileName(filePath)}");
-            window.minSize = new Vector2(700, 500);
-            window._filePath = filePath;
-            window._diffContent = diffContent;
-            window._onCloseCallback = onCloseCallback;
-            window._callbackInvoked = false;
-            window.ShowModalUtility(); // Show as a blocking modal window
-        }
-
-        private void OnEnable()
-        {
-            // Initialize the style here to avoid doing it every OnGUI call.
-            _diffStyle = new GUIStyle(EditorStyles.label)
-            {
-                richText = true,
-                wordWrap = false,
-                alignment = TextAnchor.UpperLeft
-            };
-        }
-
-        private void OnGUI()
-        {
-            EditorGUILayout.LabelField(_filePath, EditorStyles.boldLabel);
-
-            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition, EditorStyles.helpBox);
-            
-            var coloredText = GetColoredDiff(_diffContent);
-            var content = new GUIContent(coloredText);
-            
-            // Calculate the required height based on the window's width, accounting for scrollbar and padding.
-            var viewWidth = EditorGUIUtility.currentViewWidth - 30; // Approximate width inside scroll view
-            var requiredHeight = _diffStyle.CalcHeight(content, viewWidth);
-            
-            // Use GUILayout.Label with an explicit height to ensure the ScrollView's content area is sized correctly.
-            EditorGUILayout.SelectableLabel(coloredText, _diffStyle, GUILayout.MinHeight(requiredHeight));
-
-            EditorGUILayout.EndScrollView();
-
-            EditorGUILayout.Space();
-            EditorGUILayout.HelpBox("Review the changes above. Green lines are additions, red lines are deletions. Reverting will permanently discard these changes.", MessageType.Warning);
-
-            EditorGUILayout.BeginHorizontal();
-            GUILayout.FlexibleSpace();
-            if (GUILayout.Button("Revert Changes", GUILayout.Height(30), GUILayout.Width(150)))
-            {
-                _callbackInvoked = true;
-                _onCloseCallback?.Invoke(true);
-                Close();
-            }
-            if (GUILayout.Button("Cancel", GUILayout.Height(30), GUILayout.Width(120)))
-            {
-                Close();
-            }
-            EditorGUILayout.EndHorizontal();
-        }
-
-        private static string GetColoredDiff(string rawDiff)
-        {
-            var coloredDiff = "";
-            var lines = rawDiff.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
-            foreach (var line in lines)
-            {
-                if (line.StartsWith("+"))
-                {
-                    coloredDiff += $"<color=green>{line}</color>\n";
-                }
-                else if (line.StartsWith("-"))
-                {
-                    coloredDiff += $"<color=red>{line}</color>\n";
-                }
-                else if (line.StartsWith("@@"))
-                {
-                     coloredDiff += $"<color=cyan>{line}</color>\n";
-                }
-                else
-                {
-                    coloredDiff += $"{line}\n";
-                }
-            }
-            return coloredDiff + "\n";
-        }
-
-        private void OnDestroy()
-        {
-            // This is called when the window is closed by any means.
-            // If the callback hasn't been invoked yet (i.e., user clicked 'X' or 'Cancel'),
-            // we invoke it with 'false' to signify cancellation.
-            if (!_callbackInvoked)
-            {
-                _onCloseCallback?.Invoke(false);
-            }
-        }
-    }
-}

+ 0 - 3
Assets/Arbitrator/Editor/GUI/DiffWindow.cs.meta

@@ -1,3 +0,0 @@
-fileFormatVersion: 2
-guid: 925fa0607b96465b89370d83f2668c89
-timeCreated: 1750158026

+ 3 - 0
Assets/Arbitrator/Editor/Settings.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 3180077b5d884b0bb419db6e51ba51b2
+timeCreated: 1750424008

+ 7 - 0
Assets/Arbitrator/Editor/Settings/BetterGitSettings.cs

@@ -0,0 +1,7 @@
+namespace Terra.Arbitrator.Settings
+{
+    public class BetterGitSettings
+    {
+        
+    }
+}

+ 3 - 0
Assets/Arbitrator/Editor/Settings/BetterGitSettings.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: c7834214221e4b1d925e2827543b5ee2
+timeCreated: 1750424017

文件差异内容过多而无法显示
+ 5085 - 0
UserSettings/Layouts/CurrentMaximizeLayout.dwlt