Files
TEngine/UnityProject/Assets/Obfuz/ObfuzInitialize.cs
2025-07-26 08:10:41 +08:00

24 lines
816 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Obfuz;
using Obfuz.EncryptionVM;
using UnityEngine;
namespace Launcher
{
public class ObfuzInitialize : MonoBehaviour
{
// 初始化EncryptionService后被混淆的代码才能正常运行
// 因此尽可能地早地初始化它。
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
private static void SetUpStaticSecretKey()
{
#if ENABLE_OBFUZ
Debug.Log("Enable Obfuz");
Debug.Log("SetUpStaticSecret begin");
EncryptionService<DefaultStaticEncryptionScope>.Encryptor = new GeneratedEncryptionVirtualMachine(Resources.Load<TextAsset>("Obfuz/defaultStaticSecretKey").bytes);
Debug.Log("SetUpStaticSecret end");
#else
Debug.Log("Disable Obfuz");
#endif
}
}
}