예제 #1
0
 public FormError(GameErrorInfo error)
 {
     InitializeComponent();
     this.error = error;
     lbLetter.Text = error.Letter;
     lbWord.Text = error.MaskedWord;
     richTextBox1.Rtf = GameDictionary.GetRuleDescriptioRtf(error.Rule);
 }
예제 #2
0
 public static void ShowError(IWin32Window owner, GameErrorInfo error)
 {
     using (FormError formError = new FormError(error)) {
         if (owner is Form) {
             formError.Icon = ((Form)owner).Icon;
         }
         formError.ShowDialog(owner);
     }
 }
예제 #3
0
파일: Game.cs 프로젝트: DunkanDX/WordGame
 GameWord CheckLetterStopCell(GameCellPos letterPos, GameCell cell, out GameErrorInfo gameError)
 {
     GameWord word = cell.GameObject as GameWord;
     gameError = null;
     if (word != null) {
         GameCellPos wordPos;
         if (mainTable.TryGetObjectPosition(word, out wordPos) && ((wordPos.Column == letterPos.Column) || (wordPos.Column + word.Width > letterPos.Column))) {
             int wordRelColumn = letterPos.Column - wordPos.Column;
             if (wordRelColumn >= 0 && wordRelColumn < word.Width){
                 if (string.Equals(word.StringMap[0, wordRelColumn],
                                     currentLetter.StringMap[0, 0], StringComparison.InvariantCultureIgnoreCase)) {
                     return word;
                 } else {
                     gameError = new GameErrorInfo(word.RulesMap[0, wordRelColumn], currentLetter.StringMap[0, 0], word.Word);
                 }
             }
         }
     }
     return null;
 }
예제 #4
0
파일: Game.cs 프로젝트: DunkanDX/WordGame
 GameWord CheckLetterStop(out GameErrorInfo gameErrorInfo)
 {
     GameCellPos letterPos;
     gameErrorInfo = null;
     if (currentLetter == null) return null;
     if (!mainTable.TryGetObjectPosition(currentLetter, out letterPos)) return null;
     if (letterPos.Column - 1 >= 0) {
         GameCell cell = mainTable[letterPos.Row, letterPos.Column - 1];
         GameErrorInfo currentGameError;
         GameWord result = CheckLetterStopCell(letterPos, cell, out currentGameError);
         if (result != null) {
             gameErrorInfo = null;
             return result;
         }
         gameErrorInfo = currentGameError;
     }
     if (letterPos.Column + 1 < mainTable.Width) {
         GameCell cell = mainTable[letterPos.Row, letterPos.Column + 1];
         GameErrorInfo currentGameError;
         GameWord result = CheckLetterStopCell(letterPos, cell, out currentGameError);
         if (result != null) {
             gameErrorInfo = null;
             return result;
         }
         gameErrorInfo = currentGameError;
     }
     return null;
 }