Ejemplo n.º 1
0
        private void Start()
        {
            // Initialize the communication channel with the host
            ApplicationBridge.Initialize();

            Panel rootPanel = new Grid();

            RootVisual = rootPanel;

            // Test the connection speed and launch the webviewer once it's completed
            ConnectionTester.TestConnection(new Action(StartWebViewer));
        }
Ejemplo n.º 2
0
 public PluginManager(MenuStrip menuStrip, ToolStripContainer toolStripContainer, MapPanel mapPanel, MapTreeView mapTreeView)
 {
     m_plugins           = new Dictionary <string, IPlugin>();
     m_applicationBridge = new ApplicationBridge(menuStrip, toolStripContainer, mapPanel, mapTreeView);
     //PurgePluginDomain();
 }
Ejemplo n.º 3
0
        public static void Initialize()
        {
            foreach (var arg in Environment.GetCommandLineArgs())
            {
                if (arg == StartupArguments.DisableFancyColors)
                {
                    ConsoleAllocator.FancyColorsEnabled = false;
                }

                if (arg == StartupArguments.AllocateConsole)
                {
                    ConsoleAllocator.Redirect();
                    ConsoleEnabled = true;
                }
            }

            var version = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            EarlyLog.Info($"Centrifuge bootstrap for Reactor Mod Loader and API. Version {version}. Unity {ApplicationBridge.UnityVersion}");

            if (ConsoleEnabled)
            {
                EarlyLog.Info($"Diagnostics mode enabled. Remove '{StartupArguments.AllocateConsole}' command line argument to disable.");
            }

            if (ApplicationBridge.GetRunningUnityGeneration() == UnityGeneration.Unity4OrOlder)
            {
                EarlyLog.Error("Centrifuge requires Unity 5 or newer. Terminating.");
                return;
            }

            EarlyLog.Info("Trying to find Centrifuge Reactor DLL...");
            var reactorPath = GetCrossPlatformCompatibleReactorPath();

            if (!File.Exists(reactorPath))
            {
                EarlyLog.Error($"Centrifuge Reactor DLL could not be found at '{reactorPath}'. Mods will not be loaded.");
                return;
            }

            Type proxyType;

            try
            {
                EarlyLog.Info("Validating and loading Centrifuge Reactor DLL...");
                Assembly.LoadFrom(reactorPath);

                EarlyLog.Info("Building manager proxy component for Unity Engine...");
                proxyType = new ManagerProxyBuilder().WriteDynamicAssemblyAndLoadProxyType();

                if (proxyType == null)
                {
                    EarlyLog.Info("Failed.");
                    return;
                }
            }
            catch (ReflectionTypeLoadException rtle)
            {
                EarlyLog.Exception(rtle);

                EarlyLog.Info(" --- LOADER EXCEPTIONS FOLLOW --- ");
                foreach (var lex in rtle.LoaderExceptions)
                {
                    EarlyLog.Exception(lex);
                }
                return;
            }
            catch (Exception ex)
            {
                EarlyLog.Exception(ex);
                return;
            }

            try
            {
                EarlyLog.Info("Creating Reactor Manager GameObject...");
                ReactorManagerObject = GameObjectBridge.CreateGameObject("com.github.ciastex/ReactorModLoaderProxy");
            }
            catch (Exception e)
            {
                EarlyLog.Exception(e);
                return;
            }

            EarlyLog.Info("About to add component to Reactor Manager GameObject.");
            object proxyComponent;

            try
            {
                proxyComponent = GameObjectBridge.AttachComponentTo(ReactorManagerObject, proxyType);
            }
            catch (Exception e)
            {
                EarlyLog.Exception(e);
                return;
            }

            if (proxyComponent == null)
            {
                EarlyLog.Error("Manager proxy component has failed to attach when it wasn't really supposed to fail on Unity 5+.");

                EarlyLog.Info("Report this stuff to https://github.com/Ciastex/Centrifuge/issues.");
                EarlyLog.Info("Make sure to check for and - if existing - include your game's output_log.txt (and/or Player.log) in the report.");
                EarlyLog.Info("Definitely include this entire log as well.");
                EarlyLog.Info("Otherwise I'll be very angry and ask you for this stuff in a very rude manner.");

                if (Platform.IsUnix())
                {
                    EarlyLog.Info("Look in ~/.config/unity3d/<CompanyName>/<GameName>/ for any .log and/or .txt files.");
                }
                else
                {
                    var path = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "\\AppData\\LocalLow");
                    EarlyLog.Info($"Look in {path}\\<CompanyName>\\<GameName> for any .log and/or .txt files.");
                }
            }

            EarlyLog.Info(" --- BOOTSTRAPPER FINISHED --- ");
        }