You've already forked CC-Framework.EditorExtend
init
This commit is contained in:
88
Assets/CCTools/Editor/Config/CCToolsConfig.cs
Normal file
88
Assets/CCTools/Editor/Config/CCToolsConfig.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
|
||||
namespace CCTools.Config
|
||||
|
||||
{
|
||||
|
||||
public static class CCToolsConfig
|
||||
|
||||
{
|
||||
|
||||
private const string ENABLE_FIGMA_UPDATE_KEY = "CCTools.EnableFigmaUpdate";
|
||||
|
||||
private const string MENU_ITEM_PATH = "CC-Tools/RectTransform Tool/Enable Figma Update";
|
||||
|
||||
|
||||
|
||||
// 默认启用
|
||||
public static bool enableFigmaUpdate = true;
|
||||
|
||||
|
||||
|
||||
static CCToolsConfig()
|
||||
{
|
||||
|
||||
// 从 EditorPrefs 加载保存的状态
|
||||
enableFigmaUpdate = EditorPrefs.GetBool(ENABLE_FIGMA_UPDATE_KEY, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool EnableFigmaUpdate
|
||||
|
||||
{
|
||||
|
||||
get => enableFigmaUpdate;
|
||||
|
||||
private set
|
||||
{
|
||||
|
||||
if (enableFigmaUpdate != value)
|
||||
|
||||
{
|
||||
|
||||
enableFigmaUpdate = value;
|
||||
|
||||
EditorPrefs.SetBool(ENABLE_FIGMA_UPDATE_KEY, value);
|
||||
|
||||
// 刷新编辑器
|
||||
UnityEditorInternal.InternalEditorUtility.RepaintAllViews();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MenuItem(MENU_ITEM_PATH)]
|
||||
|
||||
private static void ToggleFigmaUpdate()
|
||||
|
||||
{
|
||||
|
||||
enableFigmaUpdate = !enableFigmaUpdate;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MenuItem(MENU_ITEM_PATH, true)]
|
||||
|
||||
private static bool ToggleFigmaUpdateValidate()
|
||||
|
||||
{
|
||||
|
||||
Menu.SetChecked(MENU_ITEM_PATH, enableFigmaUpdate);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
11
Assets/CCTools/Editor/Config/CCToolsConfig.cs.meta
Normal file
11
Assets/CCTools/Editor/Config/CCToolsConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07c448ff099a133439867c8cd9f41938
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user