Update
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
using DA_Assets.Constants;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.Logging;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ContextMenuItems
|
||||
{
|
||||
[MenuItem("Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.Create + " " + FcuConfig.ProductName, false, 0)]
|
||||
private static void CreateFcu_OnClick()
|
||||
{
|
||||
FcuEventHandlers.CreateFcu_OnClick();
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.SetFcuToSyncHelpers, false, 10)]
|
||||
private static void SetFcuToSyncHelpers_OnClick()
|
||||
{
|
||||
if (Selection.activeGameObject.TryGetComponentSafe(out FigmaConverterUnity fcu))
|
||||
{
|
||||
fcu.EventHandlers.SetFcuToSyncHelpers_OnClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_component_not_selected_in_hierarchy.Localize(nameof(FigmaConverterUnity)));
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.OptimizeSyncHelpers, false, 11)]
|
||||
private static void OptimizeSyncHelpers_OnClick()
|
||||
{
|
||||
if (Selection.activeGameObject.TryGetComponentSafe(out FigmaConverterUnity fcu))
|
||||
{
|
||||
fcu.EventHandlers.OptimizeSyncHelpers_OnClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_component_not_selected_in_hierarchy.Localize(nameof(FigmaConverterUnity)));
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.CompareTwoObjects, false, 12)]
|
||||
private static void Compare_OnClick()
|
||||
{
|
||||
if (Selection.gameObjects.Length != 2)
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_incorrect_selection.Localize());
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject go1 = Selection.gameObjects[0];
|
||||
GameObject go2 = Selection.gameObjects[1];
|
||||
|
||||
bool e1 = go1.TryGetComponentSafe(out SyncHelper sh1);
|
||||
bool e2 = go2.TryGetComponentSafe(out SyncHelper sh2);
|
||||
|
||||
if (e1 == false)
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_no_sync_helper.Localize(go1.name));
|
||||
return;
|
||||
}
|
||||
|
||||
if (e2 == false)
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_no_sync_helper.Localize(go2.name));
|
||||
return;
|
||||
}
|
||||
|
||||
ComparerWindow.Show(sh1, sh2);
|
||||
}
|
||||
|
||||
/*[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.DestroyLastImported, false, 13)]
|
||||
private static void DestroyLastImportedFrames_OnClick()
|
||||
{
|
||||
if (Selection.activeGameObject.TryGetComponentSafe(out FigmaConverterUnity fcu))
|
||||
{
|
||||
fcu.EventHandlers.DestroyLastImportedFrames_OnClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_component_not_selected_in_hierarchy.Localize(nameof(FigmaConverterUnity)));
|
||||
}
|
||||
}*/
|
||||
|
||||
[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.DestroySyncHelpers, false, 14)]
|
||||
private static void DestroySyncHelpers_OnClick()
|
||||
{
|
||||
if (Selection.activeGameObject.TryGetComponentSafe(out FigmaConverterUnity fcu))
|
||||
{
|
||||
fcu.EventHandlers.DestroySyncHelpers_OnClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_component_not_selected_in_hierarchy.Localize(nameof(FigmaConverterUnity)));
|
||||
}
|
||||
}
|
||||
|
||||
//[MenuItem("GameObject/Tools/" + DAConstants.Publisher + "/" + FcuConfig.ProductNameShort + ": " + FcuConfig.UpdatePrefabs, false, 5)]
|
||||
private static void UpdatePrefabs_OnClick()
|
||||
{
|
||||
if (Selection.activeGameObject.TryGetComponentSafe(out FigmaConverterUnity fcu))
|
||||
{
|
||||
fcu.EventHandlers.UpdatePrefabs_OnClick();
|
||||
}
|
||||
else
|
||||
{
|
||||
DALogger.LogError(FcuLocKey.log_component_not_selected_in_hierarchy.Localize(nameof(FigmaConverterUnity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53ce8ebb88d80ba45a3cbe13d1c50136
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,620 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Model;
|
||||
using DA_Assets.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class DifferenceCheckerWindow : LinkedEditorWindow<DifferenceCheckerWindow, FcuEditor, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private Dictionary<string, InfinityScrollRectWindow<SelectableObject<DiffInfo>, BlackInspector>> _importScrolls = new Dictionary<string, InfinityScrollRectWindow<SelectableObject<DiffInfo>, BlackInspector>>();
|
||||
private Dictionary<string, InfinityScrollRectWindow<SelectableObject<SyncData>, BlackInspector>> _removeScrolls = new Dictionary<string, InfinityScrollRectWindow<SelectableObject<SyncData>, BlackInspector>>();
|
||||
|
||||
private List<HamburgerItem> _selectableHambItems = new List<HamburgerItem>();
|
||||
|
||||
private UpdateBool _importNew = new UpdateBool(false, false);
|
||||
private UpdateBool _importFigmaChanged = new UpdateBool(false, false);
|
||||
private UpdateBool _importUnityChanged = new UpdateBool(false, false);
|
||||
private UpdateBool _importOther = new UpdateBool(false, false);
|
||||
|
||||
private Vector2Int _importNewCount = Vector2Int.zero;
|
||||
private Vector2Int _figmaSideChangedCount = Vector2Int.zero;
|
||||
private Vector2Int _unitySideChangedCount = Vector2Int.zero;
|
||||
private Vector2Int _importOtherCount = Vector2Int.zero;
|
||||
|
||||
private PreImportInput _diffStruct = new PreImportInput();
|
||||
private Action<PreImportOutput> _callback;
|
||||
|
||||
private bool inited = false;
|
||||
|
||||
internal void SetData(PreImportInput diffStruct, Action<PreImportOutput> callback)
|
||||
{
|
||||
_diffStruct = diffStruct;
|
||||
_callback = callback;
|
||||
|
||||
foreach (SelectableObject<DiffInfo> item in diffStruct.ToImport.Childs)
|
||||
{
|
||||
var isrw = new InfinityScrollRectWindow<SelectableObject<DiffInfo>, BlackInspector>(4, 100);
|
||||
isrw.SetData(item.Childs, DrawToImportItem);
|
||||
_importScrolls.Add($"toimport_{item.Object.Id}", isrw);
|
||||
}
|
||||
|
||||
foreach (SelectableObject<SyncData> item in diffStruct.ToRemove.Childs)
|
||||
{
|
||||
var isrw = new InfinityScrollRectWindow<SelectableObject<SyncData>, BlackInspector>(11, 40);
|
||||
isrw.SetData(item.Childs, DrawToRemoveItem);
|
||||
_removeScrolls.Add(item.Object.Id, isrw);
|
||||
}
|
||||
|
||||
UpdateFlags();
|
||||
inited = true;
|
||||
}
|
||||
|
||||
private void CheckForClose()
|
||||
{
|
||||
if (_diffStruct.IsDefault())
|
||||
{
|
||||
Debug.Log($"{this.name} was closed because the scripts were recompiled.");
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawGUI()
|
||||
{
|
||||
if (!inited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckForClose();
|
||||
}
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Scroll = true,
|
||||
Style = gui.ColoredStyle.DiffCheckerBackground,
|
||||
Body = () =>
|
||||
{
|
||||
gui.DrawSplitGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
SplitterWidth = 5,
|
||||
SplitterStartPos = 500
|
||||
},
|
||||
() =>
|
||||
{
|
||||
LeftPanel();
|
||||
},
|
||||
() =>
|
||||
{
|
||||
RightPanel();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void Footer()
|
||||
{
|
||||
if (gui.OutlineButton(FcuLocKey.label_apply_and_continue.Localize(), FcuLocKey.tooltip_apply_and_continue.Localize()))
|
||||
{
|
||||
Apply_OnClick();
|
||||
}
|
||||
|
||||
void Apply_OnClick()
|
||||
{
|
||||
IEnumerable<string> toImportSelected = _diffStruct.ToImport.Childs
|
||||
.SelectRecursive(x => x.Childs)
|
||||
.Where(x => x.Selected)
|
||||
.Select(x => x.Object.Id);
|
||||
|
||||
IEnumerable<SyncData> toRemoveSelected = _diffStruct.ToRemove.Childs
|
||||
.SelectRecursive(x => x.Childs)
|
||||
.Where(x => x.Selected)
|
||||
.Select(x => x.Object);
|
||||
|
||||
PreImportOutput result = new PreImportOutput
|
||||
{
|
||||
ToImport = toImportSelected,
|
||||
ToRemove = toRemoveSelected
|
||||
};
|
||||
|
||||
_callback.Invoke(result);
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void LeftPanel()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.DiffCheckerToImportPanel,
|
||||
Body = () =>
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_components_to_import.Localize(), FcuLocKey.tooltip_components_to_import.Localize());
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
DrawToImport();
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.OutlineButton(FcuLocKey.label_open_diff_checker.Localize()))
|
||||
{
|
||||
Application.OpenURL("https://www.diffchecker.com/");
|
||||
}
|
||||
|
||||
gui.FlexibleSpace();
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space15();
|
||||
|
||||
DrawMenuWithChildren(_diffStruct.ToImport);
|
||||
|
||||
|
||||
void DrawMenuWithChildren(SelectableObject<DiffInfo> item)
|
||||
{
|
||||
bool isRoot = item.Object.Id == PreImportDataCreator.TO_IMPORT_MENU_ID;
|
||||
|
||||
int allCount = item.CountItems(x => x.Childs.IsEmpty());
|
||||
int selectedCount = item.CountItems(x => x.Childs.IsEmpty() && x.Selected);
|
||||
|
||||
bool isAllSelected = selectedCount == allCount;
|
||||
|
||||
GUIContent gc;
|
||||
string menuId = "toimport_";
|
||||
|
||||
if (isRoot)
|
||||
{
|
||||
menuId += PreImportDataCreator.TO_IMPORT_MENU_ID;
|
||||
gc = new GUIContent(FcuLocKey.label_components_with_count.Localize(selectedCount, allCount), "");
|
||||
|
||||
gui.DrawMenu(_selectableHambItems, new HamburgerItem
|
||||
{
|
||||
Id = menuId,
|
||||
GUIContent = gc,
|
||||
Body = () =>
|
||||
{
|
||||
foreach (SelectableObject<DiffInfo> child in item.Childs)
|
||||
{
|
||||
DrawMenuWithChildren(child);
|
||||
}
|
||||
},
|
||||
CheckBoxValueChanged = (id, value) =>
|
||||
{
|
||||
SetAllChildrenSelected(item, value, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
menuId += item.Object.Id;
|
||||
gc = new GUIContent($"{item.Object.Name} ({selectedCount}/{allCount})", "");
|
||||
|
||||
gui.DrawMenu(_selectableHambItems, new HamburgerItem
|
||||
{
|
||||
Id = menuId,
|
||||
GUIContent = gc,
|
||||
Body = () =>
|
||||
{
|
||||
_importScrolls[menuId].OnGUI();
|
||||
},
|
||||
CheckBoxValueChanged = (id, value) =>
|
||||
{
|
||||
SetAllChildrenSelected(item, value, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SetCheckboxValue(menuId, isAllSelected);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
private void SetCheckboxValue(string id, bool value)
|
||||
{
|
||||
UpdateBool checkBoxValue = _selectableHambItems.FirstOrDefault(item => item.Id == id)?.CheckBoxValue;
|
||||
|
||||
if (checkBoxValue != null)
|
||||
{
|
||||
checkBoxValue.Value = value;
|
||||
checkBoxValue.Temp = value;
|
||||
}
|
||||
}
|
||||
private void RightPanel()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.DiffCheckerToRemovePanel,
|
||||
Body = () =>
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_remove_from_scene.Localize(), FcuLocKey.tooltip_remove_from_scene.Localize());
|
||||
|
||||
gui.Space15();
|
||||
|
||||
foreach (SelectableObject<SyncData> item in _diffStruct.ToRemove.Childs)
|
||||
{
|
||||
int selectedCount = item.Childs.Count(x => x.Selected);
|
||||
int allCount = item.Childs.Count;
|
||||
bool isAllSelected = selectedCount == allCount;
|
||||
|
||||
string menuId = "toremove_";
|
||||
menuId += item.Object.Id;
|
||||
|
||||
gui.DrawMenu(_selectableHambItems, new HamburgerItem
|
||||
{
|
||||
Id = menuId,
|
||||
GUIContent = new GUIContent($"{item.Object.Names.ObjectName} ({selectedCount}/{allCount})"),
|
||||
Body = () => _removeScrolls[item.Object.Id].OnGUI(),
|
||||
CheckBoxValueChanged = (id, value) =>
|
||||
{
|
||||
SetAllChildrenSelected(item, value, true);
|
||||
}
|
||||
});
|
||||
|
||||
SetCheckboxValue(menuId, isAllSelected);
|
||||
}
|
||||
|
||||
gui.FlexibleSpace();
|
||||
gui.Line();
|
||||
gui.Space15();
|
||||
|
||||
Footer();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void SetAllChildrenSelected<T>(SelectableObject<T> item, bool selected, bool remove) where T : IHaveId
|
||||
{
|
||||
SetAllChildrenSelectedRecursive(item, selected);
|
||||
|
||||
UpdateFlags();
|
||||
|
||||
void SetAllChildrenSelectedRecursive(SelectableObject<T> currentItem, bool value)
|
||||
{
|
||||
currentItem.Selected = value;
|
||||
|
||||
foreach (SelectableObject<T> child in currentItem.Childs)
|
||||
{
|
||||
SetAllChildrenSelectedRecursive(child, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawToRemoveItem(SelectableObject<SyncData> item)
|
||||
{
|
||||
bool oldState = item.Selected;
|
||||
item.Selected = gui.CheckBox(new GUIContent(GetHierarchyWithoutRootFrame(item.Object.NameHierarchy)), item.Selected, false);
|
||||
if (item.Selected != oldState)
|
||||
{
|
||||
UpdateFlags();
|
||||
}
|
||||
}
|
||||
|
||||
private string GetHierarchyWithoutRootFrame(string hierarchy)
|
||||
{
|
||||
int index = hierarchy.IndexOf(FcuConfig.HierarchyDelimiter);
|
||||
if (index != -1)
|
||||
{
|
||||
return ".." + hierarchy.Substring(index);
|
||||
}
|
||||
return hierarchy;
|
||||
}
|
||||
|
||||
private void DrawToImportItem(SelectableObject<DiffInfo> item)
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
gui.Space5();
|
||||
|
||||
string name = item.Object.OldData != null ? item.Object.OldData.NameHierarchy : item.Object.NewData.Data.NameHierarchy;
|
||||
name = GetHierarchyWithoutRootFrame(name);
|
||||
gui.Label12px(name, null, GUILayout.ExpandWidth(true));
|
||||
gui.Space5();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
bool oldState = item.Selected;
|
||||
item.Selected = GUILayout.Toggle(item.Selected, GUIContent.none);
|
||||
if (item.Selected != oldState)
|
||||
{
|
||||
UpdateFlags();
|
||||
}
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
if (gui.Button(new GUIContent(FcuLocKey.label_copy_old_data.Localize()), GUILayout.Width(120)))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = item.Object.OldData.HashData;
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.Button(new GUIContent(FcuLocKey.label_copy_new_data.Localize()), GUILayout.Width(120)))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = item.Object.NewData.Data.HashData;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space15();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
if (item.Object.HasFigmaDiff)
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_different_component_data.Localize(), null, GUILayout.ExpandWidth(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.Label12px("_");
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (item.Object.Color.Enabled)
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_has_differences.Localize(
|
||||
"Color",
|
||||
$"{item.Object.Color.Value1}",
|
||||
$"{item.Object.Color.Value2}"), null, GUILayout.ExpandWidth(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.Label12px("_");
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (item.Object.Size.Enabled)
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_has_differences.Localize(
|
||||
"Size",
|
||||
$"{item.Object.Size.Value1}",
|
||||
$"{item.Object.Size.Value2}"), null, GUILayout.ExpandWidth(true));
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.Label12px("_");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.FlexibleSpace();
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space5();
|
||||
|
||||
gui.Line();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void UpdateData(Func<SelectableObject<DiffInfo>, bool> condition, bool value)
|
||||
{
|
||||
foreach (SelectableObject<DiffInfo> item in _diffStruct.ToImport.Childs)
|
||||
{
|
||||
UpdateDataRecursive(item, condition, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateDataRecursive(SelectableObject<DiffInfo> item, Func<SelectableObject<DiffInfo>, bool> condition, bool value)
|
||||
{
|
||||
if (condition(item))
|
||||
item.Selected = value;
|
||||
|
||||
foreach (SelectableObject<DiffInfo> child in item.Childs)
|
||||
{
|
||||
UpdateDataRecursive(child, condition, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateFlags()
|
||||
{
|
||||
int importNewCount = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.IsNew);
|
||||
int importNewCountSelected = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.IsNew && x.Selected);
|
||||
_importNewCount = new Vector2Int(importNewCountSelected, importNewCount);
|
||||
_importNew.Value = importNewCount == importNewCountSelected && importNewCount != 0;
|
||||
_importNew.Temp = importNewCount == importNewCountSelected && importNewCount != 0;
|
||||
|
||||
int figmaChangedCount = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.HasFigmaDiff);
|
||||
int figmaChangedCountSelected = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.HasFigmaDiff && x.Selected);
|
||||
_figmaSideChangedCount = new Vector2Int(figmaChangedCountSelected, figmaChangedCount);
|
||||
_importFigmaChanged.Value = figmaChangedCount == figmaChangedCountSelected && figmaChangedCount != 0;
|
||||
_importFigmaChanged.Temp = figmaChangedCount == figmaChangedCountSelected && figmaChangedCount != 0;
|
||||
|
||||
int unityChangedCount = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.IsUnitySideChanged());
|
||||
int unityChangedCountSelected = _diffStruct.ToImport.CountItems(x => x.Childs.IsEmpty() && x.Object.IsUnitySideChanged() && x.Selected);
|
||||
_unitySideChangedCount = new Vector2Int(unityChangedCountSelected, unityChangedCount);
|
||||
_importUnityChanged.Value = unityChangedCount == unityChangedCountSelected && unityChangedCount != 0;
|
||||
_importUnityChanged.Temp = unityChangedCount == unityChangedCountSelected && unityChangedCount != 0;
|
||||
|
||||
int importSameCount = _diffStruct.ToImport.CountItems(x =>
|
||||
x.Object.IsNotChanged() &&
|
||||
!x.Object.IsUnitySideChanged());
|
||||
|
||||
int importSameCountSelected = _diffStruct.ToImport.CountItems(x =>
|
||||
x.Object.IsNotChanged() &&
|
||||
x.Selected);
|
||||
|
||||
_importOtherCount = new Vector2Int(importSameCountSelected, importSameCount);
|
||||
_importOther.Value = importSameCount == importSameCountSelected && importSameCount != 0;
|
||||
_importOther.Temp = importSameCount == importSameCountSelected && importSameCount != 0;
|
||||
}
|
||||
|
||||
private void ImportFigmaSide_OnChanged()
|
||||
{
|
||||
UpdateData(x => x.Object.HasFigmaDiff, _importFigmaChanged.Value);
|
||||
UpdateFlags();
|
||||
}
|
||||
|
||||
private void UnitySide_OnChanged()
|
||||
{
|
||||
UpdateData(x => x.Object.Color.Enabled || x.Object.Size.Enabled, _importUnityChanged.Value);
|
||||
UpdateFlags();
|
||||
}
|
||||
|
||||
private void ImportNew_OnChanged()
|
||||
{
|
||||
UpdateData(x => x.Object.IsNew, _importNew.Value);
|
||||
UpdateFlags();
|
||||
}
|
||||
|
||||
private void ImportOther_OnChanged()
|
||||
{
|
||||
UpdateData(x => !x.Object.IsNew &&
|
||||
!x.Object.HasFigmaDiff &&
|
||||
!x.Object.IsUnitySideChanged(), _importOther.Value);
|
||||
|
||||
UpdateFlags();
|
||||
}
|
||||
|
||||
private void DrawToImport()
|
||||
{
|
||||
gui.DrawTable(new Action[4, 3]
|
||||
{
|
||||
{
|
||||
() =>
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_new.Localize(), FcuLocKey.tooltip_new_components.Localize());
|
||||
},
|
||||
() =>
|
||||
{
|
||||
GUILayout.Label($"{_importNewCount.x}/{_importNewCount.y}", EditorStyles.boldLabel);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
_importNew.Value = GUILayout.Toggle(_importNew.Value, GUIContent.none);
|
||||
if (_importNew.Value != _importNew.Temp)
|
||||
{
|
||||
_importNew.Temp = _importNew.Value;
|
||||
ImportNew_OnChanged();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
() =>
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_changed_in_figma.Localize(), FcuLocKey.tooltip_changed_in_figma.Localize());
|
||||
},
|
||||
() =>
|
||||
{
|
||||
GUILayout.Label($"{_figmaSideChangedCount.x}/{_figmaSideChangedCount.y}", EditorStyles.boldLabel);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
_importFigmaChanged.Value = GUILayout.Toggle(_importFigmaChanged.Value, GUIContent.none);
|
||||
if (_importFigmaChanged.Value != _importFigmaChanged.Temp)
|
||||
{
|
||||
_importFigmaChanged.Temp = _importFigmaChanged.Value;
|
||||
ImportFigmaSide_OnChanged();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
() =>
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_changed_in_unity.Localize(), FcuLocKey.tooltip_changed_in_unity.Localize());
|
||||
},
|
||||
() =>
|
||||
{
|
||||
GUILayout.Label($"{_unitySideChangedCount.x}/{_unitySideChangedCount.y}", EditorStyles.boldLabel);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
_importUnityChanged.Value = GUILayout.Toggle(_importUnityChanged.Value, GUIContent.none);
|
||||
if (_importUnityChanged.Value != _importUnityChanged.Temp)
|
||||
{
|
||||
_importUnityChanged.Temp = _importUnityChanged.Value;
|
||||
UnitySide_OnChanged();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
() =>
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_without_changes.Localize(), FcuLocKey.tooltip_label_without_changes.Localize());
|
||||
},
|
||||
() =>
|
||||
{
|
||||
GUILayout.Label($"{_importOtherCount.x}/{_importOtherCount.y}", EditorStyles.boldLabel);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
_importOther.Value = GUILayout.Toggle(_importOther.Value, GUIContent.none);
|
||||
if (_importOther.Value != _importOther.Temp)
|
||||
{
|
||||
_importOther.Temp = _importOther.Value;
|
||||
ImportOther_OnChanged();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
internal static class DiffCheckerExtensions
|
||||
{
|
||||
internal static bool IsNotChanged(this DiffInfo diffInfo)
|
||||
{
|
||||
return !diffInfo.IsNew &&
|
||||
!diffInfo.HasFigmaDiff &&
|
||||
!diffInfo.IsUnitySideChanged();
|
||||
}
|
||||
|
||||
internal static bool IsUnitySideChanged(this DiffInfo diffInfo)
|
||||
{
|
||||
return diffInfo.Color.Enabled || diffInfo.Size.Enabled;
|
||||
}
|
||||
|
||||
internal static int CountItems<T>(this SelectableObject<T> obj, Func<SelectableObject<T>, bool> condition)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (condition(obj))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
||||
foreach (SelectableObject<T> child in obj.Childs)
|
||||
{
|
||||
count += child.CountItems(condition);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd2d49e3322433c439b7db651b3d0e0b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d072ad781ff31a44bf6c389f8dd65b5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,295 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.Logging;
|
||||
using DA_Assets.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable IDE0003
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[CustomEditor(typeof(FigmaConverterUnity)), CanEditMultipleObjects]
|
||||
internal class FcuEditor : DAEditor<FcuEditor, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
monoBeh.DelegateHolder.SetSpriteRects = SpriteEditorUtility.SetSpriteRects;
|
||||
monoBeh.DelegateHolder.ShowDifferenceChecker = ShowDifferenceChecker;
|
||||
monoBeh.DelegateHolder.UpdateScrollContent = this.FrameList.UpdateScrollContent;
|
||||
monoBeh.DelegateHolder.UpdateScrollContent();
|
||||
monoBeh.DelegateHolder.GetGameViewSize = GameViewUtils.GetGameViewSize;
|
||||
monoBeh.DelegateHolder.SetGameViewSize = GameViewUtils.SetGameViewSize;
|
||||
|
||||
try
|
||||
{
|
||||
_currentAssetVersion = UpdateChecker.GetCurrentVersionInfo(AssetType.fcu, FcuConfig.Instance.ProductVersion);
|
||||
_assetInfo = DAWebConfig.WebConfig.Assets.FirstOrDefault(x => x.Type == AssetType.fcu);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning(ex);
|
||||
}
|
||||
|
||||
_ = monoBeh.Authorizer.TryRestoreSession();
|
||||
}
|
||||
|
||||
private void ShowDifferenceChecker(PreImportInput data, Action<PreImportOutput> callback)
|
||||
{
|
||||
this.DifferenceCheckerWindow.SetData(data, callback);
|
||||
this.DifferenceCheckerWindow.Show();
|
||||
}
|
||||
|
||||
public void DrawBaseOnInspectorGUI()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () => base.OnInspectorGUI()
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
DrawWindowedGUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawGUI(gui.ColoredStyle.Background);
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawWindowedGUI()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.Background,
|
||||
Body = () =>
|
||||
{
|
||||
gui.TopProgressBar(monoBeh.RequestSender.PbarProgress);
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
this.Header.DrawSmallHeader();
|
||||
|
||||
gui.Space15();
|
||||
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconOpen, FcuLocKey.tooltip_open_fcu_window.Localize())))
|
||||
{
|
||||
this.SettingsWindow.Show();
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconExpandWindow, FcuLocKey.tooltip_change_window_mode.Localize())))
|
||||
{
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
monoBeh.Settings.MainSettings.WindowMode = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void DrawGUI(GUIStyle customStyle)
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = customStyle,
|
||||
Body = () =>
|
||||
{
|
||||
this.Header.Draw();
|
||||
|
||||
gui.Space15();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
monoBeh.Settings.MainSettings.ProjectUrl = gui.BigTextField(monoBeh.Settings.MainSettings.ProjectUrl, null);
|
||||
|
||||
gui.Space5();
|
||||
|
||||
Group gr = new Group();
|
||||
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
gr.Style = gui.ColoredStyle.Group5Buttons;
|
||||
}
|
||||
else
|
||||
{
|
||||
gr.Style = gui.ColoredStyle.Group6Buttons;
|
||||
}
|
||||
|
||||
gr.GroupType = GroupType.Horizontal;
|
||||
gr.Body = () =>
|
||||
{
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.ImgViewRecent, FcuLocKey.tooltip_recent_projects.Localize())))
|
||||
{
|
||||
ShowRecentProjectsPopup_OnClick();
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconDownload, FcuLocKey.tooltip_download_project.Localize())))
|
||||
{
|
||||
if (monoBeh.Authorizer.IsAuthed() == false)
|
||||
{
|
||||
DALogger.Log(FcuLocKey.log_not_authorized.Localize());
|
||||
}
|
||||
else if (monoBeh.Settings.MainSettings.ProjectUrl.IsEmpty())
|
||||
{
|
||||
DALogger.Log(FcuLocKey.log_incorrent_project_url.Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
monoBeh.EventHandlers.DownloadProject_OnClick();
|
||||
}
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconImport, FcuLocKey.tooltip_import_frames.Localize())))
|
||||
{
|
||||
monoBeh.EventHandlers.ImportSelectedFrames_OnClick();
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconStop, FcuLocKey.tooltip_stop_import.Localize())))
|
||||
{
|
||||
monoBeh.EventHandlers.StopImport_OnClick();
|
||||
}
|
||||
|
||||
if (monoBeh.Settings.MainSettings.WindowMode == false)
|
||||
{
|
||||
gui.Space5();
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconSettings, FcuLocKey.tooltip_open_settings_window.Localize())))
|
||||
{
|
||||
this.SettingsWindow.Show();
|
||||
}
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
if (gui.SquareButton30x30(new GUIContent(gui.Data.Resources.IconExpandWindow, FcuLocKey.tooltip_change_window_mode.Localize())))
|
||||
{
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
monoBeh.Settings.MainSettings.WindowMode = false;
|
||||
this.SettingsWindow.CreateTabs();
|
||||
}
|
||||
else
|
||||
{
|
||||
monoBeh.Settings.MainSettings.WindowMode = true;
|
||||
this.SettingsWindow.Show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
gui.DrawGroup(gr);
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (!monoBeh.InspectorDrawer.SelectableDocument.IsProjectEmpty())
|
||||
{
|
||||
this.FrameList.Draw();
|
||||
}
|
||||
|
||||
if (!_assetInfo.DeveloperMessage.Text.IsEmpty() || !_currentAssetVersion.DeveloperMessage.Text.IsEmpty())
|
||||
{
|
||||
gui.Space15();
|
||||
}
|
||||
|
||||
if (!_assetInfo.DeveloperMessage.Text.IsEmpty())
|
||||
{
|
||||
gui.HelpBox(_assetInfo.DeveloperMessage.Text, _assetInfo.DeveloperMessage.Type);
|
||||
gui.Space5();
|
||||
}
|
||||
|
||||
if (!_currentAssetVersion.DeveloperMessage.Text.IsEmpty())
|
||||
{
|
||||
gui.HelpBox(_currentAssetVersion.DeveloperMessage.Text, _currentAssetVersion.DeveloperMessage.Type);
|
||||
gui.Space5();
|
||||
}
|
||||
|
||||
Footer.DrawFooter();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ShowRecentProjectsPopup_OnClick()
|
||||
{
|
||||
List<RecentProject> recentProjects = monoBeh.ProjectCacher.GetRecentProjects();
|
||||
|
||||
List<GUIContent> options = new List<GUIContent>();
|
||||
|
||||
if (recentProjects.IsEmpty())
|
||||
{
|
||||
options.Add(new GUIContent(FcuLocKey.label_no_recent_projects.Localize()));
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (RecentProject project in recentProjects)
|
||||
{
|
||||
options.Add(new GUIContent(project.Name));
|
||||
}
|
||||
}
|
||||
|
||||
EditorUtility.DisplayCustomMenu(new Rect(11, 150, 0, 0), options.ToArray(), -1, (userData, ops, selected) =>
|
||||
{
|
||||
RecentProject recentProject = recentProjects[selected];
|
||||
monoBeh.Settings.MainSettings.ProjectUrl = recentProject.Url;
|
||||
monoBeh.EventHandlers.DownloadProject_OnClick();
|
||||
}, null);
|
||||
}
|
||||
|
||||
internal DifferenceCheckerWindow DifferenceCheckerWindow =>
|
||||
DifferenceCheckerWindow.GetInstance(this, monoBeh, new Vector2(900, 600), false);
|
||||
|
||||
internal FcuSettingsWindow SettingsWindow =>
|
||||
FcuSettingsWindow.GetInstance(this, monoBeh, new Vector2(800, 600), false);
|
||||
|
||||
private HeaderSection _headerSection;
|
||||
internal HeaderSection Header => monoBeh.Link(ref _headerSection, this);
|
||||
|
||||
private FramesSection _frameListSection;
|
||||
internal FramesSection FrameList => monoBeh.Link(ref _frameListSection, this);
|
||||
|
||||
private AssetVersion _currentAssetVersion;
|
||||
private Asset _assetInfo;
|
||||
}
|
||||
|
||||
public enum HamburgerMenuId
|
||||
{
|
||||
MainSettingsKey,
|
||||
UnityTextSettingsKey,
|
||||
TextMeshSettingsKey,
|
||||
PuiSettingsKey,
|
||||
MPUIKitSettingsKey,
|
||||
FrameListKey,
|
||||
AssetsConfigKey,
|
||||
AssetToolsKey,
|
||||
DebugToolsKey,
|
||||
RemoveUnusedSpritesKey,
|
||||
ImportEventsKey,
|
||||
UnityImageSettingsKey,
|
||||
Shapes2DSettingsKey,
|
||||
TMFontsConverterKey
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc8f5f60c6791de4489a0cf2f325d658
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using DA_Assets.FCU.Model;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[CustomEditor(typeof(SyncHelper)), CanEditMultipleObjects]
|
||||
internal class SyncHelperEditor : UnityEditor.Editor
|
||||
{
|
||||
private DAInspector gui => BlackInspector.Instance.Inspector;
|
||||
private FigmaConverterUnity monoBeh;
|
||||
private SyncHelper syncObject;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
syncObject = (SyncHelper)target;
|
||||
monoBeh = syncObject.Data.FigmaConverterUnity as FigmaConverterUnity;
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.Background,
|
||||
Body = () =>
|
||||
{
|
||||
|
||||
if (monoBeh == null)
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_dont_remove_fcu_meta.Localize(), null, GUILayout.ExpandWidth(true));
|
||||
gui.Label10px(FcuLocKey.label_more_about_layout_updating.Localize(), null, GUILayout.ExpandWidth(true));
|
||||
|
||||
gui.Space10();
|
||||
|
||||
gui.Label10px(FcuLocKey.label_fcu_is_null.Localize(nameof(FigmaConverterUnity), FcuConfig.CreatePrefabs, FcuConfig.SetFcuToSyncHelpers), null, GUILayout.ExpandWidth(true));
|
||||
return;
|
||||
}
|
||||
|
||||
gui.Colorize(() =>
|
||||
{
|
||||
if (monoBeh.IsUITK())
|
||||
{
|
||||
GUILayout.TextArea(syncObject.Data.NameHierarchy);
|
||||
}
|
||||
|
||||
if (monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
EditorGUILayout.Vector3Field("World Position", syncObject.transform.position);
|
||||
EditorGUILayout.Vector3Field("Local Position", syncObject.transform.localPosition);
|
||||
gui.Space10();
|
||||
base.OnInspectorGUI();
|
||||
}
|
||||
});
|
||||
|
||||
if (monoBeh.IsUITK() || monoBeh.IsDebug())
|
||||
gui.Space10();
|
||||
|
||||
gui.Label12px(FcuLocKey.label_dont_remove_fcu_meta.Localize(), null, GUILayout.ExpandWidth(true));
|
||||
gui.Label10px(FcuLocKey.label_more_about_layout_updating.Localize(), null, GUILayout.ExpandWidth(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 63aeeb6ed41d1e54ab010422bb5c1402
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53423b99078faac44a534a12f0a8fb79
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,129 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Serializable]
|
||||
internal class FramesSection : MonoBehaviourLinkerEditor<FcuEditor, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
protected int _visibleItemCount = 10;
|
||||
protected float _itemHeight = 35;
|
||||
|
||||
private Dictionary<string, InfinityScrollRectWindow<SelectableFObject, BlackInspector>> _scrolls = new Dictionary<string, InfinityScrollRectWindow<SelectableFObject, BlackInspector>>();
|
||||
|
||||
public void UpdateScrollContent()
|
||||
{
|
||||
_scrolls.Clear();
|
||||
|
||||
foreach (SelectableFObject item in monoBeh.InspectorDrawer.SelectableDocument.Childs)
|
||||
{
|
||||
var isrw = new InfinityScrollRectWindow<SelectableFObject, BlackInspector>(10, 35);
|
||||
_scrolls.Add(item.Id, isrw);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFrame(SelectableFObject item)
|
||||
{
|
||||
item.Selected = gui.CheckBox(new GUIContent(item.Name), item.Selected, rightSide: false, onValueChange: () =>
|
||||
{
|
||||
monoBeh.InspectorDrawer.FillSelectableFramesArray(monoBeh.CurrentProject.FigmaProject.Document);
|
||||
});
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
SelectableFObject doc = monoBeh.InspectorDrawer.SelectableDocument;
|
||||
|
||||
DrawMenuWithChildren(doc);
|
||||
|
||||
void DrawMenuWithChildren(SelectableFObject item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int selectedCount = item.Childs.Where(x => x != null).SelectRecursive(x => x.Childs).Count(x => x.Childs.IsEmpty() && x.Selected);
|
||||
int allCount = item.Childs.Where(x => x != null).SelectRecursive(x => x.Childs).Count(x => x.Childs.IsEmpty());
|
||||
bool isAllSelected = selectedCount == allCount;
|
||||
|
||||
SetCheckboxValue(item.Id, isAllSelected);
|
||||
|
||||
if (item.Type == Model.NodeType.CANVAS)
|
||||
{
|
||||
gui.DrawMenu(monoBeh.InspectorDrawer.SelectableHamburgerItems, new HamburgerItem
|
||||
{
|
||||
Id = item.Id,
|
||||
GUIContent = new GUIContent($"{item.Name} ({selectedCount}/{allCount})", ""),
|
||||
Body = () =>
|
||||
{
|
||||
foreach (SelectableFObject item1 in monoBeh.InspectorDrawer.SelectableDocument.Childs)
|
||||
{
|
||||
if (_scrolls.TryGetValue(item1.Id, out var scroll1))
|
||||
{
|
||||
scroll1.SetData(item1.Childs, DrawFrame);
|
||||
}
|
||||
}
|
||||
|
||||
if (_scrolls.TryGetValue(item.Id, out var scroll2))
|
||||
{
|
||||
scroll2.OnGUI();
|
||||
}
|
||||
},
|
||||
CheckBoxValueChanged = (id, value) => SetAllChildrenSelected(item, value)
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GUIContent gc;
|
||||
|
||||
if (item.Type == Model.NodeType.DOCUMENT)
|
||||
{
|
||||
gc = new GUIContent(FcuLocKey.label_frames_to_import.Localize(selectedCount, allCount), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
gc = new GUIContent($"{item.Name} ({selectedCount}/{allCount})", "");
|
||||
}
|
||||
|
||||
gui.DrawMenu(monoBeh.InspectorDrawer.SelectableHamburgerItems, new HamburgerItem
|
||||
{
|
||||
Id = item.Id,
|
||||
GUIContent = gc,
|
||||
Body = () =>
|
||||
{
|
||||
foreach (var child in item.Childs)
|
||||
{
|
||||
DrawMenuWithChildren(child);
|
||||
}
|
||||
},
|
||||
CheckBoxValueChanged = (id, value) => SetAllChildrenSelected(item, value)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void SetCheckboxValue(string id, bool value)
|
||||
{
|
||||
var checkBoxValue = monoBeh.InspectorDrawer.SelectableHamburgerItems.FirstOrDefault(item => item.Id == id)?.CheckBoxValue;
|
||||
if (checkBoxValue != null)
|
||||
{
|
||||
checkBoxValue.Value = value;
|
||||
checkBoxValue.Temp = value;
|
||||
}
|
||||
}
|
||||
|
||||
void SetAllChildrenSelected(SelectableFObject item, bool selected)
|
||||
{
|
||||
item.Selected = selected;
|
||||
foreach (var child in item.Childs)
|
||||
{
|
||||
SetAllChildrenSelected(child, selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d6c360a2d933754cb8cc9e8b277d6df
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,205 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using DA_Assets.Tools;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Serializable]
|
||||
internal class HeaderSection : MonoBehaviourLinkerEditor<FcuEditor, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private void DrawStar()
|
||||
{
|
||||
GUILayout.Box(gui.Data.Resources.ImgStar, gui.ColoredStyle.ImgStar);
|
||||
}
|
||||
|
||||
private void RateMeUI()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.FlexibleSpace();
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
DrawStar();
|
||||
|
||||
if (i != 5)
|
||||
{
|
||||
gui.Space5();
|
||||
}
|
||||
}
|
||||
|
||||
gui.FlexibleSpace();
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space15();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.BoxPanel,
|
||||
Body = () =>
|
||||
{
|
||||
int dc = GetFirstVersionDaysCount();
|
||||
gui.Label12px(new GUIContent(FcuLocKey.label_rateme_desc.Localize(dc)), GUILayout.ExpandWidth(true));
|
||||
|
||||
gui.Space5();
|
||||
if (gui.OutlineButton("Don't show", "null", true))
|
||||
{
|
||||
DontShowRateMe_OnClick();
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
if (gui.OutlineButton("Open Asset Store", "null", true))
|
||||
{
|
||||
int packageId;
|
||||
|
||||
if (monoBeh.IsUGUI())
|
||||
{
|
||||
packageId = 198134;
|
||||
}
|
||||
else
|
||||
{
|
||||
packageId = 272042;
|
||||
}
|
||||
|
||||
Application.OpenURL("https://assetstore.unity.com/packages/tools/utilities/" + packageId + "#reviews");
|
||||
|
||||
DontShowRateMe_OnClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DontShowRateMe_OnClick()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
UnityEditor.EditorPrefs.SetInt(FcuConfig.RATEME_PREFS_KEY, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
gui.TopProgressBar(monoBeh.RequestSender.PbarProgress);
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.Space(18);
|
||||
GUILayout.BeginVertical(gui.Data.Resources.FcuLogo, gui.ColoredStyle.Logo);
|
||||
gui.Space30();
|
||||
GUILayout.EndVertical();
|
||||
gui.Space(18);
|
||||
}
|
||||
});
|
||||
|
||||
if (monoBeh.AssetTools.NeedShowRateMe)
|
||||
{
|
||||
RateMeUI();
|
||||
gui.Space(25);
|
||||
}
|
||||
|
||||
UpdateChecker.DrawVersionLine(AssetType.fcu, FcuConfig.Instance.ProductVersion);
|
||||
#if FCU_EXISTS && FCU_UITK_EXT_EXISTS
|
||||
UpdateChecker.DrawVersionLine(AssetType.uitk, FuitkConfig.Instance.ProductVersion);
|
||||
#endif
|
||||
DrawImportInfoLine();
|
||||
DrawCurrentProjectName();
|
||||
}
|
||||
|
||||
private static int GetFirstVersionDaysCount()
|
||||
{
|
||||
try
|
||||
{
|
||||
Asset assetInfo = DAWebConfig.WebConfig.Assets.FirstOrDefault(x => x.Type == AssetType.fcu);
|
||||
AssetVersion firstVersion = assetInfo.Versions.First();
|
||||
|
||||
DateTime firstDt = DateTime.ParseExact(firstVersion.ReleaseDate, "MMM d, yyyy", new System.Globalization.CultureInfo("en-US"));
|
||||
|
||||
int dc = (int)Mathf.Abs((float)(DateTime.Now - firstDt).TotalDays);
|
||||
|
||||
return dc;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
public void DrawSmallHeader()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
DrawImportInfoLine();
|
||||
DrawCurrentProjectName();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawImportInfoLine()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.FlexibleSpace();
|
||||
|
||||
gui.Label10px(new GUIContent($"{Mathf.Round(monoBeh.RequestSender.PbarBytes / 1024)} kB", FcuLocKey.label_kilobytes.Localize()));
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent("—"));
|
||||
|
||||
string userId = monoBeh.Authorizer.CurrentSession.User.Id.SubstringSafe(10);
|
||||
string userName = monoBeh.Authorizer.CurrentSession.User.Name;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userName) == false)
|
||||
{
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent(userName, FcuLocKey.label_user_name.Localize()));
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent("—"));
|
||||
}
|
||||
else if (string.IsNullOrWhiteSpace(userId) == false)
|
||||
{
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent(userId, FcuLocKey.tooltip_user_id.Localize()));
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent("—"));
|
||||
}
|
||||
|
||||
gui.Space5();
|
||||
gui.Label10px(new GUIContent(monoBeh.Guid, FcuLocKey.tooltip_asset_instance_id.Localize()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawCurrentProjectName()
|
||||
{
|
||||
string currentProjectName = monoBeh.CurrentProject.ProjectName;
|
||||
|
||||
if (currentProjectName != null)
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.FlexibleSpace();
|
||||
gui.Label10px(currentProjectName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abb9fafbbe0971843803ff2d85f5e8fd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdffaed3ea1d1924fb13c316d98c2426
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,136 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class TextMeshSection : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private string[] shaderNames = new string[] { };
|
||||
|
||||
private int shaderSelectedIndex = -1;
|
||||
|
||||
public override void OnLink()
|
||||
{
|
||||
SetShaderNames();
|
||||
}
|
||||
|
||||
private void SetShaderNames()
|
||||
{
|
||||
shaderNames = ShaderUtil.GetAllShaderInfo().Select(info => info.name).ToArray();
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
#if TextMeshPro
|
||||
gui.SectionHeader(FcuLocKey.label_textmeshpro_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.AutoSize = gui.Toggle(new GUIContent(FcuLocKey.label_auto_size.Localize(), FcuLocKey.tooltip_auto_size.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.AutoSize);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.OverrideTags = gui.Toggle(new GUIContent(FcuLocKey.label_override_tags.Localize(), FcuLocKey.tooltip_override_tags.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.OverrideTags);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.Wrapping = gui.Toggle(new GUIContent(FcuLocKey.label_wrapping.Localize(), FcuLocKey.tooltip_wrapping.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.Wrapping);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (monoBeh.IsNova() || monoBeh.IsDebug())
|
||||
{
|
||||
monoBeh.Settings.TextMeshSettings.OrthographicMode = gui.Toggle(new GUIContent(FcuLocKey.label_orthographic_mode.Localize(), FcuLocKey.tooltip_orthographic_mode.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.OrthographicMode);
|
||||
|
||||
gui.Space10();
|
||||
}
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.RichText = gui.Toggle(new GUIContent(FcuLocKey.label_rich_text.Localize(), FcuLocKey.tooltip_rich_text.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.RichText);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.RaycastTarget = gui.Toggle(new GUIContent(FcuLocKey.label_raycast_target.Localize(), FcuLocKey.tooltip_raycast_target.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.RaycastTarget);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.ParseEscapeCharacters = gui.Toggle(new GUIContent(FcuLocKey.label_parse_escape_characters.Localize(), FcuLocKey.tooltip_parse_escape_characters.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.ParseEscapeCharacters);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.VisibleDescender = gui.Toggle(new GUIContent(FcuLocKey.label_visible_descender.Localize(), FcuLocKey.tooltip_visible_descender.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.VisibleDescender);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.Kerning = gui.Toggle(new GUIContent(FcuLocKey.label_kerning.Localize(), FcuLocKey.tooltip_kerning.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.Kerning);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.ExtraPadding = gui.Toggle(new GUIContent(FcuLocKey.label_extra_padding.Localize(), FcuLocKey.tooltip_extra_padding.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.ExtraPadding);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.Overflow = gui.EnumField(new GUIContent(FcuLocKey.label_overflow.Localize(), FcuLocKey.tooltip_overflow.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.Overflow);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.HorizontalMapping = gui.EnumField(new GUIContent(FcuLocKey.label_horizontal_mapping.Localize(), FcuLocKey.tooltip_horizontal_mapping.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.HorizontalMapping);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.VerticalMapping = gui.EnumField(new GUIContent(FcuLocKey.label_vertical_mapping.Localize(), FcuLocKey.tooltip_vertical_mapping.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.VerticalMapping);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.GeometrySorting = gui.EnumField(new GUIContent(FcuLocKey.label_geometry_sorting.Localize(), FcuLocKey.tooltip_geometry_sorting.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.GeometrySorting);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
shaderSelectedIndex = gui.ShaderDropdown(new GUIContent(FcuLocKey.label_shader.Localize()), shaderSelectedIndex, shaderNames, (option) =>
|
||||
{
|
||||
monoBeh.Settings.TextMeshSettings.Shader = Shader.Find(shaderNames[option]);
|
||||
});
|
||||
|
||||
#if RTLTMP_EXISTS
|
||||
if (monoBeh.UsingRTLTextMeshPro() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.Farsi = gui.Toggle(new GUIContent(FcuLocKey.label_farsi.Localize(), FcuLocKey.tooltip_farsi.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.Farsi);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.ForceFix = gui.Toggle(new GUIContent(FcuLocKey.label_force_fix.Localize(), FcuLocKey.tooltip_force_fix.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.ForceFix);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.PreserveNumbers = gui.Toggle(new GUIContent(FcuLocKey.label_preserve_numbers.Localize(), FcuLocKey.tooltip_preserve_numbers.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.PreserveNumbers);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextMeshSettings.FixTags = gui.Toggle(new GUIContent(FcuLocKey.label_fix_tags.Localize(), FcuLocKey.tooltip_fix_tags.Localize()),
|
||||
monoBeh.Settings.TextMeshSettings.FixTags);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 175db6af22d7e3a4a9abff4ad74dbf62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class UnityImageSection : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_unity_image_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
if (monoBeh.UsingRawImage() == false)
|
||||
{
|
||||
monoBeh.Settings.UnityImageSettings.Type = gui.EnumField(new GUIContent(FcuLocKey.label_image_type.Localize(), ""),
|
||||
monoBeh.Settings.UnityImageSettings.Type);
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.UnityImageSettings.RaycastTarget = gui.Toggle(new GUIContent(FcuLocKey.label_raycast_target.Localize(), ""),
|
||||
monoBeh.Settings.UnityImageSettings.RaycastTarget);
|
||||
|
||||
if (monoBeh.UsingRawImage() == false)
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.UnityImageSettings.PreserveAspect = gui.Toggle(new GUIContent(FcuLocKey.label_preserve_aspect.Localize(), ""),
|
||||
monoBeh.Settings.UnityImageSettings.PreserveAspect);
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.UnityImageSettings.RaycastPadding = gui.Vector4Field(new GUIContent(FcuLocKey.label_raycast_padding.Localize(), ""),
|
||||
monoBeh.Settings.UnityImageSettings.RaycastPadding);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.UnityImageSettings.Maskable = gui.Toggle(new GUIContent(FcuLocKey.label_maskable.Localize(), ""),
|
||||
monoBeh.Settings.UnityImageSettings.Maskable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 821b2e52453bb0d438e04625e8871e82
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc3c64974e8a14d4aa6af4cd761fea37
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Model;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class AuthTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public override void OnLink()
|
||||
{
|
||||
base.OnLink();
|
||||
monoBeh.Authorizer.Init();
|
||||
}
|
||||
|
||||
internal void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_figma_auth.Localize(), FcuLocKey.label_figma_auth.Localize());
|
||||
gui.Space15();
|
||||
|
||||
if (monoBeh.Authorizer.Options.IsEmpty())
|
||||
{
|
||||
DrawButtons();
|
||||
return;
|
||||
}
|
||||
|
||||
monoBeh.Authorizer.SelectedTableIndex = gui.BigDropdown(monoBeh.Authorizer.SelectedTableIndex, monoBeh.Authorizer.Options, (selected) =>
|
||||
{
|
||||
monoBeh.Authorizer.CurrentSession = monoBeh.Authorizer.RecentSessions[selected];
|
||||
}, expand: false);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
DrawButtons();
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton(new GUIContent("Delete all sessions")))
|
||||
{
|
||||
EditorPrefs.DeleteKey(FcuConfig.FIGMA_SESSIONS_PREFS_KEY);
|
||||
monoBeh.Authorizer.Init();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawButtons()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
if (gui.OutlineButton(new GUIContent("Sign In With Web Browser")))
|
||||
{
|
||||
monoBeh.EventHandlers.Auth_OnClick();
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Sign In With Access Token"))
|
||||
{
|
||||
_ = monoBeh.Authorizer.AddNew(new Model.AuthResult
|
||||
{
|
||||
AccessToken = monoBeh.Authorizer.Token
|
||||
}, AuthType.Manual);
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
FigmaSessionItem session = monoBeh.Authorizer.CurrentSession;
|
||||
|
||||
string token = gui.BigTextField(
|
||||
monoBeh.Authorizer.Token,
|
||||
null);
|
||||
|
||||
AuthResult authResult = session.AuthResult;
|
||||
authResult.AccessToken = token;
|
||||
session.AuthResult = authResult;
|
||||
monoBeh.Authorizer.CurrentSession = session;
|
||||
|
||||
gui.FlexibleSpace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49662f870a48b2d47b38164f3a69e5c3
|
||||
@@ -0,0 +1,16 @@
|
||||
using DA_Assets.DAI;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ButtonsTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
internal void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_buttons_tab.Localize(), FcuLocKey.tooltip_buttons_tab.Localize());
|
||||
gui.Space15();
|
||||
|
||||
gui.DrawObjectFields(monoBeh.Settings.ButtonSettings);
|
||||
gui.DrawObjectFields(monoBeh.Settings.ButtonSettings.UnityButtonSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3380dcddcc9e33240a38d9853d882437
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using DA_Assets.Tools;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class DebugTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private UnityEditor.Editor fcuConfigEditor;
|
||||
|
||||
public override void OnLink()
|
||||
{
|
||||
fcuConfigEditor = UnityEditor.Editor.CreateEditor(FcuConfig.Instance);
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_debug_tools.Localize());
|
||||
gui.Space15();
|
||||
|
||||
FcuDebugSettingsFlags settings = FcuDebugSettings.Settings;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
FcuDebugSettingsFlags newFlags = (FcuDebugSettingsFlags)EditorGUILayout.EnumFlagsField("Debug Settings", settings);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
FcuDebugSettings.Settings = newFlags;
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
if (gui.OutlineButton("Open logs folder"))
|
||||
{
|
||||
FcuConfig.LogPath.OpenFolderInOS();
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Open cache folder"))
|
||||
{
|
||||
FcuConfig.CachePath.OpenFolderInOS();
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Open backup folder"))
|
||||
{
|
||||
SceneBackuper.GetBackupsPath().OpenFolderInOS();
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Test Button"))
|
||||
{
|
||||
TestButton_OnClick();
|
||||
}
|
||||
|
||||
gui.FlexibleSpace();
|
||||
}
|
||||
});
|
||||
|
||||
if (monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space30();
|
||||
|
||||
gui.Colorize(() =>
|
||||
{
|
||||
fcuConfigEditor.OnInspectorGUI();
|
||||
});
|
||||
|
||||
if (scriptableObject.Inspector != null)
|
||||
{
|
||||
gui.Space30();
|
||||
scriptableObject.Inspector.DrawBaseOnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TestButton_OnClick()
|
||||
{
|
||||
//Debug.Log(Color.white);
|
||||
//UnityWebRequest request = UnityWebRequest.Get("http://google.com/generate_204");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8756f6906897ede419956a9b3e9419a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,159 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Serializable]
|
||||
internal class ImageSpritesTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_images_and_sprites_tab.Localize(), FcuLocKey.tooltip_images_and_sprites_tab.Localize());
|
||||
gui.Space15();
|
||||
|
||||
if (monoBeh.IsUGUI())
|
||||
{
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageComponent = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_image_component.Localize(), FcuLocKey.tooltip_image_component.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageComponent, false);
|
||||
|
||||
if (monoBeh.UsingAnyProceduralImage() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Settings.ImageSpritesSettings.ProceduralCondition);
|
||||
}
|
||||
|
||||
if (monoBeh.UsingSvgImage() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Settings.ImageSpritesSettings.SvgCondition);
|
||||
}
|
||||
|
||||
|
||||
if (monoBeh.UsingUnityImage() || monoBeh.UsingRawImage() || monoBeh.IsDebug())
|
||||
{
|
||||
if (UnityEditor.PlayerSettings.colorSpace == ColorSpace.Linear || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
monoBeh.Settings.ImageSpritesSettings.UseImageLinearMaterial = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_use_image_linear_material.Localize(), FcuLocKey.tooltip_use_image_linear_material.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.UseImageLinearMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
}
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageFormat = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_images_format.Localize(), FcuLocKey.tooltip_images_format.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageFormat);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageScale = gui.SliderField(
|
||||
new GUIContent(FcuLocKey.label_images_scale.Localize(), FcuLocKey.tooltip_images_scale.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.ImageScale, 0.25f, 4.0f).RoundToNearest025();
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.MaxSpriteSize = gui.Vector2IntField(
|
||||
new GUIContent(FcuLocKey.label_max_sprite_size.Localize(), FcuLocKey.tooltip_max_sprite_size.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.MaxSpriteSize);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.PixelsPerUnit = gui.FloatField(
|
||||
new GUIContent(FcuLocKey.label_pixels_per_unit.Localize(), FcuLocKey.tooltip_pixels_per_unit.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.PixelsPerUnit);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.RedownloadSprites = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_redownload_sprites.Localize(), FcuLocKey.tooltip_redownload_sprites.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.RedownloadSprites);
|
||||
|
||||
bool procedural = monoBeh.UsingAnyProceduralImage() || monoBeh.IsUITK() || monoBeh.IsNova();
|
||||
|
||||
if (procedural || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.DownloadMultipleFills = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_download_multiple_fills.Localize(), FcuLocKey.tooltip_download_multiple_fills.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.DownloadMultipleFills);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.DownloadUnsupportedGradients = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_download_unsupported_gradients.Localize(), FcuLocKey.tooltip_download_unsupported_gradients.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.DownloadUnsupportedGradients);
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.PreserveRatioMode = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_preserve_ratio_mode.Localize(), FcuLocKey.tooltip_preserve_ratio_mode.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.PreserveRatioMode, uppercase: false);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ImageSpritesSettings.SpritesPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_sprites_path.Localize(), FcuLocKey.tooltip_sprites_path.Localize()),
|
||||
monoBeh.Settings.ImageSpritesSettings.SpritesPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_folder.Localize());
|
||||
|
||||
if (monoBeh.IsUGUI())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
switch (monoBeh.Settings.ImageSpritesSettings.ImageComponent)
|
||||
{
|
||||
case ImageComponent.UnityImage:
|
||||
case ImageComponent.RawImage:
|
||||
this.UnityImageSettingsSection.Draw();
|
||||
break;
|
||||
case ImageComponent.SubcShape:
|
||||
gui.SectionHeader(FcuLocKey.label_shapes2d_settings.Localize());
|
||||
gui.Space15();
|
||||
gui.DrawObjectFields(monoBeh.Settings.Shapes2DSettings);
|
||||
break;
|
||||
case ImageComponent.ProceduralImage:
|
||||
gui.DrawObjectFields(monoBeh.Settings.JoshPuiSettings);
|
||||
break;
|
||||
case ImageComponent.RoundedImage:
|
||||
gui.DrawObjectFields(monoBeh.Settings.DttPuiSettings);
|
||||
break;
|
||||
case ImageComponent.MPImage:
|
||||
gui.DrawObjectFields(monoBeh.Settings.MPUIKitSettings);
|
||||
break;
|
||||
case ImageComponent.SpriteRenderer:
|
||||
gui.DrawObjectFields(monoBeh.Settings.SpriteRendererSettings);
|
||||
break;
|
||||
case ImageComponent.SvgImage:
|
||||
gui.DrawObjectFields(monoBeh.Settings.SvgImageSettings);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
gui.DrawObjectFields(monoBeh.Settings.TextureImporterSettings);
|
||||
|
||||
if (monoBeh.IsUGUI())
|
||||
{
|
||||
if (monoBeh.UsingSvgImage() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
gui.DrawObjectFields(monoBeh.Settings.SVGImporterSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private UnityImageSection unityImageSettingsSection;
|
||||
internal UnityImageSection UnityImageSettingsSection => monoBeh.Link(ref unityImageSettingsSection, scriptableObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c71431a8765be9b49b63b897feee765f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
using DA_Assets.DAI;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ImportEventsTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
internal void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_import_events.Localize());
|
||||
gui.Space15();
|
||||
|
||||
#if UNITY_2020_1_OR_NEWER == false
|
||||
gui.Label12px(FcuLocKey.label_supported_from_unity_version.Localize("2020.1.0"));
|
||||
return;
|
||||
#endif
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Events.OnObjectInstantiate);
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Events.OnAddComponent);
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Events.OnImportStart);
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Events.OnImportComplete);
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Events.OnImportFail);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cec4a2211705fe04bbce17d18bdde95e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
#if DALOC_EXISTS
|
||||
using DA_Assets.DAL;
|
||||
#endif
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class LocalizationTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private GenericMenu _selectLangMenu;
|
||||
|
||||
public override void OnLink()
|
||||
{
|
||||
base.OnLink();
|
||||
|
||||
#if DALOC_EXISTS
|
||||
_selectLangMenu = LanguageCollector.CreateLanguageMenu((cultureCode) =>
|
||||
{
|
||||
monoBeh.Settings.LocalizationSettings.CurrentFigmaLayoutCulture = cultureCode;
|
||||
Debug.Log(cultureCode);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_localization_settings.Localize(), FcuLocKey.tooltip_localization_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.LocalizationComponent = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_loc_component.Localize(), FcuLocKey.tooltip_loc_component.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.LocalizationComponent, false, null);
|
||||
|
||||
if (monoBeh.Settings.LocalizationSettings.LocalizationComponent == LocalizationComponent.None)
|
||||
return;
|
||||
|
||||
if (monoBeh.Settings.LocalizationSettings.LocalizationComponent == LocalizationComponent.DALocalizator || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
#if DALOC_EXISTS
|
||||
monoBeh.Settings.LocalizationSettings.Localizator = (ScriptableObject)gui.ObjectField(
|
||||
new GUIContent(FcuLocKey.label_localizator.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.Localizator,
|
||||
typeof(LocalizatorBase<>),
|
||||
false);
|
||||
#endif
|
||||
if (monoBeh.Settings.LocalizationSettings.Localizator == null)
|
||||
{
|
||||
gui.Space10();
|
||||
string message = $"Before starting the import, you need to serialize your localizer into the '{nameof(monoBeh.Settings.LocalizationSettings.Localizator)}' field.";
|
||||
gui.HelpBox(message, MessageType.Warning);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.LocKeyMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_loc_key_max_lenght.Localize(), FcuLocKey.tooltip_loc_key_max_lenght.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.LocKeyMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.LocKeyCaseType = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_loc_case_type.Localize(), FcuLocKey.tooltip_loc_case_type.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.LocKeyCaseType, false, null);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
|
||||
gui.GenericMenu(_selectLangMenu, new GUIContent(FcuLocKey.label_figma_layout_culture.Localize()), monoBeh.Settings.LocalizationSettings.CurrentFigmaLayoutCulture);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.CsvSeparator = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_csv_separator.Localize(), FcuLocKey.tooltip_csv_separator.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.CsvSeparator, false, null);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.LocFolderPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_loc_folder_path.Localize(), FcuLocKey.tooltip_loc_folder_path.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.LocFolderPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_folder.Localize());
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.LocalizationSettings.LocFileName = gui.TextField(
|
||||
new GUIContent(FcuLocKey.label_loc_file_name.Localize(), FcuLocKey.tooltip_loc_file_name.Localize()),
|
||||
monoBeh.Settings.LocalizationSettings.LocFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c393fed78a4b574b8cbdc56c6878ff1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class MainSettingsTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_main_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
gui.EnumField(new GUIContent(FcuLocKey.label_ui_framework.Localize(), FcuLocKey.tooltip_ui_framework.Localize()),
|
||||
monoBeh.Settings.MainSettings.UIFramework, onChange: (newValue) =>
|
||||
{
|
||||
monoBeh.Settings.MainSettings.UIFramework = newValue;
|
||||
scriptableObject.CreateTabs();
|
||||
});
|
||||
|
||||
if (monoBeh.IsUGUI() || monoBeh.IsNova() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.GameObjectLayer = gui.LayerField(
|
||||
new GUIContent(FcuLocKey.label_go_layer.Localize(), FcuLocKey.tooltip_go_layer.Localize()),
|
||||
monoBeh.Settings.MainSettings.GameObjectLayer);
|
||||
}
|
||||
|
||||
if (monoBeh.IsUGUI() || monoBeh.IsDebug())
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.PositioningMode = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_positioning_mode.Localize(), FcuLocKey.tooltip_positioning_mode.Localize()),
|
||||
monoBeh.Settings.MainSettings.PositioningMode);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.PivotType = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_pivot_type.Localize(), FcuLocKey.tooltip_pivot_type.Localize()),
|
||||
monoBeh.Settings.MainSettings.PivotType, uppercase: false);
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.GameObjectNameMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_go_name_max_length.Localize(), FcuLocKey.tooltip_go_name_max_length.Localize()),
|
||||
monoBeh.Settings.MainSettings.GameObjectNameMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.TextObjectNameMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_text_name_max_length.Localize(), FcuLocKey.tooltip_text_name_max_length.Localize()),
|
||||
monoBeh.Settings.MainSettings.TextObjectNameMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.RawImport = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_raw_import.Localize(), FcuLocKey.tooltip_raw_import.Localize()),
|
||||
monoBeh.Settings.MainSettings.RawImport);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.MainSettings.Https = gui.Toggle(
|
||||
new GUIContent(FcuLocKey.label_https_setting.Localize(), FcuLocKey.tooltip_https_setting.Localize()),
|
||||
monoBeh.Settings.MainSettings.Https);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.Settings.MainSettings.AllowedNameChars);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ffd4dd692a651b41ba4091cc11843ef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,19 @@
|
||||
using DA_Assets.DAI;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class MainTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
if (scriptableObject.Inspector.Header.MonoBeh == null)
|
||||
{
|
||||
scriptableObject.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptableObject.Inspector.DrawGUI(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c6e102231dc1ca4d91278f3df36b835
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
using DA_Assets.DAI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class PrefabCreatorTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_prefab_creator.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.PrefabSettings.PrefabsPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_prefabs_path.Localize(), FcuLocKey.tooltip_prefabs_path.Localize()),
|
||||
monoBeh.Settings.PrefabSettings.PrefabsPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_prefabs_folder.Localize());
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.PrefabSettings.TextPrefabNameType = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_text_prefab_naming_mode.Localize(), ""),
|
||||
monoBeh.Settings.PrefabSettings.TextPrefabNameType,
|
||||
false,
|
||||
new string[]
|
||||
{
|
||||
FcuLocKey.label_humanized_color.Localize(),
|
||||
FcuLocKey.label_hex_color.Localize(),
|
||||
FcuLocKey.label_figma_color.Localize()
|
||||
});
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Create", expand: true))
|
||||
{
|
||||
monoBeh.EventHandlers.CreatePrefabs_OnClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7be24b6c94abcd64bbee96b29486add5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
using DA_Assets.DAI;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ScriptGeneratorTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_script_generator.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.SerializationMode = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_serialization_mode.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.SerializationMode, uppercase: false);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.Namespace = gui.TextField(
|
||||
new GUIContent(FcuLocKey.label_namespace.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.Namespace);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.BaseClass = gui.TextField(
|
||||
new GUIContent(FcuLocKey.label_base_class.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.BaseClass);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.OutputPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_scripts_output_path.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.OutputPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_folder.Localize());
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.FieldNameMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_field_name_max_length.Localize(), FcuLocKey.tooltip_field_name_max_length.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.FieldNameMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.MethodNameMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_method_name_max_length.Localize(), FcuLocKey.tooltip_method_name_max_length.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.MethodNameMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.ScriptGeneratorSettings.ClassNameMaxLenght = gui.IntField(
|
||||
new GUIContent(FcuLocKey.label_class_name_max_length.Localize(), FcuLocKey.tooltip_class_name_max_length.Localize()),
|
||||
monoBeh.Settings.ScriptGeneratorSettings.ClassNameMaxLenght);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Generate scripts", expand: true))
|
||||
{
|
||||
monoBeh.EventHandlers.GenerateScripts_OnClick();
|
||||
}
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.OutlineButton("Serialize objects", expand: true))
|
||||
{
|
||||
monoBeh.EventHandlers.SerializeObjects_OnClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c2f27bf5bbe2ecf4cab69da3888f42e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
using DA_Assets.DAI;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ShadowsTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_shadows_tab.Localize(), FcuLocKey.tooltip_shadows_tab.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.ShadowSettings.ShadowComponent = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_shadow_type.Localize(), FcuLocKey.tooltip_shadow_type.Localize()),
|
||||
monoBeh.Settings.ShadowSettings.ShadowComponent, false);
|
||||
|
||||
gui.Space30();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47b9dee7b703f67449fac7748187f819
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,195 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Model;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Serializable]
|
||||
internal class TextFontsTab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_text_and_fonts.Localize(), FcuLocKey.tooltip_text_and_fonts.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.Settings.TextFontsSettings.TextComponent = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_text_component.Localize(), FcuLocKey.tooltip_text_component.Localize()),
|
||||
monoBeh.Settings.TextFontsSettings.TextComponent, false);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextFontsSettings.OverrideLetterSpacing = gui.Toggle(new GUIContent(FcuLocKey.label_override_tmp_letter_spacing.Localize(), FcuLocKey.tooltip_override_tmp_letter_spacing.Localize()),
|
||||
monoBeh.Settings.TextFontsSettings.OverrideLetterSpacing);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.TextFontsSettings.OverrideLineSpacingPx = gui.Toggle(new GUIContent(FcuLocKey.label_override_line_spacing_px.Localize(), FcuLocKey.tooltip_override_line_spacing_px.Localize()),
|
||||
monoBeh.Settings.TextFontsSettings.OverrideLineSpacingPx);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
switch (monoBeh.Settings.TextFontsSettings.TextComponent)
|
||||
{
|
||||
case TextComponent.UnityText:
|
||||
DrawDefaultTextSettings();
|
||||
break;
|
||||
case TextComponent.TextMeshPro:
|
||||
case TextComponent.RTLTextMeshPro:
|
||||
this.TextMeshSettingsSection.Draw();
|
||||
break;
|
||||
}
|
||||
|
||||
gui.Space15();
|
||||
gui.SectionHeader(FcuLocKey.label_font_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
DrawPathSettings();
|
||||
|
||||
gui.Space15();
|
||||
|
||||
DrawGoogleFontsSettings();
|
||||
|
||||
#if TextMeshPro
|
||||
gui.Space15();
|
||||
DrawFontGenerationSettings();
|
||||
#endif
|
||||
|
||||
gui.Space30();
|
||||
}
|
||||
|
||||
public void DrawDefaultTextSettings()
|
||||
{
|
||||
gui.DrawObjectFields(monoBeh.Settings.UnityTextSettings);
|
||||
|
||||
if (monoBeh.Settings.UnityTextSettings.VerticalWrapMode == VerticalWrapMode.Overflow)
|
||||
{
|
||||
monoBeh.Settings.UnityTextSettings.BestFit = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawFontGenerationSettings()
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_asset_creator_settings.Localize(), FcuLocKey.tooltip_asset_creator_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
monoBeh.FontDownloader.TmpDownloader.SamplingPointSize = gui.IntField(new GUIContent(FcuLocKey.label_sampling_point_size.Localize(), FcuLocKey.tooltip_sampling_point_size.Localize()),
|
||||
monoBeh.FontDownloader.TmpDownloader.SamplingPointSize);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasPadding = gui.IntField(new GUIContent(FcuLocKey.label_atlas_padding.Localize(), FcuLocKey.tooltip_atlas_padding.Localize()),
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasPadding);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.FontDownloader.TmpDownloader.RenderMode = gui.EnumField(new GUIContent(FcuLocKey.label_render_mode.Localize(), FcuLocKey.tooltip_render_mode.Localize()),
|
||||
monoBeh.FontDownloader.TmpDownloader.RenderMode);
|
||||
|
||||
gui.Space10();
|
||||
|
||||
Vector2Int atlasResolution = new Vector2Int(monoBeh.FontDownloader.TmpDownloader.AtlasWidth, monoBeh.FontDownloader.TmpDownloader.AtlasHeight);
|
||||
atlasResolution = gui.Vector2IntField(new GUIContent(FcuLocKey.label_atlas_resolution.Localize(), FcuLocKey.tooltip_atlas_resolution.Localize()), atlasResolution);
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasWidth = atlasResolution.x;
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasHeight = atlasResolution.y;
|
||||
|
||||
gui.Space10();
|
||||
|
||||
#if TextMeshPro
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasPopulationMode = gui.EnumField(new GUIContent(FcuLocKey.label_atlas_population_mode.Localize(), FcuLocKey.tooltip_atlas_population_mode.Localize()),
|
||||
monoBeh.FontDownloader.TmpDownloader.AtlasPopulationMode);
|
||||
#endif
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.FontDownloader.TmpDownloader.EnableMultiAtlasSupport = gui.Toggle(new GUIContent(FcuLocKey.label_enable_multi_atlas_support.Localize(), FcuLocKey.tooltip_enable_multi_atlas_support.Localize()),
|
||||
monoBeh.FontDownloader.TmpDownloader.EnableMultiAtlasSupport);
|
||||
|
||||
gui.Space15();
|
||||
|
||||
if (gui.OutlineButton(FcuLocKey.label_download_fonts_from_project.Localize(monoBeh.Settings.TextFontsSettings.TextComponent)))
|
||||
{
|
||||
_ = monoBeh.FontDownloader.DownloadAllProjectFonts();
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawGoogleFontsSettings()
|
||||
{
|
||||
gui.SectionHeader(FcuLocKey.label_google_fonts_settings.Localize());
|
||||
gui.Space15();
|
||||
|
||||
FcuConfig.Instance.GoogleFontsApiKey = gui.TextField(
|
||||
new GUIContent(FcuLocKey.label_google_fonts_api_key.Localize(), FcuLocKey.tooltip_google_fonts_api_key.Localize(FcuLocKey.label_google_fonts_api_key.Localize())),
|
||||
FcuConfig.Instance.GoogleFontsApiKey,
|
||||
new GUIContent(FcuLocKey.label_get_google_api_key.Localize()), () =>
|
||||
{
|
||||
Application.OpenURL("https://developers.google.com/fonts/docs/developer_api#identifying_your_application_to_google");
|
||||
});
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.FontDownloader.GFontsApi.FontSubsets |= FontSubset.Latin;
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(
|
||||
scriptableObject.SerializedObject, x => x.FontDownloader.GFontsApi.FontSubsets);
|
||||
}
|
||||
|
||||
private void DrawPathSettings()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
monoBeh.FontLoader.TtfFontsPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_ttf_path.Localize(), ""),
|
||||
monoBeh.FontLoader.TtfFontsPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_fonts_folder.Localize());
|
||||
|
||||
gui.Space10();
|
||||
|
||||
if (gui.SubButtonText(FcuLocKey.label_add_ttf_fonts_from_folder.Localize(), FcuLocKey.tooltip_add_fonts_from_folder.Localize()))
|
||||
{
|
||||
_ = monoBeh.FontLoader.AddToTtfFontsList();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gui.Space5();
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.FontLoader.TtfFonts);
|
||||
|
||||
#if TextMeshPro
|
||||
gui.Space15();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
monoBeh.FontLoader.TmpFontsPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_tmp_path.Localize(), ""),
|
||||
monoBeh.FontLoader.TmpFontsPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_fonts_folder.Localize());
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.SubButtonText(FcuLocKey.label_add_tmp_fonts_from_folder.Localize(), FcuLocKey.tooltip_add_fonts_from_folder.Localize()))
|
||||
{
|
||||
_ = monoBeh.FontLoader.AddToTmpMeshFontsList();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space5();
|
||||
|
||||
gui.SerializedPropertyField<FigmaConverterUnity>(scriptableObject.SerializedObject, x => x.FontLoader.TmpFonts);
|
||||
#endif
|
||||
}
|
||||
|
||||
private TextMeshSection textMeshSettingsSection;
|
||||
internal TextMeshSection TextMeshSettingsSection => monoBeh.Link(ref textMeshSettingsSection, scriptableObject);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc10d3e2df124c14e8bd38c05576df10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
using DA_Assets.DAI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class UITK_Tab : MonoBehaviourLinkerEditor<FcuSettingsWindow, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
public void Draw()
|
||||
{
|
||||
gui.TabHeader(FcuLocKey.label_ui_toolkit_tab.Localize(), FcuLocKey.tooltip_ui_toolkit_tab.Localize());
|
||||
gui.Space15();
|
||||
|
||||
#if UITK_LINKER_EXISTS
|
||||
monoBeh.Settings.UITK_Settings.UitkLinkingMode = gui.EnumField(
|
||||
new GUIContent(FcuLocKey.label_uitk_linking_mode.Localize(), FcuLocKey.tooltip_uitk_linking_mode.Localize()),
|
||||
monoBeh.Settings.UITK_Settings.UitkLinkingMode);
|
||||
#endif
|
||||
|
||||
gui.Space10();
|
||||
|
||||
monoBeh.Settings.UITK_Settings.UitkOutputPath = gui.FolderField(
|
||||
new GUIContent(FcuLocKey.label_uitk_output_path.Localize(), FcuLocKey.tooltip_uitk_output_path.Localize()),
|
||||
monoBeh.Settings.UITK_Settings.UitkOutputPath,
|
||||
new GUIContent(FcuLocKey.label_change.Localize()),
|
||||
FcuLocKey.label_select_folder.Localize());
|
||||
|
||||
gui.Space10();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb361c999f81c4e4b99de284aa558d38
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d24035235f43962478f3bd5a675503d5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,96 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Model;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class ComparerWindow : EditorWindow
|
||||
{
|
||||
private static Vector2 windowSize = new Vector2(410, 290);
|
||||
private SyncHelper sh1, sh2;
|
||||
private DAInspector gui => BlackInspector.Instance.Inspector;
|
||||
|
||||
public static void Show(SyncHelper sh1, SyncHelper sh2)
|
||||
{
|
||||
ComparerWindow win = GetWindow<ComparerWindow>(FcuLocKey.label_object_comparer.Localize());
|
||||
win.SetModel(sh1, sh2);
|
||||
|
||||
win.position = new Rect(
|
||||
(Screen.currentResolution.width - windowSize.x * 2) / 2,
|
||||
(Screen.currentResolution.height - windowSize.y * 2) / 2,
|
||||
windowSize.x,
|
||||
windowSize.y);
|
||||
}
|
||||
|
||||
public void SetModel(SyncHelper sh1, SyncHelper sh2)
|
||||
{
|
||||
this.sh1 = sh1;
|
||||
this.sh2 = sh2;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.TabBg2,
|
||||
Scroll = true,
|
||||
Body = () =>
|
||||
{
|
||||
gui.Label12px(FcuLocKey.label_comparer_desc.Localize(FcuLocKey.label_open_diff_checker.Localize()));
|
||||
|
||||
gui.Space5();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
GUILayout.TextArea(sh1.Data.HashDataTree, GUILayout.Height(100));
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.OutlineButton(FcuLocKey.label_copy_to_clipboard.Localize(), null, true))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = sh1.Data.HashDataTree;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space5();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Body = () =>
|
||||
{
|
||||
GUILayout.TextArea(sh2.Data.HashDataTree, GUILayout.Height(100));
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.OutlineButton(FcuLocKey.label_copy_to_clipboard.Localize(), null, true))
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = sh2.Data.HashDataTree;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space5();
|
||||
|
||||
if (gui.OutlineButton(FcuLocKey.label_open_diff_checker.Localize(), null, true))
|
||||
{
|
||||
Application.OpenURL($"https://www.diffchecker.com/");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 050d9c123abe21749a4c690ea0ac76dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,230 @@
|
||||
using DA_Assets.DAI;
|
||||
using DA_Assets.FCU.Extensions;
|
||||
using DA_Assets.Tools;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable IDE0003
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
internal class FcuSettingsWindow : LinkedEditorWindow<FcuSettingsWindow, FcuEditor, FigmaConverterUnity, BlackInspector>
|
||||
{
|
||||
private List<UITab> _tabs = new List<UITab>();
|
||||
private int _selectedTab = 0;
|
||||
private AssetVersion _currentVersion;
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
CreateTabs();
|
||||
_currentVersion = UpdateChecker.GetCurrentVersionInfo(AssetType.fcu, FcuConfig.Instance.ProductVersion);
|
||||
}
|
||||
|
||||
public void CreateTabs()
|
||||
{
|
||||
_tabs.Clear();
|
||||
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
UITab assetTab = new UITab(FcuLocKey.label_asset.Localize(), null, this.MainTab.Draw);
|
||||
_tabs.Add(assetTab);
|
||||
}
|
||||
|
||||
UITab mainSettingTab = new UITab(FcuLocKey.label_main_settings.Localize(), null, this.MainSettingsTab.Draw);
|
||||
_tabs.Add(mainSettingTab);
|
||||
|
||||
UITab authTab = new UITab(FcuLocKey.label_figma_auth.Localize(), FcuLocKey.tooltip_figma_auth.Localize(), this.AuthorizerTab.Draw);
|
||||
_tabs.Add(authTab);
|
||||
|
||||
UITab imageSpritesTab = new UITab(FcuLocKey.label_images_and_sprites_tab.Localize(), FcuLocKey.tooltip_images_and_sprites_tab.Localize(), this.ImageSpritesTab.Draw);
|
||||
_tabs.Add(imageSpritesTab);
|
||||
|
||||
UITab textFontTab = new UITab(FcuLocKey.label_text_and_fonts.Localize(), FcuLocKey.tooltip_text_and_fonts.Localize(), this.TextFontsTab.Draw);
|
||||
_tabs.Add(textFontTab);
|
||||
|
||||
if (monoBeh.IsUGUI() || monoBeh.IsNova() || monoBeh.IsDebug())
|
||||
{
|
||||
UITab buttonsTab = new UITab(FcuLocKey.label_buttons_tab.Localize(), FcuLocKey.tooltip_buttons_tab.Localize(), this.ButtonsTab.Draw);
|
||||
_tabs.Add(buttonsTab);
|
||||
}
|
||||
|
||||
UITab uitkTab = new UITab(FcuLocKey.label_ui_toolkit_tab.Localize(), FcuLocKey.tooltip_ui_toolkit_tab.Localize(), this.UITK_Tab.Draw);
|
||||
_tabs.Add(uitkTab);
|
||||
|
||||
UITab locTab = new UITab(FcuLocKey.label_localization_settings.Localize(), null, this.LocalizationTab.Draw);
|
||||
_tabs.Add(locTab);
|
||||
|
||||
if (monoBeh.IsUGUI() || monoBeh.IsDebug())
|
||||
{
|
||||
UITab shadowsTab = new UITab(FcuLocKey.label_shadows_tab.Localize(), FcuLocKey.tooltip_shadows_tab.Localize(), this.ShadowsTab.Draw);
|
||||
_tabs.Add(shadowsTab);
|
||||
}
|
||||
|
||||
if (monoBeh.IsUGUI() || monoBeh.IsNova() || monoBeh.IsDebug())
|
||||
{
|
||||
UITab prefabsTab = new UITab(FcuLocKey.label_prefab_creator.Localize(), null, this.PrefabCreatorTab.Draw);
|
||||
_tabs.Add(prefabsTab);
|
||||
}
|
||||
|
||||
UITab scriptGeneratorTab = new UITab(FcuLocKey.label_script_generator.Localize(), FcuLocKey.tooltip_script_generator.Localize(), this.ScriptGeneratorTab.Draw);
|
||||
_tabs.Add(scriptGeneratorTab);
|
||||
|
||||
UITab importEventsTab = new UITab(FcuLocKey.label_import_events.Localize(), null, this.ImportEventsTab.Draw);
|
||||
_tabs.Add(importEventsTab);
|
||||
|
||||
UITab debugTools = new UITab(FcuLocKey.label_debug.Localize(), FcuLocKey.tooltip_debug_tools.Localize(), this.DebugTab.Draw);
|
||||
_tabs.Add(debugTools);
|
||||
|
||||
_tabs[_selectedTab].Selected = true;
|
||||
}
|
||||
|
||||
public override void DrawGUI()
|
||||
{
|
||||
if (_tabs.Count < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (monoBeh.Settings.MainSettings.WindowMode)
|
||||
{
|
||||
titleContent = new GUIContent(FcuLocKey.label_fcu.Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
titleContent = new GUIContent(FcuLocKey.label_settings.Localize());
|
||||
}
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
DrawMenu();
|
||||
gui.VerticalSeparator();
|
||||
DrawTabContent();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawMenu()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.HamburgerTabsBg,
|
||||
Options = new[] { GUILayout.Width(200) },
|
||||
Scroll = true,
|
||||
InstanceId = monoBeh.GetInstanceID(),
|
||||
Body = () =>
|
||||
{
|
||||
for (int i = 0; i < _tabs.Count; i++)
|
||||
{
|
||||
if (gui.TabButton(_tabs[i]))
|
||||
{
|
||||
_selectedTab = i;
|
||||
_tabs[i].Selected = true;
|
||||
|
||||
for (int j = 0; j < _tabs.Count; j++)
|
||||
{
|
||||
if (i != j)
|
||||
{
|
||||
_tabs[j].Selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gui.FlexibleSpace();
|
||||
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Horizontal,
|
||||
Body = () =>
|
||||
{
|
||||
gui.Space10();
|
||||
|
||||
switch (_currentVersion.VersionType)
|
||||
{
|
||||
case VersionType.stable:
|
||||
gui.Label10px(FcuLocKey.label_stable_version.Localize(), null);
|
||||
break;
|
||||
case VersionType.beta:
|
||||
gui.Label10px(FcuLocKey.label_beta_version.Localize(), null);
|
||||
break;
|
||||
case VersionType.buggy:
|
||||
gui.RedLinkLabel10px(new GUIContent(FcuLocKey.label_buggy_version.Localize()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
gui.Space(7);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawTabContent()
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.TabBg1,
|
||||
Scroll = true,
|
||||
InstanceId = monoBeh.GetInstanceID(),
|
||||
Body = () =>
|
||||
{
|
||||
gui.DrawGroup(new Group
|
||||
{
|
||||
GroupType = GroupType.Vertical,
|
||||
Style = gui.ColoredStyle.TabBg2,
|
||||
Body = () =>
|
||||
{
|
||||
_tabs[_selectedTab].Content.Invoke();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private MainTab mainTab;
|
||||
internal MainTab MainTab => monoBeh.Link(ref mainTab, this);
|
||||
|
||||
private LocalizationTab localizationTab;
|
||||
internal LocalizationTab LocalizationTab => monoBeh.Link(ref localizationTab, this);
|
||||
|
||||
private ButtonsTab buttonsTab;
|
||||
internal ButtonsTab ButtonsTab => monoBeh.Link(ref buttonsTab, this);
|
||||
|
||||
private MainSettingsTab mainSettingsTab;
|
||||
internal MainSettingsTab MainSettingsTab => monoBeh.Link(ref mainSettingsTab, this);
|
||||
|
||||
private ScriptGeneratorTab scriptGeneratorTab;
|
||||
internal ScriptGeneratorTab ScriptGeneratorTab => monoBeh.Link(ref scriptGeneratorTab, this);
|
||||
|
||||
private AuthTab authorizerTab;
|
||||
internal AuthTab AuthorizerTab => monoBeh.Link(ref authorizerTab, this);
|
||||
|
||||
private TextFontsTab textFontsTab;
|
||||
internal TextFontsTab TextFontsTab => monoBeh.Link(ref textFontsTab, this);
|
||||
|
||||
private UITK_Tab uitkTab;
|
||||
internal UITK_Tab UITK_Tab => monoBeh.Link(ref uitkTab, this);
|
||||
|
||||
private ImageSpritesTab imageSpritesTab;
|
||||
internal ImageSpritesTab ImageSpritesTab => monoBeh.Link(ref imageSpritesTab, this);
|
||||
|
||||
private ShadowsTab shadowsTab;
|
||||
internal ShadowsTab ShadowsTab => monoBeh.Link(ref shadowsTab, this);
|
||||
|
||||
private ImportEventsTab importEventsTab;
|
||||
internal ImportEventsTab ImportEventsTab => monoBeh.Link(ref importEventsTab, this);
|
||||
|
||||
private DebugTab debugTab;
|
||||
internal DebugTab DebugTab => monoBeh.Link(ref debugTab, this);
|
||||
|
||||
private PrefabCreatorTab prefabCreatorTab;
|
||||
internal PrefabCreatorTab PrefabCreatorTab => monoBeh.Link(ref prefabCreatorTab, this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f33d6c165f60e2a40b16636d85ef8189
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user