Exemple #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);
            }
        }
Exemple #2
0
        private static void DrawWallHackSection()
        {
            using (var changed = new EditorGUI.ChangeCheckScope())
            {
                var fold = GUITools.DrawFoldHeader("WallHack Detector", ACTkEditorPrefsSettings.WallHackFoldout);
                if (changed.changed)
                {
                    ACTkEditorPrefsSettings.WallHackFoldout = fold;
                }
            }

            if (!ACTkEditorPrefsSettings.WallHackFoldout)
            {
                return;
            }

            GUILayout.Space(-3f);

            using (GUITools.Vertical(GUITools.PanelWithBackground))
            {
                GUILayout.Label(
                    "Wireframe module uses own shader under the hood and it should be included into the build.",
                    EditorStyles.wordWrappedLabel);

                ReadGraphicsAsset();

                if (graphicsSettingsAsset != null && includedShaders != null)
                {
                    // outputs whole included shaders list, use for debug
                    //EditorGUILayout.PropertyField(includedShaders, true);

                    var shaderIndex = GetWallhackDetectorShaderIndex();

                    EditorGUI.BeginChangeCheck();

                    var status = shaderIndex != -1 ? ColorTools.GetGreenString() + ">included" : ColorTools.GetRedString() + ">not included";
                    GUILayout.Label("Shader status: <color=#" + status + "</color>", GUITools.RichLabel);

                    GUILayout.Space(5f);
                    EditorGUILayout.HelpBox("You don't need to include it if you're not going to use Wireframe module",
                                            MessageType.Info, true);
                    GUILayout.Space(5f);

                    if (shaderIndex != -1)
                    {
                        if (GUILayout.Button("Remove shader"))
                        {
                            includedShaders.DeleteArrayElementAtIndex(shaderIndex);
                            includedShaders.DeleteArrayElementAtIndex(shaderIndex);
                        }

                        GUILayout.Space(3);
                    }
                    else
                    {
                        using (GUITools.Horizontal())
                        {
                            if (GUILayout.Button("Auto Include"))
                            {
                                var shader = Shader.Find(WallHackDetector.WireframeShaderName);
                                if (shader != null)
                                {
                                    includedShaders.InsertArrayElementAtIndex(includedShaders.arraySize);
                                    var newItem = includedShaders.GetArrayElementAtIndex(includedShaders.arraySize - 1);
                                    newItem.objectReferenceValue = shader;
                                }
                                else
                                {
                                    Debug.LogError(ACTkConstants.LogPrefix + "Can't find " + WallHackDetector.WireframeShaderName +
                                                   " shader! Please report this to the  " +
                                                   ACTkEditorConstants.SupportEmail +
                                                   " including your Unity version number.");
                                }
                            }

                            if (GUILayout.Button("Include manually (see readme.pdf)"))
                            {
#if UNITY_2018_3_OR_NEWER
                                SettingsService.OpenProjectSettings("Project/Graphics");
#else
                                EditorApplication.ExecuteMenuItem("Edit/Project Settings/Graphics");
#endif
                            }
                        }

                        GUILayout.Space(3);
                    }

                    if (EditorGUI.EndChangeCheck())
                    {
                        graphicsSettingsAsset.ApplyModifiedProperties();
                    }
                }
                else
                {
                    GUILayout.Label("Can't automatically control " + WallHackDetector.WireframeShaderName +
                                    " shader existence at the Always Included Shaders list. Please, manage this manually in Graphics Settings.");
                    if (GUILayout.Button("Open Graphics Settings"))
                    {
                        EditorApplication.ExecuteMenuItem("Edit/Project Settings/Graphics");
                    }
                }
            }
        }