copy constructors
This commit is contained in:
@@ -24,6 +24,7 @@ namespace OpenRA.Widgets
|
||||
class BackgroundWidget : Widget
|
||||
{
|
||||
public readonly string Background = "dialog";
|
||||
|
||||
public override void Draw(World world)
|
||||
{
|
||||
if (!IsVisible())
|
||||
@@ -36,5 +37,15 @@ namespace OpenRA.Widgets
|
||||
WidgetUtils.DrawPanel(Background, rect);
|
||||
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;
|
||||
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()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -15,6 +15,16 @@ namespace OpenRA.Widgets
|
||||
bool mapPreviewDirty = true;
|
||||
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 )
|
||||
{
|
||||
var map = Game.chrome.currentMap;
|
||||
|
||||
@@ -36,6 +36,11 @@ namespace OpenRA.Widgets
|
||||
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)); }
|
||||
|
||||
public MoneyBinWidget() : base() { }
|
||||
public MoneyBinWidget(Widget other) : base(other) { }
|
||||
|
||||
public override Widget Clone() { return new MoneyBinWidget(this); }
|
||||
|
||||
public override void Draw(World world)
|
||||
{
|
||||
var digitCollection = "digits-" + world.LocalPlayer.Country.Race;
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!IsVisible())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -9,6 +9,12 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
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)
|
||||
{
|
||||
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.
|
||||
* This file is part of OpenRA.
|
||||
@@ -48,6 +48,17 @@ namespace OpenRA.Widgets
|
||||
|
||||
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)
|
||||
{
|
||||
DrawRadar(world);
|
||||
|
||||
@@ -35,6 +35,18 @@ namespace OpenRA.Widgets
|
||||
Animation clock;
|
||||
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()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -27,7 +27,7 @@ using OpenRA.Widgets.Delegates;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
public class Widget
|
||||
public abstract class Widget
|
||||
{
|
||||
// Info defined in YAML
|
||||
public string Id = null;
|
||||
@@ -78,10 +78,7 @@ namespace OpenRA.Widgets
|
||||
AddChild(child.Clone());
|
||||
}
|
||||
|
||||
public virtual Widget Clone()
|
||||
{
|
||||
return new Widget(this);
|
||||
}
|
||||
public abstract Widget Clone();
|
||||
|
||||
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 { }
|
||||
}
|
||||
@@ -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.
|
||||
* This file is part of OpenRA.
|
||||
@@ -30,6 +30,12 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (Game.chrome.ticksSinceLastMove < worldTooltipDelay || world == null || world.LocalPlayer == null)
|
||||
|
||||
Reference in New Issue
Block a user