Use expression body syntax
This commit is contained in:
@@ -225,14 +225,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public override string GetCursor(int2 pos) { return Cursor; }
|
||||
|
||||
public override int2 ChildOrigin
|
||||
{
|
||||
get
|
||||
{
|
||||
return RenderOrigin +
|
||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0));
|
||||
}
|
||||
}
|
||||
public override int2 ChildOrigin =>
|
||||
RenderOrigin +
|
||||
(Depressed ? new int2(VisualHeight, VisualHeight) : new int2(0, 0));
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
@@ -282,7 +277,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new ButtonWidget(this); }
|
||||
public virtual int UsableWidth { get { return Bounds.Width; } }
|
||||
public virtual int UsableWidth => Bounds.Width;
|
||||
|
||||
public virtual void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
const int LogLength = 9;
|
||||
List<ChatLine> recentLines = new List<ChatLine>();
|
||||
|
||||
public override Rectangle EventBounds { get { return Rectangle.Empty; } }
|
||||
public override Rectangle EventBounds => Rectangle.Empty;
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return true;
|
||||
}
|
||||
|
||||
public Color Color { get { return Color.FromAhsv(H, S, V); } }
|
||||
public Color Color => Color.FromAhsv(H, S, V);
|
||||
|
||||
public void Set(float hue)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public override Widget Clone() { return new DropDownButtonWidget(this); }
|
||||
|
||||
// This is crap
|
||||
public override int UsableWidth { get { return Bounds.Width - Bounds.Height; } } /* space for button */
|
||||
public override int UsableWidth => Bounds.Width - Bounds.Height; /* space for button */
|
||||
|
||||
public override void Hidden()
|
||||
{
|
||||
|
||||
@@ -54,10 +54,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
EditorActorPreview CurrentActor
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentActorInner;
|
||||
}
|
||||
get => currentActorInner;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -438,7 +435,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
public bool ShouldDoOnSave { get { return false; } }
|
||||
public bool ShouldDoOnSave => false;
|
||||
}
|
||||
|
||||
public interface IEditActorHandle
|
||||
@@ -554,6 +551,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
public bool ShouldDoOnSave { get { return true; } }
|
||||
public bool ShouldDoOnSave => true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -545,10 +545,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
}
|
||||
|
||||
// HACK The height of the templates and the scrollpanel needs to be kept in synch
|
||||
bool ShowScrollBar
|
||||
{
|
||||
get { return players.Count() + (hasTeams ? teams.Count() : 0) > 10; }
|
||||
}
|
||||
bool ShowScrollBar => players.Count() + (hasTeams ? teams.Count() : 0) > 10;
|
||||
|
||||
class StatsDropDownOption
|
||||
{
|
||||
|
||||
@@ -763,19 +763,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
public string MapName;
|
||||
public string Faction;
|
||||
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return Type == default(GameType)
|
||||
&& Date == default(DateType)
|
||||
&& Duration == default(DurationType)
|
||||
&& Outcome == default(WinState)
|
||||
&& string.IsNullOrEmpty(PlayerName)
|
||||
&& string.IsNullOrEmpty(MapName)
|
||||
&& string.IsNullOrEmpty(Faction);
|
||||
}
|
||||
}
|
||||
public bool IsEmpty =>
|
||||
Type == default(GameType)
|
||||
&& Date == default(DateType)
|
||||
&& Duration == default(DurationType)
|
||||
&& Outcome == default(WinState)
|
||||
&& string.IsNullOrEmpty(PlayerName)
|
||||
&& string.IsNullOrEmpty(MapName)
|
||||
&& string.IsNullOrEmpty(Faction);
|
||||
}
|
||||
|
||||
enum GameType
|
||||
|
||||
@@ -224,6 +224,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
public bool Loaded { get { return minimap != null; } }
|
||||
public bool Loaded => minimap != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
palette = null;
|
||||
}
|
||||
|
||||
public override int2 ChildOrigin { get { return location; } }
|
||||
public override int2 ChildOrigin => location;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +98,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public ProductionQueue CurrentQueue
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentQueue;
|
||||
}
|
||||
get => currentQueue;
|
||||
set
|
||||
{
|
||||
currentQueue = value;
|
||||
@@ -112,7 +109,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
}
|
||||
}
|
||||
|
||||
public override Rectangle EventBounds { get { return eventBounds; } }
|
||||
public override Rectangle EventBounds => eventBounds;
|
||||
Dictionary<Rectangle, ProductionIcon> icons = new Dictionary<Rectangle, ProductionIcon>();
|
||||
Animation cantBuild, clock;
|
||||
Rectangle eventBounds = Rectangle.Empty;
|
||||
@@ -206,10 +203,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
IconRowOffset--;
|
||||
}
|
||||
|
||||
public bool CanScrollUp
|
||||
{
|
||||
get { return IconRowOffset > 0; }
|
||||
}
|
||||
public bool CanScrollUp => IconRowOffset > 0;
|
||||
|
||||
public void ScrollToTop()
|
||||
{
|
||||
|
||||
@@ -147,10 +147,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public string QueueGroup
|
||||
{
|
||||
get
|
||||
{
|
||||
return queueGroup;
|
||||
}
|
||||
get => queueGroup;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -162,10 +159,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public ProductionQueue CurrentQueue
|
||||
{
|
||||
get
|
||||
{
|
||||
return paletteWidget.Value.CurrentQueue;
|
||||
}
|
||||
get => paletteWidget.Value.CurrentQueue;
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
@@ -230,13 +230,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
Game.Renderer.DisableScissor();
|
||||
}
|
||||
|
||||
public override int2 ChildOrigin
|
||||
{
|
||||
get
|
||||
{
|
||||
return RenderOrigin + new int2(ScrollBar == ScrollBar.Left ? ScrollbarWidth : 0, (int)currentListOffset);
|
||||
}
|
||||
}
|
||||
public override int2 ChildOrigin => RenderOrigin + new int2(ScrollBar == ScrollBar.Left ? ScrollbarWidth : 0, (int)currentListOffset);
|
||||
|
||||
public override bool EventBoundsContains(int2 location)
|
||||
{
|
||||
@@ -268,10 +262,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
SetListOffset(value, smooth);
|
||||
}
|
||||
|
||||
public bool ScrolledToBottom
|
||||
{
|
||||
get { return targetListOffset == Math.Min(0, Bounds.Height - ContentHeight) || ContentHeight <= Bounds.Height; }
|
||||
}
|
||||
public bool ScrolledToBottom => targetListOffset == Math.Min(0, Bounds.Height - ContentHeight) || ContentHeight <= Bounds.Height;
|
||||
|
||||
void ScrollToItem(Widget item, bool smooth = false)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
HotkeyReference[] hotkeys;
|
||||
|
||||
Rectangle eventBounds;
|
||||
public override Rectangle EventBounds { get { return eventBounds; } }
|
||||
public override Rectangle EventBounds => eventBounds;
|
||||
SpriteFont overlayFont;
|
||||
float2 iconOffset, holdOffset, readyOffset, timeOffset;
|
||||
|
||||
|
||||
@@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public TerrainTemplateInfo Template
|
||||
{
|
||||
get
|
||||
{
|
||||
return template;
|
||||
}
|
||||
get => template;
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
@@ -23,10 +23,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
string text = "";
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text;
|
||||
}
|
||||
get => text;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -46,10 +43,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
TextFieldType type = TextFieldType.General;
|
||||
public TextFieldType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
return type;
|
||||
}
|
||||
get => type;
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public bool DrawOverlay = true;
|
||||
public bool Skippable = true;
|
||||
|
||||
public bool Paused { get { return paused; } }
|
||||
public IVideo Video { get { return video; } }
|
||||
public bool Paused => paused;
|
||||
public IVideo Video => video;
|
||||
|
||||
Sprite videoSprite, overlaySprite;
|
||||
Sheet overlaySheet;
|
||||
|
||||
@@ -302,14 +302,9 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
return null;
|
||||
}
|
||||
|
||||
bool IsJoystickScrolling
|
||||
{
|
||||
get
|
||||
{
|
||||
return joystickScrollStart.HasValue && joystickScrollEnd.HasValue &&
|
||||
(joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.MouseScrollDeadzone;
|
||||
}
|
||||
}
|
||||
bool IsJoystickScrolling =>
|
||||
joystickScrollStart.HasValue && joystickScrollEnd.HasValue &&
|
||||
(joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.MouseScrollDeadzone;
|
||||
|
||||
public override bool HandleMouseInput(MouseInput mi)
|
||||
{
|
||||
|
||||
@@ -35,13 +35,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
int2 dragStart, mousePos;
|
||||
bool isDragging = false;
|
||||
|
||||
bool IsValidDragbox
|
||||
{
|
||||
get
|
||||
{
|
||||
return isDragging && (dragStart - mousePos).Length > Game.Settings.Game.SelectionDeadzone;
|
||||
}
|
||||
}
|
||||
bool IsValidDragbox => isDragging && (dragStart - mousePos).Length > Game.Settings.Game.SelectionDeadzone;
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public WorldInteractionControllerWidget(World world, WorldRenderer worldRenderer)
|
||||
|
||||
Reference in New Issue
Block a user