Exemplo n.º 1
0
        //END EDIT ------------------------------------------------------------------------------------------------------------------------

        static UnityFeatureHelper()
        {
            //Wh010ne Fork --------------------------------------------------------------------------------------------------------------------

            bool gotTypeError = false;

            try
            {
                _sceneManager = Type.GetType("UnityEngine.SceneManagement.SceneManager, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", true);
            }
            catch (TypeLoadException e)
            {
                gotTypeError = true;
                File.WriteAllText(DebugHelpers.debugPath + "SCENEMANAGER_ERROR.txt", "TypeLoad Error:\r\n\r\n" + e.Message);
            } //SceneManager

            try
            {
                _scene = Type.GetType("UnityEngine.SceneManagement.Scene, UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", true);
            }
            catch (TypeLoadException e)
            {
                gotTypeError = true;
                File.WriteAllText(DebugHelpers.debugPath + "SCENE_ERROR.txt", "TypeLoad Error:\r\n\r\n" + e.Message);
            } //Scene

            try
            {
                _xml = Type.GetType("System.Xml.XmlComment, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null", true);
            }
            catch (TypeLoadException e)
            {
                gotTypeError = true;
                File.WriteAllText(DebugHelpers.debugPath + "XML_ERROR.txt", "TypeLoad Error:\r\n\r\n" + e.Message);
            } //XML

            try
            {
                _vectrosity = Type.GetType("Vectrosity.VectorObject2D, Vectrosity, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", true);
            }
            catch (TypeLoadException e)
            {
                gotTypeError = true;
                File.WriteAllText(DebugHelpers.debugPath + "VECTROSITY_ERROR.txt", "TypeLoad Error:\r\n\r\n" + e.Message);
            } //Vectrosity

            if (gotTypeError || RuntimeUnityEditorCore._enableDebug)
            {
                DebugHelpers.DebugWriteDetails();
            }

            //END EDIT ------------------------------------------------------------------------------------------------------------------------

            SupportsScenes = _scene != null && _sceneManager != null;
            if (!SupportsScenes)
            {
                RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[RuntimeEditor] UnityEngine.SceneManager and/or UnityEngine.SceneManagement.Scene are not available, some features will be disabled");
            }

            // Todo detect properly?
            SupportsCursorIndex = SupportsScenes;
            if (!SupportsCursorIndex)
            {
                RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[RuntimeEditor] TextEditor.cursorIndex is not available, some features will be disabled");
            }

            SupportsXml = _xml != null;
            if (!SupportsXml)
            {
                RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[RuntimeEditor] System.XML.dll is not available, REPL will be disabled");
            }

            SupportsVectrosity = _vectrosity != null;
            if (!SupportsVectrosity)
            {
                RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[RuntimeEditor] Vectrosity.dll is not available, drawing gizmos will be disabled");
            }

            #region [Testing]

            /*
             * //Wh010ne Fork --------------------------------------------------------------------------------------------------------------------
             *
             * if (_scene.FullName.ToString() != "") { if (_sceneManager.FullName.ToString() != "") { SupportsScenes = true; } }
             * if (!SupportsScenes) { RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[InjectedDLL] UnityEngine.SceneManager and/or UnityEngine.SceneManagement.Scene are not available, some features will be disabled"); }
             *
             * // TODO: detect properly?
             * SupportsCursorIndex = SupportsScenes;
             * if (!SupportsCursorIndex) { RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[InjectedDLL] TextEditor.cursorIndex is not available, some features will be disabled"); }
             *
             * if (_xml.FullName.ToString() != "") { SupportsXml = true; }
             * if (!SupportsXml) { RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[InjectedDLL] System.XML.dll is not available, REPL will be disabled"); }
             *
             * if (_vectrosity.FullName.ToString() != "") { SupportsVectrosity = true; }
             * if (!SupportsVectrosity) { RuntimeUnityEditorCore.Logger.Log(LogLevel.Warning, "[InjectedDLL] Vectrosity.dll is not available, drawing gizmos will be disabled"); }
             *
             * //END EDIT ------------------------------------------------------------------------------------------------------------------------
             */

            #endregion
        }