Exemple #1
0
        protected override void OnEnable()
        {
            Application.EnableVisualStyles();
            base.OnEnable();

            Context.Server.LevelManager.LevelCreated += (sender, args) =>
            {
                if (_biomeMapForm != null)
                {
                    return;
                }
                CreateForm(args.Level);
            };

            Context.Server.PlayerFactory.PlayerCreated += (sender, args) =>
            {
                args.Player.PlayerJoin += (o, eventArgs) =>
                {
                    _biomeMapForm.UpdateLevel();
                    args.Player.SetEffect(new Speed()
                    {
                        Duration  = Effect.MaxDuration,
                        Level     = 10,
                        Particles = false
                    });
                };
            };
        }
Exemple #2
0
        private void Update(object state)
        {
            if (_biomeMapForm == null)
            {
                return;
            }

            if (!Monitor.TryEnter(_sync))
            {
                return;
            }
            try
            {
                Console.WriteLine("Update Level");

                _biomeMapForm?.UpdateLevel();
            }
            finally
            {
                Monitor.Exit(_sync);
            }
        }