示例#1
0
        internal void Initialize()
        {
            Environment.Initialize();
            try
            {
                Implementation.OnRocketImplementationInitialized += () =>
                {
                    gameObject.TryAddComponent <TaskDispatcher>();
                    gameObject.TryAddComponent <AutomaticShutdownWatchdog>();
                    if (Settings.Instance.RCON.Enabled)
                    {
                        gameObject.TryAddComponent <RCONServer>();
                    }
                };

                Settings    = new XMLFileAsset <RocketSettings>(Environment.SettingsFile);
                Translation = new XMLFileAsset <TranslationList>(String.Format(Environment.TranslationFile, Settings.Instance.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations);
                defaultTranslations.AddUnknownEntries(Translation);
                Permissions = gameObject.TryAddComponent <RocketPermissionsManager>();
                Plugins     = gameObject.TryAddComponent <RocketPluginManager>();
                Commands    = gameObject.TryAddComponent <RocketCommandManager>();

                if (Settings.Instance.MaxFrames < 10 && Settings.Instance.MaxFrames != -1)
                {
                    Settings.Instance.MaxFrames = 10;
                }
                Application.targetFrameRate = Settings.Instance.MaxFrames;

                OnRockedInitialized.TryInvoke();
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
        }
示例#2
0
        internal void Initialize()
        {
            Environment.Initialize();
            try
            {
                Implementation.OnRocketImplementationInitialized += () =>
                {
                    gameObject.TryAddComponent <TaskDispatcher>();
                    gameObject.TryAddComponent <AutomaticShutdownWatchdog>();
                    if (Settings.Instance.RCON.Enabled)
                    {
                        gameObject.TryAddComponent <RCONServer>();
                    }
                };

                Settings = new XMLFileAsset <RocketSettings>(Environment.SettingsFile);
                var settings = Settings.Instance;
                Translation = new XMLFileAsset <TranslationList>(string.Format(Environment.TranslationFile, settings.LanguageCode), new Type[] { typeof(TranslationList), typeof(TranslationListEntry) }, defaultTranslations);
                defaultTranslations.AddUnknownEntries(Translation);
                Permissions = gameObject.TryAddComponent <RocketPermissionsManager>();
                //Plugins = gameObject.TryAddComponent<RocketPluginManager>();
                Plugins = new RocketPluginManager();
                RocketPluginManager.Awake();
                Commands = new RocketCommandManager();
                Commands.Awake();
                // Load Commands from Rocket.Core.Commands.
                Commands.RegisterFromAssembly(Assembly.GetExecutingAssembly());

                if (settings.MaxFrames < 10 && settings.MaxFrames != -1)
                {
                    settings.MaxFrames = 10;
                }
                Application.targetFrameRate = settings.MaxFrames;

                OnRockedInitialized.TryInvoke();

                Plugins.loadPlugins();
            }
            catch (Exception ex)
            {
                Logging.Logger.LogException(ex);
            }
        }