- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
-(id)init
{ for (int i=0; i<20; i++){
CCMenuItemImage *menuItemImage = [CCMenuItemImage itemFromNormalImage:@"г°®©б⥁.png"
selectedImage:@"г°®©б⥁.png"
disabledImage:@"г°®©б⥁.png"
target:self
selector:[self selectorAtIndex:i]];
menuItemImage.position = CGPointMake(+3*30*(i+1)-self.contentSize.width/2 -size.width /2,
-3*30*k*(i+1)+self.contentSize.height/2+size.height/2);
[menuItemArray addObject:menuItemImage];
}
CCMenu *menu = [CCMenu menuWithItems:
[menuItemArray objectAtIndex:0],
[menuItemArray objectAtIndex:1],
[menuItemArray objectAtIndex:2],
[menuItemArray objectAtIndex:3],
[menuItemArray objectAtIndex:4],
[menuItemArray objectAtIndex:5],
nil];
[self addChild:menu z:1];
}
-(SEL)selectorAtIndex:(NSInteger)index
{
switch (index) {
case 0:
return @selector(kilLev0);
break;
case 1:
return @selector(kilLev1);
break;
case 2:
return @selector(kilLev2);
break;
case 3:
return @selector(kilLev3);
break;
case 4:
return @selector(kilLev4);
break;
case 5:
return @selector(kilLev5);
break;
default:
return @selector(kilLev3);
break;
}
}
-(void)kilLev0
{
[self killLevelAtIndex:0];
}
-(void)kilLev1
{
[self killLevelAtIndex:1];
}
-(void)kilLev2
{
[self killLevelAtIndex:2];
}
-(void)kilLev3
{
[self killLevelAtIndex:3];
}
-(void)kilLev4
{
[self killLevelAtIndex:4];
}
-(void)kilLev5
{
[self killLevelAtIndex:5];
}
-(void)killLevelAtIndex:(NSInteger)levelIndex
{
NSLog(@"Level Index = %d",levelIndex);
[self.delegate startKillLevelAtIndex:levelIndex];
}
Люди добрые, я сам ржу глядя на то, что написал...
Подскажите пожалуйста как описать правильно?
notxcain 16.02.2012 20:47 # 0
убрать все методы и оставить
- (void)forwardInvocation:(NSInvocation *)anInvocation{
NSString *selectorString = NSStringFromSelector([anInvocation selector]);
if ([selectorString hasPrefix:@"killLev"]) {
int index = [[selectorString substringFromIndex:6] intValue];
[self startKillLevelAtIndex:index];
} else
[super forwardInvocation:anInvocation];
}