コード例 #1
0
ファイル: Updater.cs プロジェクト: BeginnerEric/Testcode
        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);
            }
        }