Make UI cursors configurable.
This commit is contained in:
committed by
Paul Chote
parent
96c4554644
commit
e7cfd2765c
@@ -16,6 +16,7 @@ using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Orders
|
||||
{
|
||||
@@ -38,6 +39,8 @@ namespace OpenRA.Mods.Common.Orders
|
||||
|
||||
public class PlaceBuildingOrderGenerator : IOrderGenerator
|
||||
{
|
||||
readonly string worldDefaultCursor = ChromeMetrics.Get<string>("WorldDefaultCursor");
|
||||
|
||||
class VariantWrapper
|
||||
{
|
||||
public readonly ActorInfo ActorInfo;
|
||||
@@ -288,7 +291,10 @@ namespace OpenRA.Mods.Common.Orders
|
||||
return preview != null ? preview.RenderAnnotations(wr, TopLeft) : Enumerable.Empty<IRenderable>();
|
||||
}
|
||||
|
||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return "default"; }
|
||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||
{
|
||||
return worldDefaultCursor;
|
||||
}
|
||||
|
||||
bool IOrderGenerator.HandleKeyPress(KeyInput e)
|
||||
{
|
||||
|
||||
@@ -68,6 +68,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public Action OnDoubleClick = () => { };
|
||||
public Action<KeyInput> OnKeyPress = _ => { };
|
||||
|
||||
public string Cursor = ChromeMetrics.Get<string>("ButtonCursor");
|
||||
|
||||
protected readonly Ruleset ModRules;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
@@ -221,6 +223,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
tooltipContainer.Value.RemoveTooltip();
|
||||
}
|
||||
|
||||
public override string GetCursor(int2 pos) { return Cursor; }
|
||||
|
||||
public override int2 ChildOrigin
|
||||
{
|
||||
get
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
readonly int cellWidth;
|
||||
readonly int previewWidth;
|
||||
readonly int previewHeight;
|
||||
readonly string worldDefaultCursor = ChromeMetrics.Get<string>("WorldDefaultCursor");
|
||||
|
||||
float radarMinimapHeight;
|
||||
int frame;
|
||||
@@ -283,7 +284,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
var cursor = world.OrderGenerator.GetCursor(world, cell, worldPixel, mi);
|
||||
if (cursor == null)
|
||||
return "default";
|
||||
return worldDefaultCursor;
|
||||
|
||||
return Game.ModData.CursorProvider.HasCursorSequence(cursor + "-minimap") ? cursor + "-minimap" : cursor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user