Update
This commit is contained in:
@@ -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:
|
||||
Reference in New Issue
Block a user