DefaultInputController -> WorldInteractionController; Tooltip tweaks.
This commit is contained in:
@@ -227,8 +227,8 @@
|
|||||||
<Compile Include="Widgets\TimerWidget.cs" />
|
<Compile Include="Widgets\TimerWidget.cs" />
|
||||||
<Compile Include="Widgets\ShpImageWidget.cs" />
|
<Compile Include="Widgets\ShpImageWidget.cs" />
|
||||||
<Compile Include="Widgets\OrderButtonWidget.cs" />
|
<Compile Include="Widgets\OrderButtonWidget.cs" />
|
||||||
<Compile Include="Widgets\DefaultInputControllerWidget.cs" />
|
|
||||||
<Compile Include="Traits\DrawLineToTarget.cs" />
|
<Compile Include="Traits\DrawLineToTarget.cs" />
|
||||||
|
<Compile Include="Widgets\WorldInteractionControllerWidget.cs" />
|
||||||
<Compile Include="Widgets\ViewportScrollControllerWidget.cs" />
|
<Compile Include="Widgets\ViewportScrollControllerWidget.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -18,10 +18,10 @@ using OpenRA.FileFormats;
|
|||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
class DefaultInputControllerWidget : Widget
|
class WorldInteractionControllerWidget : Widget
|
||||||
{
|
{
|
||||||
public DefaultInputControllerWidget() : base() {}
|
public WorldInteractionControllerWidget() : base() {}
|
||||||
protected DefaultInputControllerWidget(DefaultInputControllerWidget widget) : base(widget) {}
|
protected WorldInteractionControllerWidget(WorldInteractionControllerWidget widget) : base(widget) {}
|
||||||
|
|
||||||
public override void DrawInner( World world )
|
public override void DrawInner( World world )
|
||||||
{
|
{
|
||||||
@@ -171,6 +171,6 @@ namespace OpenRA.Widgets
|
|||||||
Game.viewport.Center(world.Selection.Actors);
|
Game.viewport.Center(world.Selection.Actors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Widget Clone() { return new DefaultInputControllerWidget(this); }
|
public override Widget Clone() { return new WorldInteractionControllerWidget(this); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,18 +18,35 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
public class WorldTooltipWidget : Widget
|
public class WorldTooltipWidget : Widget
|
||||||
{
|
{
|
||||||
const int worldTooltipDelay = 10; /* ticks */
|
public int TooltipDelay = 10;
|
||||||
|
|
||||||
public WorldTooltipWidget() : base() { }
|
public WorldTooltipWidget() : base() { }
|
||||||
|
|
||||||
public override void DrawInner(World world)
|
public override void DrawInner(World world)
|
||||||
{
|
{
|
||||||
if (Widget.TicksSinceLastMove < worldTooltipDelay || world == null || world.LocalPlayer == null)
|
if (Widget.TicksSinceLastMove < TooltipDelay || world == null || world.LocalPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var cell = Game.viewport.ViewToWorld(Widget.LastMousePos).ToInt2();
|
||||||
|
if (!world.Map.IsInMap(cell)) return;
|
||||||
|
|
||||||
|
if (!world.LocalPlayer.Shroud.IsExplored(cell))
|
||||||
|
{
|
||||||
|
var utext = "Unexplored Terrain";
|
||||||
|
var usz = Game.Renderer.BoldFont.Measure(utext) + new int2(20, 24);
|
||||||
|
|
||||||
|
WidgetUtils.DrawPanel("dialog4", Rectangle.FromLTRB(
|
||||||
|
Widget.LastMousePos.X + 20, Widget.LastMousePos.Y + 20,
|
||||||
|
Widget.LastMousePos.X + usz.X + 20, Widget.LastMousePos.Y + usz.Y + 20));
|
||||||
|
|
||||||
|
Game.Renderer.BoldFont.DrawText(utext,
|
||||||
|
new float2(Widget.LastMousePos.X + 30, Widget.LastMousePos.Y + 30), Color.White);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var actor = world.FindUnitsAtMouse(Widget.LastMousePos).FirstOrDefault();
|
var actor = world.FindUnitsAtMouse(Widget.LastMousePos).FirstOrDefault();
|
||||||
if (actor == null) return;
|
if (actor == null || !actor.IsVisible())
|
||||||
|
return;
|
||||||
|
|
||||||
var text = actor.Info.Traits.Contains<ValuedInfo>()
|
var text = actor.Info.Traits.Contains<ValuedInfo>()
|
||||||
? actor.Info.Traits.Get<ValuedInfo>().Description
|
? actor.Info.Traits.Get<ValuedInfo>().Description
|
||||||
: actor.Info.Name;
|
: actor.Info.Name;
|
||||||
@@ -68,7 +85,6 @@ namespace OpenRA.Widgets
|
|||||||
ChromeProvider.GetImage("flags", actor.Owner.Country.Race),
|
ChromeProvider.GetImage("flags", actor.Owner.Country.Race),
|
||||||
new float2(Widget.LastMousePos.X + 30, Widget.LastMousePos.Y + 50));
|
new float2(Widget.LastMousePos.X + 30, Widget.LastMousePos.Y + 50));
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.Renderer.RgbaSpriteRenderer.Flush();
|
Game.Renderer.RgbaSpriteRenderer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Container@ROOT:
|
|||||||
Delegate:IngameChromeDelegate
|
Delegate:IngameChromeDelegate
|
||||||
Visible:false
|
Visible:false
|
||||||
Children:
|
Children:
|
||||||
DefaultInputController:
|
WorldInteractionController:
|
||||||
X:0
|
X:0
|
||||||
Y:0
|
Y:0
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
@@ -65,8 +65,6 @@ Container@ROOT:
|
|||||||
Height:25
|
Height:25
|
||||||
Text:Diplomacy
|
Text:Diplomacy
|
||||||
Bold:True
|
Bold:True
|
||||||
WorldTooltip@INGAME_WORLD_TOOLTIP:
|
|
||||||
Id:INGAME_WORLD_TOOLTIP
|
|
||||||
Button@INGAME_DEVELOPERMODE_BUTTON:
|
Button@INGAME_DEVELOPERMODE_BUTTON:
|
||||||
Id:INGAME_DEVELOPERMODE_BUTTON
|
Id:INGAME_DEVELOPERMODE_BUTTON
|
||||||
X:324
|
X:324
|
||||||
@@ -108,6 +106,7 @@ Container@ROOT:
|
|||||||
Image:repair
|
Image:repair
|
||||||
Description:Repair
|
Description:Repair
|
||||||
LongDesc:Repair damaged buildings
|
LongDesc:Repair damaged buildings
|
||||||
|
WorldTooltip:
|
||||||
Background@INGAME_OPTIONS_BG:
|
Background@INGAME_OPTIONS_BG:
|
||||||
Id:INGAME_OPTIONS_BG
|
Id:INGAME_OPTIONS_BG
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Container@ROOT:
|
|||||||
Delegate:IngameChromeDelegate
|
Delegate:IngameChromeDelegate
|
||||||
Visible:false
|
Visible:false
|
||||||
Children:
|
Children:
|
||||||
DefaultInputController:
|
WorldInteractionController:
|
||||||
X:0
|
X:0
|
||||||
Y:0
|
Y:0
|
||||||
Width:WINDOW_RIGHT
|
Width:WINDOW_RIGHT
|
||||||
@@ -115,6 +115,7 @@ Container@ROOT:
|
|||||||
Image:repair
|
Image:repair
|
||||||
Description:Repair
|
Description:Repair
|
||||||
LongDesc:Repair damaged buildings
|
LongDesc:Repair damaged buildings
|
||||||
|
WorldTooltip:
|
||||||
Background@INGAME_OPTIONS_BG:
|
Background@INGAME_OPTIONS_BG:
|
||||||
Id:INGAME_OPTIONS_BG
|
Id:INGAME_OPTIONS_BG
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
|
|||||||
Reference in New Issue
Block a user