/* * MaritimeDefenderPhaseQueue.cs * Authors: August Zinsser, Adam Nabinger * Copyright (c) 2007-2008 Cornell University This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System.Collections.Generic; namespace MaritimeDefender { /// /// All phases used in Maritime Defender /// public class MaritimeDefenderPhases { #region Constants /// /// String representing the dot coherence phase /// public const string DotTest = "DotTest"; /// /// String representing the identity test phase /// public const string IdentityTest = "IdentityTest"; /// /// String representing the shooter phase /// public const string Shooter = "Shooter"; /// /// String representing the boss phase /// public const string Boss = "Boss"; /// /// String representing the transition phase from the dot coherence phase to the shooter phase /// public const string DotTest2ShooterTransition = "DotTest2ShooterTransition"; /// /// String representing the transition phase from the shooter phase to the dot coherence phase /// public const string Shooter2DotTestTransition = "Shooter2DotTestTransition"; /// /// String representing the transition phase from the shooter phase to the boss phase /// public const string Shooter2BossTransition = "Shooter2BossTransition"; #endregion #region Contains /// /// Checks if the phaseName exists in this minigame.. /// .. just hardcoded.. for some reason.. /// /// The name of the phase to check for /// Whether or not the given phase name was part of the Maritime Defender Phases phases public bool Contains(string phaseName) { return phaseName == DotTest || phaseName == IdentityTest || phaseName == Shooter || phaseName == Boss || phaseName == DotTest2ShooterTransition || phaseName == Shooter2DotTestTransition; } #endregion } /// /// Tests the phase queue to make sure it's phases are valid for Maritime Defender /// public class MaritimeDefenderTest { /// /// Name of this test /// public string PhaseName; /// /// Trials for this test /// public int Trials; /// /// Parsed by specific minigames /// public List SpecificParameters; /// /// Must be assigned to a specific phase set in each derived class /// protected MaritimeDefenderPhases mPhases; /// /// Converts a generic test into a Maritime Defender test /// public MaritimeDefenderTest(string phaseName, int trials, List specificParameters) { PhaseName = phaseName; Trials = trials; SpecificParameters = specificParameters ?? new List(); // Validate the input from the config file mPhases = new MaritimeDefenderPhases(); if (!mPhases.Contains(phaseName)) { System.Windows.Forms.MessageBox.Show( "Unrecognized test phase name " + phaseName + ". Try reinstalling this program.", "Fatal Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error ); } } } }