Пример #1
0
        private static void DrawSymbol(ref bool field, string symbol, string hint)
        {
            EditorGUI.BeginChangeCheck();
            field = EditorGUILayout.ToggleLeft(new GUIContent(symbol, hint), field);
            if (EditorGUI.EndChangeCheck())
            {
                if (field)
                {
                    SettingsUtils.SetSymbol(symbol);
                }
                else
                {
                    SettingsUtils.RemoveSymbol(symbol);
                }

                symbolsData = SettingsUtils.GetSymbolsData();
            }
        }
Пример #2
0
 public static bool IsInjectionPossible()
 {
     return(IsTargetPlatformCompatible() && !SettingsUtils.IsIL2CPPEnabled());
 }
Пример #3
0
        private static void DrawConditionalSection()
        {
            var header = "Conditional Compilation Symbols";

            if (EditorApplication.isCompiling)
            {
                var redColor = ColorTools.GetRedString();
                header += " [<color=#" + redColor + ">compiling</color>]";
            }

            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                var fold = GUITools.DrawFoldHeader(header, ACTkEditorPrefsSettings.ConditionalFoldout);
                if (changed.changed)
                {
                    ACTkEditorPrefsSettings.ConditionalFoldout = fold;
                }
            }

            if (EditorApplication.isCompiling)
            {
                GUI.enabled = false;
            }

            if (!ACTkEditorPrefsSettings.ConditionalFoldout)
            {
                return;
            }

            GUILayout.Space(-3f);

            using (GUITools.Vertical(GUITools.PanelWithBackground))
            {
                GUILayout.Label("Here you may switch conditional compilation symbols used in ACTk.\n" +
                                "Check Readme for more details on each symbol.", EditorStyles.wordWrappedLabel);
                EditorGUILayout.Space();
                if (symbolsData == null)
                {
                    symbolsData = SettingsUtils.GetSymbolsData();
                }

                /*if (GUILayout.Button("Reset"))
                 * {
                 *      var groups = (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup));
                 *      foreach (BuildTargetGroup buildTargetGroup in groups)
                 *      {
                 *              PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, string.Empty);
                 *      }
                 * }*/

                //using (GUITools.Horizontal())
                GUILayout.Label("Debug Symbols", GUITools.LargeBoldLabel);
                GUITools.Separator();

                DrawSymbol(ref symbolsData.injectionDebug,
                           ACTkEditorConstants.Conditionals.InjectionDebug,
                           "Switches the Injection Detector debug.");
                DrawSymbol(ref symbolsData.injectionDebugVerbose,
                           ACTkEditorConstants.Conditionals.InjectionDebugVerbose,
                           "Switches the Injection Detector verbose debug level.");
                DrawSymbol(ref symbolsData.injectionDebugParanoid,
                           ACTkEditorConstants.Conditionals.InjectionDebugParanoid,
                           "Switches the Injection Detector paranoid debug level.");
                DrawSymbol(ref symbolsData.wallhackDebug,
                           ACTkEditorConstants.Conditionals.WallhackDebug,
                           "Switches the WallHack Detector debug - you'll see the WallHack objects in scene and get extra information in console.");
                DrawSymbol(ref symbolsData.detectionBacklogs,
                           ACTkEditorConstants.Conditionals.DetectionBacklogs,
                           "Enables additional logs in some detectors to make it easier to debug false positives.");

                EditorGUILayout.Space();

                GUILayout.Label("Compatibility Symbols", GUITools.LargeBoldLabel);
                GUITools.Separator();

                DrawSymbol(ref symbolsData.exposeThirdPartyIntegration,
                           ACTkEditorConstants.Conditionals.ThirdPartyIntegration,
                           "Enable to let other third-party code in project know you have ACTk added.");
                DrawSymbol(ref symbolsData.excludeObfuscation,
                           ACTkEditorConstants.Conditionals.ExcludeObfuscation,
                           "Enable if you use Unity-unaware obfuscators which support ObfuscationAttribute to help avoid names corruption.");
                DrawSymbol(ref symbolsData.preventReadPhoneState,
                           ACTkEditorConstants.Conditionals.PreventReadPhoneState,
                           "Disables ObscuredPrefs Lock To Device functionality.");
                DrawSymbol(ref symbolsData.preventInternetPermission,
                           ACTkEditorConstants.Conditionals.PreventInternetPermission,
                           "Disables TimeCheatingDetector functionality.");
                DrawSymbol(ref symbolsData.obscuredAutoMigration,
                           ACTkEditorConstants.Conditionals.ObscuredAutoMigration,
                           "Enables automatic migration of ObscuredFloat and ObscuredDouble instances from the ACTk 1.5.2.0-1.5.8.0 to the 1.5.9.0+ format. Reduces these types performance a bit.");
                DrawSymbol(ref symbolsData.usExportCompatible,
                           ACTkEditorConstants.Conditionals.UsExportCompatible,
                           "Enables US Encryption Export Regulations compatibility mode so ACTk do not force you to declare you're using encryption when publishing your application to the Apple App Store.");

                GUILayout.Space(3);
            }

            GUI.enabled = true;
        }
Пример #4
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);
            }
        }