/*
* AstroScoreCard.cs
* Authors: August Zinsser
*
* Copyright Matthew Belmonte 2007
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Astropolis.ColonySimulator;
using tAC_Engine;
namespace Astropolis
{
///
/// Games should use this class to store the score and then pass it along to the ScoreSummary class
/// to display the minigame final score and then update the overall main game score. This is the same as a GenericScoreCard
/// except it converts Bonus to Credits and DamageCosts to -Credits upon CashOut.
///
public class AstroScoreCard : GenericScoreCard
{
///
/// Create a scorecard for a minigame
///
public AstroScoreCard()
: base()
{
mResourcesGathered.Add(AstroResources.Credits, 0);
}
///
/// Display the scores in a nice GUI
///
///
public void Display(bool success, string resultsMessage)
{
AstroBaseApplication.GameManager.ShowScore(this, success, resultsMessage);
}
///
/// Transfers all funds and costs from this score to game it points to
/// If costs outweigh gains for cash, then no money is transfered.
///
public new void CashOut(GenericGame recipientGame)
{
// Convert "Bonus" into "Money" and deduct "DamageCosts"
if (mResourcesGathered.ContainsKey(AstroResources.Credits))
{
if (mResourcesGathered.ContainsKey(AstroResources.Bonus))
{
mResourcesGathered[AstroResources.Credits] += mResourcesGathered[AstroResources.Bonus];
mResourcesGathered.Remove(AstroResources.Bonus);
}
if (mResourcesGathered.ContainsKey(AstroResources.DamageCosts))
{
mResourcesGathered[AstroResources.Credits] -= mResourcesGathered[AstroResources.DamageCosts];
if (mResourcesGathered[AstroResources.Credits] < 0)
mResourcesGathered[AstroResources.Credits] = 0;
}
}
// Cash out as normal
base.CashOut(recipientGame);
}
}
}