public Judge(Hangman hangman, string word) { _hangman = hangman; _word = word; }
public override void Initialize() { this.inputRectangle = new Rectangle( (int)(this.game.getViewportWidth() * 0.15f), (int)(this.game.getViewportHeight() * 0.65f), (int)(this.game.getViewportWidth() * 0.7f), (int)(this.game.getViewportHeight() * 0.32f) ); this.hangmanRectangle = new Rectangle( (int)(this.inputRectangle.X), (int)((this.inputRectangle.Y) * 0.30f), (int)((this.inputRectangle.Width * 0.5f) * 0.7f), (int)((this.inputRectangle.Y) * 0.55f) ); this.hangman = new Hangman(this.hangmanRectangle, 7, this.game.Content.RootDirectory + @"\Strings\words.txt"); this.hangman.InitWord(); this.guessWordPos = new Vector2( (this.game.getViewportWidth() - this.hangmanRectangle.X + this.hangmanRectangle.Width) * 0.6f, (this.hangmanRectangle.Y + this.hangmanRectangle.Height) * 0.65f ); // TODO: ?????? Vector2 relativeCharacterSize = new Vector2(35, 65); this.relativeRectangleSize = new Vector2(relativeCharacterSize.X + this.game.getViewportWidth() * 0.015f, relativeCharacterSize.Y + this.game.getViewportHeight() * 0.015f); int onCurrentLineCharCount, currentLine; onCurrentLineCharCount = currentLine = 0; float spaceBetweenChars = this.game.getViewportWidth() * 0.015f; foreach (char c in avaibleCharacters) { // If another character would exceed the line go to new line if (((onCurrentLineCharCount + 1) * (this.relativeRectangleSize.X + spaceBetweenChars)) >= inputRectangle.Width) { currentLine++; onCurrentLineCharCount = 0; } Rectangle rect = new Rectangle( (int)(inputRectangle.X + (onCurrentLineCharCount * (this.relativeRectangleSize.X + spaceBetweenChars) + spaceBetweenChars)), (int)(inputRectangle.Y + (currentLine * ((this.relativeRectangleSize.Y + spaceBetweenChars))) + spaceBetweenChars), (int)this.relativeRectangleSize.X, (int)this.relativeRectangleSize.Y ); // CHARACTER SETUP Character character = new Character(rect, c, Color.Yellow); this.characters.Add(character); onCurrentLineCharCount++; } base.Initialize(); }