Skip to content

Instantly share code, notes, and snippets.

@masuhajime
Created April 8, 2015 17:10
Show Gist options
  • Save masuhajime/7534a12ccb1d717b5396 to your computer and use it in GitHub Desktop.
Save masuhajime/7534a12ccb1d717b5396 to your computer and use it in GitHub Desktop.
lambda地獄(どうすればよいのか)
// ランキング登録
this->addButton(Vec2(0, this->getBoundingBox().getMaxY()), "RegisterRank", [](Ref* ref, Widget::TouchEventType type){
if (type != Widget::TouchEventType::ENDED) {return;}
CCLOG("btn touched: Register Ranking");
auto scene = amoamo::common::scene::Ranking::createNameInput(
[](std::string inputText){
if (inputText.length() == 0) {
Director::getInstance()->getRunningScene()->addChild(amoamo::common::layer::Overlay::createDialogOk("名前を入力してね\n\(^o^)/"));
return;
}
CCLOG("input text: %s", inputText.c_str());
zipper::ParseClass pc = zipper::ParseClass(
"MarutaRecord",
"aaaaaaaaa",
"aaaaaaaaaa");
Director::getInstance()->getRunningScene()->addChild(Overlay::getLoadingLayer(), 0, "loading");
if (true) {
// id がない idを登録する
amoamo::common::network::Debug::delay([](network::HttpClient* client, network::HttpResponse* response){
Director::getInstance()->getRunningScene()->removeChildByName("loading");
// id保存する
// スコア一覧の表示
auto layer = List::getListLayer();
auto scene = Scene::create();
scene->addChild(layer);
Director::getInstance()->replaceScene(TransitionFade::create(0.3f, scene));
});
} else {
// id がある スコアの更新
amoamo::common::network::Debug::delay([](network::HttpClient* client, network::HttpResponse* response){
Director::getInstance()->getRunningScene()->removeChildByName("loading");
// スコア一覧の表示
});
}
},
[]{
// cancel (戻る)
auto scene = HelloWorld::createScene();
Director::getInstance()->replaceScene(TransitionFade::create(0.3f, scene));
}
);
Director::getInstance()->replaceScene(TransitionFade::create(0.3f, scene));
return;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment