copy constructors
This commit is contained in:
@@ -24,6 +24,7 @@ namespace OpenRA.Widgets
|
|||||||
class BackgroundWidget : Widget
|
class BackgroundWidget : Widget
|
||||||
{
|
{
|
||||||
public readonly string Background = "dialog";
|
public readonly string Background = "dialog";
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
if (!IsVisible())
|
if (!IsVisible())
|
||||||
@@ -36,5 +37,15 @@ namespace OpenRA.Widgets
|
|||||||
WidgetUtils.DrawPanel(Background, rect);
|
WidgetUtils.DrawPanel(Background, rect);
|
||||||
base.Draw(world);
|
base.Draw(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BackgroundWidget() : base() { }
|
||||||
|
|
||||||
|
public BackgroundWidget(Widget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
Background = (other as BackgroundWidget).Background;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone() { return new BackgroundWidget(this); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,16 @@ namespace OpenRA.Widgets
|
|||||||
Animation clock;
|
Animation clock;
|
||||||
List<string> visibleTabs = new List<string>();
|
List<string> visibleTabs = new List<string>();
|
||||||
|
|
||||||
|
public BuildPaletteWidget() : base() { }
|
||||||
|
|
||||||
|
public BuildPaletteWidget(Widget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Why are you Cloning BuildPalette?");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone() { return new BuildPaletteWidget(this); }
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|||||||
@@ -15,6 +15,16 @@ namespace OpenRA.Widgets
|
|||||||
bool mapPreviewDirty = true;
|
bool mapPreviewDirty = true;
|
||||||
MapStub lastMap;
|
MapStub lastMap;
|
||||||
|
|
||||||
|
public MapPreviewWidget() : base() { }
|
||||||
|
|
||||||
|
public MapPreviewWidget(Widget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
lastMap = (other as MapPreviewWidget).lastMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone() { return new MapPreviewWidget(this); }
|
||||||
|
|
||||||
public override void Draw( World world )
|
public override void Draw( World world )
|
||||||
{
|
{
|
||||||
var map = Game.chrome.currentMap;
|
var map = Game.chrome.currentMap;
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ namespace OpenRA.Widgets
|
|||||||
List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle, Action<MouseInput>>>();
|
List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle, Action<MouseInput>>>();
|
||||||
void AddButton(Rectangle r, Action<MouseInput> b) { buttons.Add(Pair.New(r, b)); }
|
void AddButton(Rectangle r, Action<MouseInput> b) { buttons.Add(Pair.New(r, b)); }
|
||||||
|
|
||||||
|
public MoneyBinWidget() : base() { }
|
||||||
|
public MoneyBinWidget(Widget other) : base(other) { }
|
||||||
|
|
||||||
|
public override Widget Clone() { return new MoneyBinWidget(this); }
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
var digitCollection = "digits-" + world.LocalPlayer.Country.Race;
|
var digitCollection = "digits-" + world.LocalPlayer.Country.Race;
|
||||||
|
|||||||
@@ -26,6 +26,12 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
class PerfGraphWidget : Widget
|
class PerfGraphWidget : Widget
|
||||||
{
|
{
|
||||||
|
public PerfGraphWidget() : base() { }
|
||||||
|
|
||||||
|
public PerfGraphWidget(Widget other) : base(other) { }
|
||||||
|
|
||||||
|
public override Widget Clone() { return new PerfGraphWidget(this); }
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
if (!IsVisible())
|
if (!IsVisible())
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -9,6 +9,12 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
class PostGameWidget : Widget
|
class PostGameWidget : Widget
|
||||||
{
|
{
|
||||||
|
public PostGameWidget() : base() { }
|
||||||
|
|
||||||
|
public PostGameWidget(Widget other) : base(other) { }
|
||||||
|
|
||||||
|
public override Widget Clone() { return new PostGameWidget(this); }
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
base.Draw(world);
|
base.Draw(world);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -48,6 +48,17 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
string radarCollection;
|
string radarCollection;
|
||||||
|
|
||||||
|
public RadarBinWidget() : base() { }
|
||||||
|
|
||||||
|
public RadarBinWidget(Widget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("Why are you Cloning RadarBin?");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone() { return new RadarBinWidget(this); }
|
||||||
|
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
DrawRadar(world);
|
DrawRadar(world);
|
||||||
|
|||||||
@@ -35,6 +35,18 @@ namespace OpenRA.Widgets
|
|||||||
Animation clock;
|
Animation clock;
|
||||||
readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle,Action<MouseInput>>>();
|
readonly List<Pair<Rectangle, Action<MouseInput>>> buttons = new List<Pair<Rectangle,Action<MouseInput>>>();
|
||||||
|
|
||||||
|
public SpecialPowerBinWidget() : base() { }
|
||||||
|
|
||||||
|
public SpecialPowerBinWidget(Widget other)
|
||||||
|
: base(other)
|
||||||
|
{
|
||||||
|
ready = (other as SpecialPowerBinWidget).ready;
|
||||||
|
clock = (other as SpecialPowerBinWidget).clock;
|
||||||
|
buttons = (other as SpecialPowerBinWidget).buttons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Widget Clone() { return new SpecialPowerBinWidget(this); }
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ using OpenRA.Widgets.Delegates;
|
|||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
public class Widget
|
public abstract class Widget
|
||||||
{
|
{
|
||||||
// Info defined in YAML
|
// Info defined in YAML
|
||||||
public string Id = null;
|
public string Id = null;
|
||||||
@@ -78,10 +78,7 @@ namespace OpenRA.Widgets
|
|||||||
AddChild(child.Clone());
|
AddChild(child.Clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual Widget Clone()
|
public abstract Widget Clone();
|
||||||
{
|
|
||||||
return new Widget(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int2 DrawPosition()
|
public int2 DrawPosition()
|
||||||
{
|
{
|
||||||
@@ -219,6 +216,12 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ContainerWidget : Widget { }
|
class ContainerWidget : Widget {
|
||||||
|
public ContainerWidget() : base() { }
|
||||||
|
|
||||||
|
public ContainerWidget(Widget other) : base(other) { }
|
||||||
|
|
||||||
|
public override Widget Clone() { return new ContainerWidget(this); }
|
||||||
|
}
|
||||||
public interface IWidgetDelegate { }
|
public interface IWidgetDelegate { }
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -30,6 +30,12 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
const int worldTooltipDelay = 10; /* ticks */
|
const int worldTooltipDelay = 10; /* ticks */
|
||||||
|
|
||||||
|
public WorldTooltipWidget() : base() { }
|
||||||
|
|
||||||
|
public WorldTooltipWidget(Widget other) : base(other) { }
|
||||||
|
|
||||||
|
public override Widget Clone() { return new WorldTooltipWidget(this); }
|
||||||
|
|
||||||
public override void Draw(World world)
|
public override void Draw(World world)
|
||||||
{
|
{
|
||||||
if (Game.chrome.ticksSinceLastMove < worldTooltipDelay || world == null || world.LocalPlayer == null)
|
if (Game.chrome.ticksSinceLastMove < worldTooltipDelay || world == null || world.LocalPlayer == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user