コード例 #1
0
 public int monsterDensityAroundCursor(float distance)
 {
     if (!Hud.Game.Me.IsInTown)
     {
         IScreenCoordinate coord = Hud.Game.Me.FloorCoordinate.ToScreenCoordinate(); //Hud.Render.GetCursorPos();
         coord.X = Hud.Window.CursorX;
         coord.Y = Hud.Window.CursorY;
         IWorldCoordinate cursor = coord.ToWorldCoordinate();
         int count = 0;
         foreach (IMonster monster in Hud.Game.AliveMonsters)
         {
             if (monster.FloorCoordinate.XYDistanceTo(cursor) < distance)
             {
                 count++;
             }
         }
         if (drawCursorCircle)
         {
             cursorBrush.DrawWorldEllipse(distance, -1, cursor);
         }
         if (drawCursorLabel)
         {
             cursorDecorator.Paint(Hud.Window.CursorX - 10, Hud.Window.CursorY + 30, 50, 20, count.ToString(), null, "");
         }
         return(count);
     }
     return(0);
 }
コード例 #2
0
 public void PaintWorld(WorldLayer layer)
 {
     if (!Hud.Game.Me.IsInTown)
     {
         IScreenCoordinate coord  = Hud.Window.CreateScreenCoordinate(Hud.Window.CursorX, Hud.Window.CursorY);
         IWorldCoordinate  cursor = coord.ToWorldCoordinate();
         int count = 0;
         foreach (IMonster monster in Hud.Game.AliveMonsters)
         {
             if (monster.FloorCoordinate.XYDistanceTo(cursor) < Distance)
             {
                 count++;
             }
         }
         if (DrawCursorCircle)
         {
             CursorCircleBrush.DrawWorldEllipse(Distance, -1, cursor);
         }
         if (DrawCursorLabel)
         {
             float width  = Hud.Window.Size.Height * CursorLabelWRatio;
             float height = Hud.Window.Size.Height * CursorLabelHRatio;
             CursorLabelDecorator.Paint(coord.X + CursorLabelXOffset, coord.Y + CursorLabelYOffset, width, height, count.ToString(), null, "");
         }
         if (DrawTopLabel)
         {
             float x      = Hud.Window.Size.Width * TopLabelXRatio;
             float y      = Hud.Window.Size.Height * TopLabelYRatio;
             float width  = Hud.Window.Size.Height * TopLabelWRatio;
             float height = Hud.Window.Size.Height * TopLabelHRatio;
             TopLabelDecorator.Paint(x - width / 2, y, width, height, count.ToString(), null, "");
         }
         if (DrawCursorLine)
         {
             var player = Hud.Game.Me.ScreenCoordinate;
             LineBrush.DrawLine(player.X, player.Y, coord.X, coord.Y);
         }
         if (DrawDistanceLabel)
         {
             var   distance = Hud.Game.Me.FloorCoordinate.XYDistanceTo(cursor);
             float x        = Hud.Window.Size.Width * DistanceLabelXRatio;
             float y        = Hud.Window.Size.Height * DistanceLabelYRatio;
             float width    = Hud.Window.Size.Height * DistanceLabelWRatio;
             float height   = Hud.Window.Size.Height * DistanceLabelHRatio;
             TopLabelDecorator.Paint(x - width / 2, y, width, height, distance.ToString("F1", CultureInfo.InvariantCulture));
         }
     }
 }