www.pudn.com > Simple-shooting-game.zip > StartScene.m, change:2012-02-07,size:1458b


//
//  StartScene.m
//  Cocos2DGame
//
//  Created by Yang QianFeng on 11-12-29.
//  Copyright (c) 2011年 千锋3G www.mobiletrain.org. All rights reserved.
//

#import "StartScene.h"
#import "LoadingScene.h"

@implementation StartScene

+(id) scene
{
	CCScene* sc = [CCScene node];
	
	StartScene* ss = [StartScene node];
	
	[sc addChild:ss];
	
	return sc;
}

+(id) node
{
	return [[[self alloc] init] autorelease];
}

-(id) init
{
	if ((self = [super init]))
	{
		[CCMenuItemFont setFontName:@"Arial"];
		[CCMenuItemFont setFontSize:25];
		
		CCMenuItem* startMi = [CCMenuItemFont itemFromString:@"开始游戏" target:self selector:@selector(onMenuStart:)];
		CCMenuItem* hsMi = [CCMenuItemFont itemFromString:@"最高分" target:self selector:@selector(onMenuHighScore:)];
		CCMenuItem* optionMi = [CCMenuItemFont itemFromString:@"选项" target:self selector:@selector(onMenuOption:)];
		CCMenuItem* helpMi = [CCMenuItemFont itemFromString:@"使用帮助" target:self selector:@selector(onMenuHelp:)];
		
		CCMenu* menu = [CCMenu menuWithItems:startMi, hsMi, optionMi, helpMi, nil];
		[menu alignItemsVertically];
		
		[self addChild:menu];
        
	}
	return self;
}

-(void) onMenuStart:(id)sender
{    
    CCScene *sc = [LoadingScene scene];
	[[CCDirector sharedDirector] replaceScene:sc];
}

-(void) onMenuHighScore:(id)sender
{
}
-(void) onMenuOption:(id)sender
{
}
-(void) onMenuHelp:(id)sender
{
}
-(void) dealloc
{    
	[super dealloc];
}
@end