Ejemplo n.º 1
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IHost, RocketUnturnedHost>(null, "unturned", "game");
            container.RegisterSingletonType <IPlayerManager, UnturnedPlayerManager>(null, "game", "unturned");
            var mgr = container.Resolve <IPlayerManager>("unturned");

            container.RegisterSingletonInstance <IUserManager>(mgr, null, "game", "unturned");

            container.RegisterSingletonType <ICommandProvider, VanillaCommandProvider>("unturned_commands");
            container.RegisterSingletonType <ICommandProvider, RocketUnturnedCommandProvider>("rocket_unturned_commands");
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IHost, EcoHost>(null, "eco", "game");
            container.RegisterSingletonType <IEcoSettingsProvider, EcoSettingsProvider>();

            IEcoSettingsProvider settingsProvider = container.Resolve <IEcoSettingsProvider>();

            settingsProvider.Load();

            container.RegisterSingletonType <ICommandProvider, EcoCommandProvider>("eco_commands");
            container.RegisterSingletonInstance <ICommandProvider>(new EcoNativeCommandProvider(container, settingsProvider), "eco_vanilla_commands");
            container.RegisterSingletonType <IPermissionProvider, EcoPermissionProvider>("eco_vanilla_permissions");
            container.RegisterSingletonType <ITaskScheduler, EcoTaskScheduler>(null, "eco", "game");

            IPlayerManager playerManager = new EcoPlayerManager(container);

            container.RegisterSingletonInstance(playerManager, null, "eco", "game");
            container.RegisterSingletonInstance <IUserManager>(playerManager, "eco", "game");
            container.RegisterSingletonType <IUserManager, StdConsoleUserManager>("stdconsole");

#if DEBUG
            container.RegisterSingletonType <IGovernment, EcoGovernment>(null, "eco", "game");
            container.RegisterSingletonType <IEconomyProvider, EcoEconomyProvider>(null, "eco", "game");
#endif
        }
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IPluginManager, JavaScriptScriptingProvider>("javascript_plugins");
            var instance = (JavaScriptScriptingProvider)container.Resolve <IPluginManager>("javascript_plugins");

            container.RegisterSingletonInstance <IScriptingProvider>(instance, "javascript");
        }
Ejemplo n.º 4
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IPluginManager, CSharpScriptingProvider>("csharp_plugins");
            var instance = (CSharpScriptingProvider)container.Resolve <IPluginManager>("csharp_plugins");

            container.RegisterSingletonInstance <IScriptingProvider>(instance, "csharp");
        }
Ejemplo n.º 5
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IUzClient, UzClient>();

            LoadModuleConfig(container);
            RegisterModuleInitializer(resolver, UzClient.Initialize);
        }
Ejemplo n.º 6
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <ITelegramBot, TelegramBot>();

            LoadModuleConfig(container);
            RegisterModuleInitializer(resolver, TelegramBot.Initialize);
        }
        public async Task InitAsync(IRuntime runtime)
        {
            //Fix CodePage 437 not supported
            ZipConstants.DefaultCodePage = System.Text.Encoding.UTF8.CodePage;

            // Another possible workaround:
            // new I18N.West();

            BaseLogger.SkipTypeFromLogging(typeof(UnturnedPlayerManager));
            ApplyTlsWorkaround();

            this.runtime     = runtime;
            rocketGameObject = new GameObject();
            Object.DontDestroyOnLoad(rocketGameObject);

            container          = runtime.Container;
            eventManager       = container.Resolve <IEventBus>();
            playerManager      = (UnturnedPlayerManager)container.Resolve <IUserManager>("host");
            ModuleTranslations = container.Resolve <ITranslationCollection>();

            logger = container.Resolve <ILogger>();
            logger.LogInformation("Loading Rocket Unturned Implementation...");

            container.RegisterSingletonType <AutomaticSaveWatchdog, AutomaticSaveWatchdog>();
            container.Resolve <AutomaticSaveWatchdog>().Start();
            LoadTranslations();

            Provider.onServerHosted += OnServerHosted;

            if (Environment.OSVersion.Platform == PlatformID.Unix ||
                Environment.OSVersion.Platform == PlatformID.MacOSX)
            {
                rocketGameObject.SetActive(false); // deactivate object so it doesn't run Awake until all properties were set
                var console = rocketGameObject.AddComponent <UnturnedConsolePipe>();
                console.Logger = logger;
                rocketGameObject.SetActive(true); // reactivate object
            }

            SteamChannel.onTriggerSend    += TriggerSend;
            Provider.onCheckValid         += OnCheckValid;
            Provider.onServerConnected    += OnPlayerConnected;
            Provider.onServerDisconnected += OnPlayerDisconnected;
            DamageTool.playerDamaged      += OnPlayerDamaged;
            Provider.onServerShutdown     += OnServerShutdown;
            ChatManager.onChatted         += (SteamPlayer player, EChatMode mode, ref Color color, ref bool isRich, string message,
                                              ref bool isVisible) =>
            {
                UnturnedPlayer          p      = (UnturnedPlayer)playerManager.GetPlayerByIdAsync(player.playerID.steamID.m_SteamID.ToString()).GetAwaiter().GetResult();
                UnturnedPlayerChatEvent @event = new UnturnedPlayerChatEvent(p, mode, color, isRich, message, !isVisible);
                eventManager.Emit(this, @event);
                color     = @event.Color;
                isRich    = @event.IsRichText;
                isVisible = [email protected];
            };

            CommandWindow.onCommandWindowOutputted += (text, color)
                                                      => logger.LogNative(text?.ToString());
        }
        public void Init(IRuntime runtime)
        {
            this.runtime     = runtime;
            rocketGameObject = new GameObject();
            Object.DontDestroyOnLoad(rocketGameObject);

            container          = runtime.Container;
            eventManager       = container.Resolve <IEventManager>();
            playerManager      = (UnturnedPlayerManager)container.Resolve <IUserManager>("game");
            ModuleTranslations = container.Resolve <ITranslationCollection>();

            logger = container.Resolve <ILogger>();
            logger.LogInformation("Loading Rocket Unturned Implementation...");

            container.RegisterSingletonType <AutomaticSaveWatchdog, AutomaticSaveWatchdog>();
            container.Resolve <AutomaticSaveWatchdog>().Start();
            LoadTranslations();

            Provider.onServerHosted += OnServerHosted;

            if (Environment.OSVersion.Platform == PlatformID.Unix ||
                Environment.OSVersion.Platform == PlatformID.MacOSX)
            {
                rocketGameObject.SetActive(false); // deactivate object so it doesn't run Awake until all properties were set
                var console = rocketGameObject.AddComponent <UnturnedConsolePipe>();
                console.Logger = logger;
                rocketGameObject.SetActive(true); // reactivate object
            }

            SteamChannel.onTriggerSend    += TriggerSend;
            Provider.onCheckValid         += OnCheckValid;
            Provider.onServerConnected    += OnPlayerConnected;
            Provider.onServerDisconnected += OnPlayerDisconnected;
            DamageTool.playerDamaged      += OnPlayerDamaged;
            Provider.onServerShutdown     += OnServerShutdown;
            ChatManager.onChatted         += (SteamPlayer player, EChatMode mode, ref Color color, ref bool isRich, string message,
                                              ref bool isVisible) =>
            {
                UnturnedPlayer          p      = (UnturnedPlayer)playerManager.GetOnlinePlayerById(player.playerID.steamID.m_SteamID.ToString());
                UnturnedPlayerChatEvent @event = new UnturnedPlayerChatEvent(p, mode, color, isRich, message, !isVisible);
                eventManager.Emit(this, @event);
                color     = @event.Color;
                isRich    = @event.IsRichText;
                isVisible = [email protected];
            };

            CommandWindow.onCommandWindowOutputted += (text, color)
                                                      => logger.LogNative(text?.ToString());
        }
Ejemplo n.º 9
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IHost, RocketUnturnedHost>(null, "unturned", "host");
            container.RegisterSingletonType <IPlayerManager, UnturnedPlayerManager>(null, "host", "unturned");
            var mgr = container.Resolve <IPlayerManager>("unturned");

            container.RegisterSingletonInstance <IUserManager>(mgr, null, "host", "unturned");
            container.RegisterSingletonType <IUserManager, StdConsoleUserManager>("stdconsole");

            container.RegisterSingletonType <ICommandProvider, VanillaCommandProvider>("unturned_commands");
            container.RegisterSingletonType <ICommandProvider, RocketUnturnedCommandProvider>("rocket_unturned_commands");

            container.RegisterSingletonType <IPermissionChecker, UnturnedAdminPermissionChecker>("unturned_admins");
        }
Ejemplo n.º 10
0
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <IPermissionProvider, RconRootPermissionProvider>("rcon");
     container.RegisterSingletonType <IUserManager, RconServer>("rcon");
     container.RegisterSingletonInstance <ILogger>(new RconLogger(container), "rcon");
 }
Ejemplo n.º 11
0
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <IHost, ConsoleHost>();
     container.RegisterSingletonType <ITaskScheduler, SimpleTaskScheduler>();
     container.RegisterSingletonType <IUserManager, ConsoleUserManager>("host");
 }
Ejemplo n.º 12
0
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <IEconomyProvider, UconomyEconomyProvider>();
 }
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <ICommandProvider, WebsiteCommandProvider>("website_commands");
 }
Ejemplo n.º 14
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterType <IConfiguration, YamlConfiguration>("yaml", null);
            container.RegisterType <IConfiguration, JsonConfiguration>("json");
            container.RegisterType <IConfiguration, XmlConfiguration>("xml");

            container.RegisterSingletonType <IRocketConfigurationProvider, RocketConfigurationProvider>();

            container.RegisterSingletonType <ILogger, ConsoleLogger>("console_logger");
            container.RegisterSingletonType <ILogger, LoggerProxy>("proxy_logger", null);

            container.RegisterSingletonType <IEventBus, EventBus>();

            container.RegisterSingletonType <ICommandHandler, DefaultCommandHandler>("default_cmdhandler");
            container.RegisterSingletonType <ICommandHandler, CommandHandlerProxy>("proxy_cmdhandler", null);

            container.RegisterSingletonType <IPluginLoader, DefaultClrPluginLoader>("dll_plugins");
            container.RegisterSingletonType <IPluginLoader, NuGetPluginLoader>("nuget_plugins");
            container.RegisterSingletonType <IPluginLoader, PluginLoaderProxy>("proxy_plugins", null);

            container.RegisterSingletonType <ICommandProvider, RocketCommandProvider>("rocket_cmdprovider");
            container.RegisterSingletonType <ICommandProvider, CommandProviderProxy>("proxy_cmdprovider", null);

            var configPermissions = container.Activate <ConfigurationPermissionProvider>();

            container.RegisterInstance <IPermissionProvider>(configPermissions, "default_permissions", null);
            container.RegisterInstance <IPermissionChecker>(configPermissions, "default_permissions");

            container.RegisterSingletonType <IPermissionChecker, ConsolePermissionChecker>("console_checker");
            container.RegisterSingletonType <IPermissionChecker, PermissionProviderProxy>("proxy_checker", null);

            container.RegisterType <ITranslationCollection, TranslationCollection>();
            container.RegisterSingletonType <IUserManager, UserManagerProxy>();
        }
Ejemplo n.º 15
0
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <IHost, TestHost>();
     container.RegisterSingletonType <IPlayerManager, TestPlayerManager>();
 }
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterType <IEntityFrameworkConnectionDescriptor, EntityFrameworkConnectionDescriptor>();
     container.RegisterSingletonType <IEntityFrameworkService, EntityFrameworkService>();
 }
Ejemplo n.º 17
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterType <IConfiguration, JsonConfiguration>();
            container.RegisterType <IConfiguration, JsonConfiguration>("json");
            container.RegisterType <IConfiguration, XmlConfiguration>("xml");

            container.RegisterSingletonType <IRocketSettingsProvider, RocketSettingsProvider>();

            container.RegisterSingletonType <ILogger, ConsoleLogger>("console_logger");
            container.RegisterSingletonType <ILogger, ProxyLogger>("proxy_logger", null);

            container.RegisterSingletonType <IEventManager, EventManager>();

            container.RegisterSingletonType <ICommandHandler, DefaultCommandHandler>("default_cmdhandler");
            container.RegisterSingletonType <ICommandHandler, ProxyCommandHandler>("proxy_cmdhandler", null);

            container.RegisterSingletonType <IPluginManager, DllPluginManager>("dll_plugins");
            container.RegisterSingletonType <IPluginManager, NuGetPluginManager>("nuget_plugins");
            container.RegisterSingletonType <IPluginManager, ProxyPluginManager>("proxy_plugins", null);

            container.RegisterSingletonType <ICommandProvider, RocketCommandProvider>("rocket_cmdprovider");
            container.RegisterSingletonType <ICommandProvider, ProxyCommandProvider>("proxy_cmdprovider", null);

            container.RegisterSingletonType <IPermissionProvider, ConfigurationPermissionProvider>(
                "default_permissions");
            container.RegisterSingletonType <IPermissionProvider, ConsolePermissionProvider>("console_permissions");
            container.RegisterSingletonType <IPermissionProvider, ProxyPermissionProvider>("proxy_permissions", null);

            container.RegisterType <ITranslationCollection, TranslationCollection>();

            container.RegisterSingletonType <IUserManager, ProxyUserManager>();
        }
Ejemplo n.º 18
0
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <IDataProvider, WarpsDataProvider>("data");
     container.RegisterSingletonType <IDataProvider, ConfigDataProvider>("config");
 }
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <ISettingsProvider>(type => SettingsProvider.Load());

            LoadModuleConfig(container);
        }
Ejemplo n.º 20
0
        public void Register(IDependencyContainer container, IDependencyResolver resolver)
        {
            container.RegisterSingletonType <IPersistenceProvider, PersistenceProvider>();

            LoadModuleConfig(container);
        }
 public void Register(IDependencyContainer container, IDependencyResolver resolver)
 {
     container.RegisterSingletonType <INHibernateConnectionDescriptor, NHibernateConnectionDescriptor>();
     container.RegisterSingletonType <INHibernateService, NHibernateService>();
 }