2025-05-21 09:23:29 +08:00
|
|
|
using UnityEditor;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
|
|
|
|
namespace Obfuz.Settings
|
|
|
|
{
|
|
|
|
public class ObfuzSettingsProvider : SettingsProvider
|
|
|
|
{
|
|
|
|
|
|
|
|
private static ObfuzSettingsProvider s_provider;
|
|
|
|
|
|
|
|
[SettingsProvider]
|
|
|
|
public static SettingsProvider CreateMyCustomSettingsProvider()
|
|
|
|
{
|
|
|
|
if (s_provider == null)
|
|
|
|
{
|
|
|
|
s_provider = new ObfuzSettingsProvider();
|
|
|
|
using (var so = new SerializedObject(ObfuzSettings.Instance))
|
|
|
|
{
|
|
|
|
s_provider.keywords = GetSearchKeywordsFromSerializedObject(so);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return s_provider;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SerializedObject _serializedObject;
|
2025-06-28 20:20:08 +08:00
|
|
|
private SerializedProperty _buildPipelineSettings;
|
|
|
|
|
2025-05-21 09:23:29 +08:00
|
|
|
private SerializedProperty _assemblySettings;
|
|
|
|
private SerializedProperty _obfuscationPassSettings;
|
|
|
|
private SerializedProperty _secretSettings;
|
|
|
|
private SerializedProperty _encryptionVMSettings;
|
|
|
|
|
|
|
|
private SerializedProperty _symbolObfusSettings;
|
|
|
|
private SerializedProperty _constEncryptSettings;
|
2025-06-21 10:59:39 +08:00
|
|
|
private SerializedProperty _evalStackObfusSettings;
|
2025-05-21 09:23:29 +08:00
|
|
|
private SerializedProperty _fieldEncryptSettings;
|
|
|
|
private SerializedProperty _callObfusSettings;
|
2025-06-17 20:21:28 +08:00
|
|
|
private SerializedProperty _exprObfusSettings;
|
2025-06-22 10:39:31 +08:00
|
|
|
private SerializedProperty _controlFlowObfusSettings;
|
2025-05-21 09:23:29 +08:00
|
|
|
|
2025-06-28 19:01:57 +08:00
|
|
|
private SerializedProperty _garbageCodeGenerationSettings;
|
2025-06-28 12:12:31 +08:00
|
|
|
|
2025-07-25 20:47:38 +08:00
|
|
|
private SerializedProperty _polymorphicDllSettings;
|
|
|
|
|
2025-05-21 09:23:29 +08:00
|
|
|
public ObfuzSettingsProvider() : base("Project/Obfuz", SettingsScope.Project)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnActivate(string searchContext, VisualElement rootElement)
|
|
|
|
{
|
|
|
|
InitGUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnDeactivate()
|
|
|
|
{
|
|
|
|
base.OnDeactivate();
|
|
|
|
ObfuzSettings.Save();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void InitGUI()
|
|
|
|
{
|
|
|
|
var setting = ObfuzSettings.Instance;
|
|
|
|
_serializedObject?.Dispose();
|
|
|
|
_serializedObject = new SerializedObject(setting);
|
2025-06-28 20:20:08 +08:00
|
|
|
_buildPipelineSettings = _serializedObject.FindProperty("buildPipelineSettings");
|
|
|
|
|
2025-05-21 09:23:29 +08:00
|
|
|
_assemblySettings = _serializedObject.FindProperty("assemblySettings");
|
|
|
|
_obfuscationPassSettings = _serializedObject.FindProperty("obfuscationPassSettings");
|
|
|
|
_secretSettings = _serializedObject.FindProperty("secretSettings");
|
|
|
|
|
|
|
|
_encryptionVMSettings = _serializedObject.FindProperty("encryptionVMSettings");
|
|
|
|
|
|
|
|
_symbolObfusSettings = _serializedObject.FindProperty("symbolObfusSettings");
|
|
|
|
_constEncryptSettings = _serializedObject.FindProperty("constEncryptSettings");
|
2025-06-21 10:59:39 +08:00
|
|
|
_evalStackObfusSettings = _serializedObject.FindProperty("evalStackObfusSettings");
|
2025-06-17 20:21:28 +08:00
|
|
|
_exprObfusSettings = _serializedObject.FindProperty("exprObfusSettings");
|
2025-05-21 09:23:29 +08:00
|
|
|
_fieldEncryptSettings = _serializedObject.FindProperty("fieldEncryptSettings");
|
|
|
|
_callObfusSettings = _serializedObject.FindProperty("callObfusSettings");
|
2025-06-28 19:01:57 +08:00
|
|
|
_controlFlowObfusSettings = _serializedObject.FindProperty("controlFlowObfusSettings");
|
2025-06-28 12:12:31 +08:00
|
|
|
|
2025-06-28 19:01:57 +08:00
|
|
|
_garbageCodeGenerationSettings = _serializedObject.FindProperty("garbageCodeGenerationSettings");
|
2025-07-25 20:47:38 +08:00
|
|
|
|
|
|
|
_polymorphicDllSettings = _serializedObject.FindProperty("polymorphicDllSettings");
|
2025-05-21 09:23:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void OnGUI(string searchContext)
|
|
|
|
{
|
2025-05-30 13:32:29 +08:00
|
|
|
if (_serializedObject == null || !_serializedObject.targetObject)
|
2025-05-21 09:23:29 +08:00
|
|
|
{
|
|
|
|
InitGUI();
|
|
|
|
}
|
|
|
|
_serializedObject.Update();
|
|
|
|
EditorGUI.BeginChangeCheck();
|
|
|
|
|
2025-06-28 20:20:08 +08:00
|
|
|
EditorGUILayout.PropertyField(_buildPipelineSettings);
|
|
|
|
|
2025-05-21 09:23:29 +08:00
|
|
|
EditorGUILayout.PropertyField(_assemblySettings);
|
|
|
|
EditorGUILayout.PropertyField(_obfuscationPassSettings);
|
|
|
|
EditorGUILayout.PropertyField(_secretSettings);
|
|
|
|
|
|
|
|
EditorGUILayout.PropertyField(_encryptionVMSettings);
|
|
|
|
|
|
|
|
EditorGUILayout.PropertyField(_symbolObfusSettings);
|
|
|
|
EditorGUILayout.PropertyField(_constEncryptSettings);
|
2025-06-21 10:59:39 +08:00
|
|
|
EditorGUILayout.PropertyField(_evalStackObfusSettings);
|
2025-06-17 20:21:28 +08:00
|
|
|
EditorGUILayout.PropertyField(_exprObfusSettings);
|
2025-05-21 09:23:29 +08:00
|
|
|
EditorGUILayout.PropertyField(_fieldEncryptSettings);
|
|
|
|
EditorGUILayout.PropertyField(_callObfusSettings);
|
2025-06-22 10:39:31 +08:00
|
|
|
EditorGUILayout.PropertyField(_controlFlowObfusSettings);
|
2025-05-21 09:23:29 +08:00
|
|
|
|
2025-06-28 19:01:57 +08:00
|
|
|
EditorGUILayout.PropertyField(_garbageCodeGenerationSettings);
|
2025-05-21 09:23:29 +08:00
|
|
|
|
2025-07-25 20:47:38 +08:00
|
|
|
EditorGUILayout.PropertyField(_polymorphicDllSettings);
|
|
|
|
|
2025-05-21 09:23:29 +08:00
|
|
|
if (EditorGUI.EndChangeCheck())
|
|
|
|
{
|
|
|
|
_serializedObject.ApplyModifiedProperties();
|
|
|
|
ObfuzSettings.Save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|