Exemplo n.º 1
0
        public override void Load(bool startup)
        {
            Command.Register(new CmdReloadEffects());
            Command.Register(new CmdEffect());
            Command.Register(new CmdSpawner());

            rnd = new Random();
            LoadEffects();
            DefineEffectsAll();


            OnPlayerFinishConnectingEvent.Register(OnPlayerFinishConnecting, Priority.Low);
            OnLevelLoadedEvent.Register(OnLevelLoaded, Priority.Low);
            OnLevelUnloadEvent.Register(OnLevelUnload, Priority.Low);
            OnLevelDeletedEvent.Register(OnLevelDeleted, Priority.Low);
            OnLevelCopiedEvent.Register(OnLevelCopied, Priority.Low);
            OnLevelRenamedEvent.Register(OnLevelRenamed, Priority.Low);

            SpawnersFile.cache = new ThreadSafeCache();
            if (!Directory.Exists(SpawnersFile.spawnerDirectory))
            {
                Directory.CreateDirectory(SpawnersFile.spawnerDirectory);
            }
            Level[] levels = LevelInfo.Loaded.Items;
            foreach (Level level in levels)
            {
                SpawnersFile.Load(level);
            }
            spawnerAccum = 0;
            ActivateSpawners();
        }
Exemplo n.º 2
0
        void InitServerTask(SchedulerTask task)
        {
            Server.Start();
            // The first check for updates is run after 10 seconds, subsequent ones every two hours
            Server.Background.QueueRepeat(Updater.UpdaterTask, null, TimeSpan.FromSeconds(10));

            OnPlayerConnectEvent.Register(Player_PlayerConnect, Priority.Low);
            OnPlayerDisconnectEvent.Register(Player_PlayerDisconnect, Priority.Low);
            OnJoinedLevelEvent.Register(Player_OnJoinedLevel, Priority.Low);

            OnLevelLoadedEvent.Register(Level_LevelLoaded, Priority.Low);
            OnLevelUnloadEvent.Register(Level_LevelUnload, Priority.Low);

            RunOnUiThread(() => main_btnProps.Enabled = true);
        }
Exemplo n.º 3
0
        public override void Unload(bool shutdown)
        {
            Command.Unregister(Command.Find("ReloadEffects"));
            Command.Unregister(Command.Find("Effect"));
            Command.Unregister(Command.Find("Spawner"));

            OnPlayerFinishConnectingEvent.Unregister(OnPlayerFinishConnecting);
            OnLevelLoadedEvent.Unregister(OnLevelLoaded);
            OnLevelUnloadEvent.Unregister(OnLevelUnload);
            OnLevelDeletedEvent.Unregister(OnLevelDeleted);
            OnLevelCopiedEvent.Unregister(OnLevelCopied);
            OnLevelRenamedEvent.Unregister(OnLevelRenamed);

            spawnersAtLevel.Clear();
            instance.Cancel(tickSpawners);
        }