Exemplo n.º 1
0
        public override void OnEnabled()
        {
            if (!File.Exists(Config.TranslationsDirectory))
            {
                File.Create(Config.TranslationsDirectory).Close();
            }

            Singleton = this;
            Manager.LoadTranslations();
            Translations                    = new Translations();
            _playerHandlers                 = new PlayerHandlers();
            _serverHandlers                 = new ServerHandlers();
            PlayerEvents.ChangingRole      += _playerHandlers.OnChangingRole;
            PlayerEvents.Died              += _playerHandlers.OnDied;
            ServerEvents.WaitingForPlayers += _serverHandlers.OnWaitingForPlayers;

            if (Config.SuicideCommand)
            {
                Manager.RegisterCommand(new SuicideCommand());
            }
            if (Config.EnableTips)
            {
                Manager.RegisterCommand(new TipsCommand());
            }

            base.OnEnabled();
        }
Exemplo n.º 2
0
        public override void OnDisabled()
        {
            PlayerEvents.ChangingRole      -= _playerHandlers.OnChangingRole;
            PlayerEvents.Died              -= _playerHandlers.OnDied;
            ServerEvents.WaitingForPlayers -= _serverHandlers.OnWaitingForPlayers;
            _playerHandlers = null;
            _serverHandlers = null;
            foreach (var coroutineHandle in Manager.CoroutineHandles)
            {
                Timing.KillCoroutines(coroutineHandle);
            }

            Translations = null;
            Singleton    = null;
            base.OnDisabled();
        }