Beispiel #1
0
// on "init" you need to initialize your instance
bool TableViewTest::init()
{
    if ( !TestCase::init() )
    {
        return false;
    }

	Size winSize = Director::getInstance()->getWinSize();

    TableView* tableView = TableView::create(this, Size(250, 60));
    tableView->setDirection(ScrollView::Direction::HORIZONTAL);
    tableView->setPosition(Vec2(20,winSize.height/2-30));
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();

	tableView = TableView::create(this, Size(60, 250));
	tableView->setDirection(ScrollView::Direction::VERTICAL);
	tableView->setPosition(Vec2(winSize.width-150,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
	this->addChild(tableView);
	tableView->reloadData();

    return true;
}
// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
    if ( !Layer::init() )
    {
        return false;
    }

	Size winSize = Director::getInstance()->getWinSize();

    TableView* tableView = TableView::create(this, Size(250, 60));
    tableView->setDirection(ScrollView::Direction::HORIZONTAL);
    tableView->setPosition(Point(20,winSize.height/2-30));
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();

	tableView = TableView::create(this, Size(60, 250));
	tableView->setDirection(ScrollView::Direction::VERTICAL);
	tableView->setPosition(Point(winSize.width-150,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
	this->addChild(tableView);
	tableView->reloadData();

	// Back Menu
	MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this));
	itemBack->setPosition(Point(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
	Menu *menuBack = Menu::create(itemBack, NULL);
	menuBack->setPosition(Point::ZERO);
	addChild(menuBack);

    return true;
}
Beispiel #3
0
// on "init" you need to initialize your instance
bool Overview::init()
{
    //初期化
    if ( !Layer::init() ) return false;
    
    //userDefaultの読み込み
    userDefault = UserDefault::getInstance();
    
    //ストーリー
    storyManager = StoryManager::getInstance();
    
    //話数
    story_count = storyManager->getStoryCount();
    
    //リスト
    story_list = storyManager->gets();
    
    //画面サイズサイズを取得
    window_size = Director::getInstance()->getWinSize();
    
    TableView* tableView = TableView::create(this, Size(window_size.width / 100 * 80, window_size.height / 100 * 80));
    //展開方向
    tableView->setDirection(TableView::Direction::VERTICAL);
    //表示順序上からしたへ
    tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
    tableView->setPosition(Point((window_size.width - tableView->getContentSize().width) / 2, 20));
    tableView->setBounceable(false);
    //追加
    tableView->setDelegate(this);
    addChild(tableView);
    tableView->reloadData();
    return true;
}
// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
    if ( !Layer::init() )
    {
        return false;
    }

	Size winSize = Director::sharedDirector()->getWinSize();

    TableView* tableView = TableView::create(this, CCSizeMake(250, 60));
    tableView->setDirection(kScrollViewDirectionHorizontal);
    tableView->setPosition(ccp(20,winSize.height/2-30));
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();

	tableView = TableView::create(this, CCSizeMake(60, 250));
	tableView->setDirection(kScrollViewDirectionVertical);
	tableView->setPosition(ccp(winSize.width-150,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(kTableViewFillTopDown);
	this->addChild(tableView);
	tableView->reloadData();

	// Back Menu
	MenuItemFont *itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(TableViewTestLayer::toExtensionsMainLayer, this));
	itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
	Menu *menuBack = Menu::create(itemBack, NULL);
	menuBack->setPosition(PointZero);
	addChild(menuBack);

    return true;
}
Beispiel #5
0
bool TaskListLayer::init()
{
	if (!Layer::init())
	{
		return false;
	}

	Size size = Director::getInstance()->getVisibleSize();

	TableView* tableView = TableView::create(this, Size(600, 500));
	tableView->setDirection(cocos2d::extension::ScrollView::Direction::VERTICAL); //方向垂直
	tableView->setPosition(Point::ZERO);
	tableView->setDelegate(this);
	tableView->setTag(0);
	addChild(tableView);

	tableView->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);  //填充次序从上到下
	tableView->reloadData();

	return true;
}
Beispiel #6
0
// 初始化
bool RankScene::init()
{
	if (!Layer::init())
	{
		return false;
	}

	selected = 3001;
	opt = "easy";
	scheduleUpdate();

	Size mysize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	//背景图片
	Sprite *pbg = Sprite::create("rank_bg.png");
	pbg->setPosition(Vec2(origin.x + mysize.width / 2, origin.y + mysize.height / 2));
	this->addChild(pbg, -1);

	//返回按钮
	Scale9Sprite *spback = Scale9Sprite::create("close.png");
	ControlButton *pbtbk = ControlButton::create(spback);
	pbtbk->setPosition(Vec2(origin.x + mysize.width - 20, origin.y + mysize.height - 25));
	pbtbk->setPreferredSize(Size(36, 36));
	pbtbk->addTargetWithActionForControlEvents(
		this,
		cccontrol_selector(RankScene::backToMenu),
		Control::EventType::TOUCH_UP_INSIDE);
	this->addChild(pbtbk);

	//rank_easy , tag = 3001
	Scale9Sprite *speasy = Scale9Sprite::create("easy.png");
	ControlButton *rkeasy = ControlButton::create(speasy);
	rkeasy->setPosition(Vec2(origin.x + 40, origin.y + mysize.height / 2 + 50));
	rkeasy->setPreferredSize(Size(75, 50));
	rkeasy->addTargetWithActionForControlEvents(
		this,
		cccontrol_selector(RankScene::showRank),
		Control::EventType::TOUCH_UP_INSIDE);
	this->addChild(rkeasy, 1, 3001);

	//rank_normal , tag = 3002
	Scale9Sprite *spnormal = Scale9Sprite::create("normal.png");
	ControlButton *rknormal = ControlButton::create(spnormal);
	rknormal->setPosition(Vec2(origin.x + 40, origin.y + mysize.height / 2 - 20));
	rknormal->setPreferredSize(Size(75, 50));
	rknormal->addTargetWithActionForControlEvents(
		this,
		cccontrol_selector(RankScene::showRank),
		Control::EventType::TOUCH_UP_INSIDE);
	this->addChild(rknormal, 1, 3002);

	//rank_hard tag = 3003
	Scale9Sprite *sphard = Scale9Sprite::create("hard.png");
	ControlButton *rkhard = ControlButton::create(sphard);
	rkhard->setPosition(Vec2(origin.x + 40, origin.y + mysize.height / 2 - 90));
	rkhard->setPreferredSize(Size(75, 50));
	rkhard->addTargetWithActionForControlEvents(
		this,
		cccontrol_selector(RankScene::showRank),
		Control::EventType::TOUCH_UP_INSIDE);
	this->addChild(rkhard, 1, 3003);

	TableView * tbeasy = TableView::create(this, Size(360, 200));
	tbeasy->setDirection(ScrollView::Direction::VERTICAL);
	tbeasy->setPosition(Vec2(origin.x + 90, origin.y + 15));
	tbeasy->setDelegate(this);
	tbeasy->setVerticalFillOrder(TableView::VerticalFillOrder::TOP_DOWN);
	this->addChild(tbeasy, 1, 3005);

	return true;
}