This commit is contained in:
2026-05-13 23:02:02 +07:00
parent 5025383676
commit 93da00c206
885 changed files with 980996 additions and 1987 deletions

View File

@@ -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);
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d6c360a2d933754cb8cc9e8b277d6df
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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);
}
});
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abb9fafbbe0971843803ff2d85f5e8fd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: