예제 #1
0
        private static void DrawIL2CPPSection()
        {
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                var fold = GUITools.DrawFoldHeader("IL2CPP", ACTkEditorPrefsSettings.IL2CPPFoldout);
                if (changed.changed)
                {
                    ACTkEditorPrefsSettings.IL2CPPFoldout = fold;
                }
            }

            if (!ACTkEditorPrefsSettings.IL2CPPFoldout)
            {
                return;
            }

            GUILayout.Space(-3f);

            using (GUITools.Vertical(GUITools.PanelWithBackground))
            {
                GUILayout.Label("IL2CPP prevents Mono injections and easy code decompilation. " +
                                "Also consider obfuscating your metadata to make cheaters cry, see <b>readme</b> for details.",
                                GUITools.RichLabel);

                GUILayout.Label("<b>Note: IL2CPP is AOT and does not support JIT!</b>", GUITools.RichMiniLabel);

                GUILayout.Space(5f);

                var supported      = SettingsUtils.IsIL2CPPSupported();
                var supportedColor = supported ? ColorTools.GetGreenString() : ColorTools.GetRedString();

                var enabled      = SettingsUtils.IsIL2CPPEnabled();
                var enabledColor = enabled ? ColorTools.GetGreenString() : ColorTools.GetRedString();

                GUILayout.Label("IL2CPP Supported: <color=#" + supportedColor + ">" + supported + "</color>",
                                GUITools.RichLabel);
                GUILayout.Label("IL2CPP Enabled: <color=#" + enabledColor + ">" + enabled + "</color>",
                                GUITools.RichLabel);

                if (!SettingsUtils.IsIL2CPPEnabled() && SettingsUtils.IsIL2CPPSupported())
                {
                    GUILayout.Space(5f);
                    EditorGUILayout.HelpBox("Use IL2CPP to stop injections & easy code decompilation",
                                            MessageType.Warning, true);
                    GUILayout.Space(5f);
                    if (GUILayout.Button(new GUIContent("Switch to IL2CPP")))
                    {
                        PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup,
                                                           ScriptingImplementation.IL2CPP);
                    }
                }

                GUILayout.Space(3);
            }
        }
예제 #2
0
 public static bool IsInjectionPossible()
 {
     return(IsTargetPlatformCompatible() && !SettingsUtils.IsIL2CPPEnabled());
 }
예제 #3
0
        private static void DrawInjectionSection()
        {
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                var fold = GUITools.DrawFoldHeader("Injection Detector", ACTkEditorPrefsSettings.InjectionFoldout);
                if (changed.changed)
                {
                    ACTkEditorPrefsSettings.InjectionFoldout = fold;
                }
            }

            if (!ACTkEditorPrefsSettings.InjectionFoldout)
            {
                return;
            }

            GUILayout.Space(-3f);

            using (GUITools.Vertical(GUITools.PanelWithBackground))
            {
                var enableInjectionDetector = ACTkSettings.Instance.InjectionDetectorEnabled;

                if (SettingsUtils.IsIL2CPPEnabled())
                {
                    EditorGUILayout.HelpBox("Injection is not possible in IL2CPP,\n" +
                                            "this detector is not needed in IL2CPP builds", MessageType.Info, true);
                    GUILayout.Space(5f);
                }
                else if (!InjectionRoutines.IsTargetPlatformCompatible())
                {
                    EditorGUILayout.HelpBox(
                        "Injection Detection is only supported in non-IL2CPP Standalone and Android builds",
                        MessageType.Warning, true);
                    GUILayout.Space(5f);
                }

                using (new GUILayout.HorizontalScope())
                {
                    EditorGUI.BeginChangeCheck();
                    enableInjectionDetector = EditorGUILayout.ToggleLeft(new GUIContent(
                                                                             "Add mono injection detection support to build",
                                                                             "Injection Detector checks assemblies against whitelist. " +
                                                                             "Please enable this option if you're using Injection Detector " +
                                                                             "and default whitelist will be generated while Unity builds resulting build.\n" +
                                                                             "Has no effect for IL2CPP or unsupported platforms."), enableInjectionDetector
                                                                         );
                    if (EditorGUI.EndChangeCheck())
                    {
                        ACTkSettings.Instance.InjectionDetectorEnabled = enableInjectionDetector;
                    }
                }

                GUILayout.Space(3);

                if (GUILayout.Button(new GUIContent(
                                         "Edit Custom Whitelist (" + ACTkSettings.Instance.InjectionDetectorWhiteList.Count + ")",
                                         "Fill any external assemblies which are not included into the project to the user-defined whitelist to make Injection Detector aware of them."))
                    )
                {
                    UserWhitelistEditor.ShowWindow();
                }

                GUILayout.Space(3);
            }
        }