ProjectDDD/Assets/0.Datas/02.Scripts/GenerateGoogleSheet/Core/GoogleSheetDiffViewer.cs

46 lines
1.4 KiB (Stored with Git LFS)
C#

#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using System.Collections.Generic;
public class GoogleSheetDiffViewer : EditorWindow
{
private List<(string Sheet, string Field, int RowIndex, string OldValue, string NewValue) > _diffs;
public static void ShowWindow(List<(string Sheet, string Field, int RowIndex, string OldValue, string NewValue) > diffs)
{
var window = GetWindow<GoogleSheetDiffViewer>("Google Sheet 변경점");
window._diffs = diffs;
window.Show();
}
private Vector2 _scroll;
private void OnGUI()
{
if (_diffs == null || _diffs.Count == 0)
{
EditorGUILayout.LabelField("변경 사항이 없습니다.");
return;
}
EditorGUILayout.LabelField("변경된 항목", EditorStyles.boldLabel);
EditorGUILayout.Space();
_scroll = EditorGUILayout.BeginScrollView(_scroll);
EditorGUILayout.BeginVertical("box");
foreach (var diff in _diffs)
{
EditorGUILayout.LabelField($"시트: {diff.Sheet}");
EditorGUILayout.LabelField($"행: {diff.RowIndex + 1}");
EditorGUILayout.LabelField($"필드: {diff.Field}");
EditorGUILayout.LabelField($"기존 값: {diff.OldValue} → 변경 값: {diff.NewValue}", EditorStyles.helpBox);
EditorGUILayout.Space();
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndScrollView();
}
}
#endif