mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
接入obfuz->2.0
This commit is contained in:
24
UnityProject/Assets/Obfuz/ObfuzInitialize.cs
Normal file
24
UnityProject/Assets/Obfuz/ObfuzInitialize.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user