有些启动添加混淆宏的隔离适配
parent
a23a5ed53f
commit
5e26abe09f
|
|
@ -8,8 +8,10 @@ using PhxhSDK.AOT.PreConfig;
|
|||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Assets.PhxhSDK.AOT.BI;
|
||||
#if USE_OBFUZ
|
||||
using Obfuz.EncryptionVM;
|
||||
using Obfuz;
|
||||
#endif
|
||||
using static ProgressBarData;
|
||||
|
||||
#if PLATFORM_ANDROID || UNITY_EDITOR
|
||||
|
|
@ -22,6 +24,7 @@ using PhxhSDK.AOT.Bilibili;
|
|||
|
||||
public class GameLauncher : MonoBehaviour
|
||||
{
|
||||
#if USE_OBFUZ
|
||||
private static bool _isSetUpStaticSecret = false;
|
||||
/// <summary>
|
||||
/// 初始化EncryptionService后被混淆的代码才能正常运行,
|
||||
|
|
@ -53,9 +56,12 @@ public class GameLauncher : MonoBehaviour
|
|||
EncryptionService<DefaultDynamicEncryptionScope>.Encryptor = new GeneratedEncryptionVirtualMachine(bytes);
|
||||
Debug.Log("[Obfz] SetUpDynamicSecret end");
|
||||
}
|
||||
#endif
|
||||
|
||||
private const string START_SCENE_NAME = "Assets/Scenes/StartScene.unity";
|
||||
#if USE_OBFUZ
|
||||
private const string DYNAMIC_SECRET_PATH = "Assets/Config/Obfuz/defaultDynamicSecretKey.bytes";
|
||||
#endif
|
||||
|
||||
//最大能容忍的下载卡住时长,一旦超过则重新开始下载
|
||||
// private const float DOWNLOAD_STUCK_TIME_MAX = 10;
|
||||
|
|
@ -99,7 +105,9 @@ public class GameLauncher : MonoBehaviour
|
|||
|
||||
private void Awake()
|
||||
{
|
||||
#if USE_OBFUZ
|
||||
_SetUpStaticSecretKey();
|
||||
#endif
|
||||
|
||||
Screen.sleepTimeout = SleepTimeout.NeverSleep; // 保持屏幕常亮
|
||||
fakeProgess = 0f;
|
||||
|
|
@ -294,9 +302,11 @@ public class GameLauncher : MonoBehaviour
|
|||
if (enableHotUpdate)
|
||||
{
|
||||
#if USE_HCLR
|
||||
#if USE_OBFUZ
|
||||
byte[] dynamicSecret = await _simpleLoader.LoadDllBytes(DYNAMIC_SECRET_PATH);
|
||||
_SetUpDynamicSecret(dynamicSecret);
|
||||
await _simpleLoader.UnloadDll(DYNAMIC_SECRET_PATH);
|
||||
#endif
|
||||
|
||||
Debug.Log("需要热更新,开始加载程序集");
|
||||
_hybridCLRHelper = new HybridCLRHelper();
|
||||
|
|
|
|||
Loading…
Reference in New Issue