Update
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b40e3faf7d1d5d246b54948d4954d6fd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c4710d8a48c84746bbf512826a589d0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 049369e8fc56b424096f0b61f0382cc6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 712e0d67c6de2c84eb01f7eb27910519
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,22 @@
|
||||
#if JSONNET_EXISTS
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace DA_Assets.FCU.Model
|
||||
{
|
||||
public struct AuthResult
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("access_token")]
|
||||
#endif
|
||||
public string AccessToken { get; set; }
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("expires_in")]
|
||||
#endif
|
||||
public string ExpiresIn { get; set; }
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("refresh_token")]
|
||||
#endif
|
||||
public string RefreshToken { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 354bdafd6ab9b134faecff943a0ff340
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3731067170012443ab12dd8ea9fca47
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
|
||||
#if JSONNET_EXISTS
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace DA_Assets.FCU.Model
|
||||
{
|
||||
[Serializable]
|
||||
public struct FigmaUser
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("id")]
|
||||
#endif
|
||||
public string Id { get; set; }
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("handle")]
|
||||
#endif
|
||||
public string Name { get; set; }
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("email")]
|
||||
#endif
|
||||
public string Email { get; set; }
|
||||
#if JSONNET_EXISTS
|
||||
[JsonProperty("img_url")]
|
||||
#endif
|
||||
public string ImgUrl { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4900b6b9596bc5d4092a7c186a9d682d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 35d4bf06fd4d60148a0a52f6345aa8ff
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace DA_Assets.FCU.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Field, AllowMultiple = false)]
|
||||
public class FObjectAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// The object's name in Figma.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
public FObjectAttribute(string name)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af80620cfa3a6394b8b14198dc5f84d4
|
||||
@@ -0,0 +1,41 @@
|
||||
using DA_Assets.DAI;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
|
||||
public class FcuInspectorProperty : CustomInspectorProperty
|
||||
{
|
||||
public FcuInspectorProperty(
|
||||
ComponentType type,
|
||||
FcuLocKey label,
|
||||
FcuLocKey tooltip,
|
||||
float minValue = 0,
|
||||
float maxValue = 1) : base(type, new GUIContent(GetLabelFromEnum(label), GetLabelFromEnum(tooltip)), minValue, maxValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static string GetLabelFromEnum(FcuLocKey value)
|
||||
{
|
||||
return value.Localize();
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false)]
|
||||
public class FcuPropertyHeader : PropertyHeader
|
||||
{
|
||||
public FcuPropertyHeader(
|
||||
FcuLocKey label,
|
||||
FcuLocKey tooltip) : base(new GUIContent(GetLabelFromEnum(label), GetLabelFromEnum(tooltip)))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private static string GetLabelFromEnum(FcuLocKey value)
|
||||
{
|
||||
return value.Localize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c43b919dc8a35843b4a83a298c874a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
|
||||
namespace DA_Assets.FCU.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Field, Inherited = false, AllowMultiple = false)]
|
||||
public sealed class PaintPriorityAttribute : Attribute
|
||||
{
|
||||
public int Priority { get; }
|
||||
|
||||
public PaintPriorityAttribute(int priority)
|
||||
{
|
||||
Priority = priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa800b8053a516044b19668e55e95eff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e74f51a5e6e3c24da8a04e17eb043cf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,162 @@
|
||||
using DA_Assets.Constants;
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Model;
|
||||
using DA_Assets.Singleton;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[CreateAssetMenu(menuName = DAConstants.Publisher + "/FCU Config")]
|
||||
public class FcuConfig : AssetConfig<FcuConfig>
|
||||
{
|
||||
[SerializeField] List<TagConfig> tags;
|
||||
public List<TagConfig> TagConfigs => tags;
|
||||
|
||||
[Header("File names")]
|
||||
[SerializeField] string webLogFileName;
|
||||
public string WebLogFileName => webLogFileName;
|
||||
|
||||
[Header("Formats")]
|
||||
[SerializeField] string dateTimeFormat1;
|
||||
public string DateTimeFormat1 => dateTimeFormat1;
|
||||
|
||||
[SerializeField] string dateTimeFormat2;
|
||||
public string DateTimeFormat2 => dateTimeFormat2;
|
||||
|
||||
[SerializeField] string dateTimeFormat3;
|
||||
public string DateTimeFormat3 => dateTimeFormat3;
|
||||
|
||||
[Header("GameObject names")]
|
||||
[SerializeField] string canvasGameObjectName;
|
||||
public string CanvasGameObjectName => canvasGameObjectName;
|
||||
[SerializeField] string i2LocGameObjectName;
|
||||
public string I2LocGameObjectName => i2LocGameObjectName;
|
||||
|
||||
[Header("Values")]
|
||||
[SerializeField] int recentProjectsLimit = 20;
|
||||
public int RecentProjectsLimit => recentProjectsLimit;
|
||||
|
||||
[SerializeField] int figmaSessionsLimit = 10;
|
||||
public int FigmaSessionsLimit => figmaSessionsLimit;
|
||||
|
||||
[SerializeField] int logFilesLimit = 50;
|
||||
public int LogFilesLimit => logFilesLimit;
|
||||
|
||||
[SerializeField] int maxRenderSize = 4096;
|
||||
public int MaxRenderSize => maxRenderSize;
|
||||
|
||||
[SerializeField] int renderUpscaleFactor = 2;
|
||||
public int RenderUpscaleFactor => renderUpscaleFactor;
|
||||
|
||||
[SerializeField] string blurredObjectTag = "UIBlur";
|
||||
public string BlurredObjectTag => blurredObjectTag;
|
||||
|
||||
[SerializeField] string blurCameraTag = "BackgroundBlur";
|
||||
public string BlurCameraTag => blurCameraTag;
|
||||
|
||||
[SerializeField] char realTagSeparator = '-';
|
||||
public char RealTagSeparator => realTagSeparator;
|
||||
|
||||
[Header("Api")]
|
||||
[SerializeField] int apiRequestsCountLimit = 2;
|
||||
public int ApiRequestsCountLimit => apiRequestsCountLimit;
|
||||
|
||||
[SerializeField] int apiTimeoutSec = 5;
|
||||
public int ApiTimeoutSec => apiTimeoutSec;
|
||||
|
||||
[SerializeField] int chunkSizeGetNodes;
|
||||
public int ChunkSizeGetNodes => chunkSizeGetNodes;
|
||||
|
||||
[SerializeField] int frameListDepth = 2;
|
||||
public int FrameListDepth => frameListDepth;
|
||||
|
||||
[SerializeField] string gFontsApiKey;
|
||||
public string GoogleFontsApiKey { get => gFontsApiKey; set => gFontsApiKey = value; }
|
||||
|
||||
[Header("Other")]
|
||||
[SerializeField] Sprite whiteSprite32px;
|
||||
public Sprite WhiteSprite32px => whiteSprite32px;
|
||||
|
||||
[SerializeField] Sprite missingImageTexture128px;
|
||||
public Sprite MissingImageTexture128px => missingImageTexture128px;
|
||||
|
||||
[SerializeField] TextAsset baseClass;
|
||||
public TextAsset BaseClass => baseClass;
|
||||
|
||||
[SerializeField] Material imageLinearMaterial;
|
||||
public Material ImageLinearMaterial => imageLinearMaterial;
|
||||
|
||||
[SerializeField] VectorMaterials vectorMaterials;
|
||||
public VectorMaterials VectorMaterials => vectorMaterials;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//CONSTANTS//////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public const string ProductName = "Figma Converter for Unity";
|
||||
public const string ProductNameShort = "FCU";
|
||||
public const string DestroyChilds = "Destroy childs";
|
||||
public const string SetFcuToSyncHelpers = "Set current FCU to SyncHelpers";
|
||||
public const string CompareTwoObjects = "Compare two selected objects";
|
||||
public const string DestroyLastImported = "Destroy last imported frames";
|
||||
public const string DestroySyncHelpers = "Destroy SyncHelpers";
|
||||
public const string CreatePrefabs = "Create Prefabs";
|
||||
public const string UpdatePrefabs = "Update Prefabs";
|
||||
public const string Create = "Create";
|
||||
public const string OptimizeSyncHelpers = "Optimize SyncHelpers";
|
||||
public const string GenerateScripts = "Generate scripts";
|
||||
|
||||
public const float IMAGE_SCALE_MIN = 0.25f;
|
||||
public const float IMAGE_SCALE_MAX = 4f;
|
||||
|
||||
public static char HierarchyDelimiter { get; } = '/';
|
||||
public static string PARENT_ID { get; } = "603951929:602259738";
|
||||
public static char AsterisksChar { get; } = '•';
|
||||
public static string DefaultLocalizationCulture { get; } = "en-US";
|
||||
|
||||
public static string RATEME_PREFS_KEY { get; } = "DONT_SHOW_RATEME";
|
||||
public static string RECENT_PROJECTS_PREFS_KEY { get; } = "recentProjectsPrefsKey";
|
||||
public static string FIGMA_SESSIONS_PREFS_KEY { get; } = "FigmaSessions";
|
||||
|
||||
public static string ClientId => "LaB1ONuPoY7QCdfshDbQbT";
|
||||
public static string ClientSecret => "E9PblceydtAyE7Onhg5FHLmnvingDp";
|
||||
public static string RedirectUri => "http://localhost:1923/";
|
||||
public static string AuthUrl => "https://www.figma.com/api/oauth/token?client_id={0}&client_secret={1}&redirect_uri={2}&code={3}&grant_type=authorization_code";
|
||||
public static string OAuthUrl => "https://www.figma.com/oauth?client_id={0}&redirect_uri={1}&scope=file_read&state={2}&response_type=code";
|
||||
|
||||
private static string logPath;
|
||||
public static string LogPath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (logPath.IsEmpty())
|
||||
logPath = Path.Combine(Directory.GetParent(Application.dataPath).FullName, "Logs");
|
||||
|
||||
logPath.CreateFolderIfNotExists();
|
||||
|
||||
return logPath;
|
||||
}
|
||||
}
|
||||
|
||||
private static string cachePath;
|
||||
public static string CachePath
|
||||
{
|
||||
get
|
||||
{
|
||||
if (cachePath.IsEmpty())
|
||||
{
|
||||
string tempFolder = Path.GetTempPath();
|
||||
cachePath = Path.Combine(tempFolder, "FcuCache");
|
||||
}
|
||||
|
||||
cachePath.CreateFolderIfNotExists();
|
||||
|
||||
return cachePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 471efbc970a337c4c83b1330ba757435
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
using DA_Assets.Tools;
|
||||
using System.Linq;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public class FcuDebugSettings
|
||||
{
|
||||
private const string FCU_DEBUG_PREFS_KEY = "FCU_DEBUG_FLAGS";
|
||||
private static FcuDebugSettingsFlags flags;
|
||||
|
||||
static FcuDebugSettings()
|
||||
{
|
||||
FcuDebugSettingsFlags[] debugFlags = new FcuDebugSettingsFlags[]
|
||||
{
|
||||
FcuDebugSettingsFlags.LogDefault,
|
||||
FcuDebugSettingsFlags.LogSetTag,
|
||||
FcuDebugSettingsFlags.LogIsDownloadable,
|
||||
FcuDebugSettingsFlags.LogTransform,
|
||||
FcuDebugSettingsFlags.LogGameObjectDrawer,
|
||||
FcuDebugSettingsFlags.LogComponentDrawer,
|
||||
FcuDebugSettingsFlags.LogHashGenerator
|
||||
};
|
||||
|
||||
flags = (FcuDebugSettingsFlags)LocalPrefs.GetInt(FCU_DEBUG_PREFS_KEY, (int)debugFlags.Aggregate((acc, flag) => acc | flag));
|
||||
}
|
||||
|
||||
public static FcuDebugSettingsFlags Settings
|
||||
{
|
||||
get
|
||||
{
|
||||
return flags;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (flags != value)
|
||||
{
|
||||
flags = value;
|
||||
LocalPrefs.SetInt(FCU_DEBUG_PREFS_KEY, (int)flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 16c8888a480355f41ada786e50e2d3e9
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
|
||||
namespace DA_Assets.FCU.Model
|
||||
{
|
||||
[Serializable]
|
||||
public struct TagConfig
|
||||
{
|
||||
[SerializeField] string label;
|
||||
[SerializeField] FcuTag fcuTag;
|
||||
[SerializeField] string figmaTag;
|
||||
[SerializeField] bool customButtonTag;
|
||||
[SerializeField] bool canBeDownloaded;
|
||||
[SerializeField] bool canBeInsideSingleImage;
|
||||
[SerializeField] bool hasComponent;
|
||||
|
||||
public FcuTag FcuTag => fcuTag;
|
||||
public string FigmaTag => figmaTag;
|
||||
public bool CustomButtonTag => customButtonTag;
|
||||
public bool CanBeDownloaded => canBeDownloaded;
|
||||
/// <summary>
|
||||
/// If the parent component includes at least one component with 1 == fall, it cannot be a downloadable image.
|
||||
/// </summary>
|
||||
public bool CanBeInsideSingleImage => canBeInsideSingleImage;
|
||||
/// <summary>
|
||||
/// Needed to count instantiated scripts/components.
|
||||
/// </summary>
|
||||
public bool HasComponent => hasComponent;
|
||||
|
||||
public void SetDefaultData(FcuTag fcuTag)
|
||||
{
|
||||
this.label = fcuTag.ToString();
|
||||
this.fcuTag = fcuTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaaa5a9158c5bf043866042fa968b2e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 918d6ace255af2845bc2032d17356d04
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,154 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using DA_Assets.Extensions;
|
||||
|
||||
|
||||
#if JSONNET_EXISTS
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public class DAFormatter
|
||||
{
|
||||
static List<string> GetJsonPropertyNames<T>()
|
||||
{
|
||||
List<string> propertyNames = new List<string>();
|
||||
|
||||
FieldInfo[] fields = typeof(T).GetFields(BindingFlags.Public | BindingFlags.Instance);
|
||||
PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
JsonPropertyAttribute attribute = field.GetCustomAttribute<JsonPropertyAttribute>();
|
||||
if (attribute != null)
|
||||
{
|
||||
propertyNames.Add(attribute.PropertyName ?? field.Name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
JsonPropertyAttribute attribute = property.GetCustomAttribute<JsonPropertyAttribute>();
|
||||
if (attribute != null)
|
||||
{
|
||||
propertyNames.Add(attribute.PropertyName ?? property.Name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return propertyNames;
|
||||
}
|
||||
|
||||
private const int indentLength = 4;
|
||||
|
||||
private static string Repeat(int n) => new string(' ', n * indentLength);
|
||||
|
||||
public static JFResult Format<T>(string str)
|
||||
{
|
||||
JFResult jsonFormatResult = new JFResult();
|
||||
|
||||
if (str.IsEmpty())
|
||||
{
|
||||
return new JFResult
|
||||
{
|
||||
Json = string.Empty,
|
||||
IsValid = false,
|
||||
MatchTargetType = false
|
||||
};
|
||||
}
|
||||
|
||||
List<string> typeNames = GetJsonPropertyNames<T>();
|
||||
|
||||
foreach (string typeName in typeNames)
|
||||
{
|
||||
if (str.Contains($"\"{typeName}\""))
|
||||
{
|
||||
jsonFormatResult.MatchTargetType = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasOpenBrace = false;
|
||||
bool hasCloseBrace = false;
|
||||
|
||||
int indent = 0;
|
||||
bool quoted = false;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (var i = 0; i < str.Length; i++)
|
||||
{
|
||||
var ch = str[i];
|
||||
switch (ch)
|
||||
{
|
||||
case '{':
|
||||
case '[':
|
||||
if (ch == '{')
|
||||
hasOpenBrace = true;
|
||||
|
||||
sb.Append(ch);
|
||||
if (quoted == false)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(Repeat(++indent));
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
case ']':
|
||||
if (ch == '}')
|
||||
hasCloseBrace = true;
|
||||
|
||||
if (quoted == false)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(Repeat(--indent));
|
||||
}
|
||||
sb.Append(ch);
|
||||
break;
|
||||
case '"':
|
||||
sb.Append(ch);
|
||||
bool escaped = false;
|
||||
var index = i;
|
||||
while (index > 0 && str[--index] == '\\')
|
||||
escaped = !escaped;
|
||||
if (escaped == false)
|
||||
quoted = !quoted;
|
||||
break;
|
||||
case ',':
|
||||
sb.Append(ch);
|
||||
if (quoted == false)
|
||||
{
|
||||
sb.AppendLine();
|
||||
sb.Append(Repeat(indent));
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
sb.Append(ch);
|
||||
if (quoted == false)
|
||||
sb.Append(" ");
|
||||
break;
|
||||
default:
|
||||
sb.Append(ch);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
jsonFormatResult.Json = sb.ToString();
|
||||
jsonFormatResult.IsValid = hasOpenBrace && hasCloseBrace;
|
||||
|
||||
return jsonFormatResult;
|
||||
}
|
||||
}
|
||||
|
||||
public struct JFResult
|
||||
{
|
||||
public bool IsValid { get; set; }
|
||||
public string Json { get; set; }
|
||||
public bool MatchTargetType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06a73c612ca81644c9da29771f70be48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
#if JSONNET_EXISTS
|
||||
using Newtonsoft.Json;
|
||||
#endif
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public class DAJson
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
private static JsonSerializerSettings settings = new JsonSerializerSettings()
|
||||
{
|
||||
Error = (sender, error) => error.ErrorContext.Handled = true,
|
||||
Formatting = Formatting.Indented
|
||||
};
|
||||
#endif
|
||||
public static string ToJson(object obj)
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
return JsonConvert.SerializeObject(obj, settings);
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
public static T FromJson<T>(string json)
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
return JsonConvert.DeserializeObject<T>(json, settings);
|
||||
#else
|
||||
return default(T);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static async Task<DAResult<T>> FromJsonAsync<T>(string json)
|
||||
{
|
||||
DAResult<T> @return = new DAResult<T>();
|
||||
|
||||
try
|
||||
{
|
||||
#if JSONNET_EXISTS == false
|
||||
throw new MissingComponentException("Json.NET packaghe is not installed.");
|
||||
#endif
|
||||
JFResult jfr = default;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
jfr = DAFormatter.Format<T>(json);
|
||||
});
|
||||
|
||||
if (jfr.IsValid == false)
|
||||
{
|
||||
throw new Exception("Not valid json.");
|
||||
}
|
||||
|
||||
if (jfr.MatchTargetType == false)
|
||||
{
|
||||
throw new InvalidCastException("The input json does not match the target type.");
|
||||
}
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
#if JSONNET_EXISTS
|
||||
@return.Object = JsonConvert.DeserializeObject<T>(json, settings);
|
||||
#endif
|
||||
});
|
||||
|
||||
@return.Success = true;
|
||||
}
|
||||
catch (InvalidCastException ex)
|
||||
{
|
||||
@return.Success = false;
|
||||
@return.Error = new WebError(29, ex.Message, ex);
|
||||
}
|
||||
catch (MissingComponentException ex)
|
||||
{
|
||||
@return.Success = false;
|
||||
@return.Error = new WebError(455, ex.Message, ex);
|
||||
}
|
||||
catch (ThreadAbortException ex)
|
||||
{
|
||||
@return.Success = false;
|
||||
@return.Error = new WebError(-1, ex.Message, ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@return.Success = false;
|
||||
@return.Error = new WebError(422, ex.Message, ex);
|
||||
}
|
||||
|
||||
return @return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13a6488720117b440923d3f85416ede7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "DA_Assets.FCU",
|
||||
"rootNamespace": "DA_Assets.FCU",
|
||||
"references": [
|
||||
"GUID:1b74e700d4693d342a6732b0ca624858",
|
||||
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||
"GUID:68550284b645f4b9894995579f34290a",
|
||||
"GUID:552447fb6cdb3d34b969d73c1b33b7d8"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"Newtonsoft.Json.dll"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd2d248e310f8234eb351b83126b632e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8fbd541e7e9a1e4e91ea5b1970b580a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Flags]
|
||||
public enum ProceduralCondition
|
||||
{
|
||||
Sprite = 1 << 0,
|
||||
RectangleNoRoundedCorners = 1 << 1,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum SvgCondition
|
||||
{
|
||||
ImageOrVideo = 1 << 0,
|
||||
AnyEffect = 1 << 1,
|
||||
}
|
||||
|
||||
public enum PreserveRatioMode
|
||||
{
|
||||
None,
|
||||
WidthControlsHeight,
|
||||
HeightControlsWidth,
|
||||
}
|
||||
|
||||
public enum FcuLogType
|
||||
{
|
||||
Default,
|
||||
SetTag,
|
||||
IsDownloadable,
|
||||
Transform,
|
||||
Error,
|
||||
GameObjectDrawer,
|
||||
ComponentDrawer,
|
||||
HashGenerator
|
||||
}
|
||||
|
||||
public enum FcuImageType
|
||||
{
|
||||
None,
|
||||
Downloadable,
|
||||
Drawable,
|
||||
Generative,
|
||||
Mask
|
||||
}
|
||||
|
||||
public enum PositioningMode
|
||||
{
|
||||
Absolute = 0,
|
||||
GameView = 1
|
||||
}
|
||||
|
||||
public enum UIFramework
|
||||
{
|
||||
UGUI = 0,
|
||||
UITK = 1,
|
||||
NOVA = 2
|
||||
}
|
||||
|
||||
public enum ImageFormat
|
||||
{
|
||||
PNG = 0,
|
||||
JPG = 1,
|
||||
SVG = 2
|
||||
}
|
||||
|
||||
public enum ImageComponent
|
||||
{
|
||||
UnityImage = 0,
|
||||
SubcShape = 1,
|
||||
MPImage = 2,
|
||||
ProceduralImage = 3,
|
||||
RawImage = 4,
|
||||
SpriteRenderer = 5,
|
||||
RoundedImage = 6,
|
||||
UIBlock2D = 7,
|
||||
SvgImage = 8,
|
||||
}
|
||||
|
||||
public enum TextComponent
|
||||
{
|
||||
UnityText = 0,
|
||||
TextMeshPro = 1,
|
||||
RTLTextMeshPro = 2
|
||||
}
|
||||
|
||||
public enum ShadowComponent
|
||||
{
|
||||
Figma = 0,
|
||||
TrueShadow = 1
|
||||
}
|
||||
|
||||
public enum ButtonComponent
|
||||
{
|
||||
UnityButton = 0,
|
||||
FcuButton = 2
|
||||
}
|
||||
|
||||
public enum LocalizationComponent
|
||||
{
|
||||
None = 0,
|
||||
DALocalizator = 1,
|
||||
I2Localization = 2,
|
||||
}
|
||||
|
||||
public enum LocalizationKeyCaseType
|
||||
{
|
||||
snake_case = 0,
|
||||
UPPER_SNAKE_CASE = 1,
|
||||
PascalCase = 2,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c5d6a028bd143c041a134d05d930f0b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
[Flags]
|
||||
public enum FcuDebugSettingsFlags
|
||||
{
|
||||
None = 0,
|
||||
LogDefault = 1 << 0,
|
||||
LogSetTag = 1 << 1,
|
||||
LogIsDownloadable = 1 << 2,
|
||||
LogTransform = 1 << 3,
|
||||
LogGameObjectDrawer = 1 << 4,
|
||||
LogComponentDrawer = 1 << 5,
|
||||
LogHashGenerator = 1 << 6,
|
||||
DebugMode = 1 << 7
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 381f5c4fc5ebe9c43917de692c0a7116
|
||||
@@ -0,0 +1,773 @@
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public static class FcuLocExtensions
|
||||
{
|
||||
public static string Localize(this FcuLocKey key, params object[] args) =>
|
||||
FcuConfig.Instance.Localizator.GetLocalizedText(key, args);
|
||||
}
|
||||
|
||||
public enum FcuLocKey
|
||||
{
|
||||
// Logs
|
||||
log_added_total,
|
||||
log_api_waiting,
|
||||
log_auth_complete,
|
||||
log_cant_auth,
|
||||
log_cant_draw_object,
|
||||
log_cant_find_package,
|
||||
log_cant_get_images,
|
||||
log_cant_get_part_of_frames,
|
||||
log_cant_get_image_links,
|
||||
log_cant_execute_because_no_backup,
|
||||
log_component_not_selected_in_hierarchy,
|
||||
log_current_canvas_metas_destroy,
|
||||
log_dev_function_enabled,
|
||||
log_downloading_fonts,
|
||||
log_downloading_images,
|
||||
log_drawn_count,
|
||||
log_enable_http_project_settings,
|
||||
log_fcu_assigned,
|
||||
log_generating_sprites,
|
||||
log_generating_tmp_fonts,
|
||||
log_getting_frames,
|
||||
log_getting_links,
|
||||
log_import_complete,
|
||||
log_import_task_canceled,
|
||||
log_incorrect_selection,
|
||||
log_instantiate_game_objects,
|
||||
log_links_added,
|
||||
log_local_prefabs_found,
|
||||
log_malformed_url,
|
||||
log_mark_as_sprite,
|
||||
log_need_auth,
|
||||
log_no_google_fonts_api_key,
|
||||
log_no_sync_helper,
|
||||
log_nothing_to_import,
|
||||
log_open_auth_page,
|
||||
log_prefabs_created,
|
||||
log_project_downloaded,
|
||||
log_project_empty,
|
||||
log_project_not_found,
|
||||
log_search_local_prefabs,
|
||||
log_set_anchors,
|
||||
log_ssl_error,
|
||||
log_start_adding_to_fonts_list,
|
||||
log_start_creating_prefabs,
|
||||
log_start_download_images,
|
||||
log_start_setting_transform,
|
||||
log_tagging,
|
||||
log_unknown_aligment,
|
||||
log_unknown_error,
|
||||
log_not_authorized,
|
||||
log_feature_not_available_with,
|
||||
log_incorrent_project_url,
|
||||
log_name_linking_not_recommended,
|
||||
log_svg_scale_1,
|
||||
log_import_failed_incompatible,
|
||||
log_import_failed_enable_required,
|
||||
log_import_failed_unsupported,
|
||||
log_tagging_by_parts,
|
||||
log_asset_not_imported,
|
||||
|
||||
//unknown
|
||||
|
||||
loading_google_fonts,
|
||||
cant_download_fonts,
|
||||
cant_generate_fonts,
|
||||
cant_load_sprites,
|
||||
cant_download_sprite,
|
||||
|
||||
// Labels and Tooltips
|
||||
label_advanced_mode,
|
||||
tooltip_advanced_mode,
|
||||
|
||||
label_add_tmp_fonts_from_folder,
|
||||
tooltip_add_fonts_from_folder,
|
||||
|
||||
label_add_ttf_fonts_from_folder,
|
||||
tooltip_add_ttf_fonts_from_folder,
|
||||
|
||||
label_all,
|
||||
tooltip_all,
|
||||
|
||||
label_apply_and_continue,
|
||||
tooltip_apply_and_continue,
|
||||
|
||||
label_asset,
|
||||
tooltip_asset,
|
||||
|
||||
label_asset_creator_settings,
|
||||
tooltip_asset_creator_settings,
|
||||
|
||||
label_asset_dependencies,
|
||||
tooltip_asset_dependencies,
|
||||
|
||||
label_atlas_padding,
|
||||
tooltip_atlas_padding,
|
||||
|
||||
label_atlas_population_mode,
|
||||
tooltip_atlas_population_mode,
|
||||
|
||||
label_atlas_resolution,
|
||||
tooltip_atlas_resolution,
|
||||
|
||||
label_auto_disable_compress_assets_on_import,
|
||||
tooltip_auto_disable_compress_assets_on_import,
|
||||
|
||||
label_auto_size,
|
||||
tooltip_auto_size,
|
||||
|
||||
label_best_fit,
|
||||
tooltip_best_fit,
|
||||
|
||||
label_beta_version,
|
||||
tooltip_beta_version,
|
||||
|
||||
label_buggy_version,
|
||||
tooltip_buggy_version,
|
||||
|
||||
label_button_settings,
|
||||
tooltip_button_settings,
|
||||
|
||||
label_button_type,
|
||||
tooltip_button_type,
|
||||
|
||||
label_change,
|
||||
tooltip_change,
|
||||
|
||||
label_changed_in_figma,
|
||||
tooltip_changed_in_figma,
|
||||
|
||||
label_changed_in_unity,
|
||||
tooltip_changed_in_unity,
|
||||
|
||||
label_comparer_desc,
|
||||
tooltip_comparer_desc,
|
||||
|
||||
label_components_settings,
|
||||
tooltip_import_components,
|
||||
|
||||
label_compression_quality,
|
||||
tooltip_compression_quality,
|
||||
|
||||
label_copy_new_data,
|
||||
tooltip_copy_new_data,
|
||||
|
||||
label_copy_old_data,
|
||||
tooltip_copy_old_data,
|
||||
|
||||
label_copy_to_clipboard,
|
||||
tooltip_copy_to_clipboard,
|
||||
|
||||
label_crunched_compression,
|
||||
tooltip_crunched_compression,
|
||||
|
||||
label_csv_separator,
|
||||
tooltip_csv_separator,
|
||||
|
||||
label_custom_pivot,
|
||||
tooltip_custom_pivot,
|
||||
|
||||
label_dabutton_settings,
|
||||
tooltip_dabutton_settings,
|
||||
|
||||
label_debug_mode,
|
||||
tooltip_debug_mode,
|
||||
|
||||
label_debug_tools,
|
||||
label_debug,
|
||||
tooltip_debug_tools,
|
||||
|
||||
label_dependencies,
|
||||
tooltip_dependencies,
|
||||
|
||||
label_disable_compress_assets_on_import,
|
||||
tooltip_disable_compress_assets_on_import,
|
||||
|
||||
label_disabled_color,
|
||||
tooltip_disabled_color,
|
||||
|
||||
label_dont_remove_fcu_meta,
|
||||
tooltip_dont_remove_fcu_meta,
|
||||
|
||||
label_download_fonts_from_project,
|
||||
tooltip_download_fonts_from_project,
|
||||
|
||||
label_download_multiple_fills,
|
||||
tooltip_download_multiple_fills,
|
||||
|
||||
label_download_unsupported_gradients,
|
||||
tooltip_download_unsupported_gradients,
|
||||
|
||||
label_fade_duration,
|
||||
tooltip_fade_duration,
|
||||
|
||||
label_figma_auth,
|
||||
tooltip_figma_auth,
|
||||
|
||||
label_figma_color,
|
||||
tooltip_figma_color,
|
||||
|
||||
label_figma_comp,
|
||||
tooltip_figma_comp,
|
||||
|
||||
label_figma_comp_desc,
|
||||
tooltip_figma_comp_desc,
|
||||
|
||||
label_figma_layout_culture,
|
||||
tooltip_figma_layout_culture,
|
||||
|
||||
label_find_added_objects,
|
||||
tooltip_find_added_objects,
|
||||
|
||||
label_flip_x,
|
||||
tooltip_flip_x,
|
||||
|
||||
label_flip_y,
|
||||
tooltip_flip_y,
|
||||
|
||||
label_font_settings,
|
||||
tooltip_font_settings,
|
||||
|
||||
label_font_subset,
|
||||
tooltip_font_subset,
|
||||
|
||||
label_force_fix,
|
||||
tooltip_force_fix,
|
||||
|
||||
label_frames_to_import,
|
||||
tooltip_frames_to_import,
|
||||
|
||||
label_generate_physics_shape,
|
||||
tooltip_generate_physics_shape,
|
||||
|
||||
label_gradient_resolution,
|
||||
tooltip_gradient_resolution,
|
||||
|
||||
label_highlighted_color,
|
||||
tooltip_highlighted_color,
|
||||
|
||||
label_horizontal_mapping,
|
||||
tooltip_horizontal_mapping,
|
||||
|
||||
label_horizontal_overflow,
|
||||
tooltip_horizontal_overflow,
|
||||
|
||||
label_https_setting,
|
||||
tooltip_https_setting,
|
||||
|
||||
label_image_and_sprites,
|
||||
tooltip_image_and_sprites,
|
||||
|
||||
label_image_component,
|
||||
tooltip_image_component,
|
||||
|
||||
label_image_type,
|
||||
tooltip_image_type,
|
||||
|
||||
label_import,
|
||||
tooltip_import,
|
||||
|
||||
label_import_events,
|
||||
tooltip_import_events,
|
||||
|
||||
log_import_stoped_because_error,
|
||||
tooltip_import_stoped_because_error,
|
||||
|
||||
log_import_stoped_manually,
|
||||
tooltip_stop_import,
|
||||
|
||||
label_kerning,
|
||||
tooltip_kerning,
|
||||
|
||||
label_kilobytes,
|
||||
tooltip_kilobytes,
|
||||
|
||||
label_layout_culture,
|
||||
tooltip_layout_culture,
|
||||
|
||||
label_line_spacing,
|
||||
tooltip_line_spacing,
|
||||
|
||||
label_loc_case_type,
|
||||
tooltip_loc_case_type,
|
||||
|
||||
label_loc_component,
|
||||
tooltip_loc_component,
|
||||
|
||||
label_loc_file_name,
|
||||
tooltip_loc_file_name,
|
||||
|
||||
label_loc_file_path,
|
||||
tooltip_loc_file_path,
|
||||
|
||||
label_localization_settings,
|
||||
tooltip_localization_settings,
|
||||
|
||||
label_localizator,
|
||||
tooltip_localizator,
|
||||
|
||||
label_log_default,
|
||||
tooltip_log_default,
|
||||
|
||||
label_log_downloadable,
|
||||
tooltip_log_downloadable,
|
||||
|
||||
label_log_go_drawer,
|
||||
tooltip_log_go_drawer,
|
||||
|
||||
label_log_set_tag,
|
||||
tooltip_log_set_tag,
|
||||
|
||||
label_log_transform,
|
||||
tooltip_log_transform,
|
||||
|
||||
label_made_by,
|
||||
tooltip_made_by,
|
||||
|
||||
label_main_settings,
|
||||
tooltip_main_settings,
|
||||
|
||||
label_mask_interaction,
|
||||
tooltip_mask_interaction,
|
||||
|
||||
label_maskable,
|
||||
tooltip_maskable,
|
||||
|
||||
label_max_cord_deviation_enabled,
|
||||
tooltip_max_cord_deviation_enabled,
|
||||
|
||||
label_max_tangent_angle_enabled,
|
||||
tooltip_max_tangent_angle_enabled,
|
||||
|
||||
label_mipmap_enabled,
|
||||
tooltip_mipmap_enabled,
|
||||
|
||||
label_missings_in_frame,
|
||||
tooltip_missings_in_frame,
|
||||
|
||||
label_namespace,
|
||||
tooltip_namespace,
|
||||
|
||||
label_new,
|
||||
tooltip_new,
|
||||
|
||||
label_no_recent_projects,
|
||||
tooltip_no_recent_projects,
|
||||
|
||||
label_normal_color,
|
||||
tooltip_normal_color,
|
||||
|
||||
label_old_data,
|
||||
tooltip_old_data,
|
||||
|
||||
label_override_line_spacing_px,
|
||||
tooltip_override_line_spacing_px,
|
||||
|
||||
label_override_tags,
|
||||
tooltip_override_tags,
|
||||
|
||||
label_parse_escape_characters,
|
||||
tooltip_parse_escape_characters,
|
||||
|
||||
label_pixels_per_unit,
|
||||
tooltip_pixels_per_unit,
|
||||
|
||||
label_positioning_mode,
|
||||
tooltip_positioning_mode,
|
||||
|
||||
label_prefab_creator,
|
||||
tooltip_prefab_creator,
|
||||
|
||||
label_prefabs_path,
|
||||
tooltip_prefabs_path,
|
||||
|
||||
label_preserve_aspect,
|
||||
tooltip_preserve_aspect,
|
||||
|
||||
label_preserve_numbers,
|
||||
tooltip_preserve_numbers,
|
||||
|
||||
label_pressed_color,
|
||||
tooltip_pressed_color,
|
||||
|
||||
label_project_url,
|
||||
tooltip_project_url,
|
||||
|
||||
label_pui_falloff_distance,
|
||||
tooltip_pui_falloff_distance,
|
||||
|
||||
label_rate,
|
||||
tooltip_rate,
|
||||
|
||||
label_rateme,
|
||||
tooltip_rateme,
|
||||
|
||||
label_rateme_desc,
|
||||
tooltip_rateme_desc,
|
||||
|
||||
label_raycast_padding,
|
||||
tooltip_raycast_padding,
|
||||
|
||||
label_raycast_target,
|
||||
tooltip_raycast_target,
|
||||
|
||||
label_redownload_sprites,
|
||||
tooltip_redownload_sprites,
|
||||
|
||||
label_remove,
|
||||
tooltip_remove,
|
||||
|
||||
label_remove_unused_sprites,
|
||||
tooltip_remove_unused_sprites,
|
||||
|
||||
label_render_mode,
|
||||
tooltip_render_mode,
|
||||
|
||||
label_rich_text,
|
||||
tooltip_rich_text,
|
||||
|
||||
label_rtl_textmeshpro_settings,
|
||||
tooltip_rtl_textmeshpro_settings,
|
||||
|
||||
label_sampling_steps,
|
||||
tooltip_sampling_steps,
|
||||
|
||||
label_selected_color,
|
||||
tooltip_selected_color,
|
||||
|
||||
label_shadow_type,
|
||||
tooltip_shadow_type,
|
||||
|
||||
label_shadows_tab,
|
||||
tooltip_shadows_tab,
|
||||
|
||||
label_sort_point,
|
||||
tooltip_sort_point,
|
||||
|
||||
label_sorting_layer,
|
||||
tooltip_sorting_layer,
|
||||
|
||||
label_sprite_import_mode,
|
||||
tooltip_sprite_import_mode,
|
||||
|
||||
label_step_distance,
|
||||
tooltip_step_distance,
|
||||
|
||||
label_svg_image_settings,
|
||||
tooltip_svg_image_settings,
|
||||
|
||||
label_svg_importer_settings,
|
||||
tooltip_svg_importer_settings,
|
||||
|
||||
label_svg_type,
|
||||
tooltip_svg_type,
|
||||
|
||||
label_text_and_fonts,
|
||||
tooltip_text_and_fonts,
|
||||
|
||||
label_text_and_font_settings,
|
||||
tooltip_text_and_font_settings,
|
||||
|
||||
label_text_component,
|
||||
tooltip_text_component,
|
||||
|
||||
label_textmeshpro_settings,
|
||||
tooltip_textmeshpro_settings,
|
||||
|
||||
label_texture_compression,
|
||||
tooltip_texture_compression,
|
||||
|
||||
label_texture_importer_settings,
|
||||
tooltip_texture_importer_settings,
|
||||
|
||||
label_texture_type,
|
||||
tooltip_texture_type,
|
||||
|
||||
label_ttf_path,
|
||||
tooltip_ttf_path,
|
||||
|
||||
label_ui_framework,
|
||||
tooltip_ui_framework,
|
||||
|
||||
label_ui_toolkit,
|
||||
tooltip_ui_toolkit,
|
||||
|
||||
label_unity_comp,
|
||||
tooltip_unity_comp,
|
||||
|
||||
label_unity_image_settings,
|
||||
tooltip_unity_image_settings,
|
||||
|
||||
label_unity_text_settings,
|
||||
tooltip_unity_text_settings,
|
||||
|
||||
label_uitk_linking_mode,
|
||||
tooltip_uitk_linking_mode,
|
||||
|
||||
label_uitk_output_path,
|
||||
tooltip_uitk_output_path,
|
||||
|
||||
label_use_i2localization,
|
||||
tooltip_use_i2localization,
|
||||
|
||||
label_visible_descender,
|
||||
tooltip_visible_descender,
|
||||
|
||||
label_viewport_options,
|
||||
tooltip_viewport_options,
|
||||
|
||||
label_vertical_mapping,
|
||||
tooltip_vertical_mapping,
|
||||
|
||||
label_vertical_overflow,
|
||||
tooltip_vertical_overflow,
|
||||
|
||||
label_without_changes,
|
||||
tooltip_label_without_changes,
|
||||
|
||||
label_wrapping,
|
||||
tooltip_wrapping,
|
||||
|
||||
label_xml_parsing,
|
||||
tooltip_xml_parsing,
|
||||
|
||||
label_procedural_ui_settings,
|
||||
tooltip_procedural_ui_settings,
|
||||
|
||||
label_pui_settings,
|
||||
tooltip_pui_settings,
|
||||
|
||||
label_color_multiplier,
|
||||
tooltip_color_multiplier,
|
||||
|
||||
label_mpuikit_settings,
|
||||
tooltip_mpuikit_settings,
|
||||
|
||||
label_sr_settings,
|
||||
tooltip_sr_settings,
|
||||
|
||||
label_is_readable,
|
||||
tooltip_is_readable,
|
||||
|
||||
label_next_order_step,
|
||||
tooltip_next_order_step,
|
||||
|
||||
label_raw_import,
|
||||
tooltip_raw_import,
|
||||
|
||||
label_images_and_sprites_tab,
|
||||
tooltip_images_and_sprites_tab,
|
||||
|
||||
label_buttons_tab,
|
||||
tooltip_buttons_tab,
|
||||
|
||||
label_ui_toolkit_tab,
|
||||
tooltip_ui_toolkit_tab,
|
||||
|
||||
label_nova_components,
|
||||
tooltip_nova_components,
|
||||
|
||||
label_fcu,
|
||||
tooltip_fcu,
|
||||
|
||||
label_settings,
|
||||
tooltip_settings,
|
||||
|
||||
label_script_generator,
|
||||
tooltip_script_generator,
|
||||
|
||||
label_enabled,
|
||||
tooltip_enabled,
|
||||
|
||||
label_scripts_output_path,
|
||||
tooltip_scripts_output_path,
|
||||
|
||||
label_select_folder,
|
||||
tooltip_select_folder,
|
||||
|
||||
label_text_prefab_naming_mode,
|
||||
tooltip_text_prefab_naming_mode,
|
||||
|
||||
label_humanized_color,
|
||||
tooltip_humanized_color,
|
||||
|
||||
label_hex_color,
|
||||
tooltip_hex_color,
|
||||
|
||||
label_log_component_drawer,
|
||||
tooltip_log_component_drawer,
|
||||
|
||||
label_log_hash_generator_drawer,
|
||||
tooltip_log_hash_generator_drawer,
|
||||
|
||||
label_override_tmp_letter_spacing,
|
||||
tooltip_override_tmp_letter_spacing,
|
||||
|
||||
label_object_comparer,
|
||||
tooltip_object_comparer,
|
||||
|
||||
label_fcu_is_null,
|
||||
tooltip_fcu_is_null,
|
||||
|
||||
label_more_about_layout_updating,
|
||||
tooltip_more_about_layout_updating,
|
||||
|
||||
tooltip_open_fcu_window,
|
||||
tooltip_change_window_mode,
|
||||
|
||||
label_orthographic_mode,
|
||||
tooltip_orthographic_mode,
|
||||
|
||||
label_extra_padding,
|
||||
tooltip_extra_padding,
|
||||
|
||||
label_overflow,
|
||||
tooltip_overflow,
|
||||
|
||||
label_geometry_sorting,
|
||||
tooltip_geometry_sorting,
|
||||
|
||||
label_shader,
|
||||
tooltip_shader,
|
||||
|
||||
label_farsi,
|
||||
tooltip_farsi,
|
||||
|
||||
label_fix_tags,
|
||||
tooltip_fix_tags,
|
||||
|
||||
label_user_name,
|
||||
tooltip_user_id,
|
||||
|
||||
label_asset_instance_id,
|
||||
tooltip_asset_instance_id,
|
||||
|
||||
label_stable_version,
|
||||
tooltip_stable_version,
|
||||
|
||||
label_open_diff_checker,
|
||||
tooltip_open_diff_checker,
|
||||
|
||||
label_go_name_max_length,
|
||||
tooltip_go_name_max_length,
|
||||
|
||||
label_text_name_max_length,
|
||||
tooltip_text_name_max_length,
|
||||
|
||||
label_go_layer,
|
||||
tooltip_go_layer,
|
||||
|
||||
label_pivot_type,
|
||||
tooltip_pivot_type,
|
||||
|
||||
label_components_to_import,
|
||||
tooltip_components_to_import,
|
||||
|
||||
label_components_with_count,
|
||||
tooltip_components_with_count,
|
||||
|
||||
tooltip_recent_projects,
|
||||
tooltip_download_project,
|
||||
|
||||
label_sampling_point_size,
|
||||
tooltip_sampling_point_size,
|
||||
|
||||
label_enable_multi_atlas_support,
|
||||
tooltip_enable_multi_atlas_support,
|
||||
|
||||
label_images_format,
|
||||
tooltip_images_format,
|
||||
|
||||
label_images_scale,
|
||||
tooltip_images_scale,
|
||||
|
||||
label_preserve_ratio_mode,
|
||||
tooltip_preserve_ratio_mode,
|
||||
|
||||
label_sprites_path,
|
||||
tooltip_sprites_path,
|
||||
|
||||
label_shapes2d_settings,
|
||||
tooltip_shapes2d_settings,
|
||||
|
||||
label_google_fonts_settings,
|
||||
tooltip_google_fonts_settings,
|
||||
|
||||
label_google_fonts_api_key,
|
||||
tooltip_google_fonts_api_key,
|
||||
|
||||
label_get_google_api_key,
|
||||
tooltip_get_google_api_key,
|
||||
|
||||
label_remove_from_scene,
|
||||
tooltip_remove_from_scene,
|
||||
|
||||
label_token,
|
||||
tooltip_token,
|
||||
|
||||
tooltip_recent_tokens,
|
||||
tooltip_auth,
|
||||
|
||||
label_tmp_path,
|
||||
tooltip_tmp_path,
|
||||
|
||||
label_no_recent_sessions,
|
||||
tooltip_no_recent_sessions,
|
||||
|
||||
label_different_component_data,
|
||||
tooltip_different_component_data,
|
||||
|
||||
label_has_differences,
|
||||
tooltip_has_differences,
|
||||
|
||||
label_new_components,
|
||||
tooltip_new_components,
|
||||
|
||||
label_import_frames,
|
||||
tooltip_import_frames,
|
||||
|
||||
label_open_settings_window,
|
||||
tooltip_open_settings_window,
|
||||
|
||||
label_select_fonts_folder,
|
||||
tooltip_select_fonts_folder,
|
||||
|
||||
label_select_prefabs_folder,
|
||||
tooltip_select_prefabs_folder,
|
||||
|
||||
label_max_cord_deviation,
|
||||
tooltip_max_cord_deviation,
|
||||
|
||||
label_max_tangent_angle,
|
||||
tooltip_max_tangent_angle,
|
||||
|
||||
label_loc_folder_path,
|
||||
tooltip_loc_folder_path,
|
||||
|
||||
label_use_image_linear_material,
|
||||
tooltip_use_image_linear_material,
|
||||
|
||||
label_loc_key_max_lenght,
|
||||
tooltip_loc_key_max_lenght,
|
||||
|
||||
label_supported_from_unity_version,
|
||||
|
||||
label_field_name_max_length,
|
||||
tooltip_field_name_max_length,
|
||||
|
||||
label_method_name_max_length,
|
||||
tooltip_method_name_max_length,
|
||||
|
||||
label_class_name_max_length,
|
||||
tooltip_class_name_max_length,
|
||||
|
||||
label_base_class,
|
||||
tooltip_base_class,
|
||||
|
||||
label_serialization_mode,
|
||||
tooltip_serialization_mode,
|
||||
label_max_sprite_size,
|
||||
tooltip_max_sprite_size
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 022e0160593f1914191fa26a448a0497
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public enum FcuNameType
|
||||
{
|
||||
Object,
|
||||
Field,
|
||||
Method,
|
||||
File,
|
||||
UitkGuid,
|
||||
Class,
|
||||
UssClass,
|
||||
LocKey,
|
||||
|
||||
HumanizedTextPrefabName,
|
||||
UxmlPath,
|
||||
|
||||
Figma,
|
||||
UITK_SpritePath,
|
||||
UITK_FontPath
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 621831154d92cfa40b5c887f71041168
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
public enum FcuTag
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Container = 1,
|
||||
Frame = 2,
|
||||
Page = 3,
|
||||
|
||||
AutoLayoutGroup = 100,
|
||||
ContentSizeFitter = 101,
|
||||
AspectRatioFitter = 102,
|
||||
|
||||
Text = 200,
|
||||
Image = 201,
|
||||
//Vector = 202,
|
||||
Background = 203,
|
||||
Slice9 = 204,
|
||||
|
||||
Button = 300,
|
||||
InputField = 301,
|
||||
Placeholder = 302,
|
||||
ScrollView = 303,
|
||||
PasswordField = 304,
|
||||
Toggle = 305,
|
||||
ToggleGroup = 306,
|
||||
|
||||
BtnDefault = 400,
|
||||
BtnHover = 401,
|
||||
BtnPressed = 402,
|
||||
BtnSelected = 403,
|
||||
BtnDisabled = 404,
|
||||
BtnLooped = 405,
|
||||
|
||||
Shadow = 500,
|
||||
CanvasGroup = 501,
|
||||
Mask = 502,
|
||||
Blur = 503,
|
||||
|
||||
Ignore = 600,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3eb5a805e99e8874881fa13b3693657e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DA_Assets.FCU
|
||||
{
|
||||
|
||||
[Flags]
|
||||
public enum FontSubset
|
||||
{
|
||||
Latin = 1 << 0,
|
||||
LatinExt = 1 << 1,
|
||||
Sinhala = 1 << 2,
|
||||
Greek = 1 << 3,
|
||||
Hebrew = 1 << 4,
|
||||
Vietnamese = 1 << 5,
|
||||
Cyrillic = 1 << 6,
|
||||
CyrillicExt = 1 << 7,
|
||||
Devanagari = 1 << 8,
|
||||
Arabic = 1 << 9,
|
||||
Khmer = 1 << 10,
|
||||
Tamil = 1 << 11,
|
||||
GreekExt = 1 << 12,
|
||||
Thai = 1 << 13,
|
||||
Bengali = 1 << 14,
|
||||
Gujarati = 1 << 15,
|
||||
Oriya = 1 << 16,
|
||||
Malayalam = 1 << 17,
|
||||
Gurmukhi = 1 << 18,
|
||||
Kannada = 1 << 19,
|
||||
Telugu = 1 << 20,
|
||||
Myanmar = 1 << 21,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f293b2949ef9cf5449263ef27584988e
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11d8605c61a74514ebdcd65975193eee
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,259 @@
|
||||
using DA_Assets.Extensions;
|
||||
using DA_Assets.FCU.Model;
|
||||
using DA_Assets.Logging;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace DA_Assets.FCU.Extensions
|
||||
{
|
||||
public static class AutoLayoutExtensions
|
||||
{
|
||||
public static bool TryFixSizeWithStroke(this FObject fobject, float currentY, out float newY)
|
||||
{
|
||||
newY = 0;
|
||||
|
||||
if (currentY > 0)
|
||||
return false;
|
||||
|
||||
if (fobject.Strokes.IsEmpty())
|
||||
return false;
|
||||
|
||||
if (!fobject.Strokes.Any(x => x.Visible.ToBoolNullTrue()))
|
||||
return false;
|
||||
|
||||
newY = fobject.StrokeWeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsInsideAutoLayout(this FObject parent, out HorizontalOrVerticalLayoutGroup layoutGroup)
|
||||
{
|
||||
layoutGroup = null;
|
||||
|
||||
if (!parent.ContainsTag(FcuTag.AutoLayoutGroup))
|
||||
return false;
|
||||
|
||||
if (parent.Data?.GameObject == null)
|
||||
return false;
|
||||
|
||||
if (!parent.Data.GameObject.TryGetComponentSafe(out layoutGroup))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static RectOffset GetPadding(this FObject fobject)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new RectOffset
|
||||
{
|
||||
bottom = (int)Mathf.Round(fobject.PaddingBottom.ToFloat()),
|
||||
top = (int)Mathf.Round(fobject.PaddingTop.ToFloat()),
|
||||
left = (int)Mathf.Round(fobject.PaddingLeft.ToFloat()),
|
||||
right = (int)Mathf.Round(fobject.PaddingRight.ToFloat())
|
||||
};
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
DALogger.LogError(ex.Message);
|
||||
return new RectOffset(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static TextAnchor GetHorLayoutAnchor(this FObject fobject)
|
||||
{
|
||||
string aligment = "";
|
||||
aligment += fobject.PrimaryAxisAlignItems;
|
||||
aligment += " ";
|
||||
aligment += fobject.CounterAxisAlignItems;
|
||||
|
||||
switch (aligment)
|
||||
{
|
||||
case "NONE NONE":
|
||||
return TextAnchor.UpperLeft;
|
||||
case "SPACE_BETWEEN NONE":
|
||||
return TextAnchor.UpperCenter;
|
||||
case "CENTER NONE":
|
||||
return TextAnchor.UpperCenter;
|
||||
case "MAX NONE":
|
||||
return TextAnchor.UpperRight;
|
||||
case "NONE CENTER":
|
||||
return TextAnchor.MiddleLeft;
|
||||
case "NONE BASELINE":
|
||||
return TextAnchor.MiddleLeft;
|
||||
case "SPACE_BETWEEN CENTER":
|
||||
return TextAnchor.MiddleCenter;
|
||||
case "CENTER CENTER":
|
||||
return TextAnchor.MiddleCenter;
|
||||
case "CENTER BASELINE":
|
||||
return TextAnchor.MiddleCenter;
|
||||
case "MAX CENTER":
|
||||
return TextAnchor.MiddleRight;
|
||||
case "MAX BASELINE":
|
||||
return TextAnchor.MiddleRight;
|
||||
case "NONE MAX":
|
||||
return TextAnchor.LowerLeft;
|
||||
case "SPACE_BETWEEN MAX":
|
||||
return TextAnchor.LowerCenter;
|
||||
case "CENTER MAX":
|
||||
return TextAnchor.LowerCenter;
|
||||
case "MAX MAX":
|
||||
return TextAnchor.LowerRight;
|
||||
}
|
||||
|
||||
DALogger.LogError(FcuLocKey.log_unknown_aligment.Localize(aligment, fobject.Data.NameHierarchy));
|
||||
return TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
public static TextAnchor GetVertLayoutAnchor(this FObject fobject)
|
||||
{
|
||||
string aligment = "";
|
||||
aligment += fobject.PrimaryAxisAlignItems;
|
||||
aligment += " ";
|
||||
aligment += fobject.CounterAxisAlignItems;
|
||||
|
||||
switch (aligment)
|
||||
{
|
||||
case "NONE NONE":
|
||||
return TextAnchor.UpperLeft;
|
||||
case "NONE CENTER":
|
||||
return TextAnchor.UpperCenter;
|
||||
case "NONE MAX":
|
||||
return TextAnchor.UpperRight;
|
||||
case "CENTER NONE":
|
||||
return TextAnchor.MiddleLeft;
|
||||
case "SPACE_BETWEEN NONE":
|
||||
return TextAnchor.MiddleLeft;
|
||||
case "CENTER CENTER":
|
||||
return TextAnchor.MiddleCenter;
|
||||
case "SPACE_BETWEEN CENTER":
|
||||
return TextAnchor.MiddleCenter;
|
||||
case "CENTER MAX":
|
||||
return TextAnchor.MiddleRight;
|
||||
case "SPACE_BETWEEN MAX":
|
||||
return TextAnchor.MiddleRight;
|
||||
case "MAX NONE":
|
||||
return TextAnchor.LowerLeft;
|
||||
case "MAX CENTER":
|
||||
return TextAnchor.LowerCenter;
|
||||
case "MAX MAX":
|
||||
return TextAnchor.LowerRight;
|
||||
}
|
||||
|
||||
DALogger.LogError(FcuLocKey.log_unknown_aligment.Localize(aligment, fobject.Data.NameHierarchy));
|
||||
return TextAnchor.UpperLeft;
|
||||
}
|
||||
|
||||
public static bool IsNeedStretchByX(this FObject fobject)
|
||||
{
|
||||
HashSet<float?> layoutGrows = new HashSet<float?>();
|
||||
|
||||
foreach (FObject child in fobject.Children)
|
||||
{
|
||||
layoutGrows.Add(child.LayoutGrow);
|
||||
}
|
||||
|
||||
if (layoutGrows.Count == 1)
|
||||
{
|
||||
if (layoutGrows.First() == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsNeedStretchByY(this FObject fobject)
|
||||
{
|
||||
HashSet<string> layoutAligns = new HashSet<string>();
|
||||
|
||||
foreach (FObject child in fobject.Children)
|
||||
{
|
||||
layoutAligns.Add(child.LayoutAlign);
|
||||
}
|
||||
|
||||
if (layoutAligns.Count == 1)
|
||||
{
|
||||
if (layoutAligns.First() == "STRETCH")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float GetHorSpacing(this FObject fobject)
|
||||
{
|
||||
if (fobject.PrimaryAxisAlignItems == PrimaryAxisAlignItem.SPACE_BETWEEN)
|
||||
{
|
||||
if (fobject.Data.ChildIndexes.IsEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (fobject.Data.ChildIndexes.Count == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int childCount = fobject.Data.ChildIndexes.Count;
|
||||
int spacingCount = childCount - 1;
|
||||
float parentWidth = fobject.Data.Size.x;
|
||||
|
||||
float allChildsWidth = 0;
|
||||
|
||||
foreach (FObject child in fobject.Children)
|
||||
{
|
||||
allChildsWidth += child.Data.Size.x;
|
||||
}
|
||||
|
||||
float spacingWidth = (parentWidth - allChildsWidth) / spacingCount;
|
||||
return spacingWidth;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return fobject.ItemSpacing.ToFloat();
|
||||
}
|
||||
}
|
||||
|
||||
public static float GetVertSpacing(this FObject fobject)
|
||||
{
|
||||
if (fobject.PrimaryAxisAlignItems == PrimaryAxisAlignItem.SPACE_BETWEEN)
|
||||
{
|
||||
if (fobject.Data.ChildIndexes.IsEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (fobject.Data.ChildIndexes.Count == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int childCount = fobject.Data.ChildIndexes.Count;
|
||||
int spacingCount = childCount - 1;
|
||||
float parentHeight = fobject.Data.Size.y;
|
||||
|
||||
float allChildsHeight = 0;
|
||||
|
||||
foreach (FObject child in fobject.Children)
|
||||
{
|
||||
allChildsHeight += child.Data.Size.y;
|
||||
}
|
||||
|
||||
float spacingWidth = (parentHeight - allChildsHeight) / spacingCount;
|
||||
return spacingWidth;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return fobject.ItemSpacing.ToFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9f91ffd5c1010848837e071bff89977
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,206 @@
|
||||
using DA_Assets.FCU.Model;
|
||||
using DA_Assets.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using UnityEngine;
|
||||
using System.IO;
|
||||
|
||||
namespace DA_Assets.FCU.Extensions
|
||||
{
|
||||
public static class FObjectExtensionsAssembly
|
||||
{
|
||||
public static bool IsSupportedRenderSize(this Vector2 sourceSize, float imageScale, out Vector2Int spriteSize, out Vector2Int renderSize)
|
||||
{
|
||||
spriteSize = (sourceSize * imageScale).ToVector2Int();
|
||||
|
||||
int maxRenderSize = FcuConfig.Instance.MaxRenderSize;
|
||||
int renderUpscaleFactor = FcuConfig.Instance.RenderUpscaleFactor;
|
||||
|
||||
renderSize = spriteSize * renderUpscaleFactor;
|
||||
|
||||
if (renderSize.x <= maxRenderSize && renderSize.y <= maxRenderSize)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsSvgExtension(this FObject fobject)
|
||||
{
|
||||
if (fobject.Data.SpritePath.IsEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string spriteExt = Path.GetExtension(fobject.Data.SpritePath);
|
||||
if (spriteExt.StartsWith(".") && spriteExt.Length > 1)
|
||||
spriteExt = spriteExt.Remove(0, 1);
|
||||
|
||||
bool isSvgSprite = spriteExt.ToLower() == ImageFormat.SVG.ToLower();
|
||||
return isSvgSprite;
|
||||
}
|
||||
|
||||
public static void ExecuteWithTemporaryParent(this FObject fobject, Transform tempChildsParent, Func<FObject, GameObject> targetSelector, Action action)
|
||||
{
|
||||
GameObject target = targetSelector(fobject);
|
||||
List<Transform> children = new List<Transform>();
|
||||
List<int> siblingIndices = new List<int>();
|
||||
|
||||
foreach (Transform child in target.transform)
|
||||
{
|
||||
children.Add(child);
|
||||
siblingIndices.Add(child.GetSiblingIndex());
|
||||
}
|
||||
|
||||
foreach (Transform child in children)
|
||||
{
|
||||
child.SetParent(tempChildsParent);
|
||||
}
|
||||
|
||||
action.Invoke();
|
||||
|
||||
for (int i = 0; i < children.Count; i++)
|
||||
{
|
||||
children[i].SetParent(target.transform);
|
||||
children[i].SetSiblingIndex(siblingIndices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsSprite(this SyncData data)
|
||||
{
|
||||
return data.FcuImageType == FcuImageType.Downloadable || data.FcuImageType == FcuImageType.Generative;
|
||||
}
|
||||
|
||||
public static bool IsSprite(this FObject fobject)
|
||||
{
|
||||
return fobject.Data.FcuImageType == FcuImageType.Downloadable || fobject.Data.FcuImageType == FcuImageType.Generative;
|
||||
}
|
||||
|
||||
public static bool IsCircle(this FObject fobject)
|
||||
{
|
||||
if (fobject.Type != NodeType.ELLIPSE)
|
||||
return false;
|
||||
|
||||
if (fobject.Size.x.Round(1) == fobject.Size.y.Round(1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsRectangle(this FObject fobject)
|
||||
{
|
||||
if (fobject.Type == NodeType.RECTANGLE)
|
||||
return true;
|
||||
|
||||
if (fobject.Type != NodeType.FRAME)
|
||||
return false;
|
||||
|
||||
if (fobject.Type == NodeType.LINE && fobject.IsSupportedLine())
|
||||
return false;
|
||||
|
||||
if (!fobject.Children.IsEmpty())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SetFlagToAllChilds(this FObject parent, Action<FObject> action)
|
||||
{
|
||||
if (parent.IsDefault() || parent.Children.IsEmpty())
|
||||
return;
|
||||
|
||||
foreach (FObject child in parent.Children)
|
||||
{
|
||||
action(child);
|
||||
SetFlagToAllChilds(child, action);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<GradientAlphaKey> ToGradientAlphaKeys(this Paint gradient)
|
||||
{
|
||||
List<GradientAlphaKey> gradientColorKeys = new List<GradientAlphaKey>();
|
||||
|
||||
if (gradient.GradientStops.IsEmpty())
|
||||
{
|
||||
return gradientColorKeys;
|
||||
}
|
||||
|
||||
foreach (GradientStop gradientStop in gradient.GradientStops)
|
||||
{
|
||||
gradientColorKeys.Add(new GradientAlphaKey
|
||||
{
|
||||
alpha = gradientStop.Color.a,
|
||||
time = gradientStop.Position
|
||||
});
|
||||
}
|
||||
|
||||
return gradientColorKeys;
|
||||
}
|
||||
|
||||
public static List<GradientColorKey> ToGradientColorKeys(this Paint gradient)
|
||||
{
|
||||
List<GradientColorKey> gradientColorKeys = new List<GradientColorKey>();
|
||||
|
||||
if (gradient.GradientStops.IsEmpty())
|
||||
{
|
||||
return gradientColorKeys;
|
||||
}
|
||||
|
||||
foreach (GradientStop gradientStop in gradient.GradientStops)
|
||||
{
|
||||
gradientColorKeys.Add(new GradientColorKey
|
||||
{
|
||||
color = gradientStop.Color,
|
||||
time = gradientStop.Position
|
||||
});
|
||||
}
|
||||
|
||||
return gradientColorKeys;
|
||||
}
|
||||
|
||||
public static string GetText(this FObject fobject)
|
||||
{
|
||||
return fobject.Characters.Replace("\\r", " ").Replace("\\n", Environment.NewLine);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsSupportedLine(this FObject fobject)
|
||||
{
|
||||
if (fobject.StrokeCap == StrokeCap.SQUARE)
|
||||
return true;
|
||||
|
||||
if (fobject.StrokeCap == StrokeCap.ROUND && fobject.StrokeWeight >= 2f)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool HasVisibleProperty<T>(this FObject fobject, Expression<Func<FObject, IEnumerable<T>>> propertySelector) where T : IVisible
|
||||
{
|
||||
var func = propertySelector.Compile();
|
||||
IEnumerable<T> collection = func(fobject);
|
||||
return !collection.IsEmpty() && collection.Any(item => item.Visible.ToBoolNullTrue());
|
||||
}
|
||||
|
||||
public static bool TryGetLocalPosition(this FObject fobject, out Vector2 rtPos)
|
||||
{
|
||||
try
|
||||
{
|
||||
rtPos = new Vector2(fobject.RelativeTransform[0][2].ToFloat(), -fobject.RelativeTransform[1][2].ToFloat());
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
rtPos = new Vector2(0, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79da7c3c8977f9b45b75150ab1498550
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user