static void Main(string[] args) { GameConfiguration config = new KeyGameModel.GameConfiguration(); config.ChainingBonus = 0.05; GameConfigReader.CreateGameConfig(@".\TestConfiguration.exe", config); }
public MockGameModel(GameConfiguration configuration, Level level) { _configuration = configuration; _level = level; _currentSequenceIndex = -1; _baseScore = 0; _currentSequenceCharIndex = -1; }
public GameModel(GameConfiguration configuration, Level level) { _configuration = configuration; _level = level; _baseScoreRunningTotal = 0; _speedBonusRunningTotal = 0; _chainBonusRunningTotal = 0; _currentChainScore = 0; _currentChainLength = 0; _currentSequenceSpeedBonus = 0; }
public GameController(GameConfiguration configuration, Level level) : base() { //intiliazing model this.configuration = configuration; this.level = level; this.model = new GameModel(configuration, level); //attaching input hooks keyboardHook.KeyPress += new KeyPressEventHandler(keyboardHook_KeyPress); keyboardHook.KeyUp += new KeyEventHandler(keyboardHook_KeyUp); this.talkingWindow.Load += new System.EventHandler(this.TalkingWindow_Load); this.talkingWindow.Shown += new System.EventHandler(this.TalkingWindow_Shown); this.inputDrainTimer = new System.Threading.Timer(inputDrainCallback, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); }
public double GetTheoreticalTopScore(GameConfiguration config) { double baseScore = 0; double speedBonus = 0; double chainBonus = 0; foreach (LevelSequence sequence in _sequences) { if (sequence.SequenceLength <= config.MaxSequenceLength) { baseScore += sequence.GetFullBaseScore(config); speedBonus += config.MaxSpeedBonusPerLetter * sequence.SequenceLength; } } chainBonus = (baseScore + speedBonus) * config.ChainingBonusCap; return baseScore + speedBonus + chainBonus; }
public double GetFullBaseScore(GameConfiguration config) { return (this.SequenceLength * config.BasePointsPerLetter) * (1.0 + config.AdditionalLetterBonus * (this.SequenceLength - 1)); }
/// <summary> /// Creates and saves a game configuration file given an instance of GameConfiguration /// </summary> /// <param name="configFilePath">Configuration file to save to</param> /// <param name="configSection">Populated configuration to be saved to file</param> public static void CreateGameConfig(string configFilePath, GameConfiguration configSection) { Configuration config = ConfigurationManager.OpenExeConfiguration(configFilePath); config.Sections.Add("GameConfig", configSection); config.Save(); }