Beginnings of building power tracking
This commit is contained in:
@@ -100,13 +100,14 @@ namespace OpenRa.Game.Graphics
|
|||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
|
|
||||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nTiles Expanded {6:F0}",
|
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nPower {7}\nTiles Expanded {6:F0}",
|
||||||
Game.RenderFrame, Game.orderManager.FrameNumber,
|
Game.RenderFrame, Game.orderManager.FrameNumber,
|
||||||
Game.RenderTime * 1000,
|
Game.RenderTime * 1000,
|
||||||
Game.TickTime * 1000,
|
Game.TickTime * 1000,
|
||||||
Game.OreTime * 1000,
|
Game.OreTime * 1000,
|
||||||
Game.LocalPlayer.Cash,
|
Game.LocalPlayer.Cash,
|
||||||
PerfHistory.items[ "nodes_expanded" ].LastValue
|
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
||||||
|
Game.LocalPlayer.Power
|
||||||
), new int2(5, 5), Color.White);
|
), new int2(5, 5), Color.White);
|
||||||
|
|
||||||
PerfHistory.Render(renderer, lineRenderer);
|
PerfHistory.Render(renderer, lineRenderer);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ namespace OpenRa.Game
|
|||||||
public Race Race;
|
public Race Race;
|
||||||
public readonly int Index;
|
public readonly int Index;
|
||||||
public int Cash;
|
public int Cash;
|
||||||
|
public int Power;
|
||||||
|
|
||||||
public Player( int index, int palette, string playerName, Race race )
|
public Player( int index, int palette, string playerName, Race race )
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,7 @@ namespace OpenRa.Game
|
|||||||
this.PlayerName = playerName;
|
this.PlayerName = playerName;
|
||||||
this.Race = race;
|
this.Race = race;
|
||||||
this.Cash = 10000;
|
this.Cash = 10000;
|
||||||
|
this.Power = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetSiloFullness()
|
public float GetSiloFullness()
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using OpenRa.Game.GameRules;
|
||||||
|
|
||||||
namespace OpenRa.Game.Traits
|
namespace OpenRa.Game.Traits
|
||||||
{
|
{
|
||||||
class Building : ITick
|
class Building : ITick, INotifyBuildComplete
|
||||||
{
|
{
|
||||||
public Building(Actor self)
|
public Building(Actor self)
|
||||||
{
|
{
|
||||||
@@ -19,5 +20,13 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void BuildingComplete(Actor self)
|
||||||
|
{
|
||||||
|
UnitInfo.BuildingInfo bi = self.unitInfo as UnitInfo.BuildingInfo;
|
||||||
|
if (bi == null) return;
|
||||||
|
|
||||||
|
self.Owner.Power += bi.Power;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,12 @@ namespace OpenRa.Game.Traits
|
|||||||
public RenderBuilding(Actor self)
|
public RenderBuilding(Actor self)
|
||||||
: base(self)
|
: base(self)
|
||||||
{
|
{
|
||||||
Make( () => anim.PlayRepeating("idle") );
|
Make(() =>
|
||||||
|
{
|
||||||
|
anim.PlayRepeating("idle");
|
||||||
|
foreach (var x in self.traits.WithInterface<INotifyBuildComplete>())
|
||||||
|
x.BuildingComplete(self);
|
||||||
|
});
|
||||||
|
|
||||||
DoBib(self, false);
|
DoBib(self, false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,5 @@ namespace OpenRa.Game.Traits
|
|||||||
interface IOrder { Order Order(Actor self, int2 xy, bool lmb, Actor underCursor); }
|
interface IOrder { Order Order(Actor self, int2 xy, bool lmb, Actor underCursor); }
|
||||||
interface INotifyDamage { void Damaged(Actor self, DamageState ds); }
|
interface INotifyDamage { void Damaged(Actor self, DamageState ds); }
|
||||||
interface INotifyDamageEx : INotifyDamage { void Damaged(Actor self, int damage); }
|
interface INotifyDamageEx : INotifyDamage { void Damaged(Actor self, int damage); }
|
||||||
|
interface INotifyBuildComplete { void BuildingComplete (Actor self); }
|
||||||
}
|
}
|
||||||
|
|||||||
76
OpenRa.sln
76
OpenRa.sln
@@ -101,48 +101,40 @@ Global
|
|||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.Build.0 = Release|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Win32.ActiveCfg = Release|x86
|
{54577061-E2D2-4336-90A2-A9A7106A30CD}.Release|Win32.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Any CPU.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Any CPU.Build.0 = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Mixed Platforms.Build.0 = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Win32.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug (x86)|Win32.Build.0 = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Any CPU.ActiveCfg = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Any CPU.Build.0 = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Mixed Platforms.Build.0 = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release (x86)|Win32.ActiveCfg = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{31411761-224C-4C54-A5FE-280890A70259}.Release|Win32.ActiveCfg = Release|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release|Any CPU.Build.0 = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Any CPU.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{31411761-224C-4C54-A5FE-280890A70259}.Release|Win32.ActiveCfg = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Win32.ActiveCfg = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Any CPU.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Win32.Build.0 = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Any CPU.Build.0 = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Mixed Platforms.Build.0 = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Mixed Platforms.Build.0 = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Win32.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Win32.ActiveCfg = Debug|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug (x86)|Win32.Build.0 = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Any CPU.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Mixed Platforms.Build.0 = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Win32.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Any CPU.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Debug|Win32.ActiveCfg = Debug|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Mixed Platforms.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Any CPU.ActiveCfg = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Mixed Platforms.Build.0 = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Any CPU.Build.0 = Release|Any CPU
|
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Win32.ActiveCfg = Release|x86
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release (x86)|Win32.ActiveCfg = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
|
||||||
{230F65CE-A6DE-4235-8B38-13A3D606C7F7}.Release|Win32.ActiveCfg = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -13,22 +13,21 @@
|
|||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
|||||||
@@ -13,23 +13,22 @@
|
|||||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
<DebugType>full</DebugType>
|
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<DebugType>full</DebugType>
|
||||||
<WarningLevel>4</WarningLevel>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<OutputPath>bin\x86\Release\</OutputPath>
|
||||||
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Ijw.DirectX, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
<Reference Include="Ijw.DirectX, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||||
|
|||||||
Reference in New Issue
Block a user