From 5201723b0f521fa8efe8e29a0a0d6eec8d0c8244 Mon Sep 17 00:00:00 2001 From: zhangbin Date: Mon, 8 Apr 2013 17:32:58 +0800 Subject: [PATCH] Optimize the sample code of HelloIAP. --- plugin/.gitignore | 5 +++- .../HelloIAP/Classes/HelloWorldScene.cpp | 26 ++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/plugin/.gitignore b/plugin/.gitignore index 26c4b812ad..26284a528f 100644 --- a/plugin/.gitignore +++ b/plugin/.gitignore @@ -91,4 +91,7 @@ tools/jenkins_scripts/mac/android/userconf.ini # Ignore files built by plugin publish/* tools/toolsForPublish/environment.sh -.settings \ No newline at end of file +.settings +plugins/china* +plugins/punchbox* +samplesPrivate* diff --git a/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp b/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp index aa824e1bd2..e23b06d8b2 100644 --- a/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp +++ b/plugin/samples/HelloIAP/Classes/HelloWorldScene.cpp @@ -112,27 +112,11 @@ void HelloWorld::eventMenuCallback(CCObject* pSender) { CCMenuItemLabel* pMenuItem = (CCMenuItemLabel*)pSender; TProductInfo pInfo; - MyPurchase::MyPayMode mode = MyPurchase::eNoneMode; - - switch (pMenuItem->getTag()) - { - case TAG_PAY_BY_ALIPAY: - pInfo["productName"] = "100金币"; - pInfo["productPrice"] = "0.1"; - pInfo["productDesc"] = "100个金灿灿的游戏币哦"; - mode = MyPurchase::eAlipay; - break; - case TAG_PAY_BY_ND91: - pInfo["productName"] = "100金币"; - pInfo["productPrice"] = "0.01"; - pInfo["productDesc"] = "100个金灿灿的游戏币哦"; - pInfo["Nd91ProductId"] = "685994"; - mode = MyPurchase::eND91; - break; - default: - break; - } - + MyPurchase::MyPayMode mode = (MyPurchase::MyPayMode) (pMenuItem->getTag() - TAG_PAY_BY_ALIPAY + 1); + pInfo["productName"] = "100金币"; + pInfo["productPrice"] = "0.01"; + pInfo["productDesc"] = "100个金灿灿的游戏币哦"; + pInfo["Nd91ProductId"] = "685994"; MyPurchase::sharedPurchase()->payByMode(pInfo, mode); }