重点内容 做游戏时候经常用到关卡选择,写了个关卡选择界面逻辑类,关卡解锁,关卡类型显示,打过的关卡星级评定,一共六大关,每个大关10个小关,ui使用cocostudio编辑,代码如下:
LevelSel.h文件
#ifndef _LEVELSEL_H
define _LEVELSEL_H
include “cocos2d.h”
include “cocos-ext.h”
include “global.h”
using namespace cocos2d;
using namespace cocos2d::extension;
class LevelSel : public CCLayer
{
public:
CREATE_FUNC(LevelSel);
bool init();
void selevent(CCObject *pSender, TouchEventType type);
void pageViewEvent(CCObject *pSender, PageViewEventType type);
void update(float delta);
void onEnter();
UIPageView* pageView;
Layout* layout_sel;
void refreshsel(int offset);
void aaaaa();
//
int stars[60];
int presel,cursel;
int curlevel;