more support power stuff

This commit is contained in:
Chris Forbes
2010-01-08 21:24:52 +13:00
parent cc0498314e
commit 6ff0f82c02
3 changed files with 51 additions and 4 deletions

View File

@@ -710,6 +710,10 @@ namespace OpenRa.Game
chromeRenderer.DrawSprite(specialBinSprite, new float2(0,14), PaletteType.Chrome);
chromeRenderer.Flush();
var y = 24;
string tooltipItem = null;
int2 tooltipPos = int2.Zero;
foreach (var sp in Game.LocalPlayer.SupportPowers)
{
var image = spsprites[sp.Key];
@@ -733,11 +737,50 @@ namespace OpenRa.Game
PaletteType.Chrome);
}
var rect = new Rectangle(5, y, 64, 48);
if (rect.Contains(lastMousePos.ToPoint()))
{
tooltipItem = sp.Key;
tooltipPos = drawPos.ToInt2() + new int2(72, 0) - Game.viewport.Location.ToInt2();
}
y += 51;
}
}
buildPaletteRenderer.Flush();
if (tooltipItem != null)
DrawSupportPowerTooltip(tooltipItem, tooltipPos);
}
string FormatTime(int ticks)
{
var seconds = ticks / 25;
var minutes = seconds / 60;
return "{0}:{1}".F(minutes, seconds % 60);
}
void DrawSupportPowerTooltip(string sp, int2 pos)
{
chromeRenderer.DrawSprite(tooltipSprite, pos, PaletteType.Chrome);
chromeRenderer.Flush();
var info = Rules.SupportPowerInfo[sp];
pos += new int2(5, 5);
renderer.DrawText2(info.Description, pos, Color.White);
var timer = "Charge Time: {0}".F(FormatTime(Game.LocalPlayer.SupportPowers[sp].RemainingTime));
DrawRightAligned(timer, pos + new int2((int)tooltipSprite.size.X - 10, 0), Color.White);
if (info.LongDesc != null)
{
pos += new int2(0, 25);
renderer.DrawText(info.LongDesc.Replace("\\n", "\n"), pos, Color.White);
}
}
}
}

View File

@@ -44,5 +44,9 @@ namespace OpenRa.Game
if (RemainingTime > 0) --RemainingTime;
}
}
public void Activate()
{
}
}
}

View File

@@ -826,7 +826,7 @@ InvulnerabilityPower
[ParadropPower] ; comes free with first AFLD
ChargeTime=7
Description=Paratroopers
LongDesc=A Badger drops a squad of Riflemen anywhere on the map
LongDesc=A Badger drops a squad of Riflemen \nanywhere on the map
Prerequisite=AFLD
TechLevel=5
Image=pinficon
@@ -844,7 +844,7 @@ GivenAuto=no
[SonarPulsePower] ; picked up in a crate, or by spy -> spen/syrd
ChargeTime=10
Description=Sonar Pulse
LongDesc=Reveals all submarines on the map for a short time.
LongDesc=Reveals all submarines on the map for a \nshort time.
OneShot=yes
Powered=no
Image=sonricon
@@ -854,7 +854,7 @@ GivenAuto=no
[ChronoshiftPower] ; free with Chronosphere... sortof the point.
ChargeTime=7
Description=Chronoshift
LongDesc=Temporarily teleports a vehicle across the map.
LongDesc=Temporarily teleports a vehicle across \nthe map.
Prerequisite=PDOX
Image=warpicon
TechLevel=12
@@ -887,7 +887,7 @@ TechLevel=12
[InvulnerabilityPower] ; the point of IRON
ChargeTime=11
Description=Invulnerability
LongDesc=Makes a single unit invulnerable for a short time.
LongDesc=Makes a single unit invulnerable for a \nshort time.
Image=infxicon
Prerequisite=IRON
TechLevel=12