Ejemplo n.º 1
0
        private void OnNewCour(object sender, Courier courier)
        {
            //if (courier.Team==Main.Owner.Team)
            //    return;

            if (Couriers.Any(x => x.Cour.Equals(courier)))
            {
                Log.Error($"Cant init this Cour -> {courier.GetDisplayName()} [{courier.Handle}]");
                return;
            }
            var myTeam     = Main.Context.Value.Owner.Team;
            var targetTeam = courier.Team;
            var isAlly     = myTeam == targetTeam;
            var newHero    = new CourContainer(courier, isAlly, Main);

            try
            {
                Couriers.Add(newHero);

                if (isAlly)
                {
                    AllyCouriers.Add(newHero);
                }
                else
                {
                    EnemyCouriers.Add(newHero);
                }

                Log.Info($"New courier -> {courier.GetDisplayName()} [{courier.Handle}] [{(isAlly ? "Ally" : "Enemy")}]");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Ejemplo n.º 2
0
        public void OnDeactivate()
        {
            foreach (var container in Heroes)
            {
                container.Flush();
            }

            foreach (var container in Couriers)
            {
                container.Dispose();
            }

            AllyHeroes.Clear();
            EnemyHeroes.Clear();
            AllyCouriers.Clear();
            EnemyCouriers.Clear();
        }
Ejemplo n.º 3
0
        private void OnCourRemoved(object sender, Courier e)
        {
            var founder = Couriers.Find(x => x.Cour.Equals(e));

            if (founder != null)
            {
                Couriers.Remove(founder);
                if (founder.IsAlly)
                {
                    AllyCouriers.Remove(founder);
                }
                else
                {
                    EnemyCouriers.Remove(founder);
                }
            }
        }