public void UpdateMouseover() { TooltipType = WorldTooltipType.None; var cell = worldRenderer.Viewport.ViewToWorld(Viewport.LastMousePos); if (!world.Map.Contains(cell)) return; if (world.ShroudObscures(cell)) { TooltipType = WorldTooltipType.Unexplored; return; } var underCursor = world.ScreenMap.ActorsAt(worldRenderer.Viewport.ViewToWorldPx(Viewport.LastMousePos)) .Where(a => !world.FogObscures(a) && a.HasTrait<IToolTip>()) .WithHighestSelectionPriority(); if (underCursor != null) { ActorTooltip = underCursor.TraitsImplementing<IToolTip>().First(); TooltipType = WorldTooltipType.Actor; return; } var frozen = world.ScreenMap.FrozenActorsAt(world.RenderPlayer, worldRenderer.Viewport.ViewToWorldPx(Viewport.LastMousePos)) .Where(a => a.TooltipInfo != null && a.IsValid) .WithHighestSelectionPriority(); if (frozen != null) { FrozenActorTooltip = frozen; TooltipType = WorldTooltipType.FrozenActor; } }
public void UpdateMouseover() { TooltipType = WorldTooltipType.None; var cell = Game.viewport.ViewToWorld(Viewport.LastMousePos).ToInt2(); if (!world.Map.IsInMap(cell)) return; if (world.LocalPlayer != null && !world.LocalPlayer.Shroud.IsExplored(cell)) { TooltipType = WorldTooltipType.Unexplored; return; } var actor = world.FindUnitsAtMouse(Viewport.LastMousePos).FirstOrDefault(); if (actor == null) return; ActorTooltip = actor.TraitsImplementing<IToolTip>().FirstOrDefault(); if (ActorTooltip != null) TooltipType = WorldTooltipType.Actor; }
public void UpdateMouseover() { TooltipType = WorldTooltipType.None; var cell = Game.viewport.ViewToWorld(Viewport.LastMousePos); if (!world.Map.IsInMap(cell)) return; if (world.ShroudObscures(cell)) { TooltipType = WorldTooltipType.Unexplored; return; } var underCursor = world.FindUnitsAtMouse(Viewport.LastMousePos) .Where(a => a.HasTrait<IToolTip>()) .OrderByDescending(a => a.Info.SelectionPriority()) .FirstOrDefault(); if (underCursor != null) { ActorTooltip = underCursor.TraitsImplementing<IToolTip>().First(); TooltipType = WorldTooltipType.Actor; return; } var frozen = world.FindFrozenActorsAtMouse(Viewport.LastMousePos) .Where(a => a.TooltipName != null) .OrderByDescending(a => a.Info.SelectionPriority()) .FirstOrDefault(); if (frozen != null) { FrozenActorTooltip = frozen; TooltipType = WorldTooltipType.FrozenActor; } }