Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Now auto selects the first letter.

  • Loading branch information...
commit 90b8c0cf1f7b9f5cbfb7f88fd44f78fa39b54bba 1 parent c6a099c
@debreuil authored
View
BIN  WordGrid.xcodeproj/project.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown
View
42 WordGrid.xcodeproj/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
@@ -17,48 +17,6 @@
landmarkName = "-createLetters"
landmarkType = "5">
</FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/GameVC.m"
- timestampString = "346980431.162103"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "136"
- endingLineNumber = "136"
- landmarkName = "-answerSelected:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/GameVC.m"
- timestampString = "346980950.208004"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "133"
- endingLineNumber = "133"
- landmarkName = "-answerSelected:"
- landmarkType = "5">
- </FileBreakpoint>
- <FileBreakpoint
- shouldBeEnabled = "No"
- ignoreCount = "0"
- continueAfterRunningActions = "No"
- isPathRelative = "1"
- filePath = "WordGrid/GameVC.m"
- timestampString = "346981086.38507"
- startingColumnNumber = "9223372036854775807"
- endingColumnNumber = "9223372036854775807"
- startingLineNumber = "188"
- endingLineNumber = "188"
- landmarkName = "-testWordComplete"
- landmarkType = "5">
- </FileBreakpoint>
</FileBreakpoints>
<SymbolicBreakpoints>
<SymbolicBreakpoint
View
6 WordGrid/AnswerData.m
@@ -28,10 +28,10 @@ + (void) initialize
@"50,51,52,53,57,58,59,58,59,60,58,59,60,61,62", nil
],
[NSArray arrayWithObjects:
- @"PRESS ON LOWER PANEL TO REVERT TILES",
- @" PRESS ONOREVE PTELTILRTANLOWERES",
+ @"PRESS ON THE LOWER PANEL TO REVERT TILES",
+ @" P PL RO T EWTHEIONTSEREVELEOSRANELRTS",
@"WAS THE CORRECT ANSWER!",
- @"27,28,29,30,31,36,37,56,57,58,59,60,45,54,55,56,57,55,56,57,49,50,51,52,53,58,59,60,61,62", nil
+ @"18,27,36,45,54,42,43,38,39,40,19,28,37,46,55,55,56,57,58,59,44,53,56,57,58,59,60,61,58,59,60,61,62", nil
],
[NSArray arrayWithObjects:
@"LETTERS CAN JOIN DIAGONALLY TOO",
View
1  WordGrid/GameVC.h
@@ -29,5 +29,6 @@
- (void) setOrientation;
- (void) testWordComplete;
- (IBAction)onDone:(id)sender;
+- (void) onTileSelected:(Tile *)t;
@end
View
31 WordGrid/GameVC.m
@@ -11,7 +11,7 @@ @implementation GameVC
GameState gameState = Game;
Boolean isLandscape = NO;
NSArray *indexes;
-
+float letterMoveDelay;
SystemSoundID correctWordSoundID;
SystemSoundID errorSoundID;
@@ -49,6 +49,11 @@ - (AnswerGrid *) getAnswerGrid
- (void) tileSelected:(NSNotification *)notification
{
Tile *t = (Tile *)[notification object];
+ [self onTileSelected:t];
+}
+
+- (void) onTileSelected:(Tile *)t
+{
lastSelectedTileIndex = t.gridIndex;
if(t.isSelectable)
@@ -60,12 +65,12 @@ - (void) tileSelected:(NSNotification *)notification
-answerGrid.frame.origin.y + tileGrid.frame.origin.y + t.frame.origin.y,
t.frame.size.width,
t.frame.size.height);
- //NSLog(@"org: %f %f", at.frame.origin.x, at.frame.origin.y);
+ //NSLog(@"org: %f %f", t.frame.size.width, t.frame.size.height);
[answerGrid setNextTileUsingTile:t];
[UIView
animateWithDuration:0.3
- delay:0.0
+ delay:letterMoveDelay
options: UIViewAnimationCurveEaseOut
animations:^
{
@@ -108,7 +113,7 @@ - (void) answerSelected:(NSNotification *)notification
Tile *t = (Tile *)[notification object];
int firstLetter = [answerGrid getWordStartIndex:t.gridIndex];
int lastRemoved = [answerGrid getCurrentWordStart];
- [tileGrid resetAnimationDelay];
+ [tileGrid resetAnimationDelay:0];
NSMutableArray *reinsertWordTiles = [NSMutableArray arrayWithCapacity:10];
@@ -218,6 +223,21 @@ - (void) testWordComplete
}
}
+- (void) autoSelectFirstLetter
+{
+ if([tileGrid isMemberOfClass:[TileGrid class]])
+ {
+ letterMoveDelay = 0.5;
+ NSNumber *firstTileIndex = [indexes objectAtIndex:0];
+ Tile *t = [tileGrid getTileAtIndex:[firstTileIndex integerValue] ];
+
+ [self.view insertSubview:answerGrid aboveSubview:tileGrid];
+ [tileGrid bringSubviewToFront:t];
+ [tileGrid ownTileSelected:t];
+ letterMoveDelay = 0.0;
+ }
+}
+
- (void) nextRound
{
gameState = Game;
@@ -232,6 +252,9 @@ - (void) nextRound
indexes = [AnswerData getCurrentIndexes];
+ // first letter is a gift
+ [self autoSelectFirstLetter];
+
[self setOrientation];
}
View
2  WordGrid/TileGrid.h
@@ -29,7 +29,7 @@
- (Tile *) getTileAtIndex:(int) index;
- (NSString *) serializeGridLetters;
- (void) setSelectableByLetter:(NSString *)let;
-- (void) resetAnimationDelay;
+- (void) resetAnimationDelay:(int) delay;
- (void) insertLastVerticalGaps;
- (void) moveColumn:(int)src toColumn:(int)dest;
- (void) clearAllSelections;
View
4 WordGrid/TileGrid.m
@@ -82,9 +82,9 @@ - (void) createRound
[self layoutGrid:NO];
}
-- (void) resetAnimationDelay
+- (void) resetAnimationDelay:(int) delay
{
- animationDelay = 0;
+ animationDelay = delay;
}
- (void) layoutGrid:(Boolean) useAnimation
Please sign in to comment.
Something went wrong with that request. Please try again.