Example #1
0
        static void Main(string[] args)
        {
            System.Threading.ThreadPool.GetMinThreads(out int q, out int a);
            var e = q;
            var r = a;


            while (true)
            {
                Task.Run(Producer);
                Thread.Sleep(200);
            }

            IdentityModel();

            // 装饰器
            StudentBase student = new Student()
            {
                Id   = 1,
                Name = "altman"
            };

            // 给student包了一层,装饰了一下。
            student = new DecoratorBase(student);
            student = new StudentDecoratorVideo(student);//再装饰一层
            student = new StudentDecoratorHomeWork(student);
            student.Study();
        }
Example #2
0
        public void PaintWorld(WorldLayer layer)
        {
            if (Hud.Game.IsInTown)
            {
                return;
            }

            IWorldCoordinate WizPosition = Hud.Game.Players.First().FloorCoordinate;
            int WizardsIngame            = 0;

            foreach (var player in Hud.Game.Players)
            {
                if (player.HeroClassDefinition.HeroClass == HeroClass.Wizard)
                {
                    WizPosition = player.FloorCoordinate;
                    WizardsIngame++;
                }
            }

            float mindist = float.MaxValue;
            var   actors  = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, Hud.Sno.SnoPowers.OculusRing.Sno) == 1);

            if (actors.Count() > 0)
            {
                var closest = actors.First();

                foreach (var actor in actors)
                {
                    float dist = actor.FloorCoordinate.XYDistanceTo(WizPosition);
                    if (dist < mindist)
                    {
                        closest = actor;
                        mindist = dist;
                    }
                }
                foreach (var actor in actors)
                {
                    if (WizardsIngame == 1)
                    {
                        if (actor == closest)
                        {
                            if (mindist < 13.3f)
                            {
                                DecoratorInside.Paint(layer, actor, actor.FloorCoordinate, null);
                            }
                            else
                            {
                                DecoratorClosest.Paint(layer, actor, actor.FloorCoordinate, null);
                            }
                        }
                        else
                        {
                            DecoratorBase.Paint(layer, actor, actor.FloorCoordinate, null);
                        }
                    }
                    else
                    {
                        DecoratorBase.Paint(layer, actor, actor.FloorCoordinate, null);
                    }
                }
            }
        }