fix game fps problem
Showing
12 changed files
with
81 additions
and
245 deletions
| ... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
| 6 | <isMusic>1</isMusic> | 6 | <isMusic>1</isMusic> |
| 7 | <isEffect>1</isEffect> | 7 | <isEffect>1</isEffect> |
| 8 | <best>4186</best> | 8 | <best>4186</best> |
| 9 | <game_play_cnt>8</game_play_cnt> | 9 | <game_play_cnt>10</game_play_cnt> |
| 10 | <is_game_vip>1</is_game_vip> | 10 | <is_game_vip>1</is_game_vip> |
| 11 | <cake_best>1</cake_best> | 11 | <cake_best>5</cake_best> |
| 12 | </userDefaultRoot> | 12 | </userDefaultRoot> | ... | ... |
No preview for this file type
| ... | @@ -8,14 +8,14 @@ | ... | @@ -8,14 +8,14 @@ |
| 8 | <versionnum>201801291657</versionnum> | 8 | <versionnum>201801291657</versionnum> |
| 9 | <isMusic>0</isMusic> | 9 | <isMusic>0</isMusic> |
| 10 | <isEffect>1</isEffect> | 10 | <isEffect>1</isEffect> |
| 11 | <fanpai_best>116</fanpai_best> | 11 | <fanpai_best>117</fanpai_best> |
| 12 | <fanpai_game_play_cnt>5</fanpai_game_play_cnt> | 12 | <fanpai_game_play_cnt>5</fanpai_game_play_cnt> |
| 13 | <best>2</best> | 13 | <best>2</best> |
| 14 | <game_play_cnt>17</game_play_cnt> | 14 | <game_play_cnt>17</game_play_cnt> |
| 15 | <cake_best>157</cake_best> | 15 | <cake_best>157</cake_best> |
| 16 | <haidao_best>689</haidao_best> | 16 | <haidao_best>1109</haidao_best> |
| 17 | <guess_game_play_cnt>2</guess_game_play_cnt> | 17 | <guess_game_play_cnt>2</guess_game_play_cnt> |
| 18 | <guess_best>18</guess_best> | 18 | <guess_best>113</guess_best> |
| 19 | <candy_best>91</candy_best> | 19 | <candy_best>91</candy_best> |
| 20 | <candy_game_play_cnt>3</candy_game_play_cnt> | 20 | <candy_game_play_cnt>3</candy_game_play_cnt> |
| 21 | <shuyishu_best>11</shuyishu_best> | 21 | <shuyishu_best>11</shuyishu_best> |
| ... | @@ -26,7 +26,7 @@ | ... | @@ -26,7 +26,7 @@ |
| 26 | <new_guide_step>4</new_guide_step> | 26 | <new_guide_step>4</new_guide_step> |
| 27 | <is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide> | 27 | <is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide> |
| 28 | <feiyanzoubi_best>603</feiyanzoubi_best> | 28 | <feiyanzoubi_best>603</feiyanzoubi_best> |
| 29 | <uid>1060100010142873</uid> | 29 | <uid>1030100010142927</uid> |
| 30 | <is_bird_game_guide>1</is_bird_game_guide> | 30 | <is_bird_game_guide>1</is_bird_game_guide> |
| 31 | <bird_best>1107</bird_best> | 31 | <bird_best>1107</bird_best> |
| 32 | <is_haidao_game_guide>1</is_haidao_game_guide> | 32 | <is_haidao_game_guide>1</is_haidao_game_guide> | ... | ... |
| ... | @@ -15,7 +15,8 @@ function ShopModel.onPayResFun(params) | ... | @@ -15,7 +15,8 @@ function ShopModel.onPayResFun(params) |
| 15 | UmengHelper.onEvent("diamond_buy_" .. payInfo.itemList[1].num); | 15 | UmengHelper.onEvent("diamond_buy_" .. payInfo.itemList[1].num); |
| 16 | print("购买钻石:" .. "diamond_buy_" .. payInfo.itemList[1].num); | 16 | print("购买钻石:" .. "diamond_buy_" .. payInfo.itemList[1].num); |
| 17 | elseif payInfo.type == 2 then | 17 | elseif payInfo.type == 2 then |
| 18 | UserModel.addVip(payInfo.id); --更新会员信息 | 18 | UserModel.addVip(payInfo.id); |
| 19 | -- 更新会员信息 | ||
| 19 | params = payInfo.rmb .. "&" .. 1; | 20 | params = payInfo.rmb .. "&" .. 1; |
| 20 | if payInfo.id == 201 then | 21 | if payInfo.id == 201 then |
| 21 | UmengHelper.onEvent("buy_vip_month"); | 22 | UmengHelper.onEvent("buy_vip_month"); |
| ... | @@ -140,7 +141,7 @@ end | ... | @@ -140,7 +141,7 @@ end |
| 140 | 141 | ||
| 141 | -- 天津联通支付 | 142 | -- 天津联通支付 |
| 142 | function ShopModel.payCucc(productId, productName, productPrice, callBack, timeoutCallBack, gameid) | 143 | function ShopModel.payCucc(productId, productName, productPrice, callBack, timeoutCallBack, gameid) |
| 143 | logUI("ShopModel------------------------------>"..productId); | 144 | logUI("ShopModel------------------------------>" .. productPrice); |
| 144 | local function onGetPayIDSuccessFun(_params) | 145 | local function onGetPayIDSuccessFun(_params) |
| 145 | local data = json.decode(_params); | 146 | local data = json.decode(_params); |
| 146 | if data.pay_id == "" then | 147 | if data.pay_id == "" then |
| ... | @@ -176,6 +177,8 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo | ... | @@ -176,6 +177,8 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo |
| 176 | local reciever = require("app.views.view.QrPayView"):show( { trade_no = tradeNo, subject = subject, price = productPrice, zfb_url = zfb_url_callback, wx_url = wx_url_callback, callBackFun = callBack }); | 177 | local reciever = require("app.views.view.QrPayView"):show( { trade_no = tradeNo, subject = subject, price = productPrice, zfb_url = zfb_url_callback, wx_url = wx_url_callback, callBackFun = callBack }); |
| 177 | local scene = cc.Director:getInstance():getRunningScene(); | 178 | local scene = cc.Director:getInstance():getRunningScene(); |
| 178 | scene.keypadManager:addKeypadReceiver(reciever); | 179 | scene.keypadManager:addKeypadReceiver(reciever); |
| 180 | else | ||
| 181 | MEMBER_TYPE = 0; | ||
| 179 | end | 182 | end |
| 180 | logUI(params); | 183 | logUI(params); |
| 181 | end | 184 | end |
| ... | @@ -187,9 +190,9 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo | ... | @@ -187,9 +190,9 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo |
| 187 | end | 190 | end |
| 188 | 191 | ||
| 189 | local pay_params = tradeNo .. "," .. productId .. "," .. subject .. "," .. amount .. "," .. notificationURL .. "," .. peng_bo_shi_token; | 192 | local pay_params = tradeNo .. "," .. productId .. "," .. subject .. "," .. amount .. "," .. notificationURL .. "," .. peng_bo_shi_token; |
| 190 | logUI("ShopModel payCucc pay_params= "..pay_params); | 193 | logUI("ShopModel payCucc pay_params= " .. pay_params); |
| 191 | local payInfo = ShopInfo.getPayInfoByProduct(productId); | 194 | local payInfo = ShopInfo.getPayInfoByProduct(productId); |
| 192 | logUI("ShopModel payCucc payInfo.id= "..payInfo.id); | 195 | logUI("ShopModel payCucc payInfo.id= " .. payInfo.id); |
| 193 | if payInfo.id == 301 then | 196 | if payInfo.id == 301 then |
| 194 | DeviceUtil.cycleBilling(pay_params, payCallbackFromJava); | 197 | DeviceUtil.cycleBilling(pay_params, payCallbackFromJava); |
| 195 | else | 198 | else |
| ... | @@ -205,12 +208,13 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo | ... | @@ -205,12 +208,13 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo |
| 205 | 208 | ||
| 206 | gameid = gameid or 0; | 209 | gameid = gameid or 0; |
| 207 | gameid = tostring(gameid); | 210 | gameid = tostring(gameid); |
| 208 | --local get_pay_id_url = string.gsub(GAME_LOGIN_URL, "login", "pay_get_id"); | 211 | -- local get_pay_id_url = string.gsub(GAME_LOGIN_URL, "login", "pay_get_id"); |
| 209 | local get_pay_id_url = string.sub(GAME_LOGIN_URL, 1, -6).."pay_get_id"; --将后几位的login截取掉,并拼接上pay_get_id | 212 | local get_pay_id_url = string.sub(GAME_LOGIN_URL, 1, -6) .. "pay_get_id"; |
| 213 | -- 将后几位的login截取掉,并拼接上pay_get_id | ||
| 210 | if CHANNEL == "cucc" and cc.Application:getInstance():getTargetPlatform() == cc.PLATFORM_OS_ANDROID then | 214 | if CHANNEL == "cucc" and cc.Application:getInstance():getTargetPlatform() == cc.PLATFORM_OS_ANDROID then |
| 211 | local paramsStr = "uid=" .. UserModel.getStringUID() .. "&product=" .. productId .. "&account=" .. UserModel.account .. "&gameid=" .. gameid; | 215 | local paramsStr = "uid=" .. UserModel.getStringUID() .. "&product=" .. productId .. "&account=" .. UserModel.account .. "&gameid=" .. gameid; |
| 212 | --logUI("ShopModel sendHttpRequest------------------------------>"); | 216 | -- logUI("ShopModel sendHttpRequest------------------------------>"); |
| 213 | logUI("ShopModel sendHttpRequest------------------------------>".."POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr); | 217 | logUI("ShopModel sendHttpRequest------------------------------>" .. "POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr); |
| 214 | DeviceUtil.sendHttpRequest("POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr, onGetPayIDSuccessFun); | 218 | DeviceUtil.sendHttpRequest("POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr, onGetPayIDSuccessFun); |
| 215 | else | 219 | else |
| 216 | HttpRequest:getInstance():post(get_pay_id_url, { uid = UserModel.getStringUID(), product = productId, account = UserModel.account, gameid = gameid }, onGetPayIDSuccessFun, onGetPayIDFaildFun); | 220 | HttpRequest:getInstance():post(get_pay_id_url, { uid = UserModel.getStringUID(), product = productId, account = UserModel.account, gameid = gameid }, onGetPayIDSuccessFun, onGetPayIDFaildFun); |
| ... | @@ -280,26 +284,29 @@ end | ... | @@ -280,26 +284,29 @@ end |
| 280 | 284 | ||
| 281 | -- 上海电信支付 | 285 | -- 上海电信支付 |
| 282 | function ShopModel.payShdx(productId, productName, productPrice, callBack, timeoutCallBack, gameid) | 286 | function ShopModel.payShdx(productId, productName, productPrice, callBack, timeoutCallBack, gameid) |
| 283 | --logD("支付类型---------------------------->"..MEMBER_TYPE); | 287 | -- logD("支付类型---------------------------->"..MEMBER_TYPE); |
| 284 | local pay_params =productId .. "," .. productName .. "," .. productPrice; | 288 | local pay_params = productId .. "," .. productName .. "," .. productPrice; |
| 285 | --local payInfo = ShopInfo.getPayInfoByProduct(productId); | 289 | -- local payInfo = ShopInfo.getPayInfoByProduct(productId); |
| 286 | 290 | ||
| 287 | local function callbackLua(params) | 291 | local function callbackLua(params) |
| 288 | local arr = StringUtil.split(params,","); | 292 | local arr = StringUtil.split(params, ","); |
| 289 | --logUI("支付返回的信息:"..arr[1].."-----------orderId:"..arr[2].."-------------orderSn:"..arr[3]); | 293 | -- logUI("支付返回的信息:"..arr[1].."-----------orderId:"..arr[2].."-------------orderSn:"..arr[3]); |
| 290 | if arr[1] and arr[1] == "success" then --成功 | 294 | if arr[1] and arr[1] == "success" then |
| 295 | -- 成功 | ||
| 291 | if callBack then | 296 | if callBack then |
| 292 | callBack(params); | 297 | callBack(params); |
| 293 | end | 298 | end |
| 294 | --Alert.showOne(strings.msg_3001); | 299 | -- Alert.showOne(strings.msg_3001); |
| 295 | elseif arr[1] and arr[1] == "cancel" then | 300 | elseif arr[1] and arr[1] == "cancel" then |
| 296 | MEMBER_TYPE=0; | 301 | MEMBER_TYPE = 0; |
| 297 | Alert.showOne(strings.msg_3003); --取消 | 302 | Alert.showOne(strings.msg_3003); |
| 303 | -- 取消 | ||
| 298 | else | 304 | else |
| 299 | MEMBER_TYPE=0; | 305 | MEMBER_TYPE = 0; |
| 300 | Alert.showOne(strings.msg_3002); --失败 | 306 | Alert.showOne(strings.msg_3002); |
| 307 | -- 失败 | ||
| 301 | end | 308 | end |
| 302 | --logUI(params); | 309 | -- logUI(params); |
| 303 | end | 310 | end |
| 304 | 311 | ||
| 305 | local function payCallbackFromJava(params) | 312 | local function payCallbackFromJava(params) |
| ... | @@ -308,11 +315,11 @@ function ShopModel.payShdx(productId, productName, productPrice, callBack, timeo | ... | @@ -308,11 +315,11 @@ function ShopModel.payShdx(productId, productName, productPrice, callBack, timeo |
| 308 | end ); | 315 | end ); |
| 309 | end | 316 | end |
| 310 | 317 | ||
| 311 | --if payInfo.id == 301 then | 318 | -- if payInfo.id == 301 then |
| 312 | -- DeviceUtil.cycleBilling(pay_params, payCallbackFromJava); | 319 | -- DeviceUtil.cycleBilling(pay_params, payCallbackFromJava); |
| 313 | --else | 320 | -- else |
| 314 | DeviceUtil.sendBilling(pay_params, payCallbackFromJava); | 321 | DeviceUtil.sendBilling(pay_params, payCallbackFromJava); |
| 315 | --end | 322 | -- end |
| 316 | end | 323 | end |
| 317 | 324 | ||
| 318 | return ShopModel | 325 | return ShopModel |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -55,7 +55,7 @@ UserModel.new_chenghao_list = { }; | ... | @@ -55,7 +55,7 @@ UserModel.new_chenghao_list = { }; |
| 55 | 55 | ||
| 56 | UserModel.team_id = 0; | 56 | UserModel.team_id = 0; |
| 57 | UserModel.pet_team = { }; | 57 | UserModel.pet_team = { }; |
| 58 | UserModel.single_game_cnt = { }; --每天玩游戏的免费次数 | 58 | UserModel.single_game_cnt = { }; -- 每天玩游戏的免费次数 |
| 59 | 59 | ||
| 60 | local items = { }; | 60 | local items = { }; |
| 61 | local task_list = { }; | 61 | local task_list = { }; |
| ... | @@ -466,21 +466,31 @@ function UserModel.onConnectSuccess(params) | ... | @@ -466,21 +466,31 @@ function UserModel.onConnectSuccess(params) |
| 466 | local function callbackLua(params) | 466 | local function callbackLua(params) |
| 467 | logUI("天津鉴权返回数据: " .. params); | 467 | logUI("天津鉴权返回数据: " .. params); |
| 468 | if params == "success" then | 468 | if params == "success" then |
| 469 | MEMBER_TYPE = 1; | 469 | MEMBER_TYPE = 301; |
| 470 | -- 初始化会员全局变量 | 470 | -- 初始化会员全局变量 |
| 471 | SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 1 }); | 471 | -- SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 1 }); |
| 472 | |||
| 473 | SocketClient:getInstance():send("gateway_msg.login_msg", | ||
| 474 | { | ||
| 475 | platform = PLATFORM, | ||
| 476 | account = account, | ||
| 477 | session = session, | ||
| 478 | shanghai_dianxin_pay_id=301, | ||
| 479 | } ); | ||
| 472 | else | 480 | else |
| 473 | -- 还不是会员,鉴权返回的productid保存再AppActivity中 | 481 | -- 还不是会员,鉴权返回的productid保存再AppActivity中 |
| 474 | SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 0 }); | 482 | -- SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 0 }); |
| 483 | |||
| 484 | SocketClient:getInstance():send("gateway_msg.login_msg", | ||
| 485 | { | ||
| 486 | platform = PLATFORM, | ||
| 487 | account = account, | ||
| 488 | session = session, | ||
| 489 | -- shanghai_dianxin_pay_id=tonumber(arr[2]), | ||
| 490 | } ); | ||
| 475 | end | 491 | end |
| 476 | end | 492 | end |
| 477 | SocketClient:getInstance():send("gateway_msg.login_msg", | 493 | |
| 478 | { | ||
| 479 | platform = PLATFORM, | ||
| 480 | account = account, | ||
| 481 | session = session, | ||
| 482 | -- shanghai_dianxin_pay_id=tonumber(arr[2]), | ||
| 483 | } ); | ||
| 484 | 494 | ||
| 485 | local vipList = ShopInfo.getVipList(); | 495 | local vipList = ShopInfo.getVipList(); |
| 486 | -- 续包月这里应该是server和content,但是配置表配反了 | 496 | -- 续包月这里应该是server和content,但是配置表配反了 |
| ... | @@ -610,11 +620,11 @@ function UserModel.onLoginSuccessFun(params) | ... | @@ -610,11 +620,11 @@ function UserModel.onLoginSuccessFun(params) |
| 610 | return aa.val3 < bb.val3; | 620 | return aa.val3 < bb.val3; |
| 611 | end ); | 621 | end ); |
| 612 | 622 | ||
| 613 | --小游戏免费使用过的次数 key:小游戏id,v1:次数 | 623 | -- 小游戏免费使用过的次数 key:小游戏id,v1:次数 |
| 614 | 624 | ||
| 615 | logD("free num===================>"..#params.data.single_game_cnt); | 625 | logD("free num===================>" .. #params.data.single_game_cnt); |
| 616 | for i, v in ipairs(params.data.single_game_cnt) do | 626 | for i, v in ipairs(params.data.single_game_cnt) do |
| 617 | logD("free num-------------------->"..v.val1); | 627 | logD("free num-------------------->" .. v.val1); |
| 618 | UserModel.single_game_cnt[i] = { key = v.key, val1 = v.val1, val2 = v.val2, val3 = v.val3 }; | 628 | UserModel.single_game_cnt[i] = { key = v.key, val1 = v.val1, val2 = v.val2, val3 = v.val3 }; |
| 619 | end | 629 | end |
| 620 | 630 | ||
| ... | @@ -1044,8 +1054,8 @@ function UserModel.getLeftVipDay() | ... | @@ -1044,8 +1054,8 @@ function UserModel.getLeftVipDay() |
| 1044 | end | 1054 | end |
| 1045 | end | 1055 | end |
| 1046 | 1056 | ||
| 1047 | --302 | 1057 | -- 302 |
| 1048 | if CHANNEL=="shdx" then | 1058 | if CHANNEL == "shdx" then |
| 1049 | local vipInfo4 = vipList[4]; | 1059 | local vipInfo4 = vipList[4]; |
| 1050 | if vipInfo4 then | 1060 | if vipInfo4 then |
| 1051 | local data4 = UserModel.getVipByID(vipInfo4.id); | 1061 | local data4 = UserModel.getVipByID(vipInfo4.id); |
| ... | @@ -1055,13 +1065,13 @@ function UserModel.getLeftVipDay() | ... | @@ -1055,13 +1065,13 @@ function UserModel.getLeftVipDay() |
| 1055 | day4 = 9999; | 1065 | day4 = 9999; |
| 1056 | end | 1066 | end |
| 1057 | 1067 | ||
| 1058 | left_day_num = math.max(left_day_num, day4); | 1068 | left_day_num = math.max(left_day_num, day4); |
| 1059 | -- 理论上这里是续包月,应该通过鉴权判断是否是VIP | 1069 | -- 理论上这里是续包月,应该通过鉴权判断是否是VIP |
| 1060 | end | 1070 | end |
| 1061 | end | 1071 | end |
| 1062 | end | 1072 | end |
| 1063 | 1073 | ||
| 1064 | if CHANNEL == "gzdt" or CHANNEL=="sxyd" then | 1074 | if CHANNEL == "gzdt" or CHANNEL == "sxyd" then |
| 1065 | -- 大唐版本所有的用户都是VIP | 1075 | -- 大唐版本所有的用户都是VIP |
| 1066 | left_day_num = 100; | 1076 | left_day_num = 100; |
| 1067 | end | 1077 | end | ... | ... |
| ... | @@ -20,6 +20,7 @@ end | ... | @@ -20,6 +20,7 @@ end |
| 20 | 20 | ||
| 21 | function MainScene:onCreate(params) | 21 | function MainScene:onCreate(params) |
| 22 | logD("enter MainScene----------------------------->"); | 22 | logD("enter MainScene----------------------------->"); |
| 23 | --cc.Director:getInstance():setDisplayStats(true); --显示FPS等调试信息 | ||
| 23 | self.keypadManager = KeypadManager:create(self); | 24 | self.keypadManager = KeypadManager:create(self); |
| 24 | 25 | ||
| 25 | self.ui = cc.CSLoader:createNode("ui/MainScene.csb"); | 26 | self.ui = cc.CSLoader:createNode("ui/MainScene.csb"); | ... | ... |
| ... | @@ -147,6 +147,7 @@ function XyxPayView:onPayCallBack(params) | ... | @@ -147,6 +147,7 @@ function XyxPayView:onPayCallBack(params) |
| 147 | self:close(); | 147 | self:close(); |
| 148 | LoadingManager.removeDataLoading(); | 148 | LoadingManager.removeDataLoading(); |
| 149 | if self.onPaySuccess then | 149 | if self.onPaySuccess then |
| 150 | cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧 | ||
| 150 | self.onPaySuccess(); | 151 | self.onPaySuccess(); |
| 151 | end | 152 | end |
| 152 | end))); | 153 | end))); | ... | ... |
| ... | @@ -163,6 +163,7 @@ function XyxPayView:onPayCallBack(params) | ... | @@ -163,6 +163,7 @@ function XyxPayView:onPayCallBack(params) |
| 163 | self:close(); | 163 | self:close(); |
| 164 | LoadingManager.removeDataLoading(); | 164 | LoadingManager.removeDataLoading(); |
| 165 | if self.onPaySuccess then | 165 | if self.onPaySuccess then |
| 166 | cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧 | ||
| 166 | self.onPaySuccess(); --各个游戏GameScene中启动游戏的回调 | 167 | self.onPaySuccess(); --各个游戏GameScene中启动游戏的回调 |
| 167 | else --从活动跳过去的在跳回去(打补丁,焦点框跳转的有问题) | 168 | else --从活动跳过去的在跳回去(打补丁,焦点框跳转的有问题) |
| 168 | local reciever = require("app.views.view.ActivityView"):show(); | 169 | local reciever = require("app.views.view.ActivityView"):show(); | ... | ... |
| ... | @@ -130,22 +130,31 @@ function XyxPayView:onBuyClick(ref,event) | ... | @@ -130,22 +130,31 @@ function XyxPayView:onBuyClick(ref,event) |
| 130 | self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP); | 130 | self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP); |
| 131 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever);--]] | 131 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever);--]] |
| 132 | local vipList = ShopInfo.getVipList(); | 132 | local vipList = ShopInfo.getVipList(); |
| 133 | MEMBER_TYPE=vipList[3].id; | ||
| 133 | local shopInfo = ShopInfo.getPayInfo(vipList[3].id); | 134 | local shopInfo = ShopInfo.getPayInfo(vipList[3].id); |
| 134 | ShopModel.pay(shopInfo.product, shopInfo.name, shopInfo.costList[1].num); | 135 | ShopModel.pay(shopInfo.product, shopInfo.name, shopInfo.costList[1].num,handler(self,self.onPayCallBack)); |
| 135 | end | 136 | end |
| 136 | 137 | ||
| 137 | function XyxPayView:onPayCallBack(params) | 138 | function XyxPayView:onPayCallBack(params) |
| 139 | logUI("XyxpayView_tianjin_cucc--------->"..params); | ||
| 138 | if params == "success" then | 140 | if params == "success" then |
| 141 | SocketClient:getInstance():send("gateway_msg.shanghai_dianxin_pay_msg", | ||
| 142 | { | ||
| 143 | shanghai_dianxin_pay_id = MEMBER_TYPE, | ||
| 144 | order_number=0, | ||
| 145 | order_number=0, | ||
| 146 | } ); | ||
| 147 | |||
| 139 | if not TableUtil.IsInTable(UserModel.free_game_id,self.game_id) then | 148 | if not TableUtil.IsInTable(UserModel.free_game_id,self.game_id) then |
| 140 | table.insert(UserModel.free_game_id,self.game_id); | 149 | table.insert(UserModel.free_game_id,self.game_id); |
| 141 | end | 150 | end |
| 142 | 151 | ||
| 143 | LoadingManager.showDataLoading(); | 152 | LoadingManager.showDataLoading(); |
| 144 | |||
| 145 | self:runAction(cc.Sequence:create(cc.DelayTime:create(1),cc.CallFunc:create(function () | 153 | self:runAction(cc.Sequence:create(cc.DelayTime:create(1),cc.CallFunc:create(function () |
| 146 | self:close(); | 154 | self:close(); |
| 147 | LoadingManager.removeDataLoading(); | 155 | LoadingManager.removeDataLoading(); |
| 148 | if self.onPaySuccess then | 156 | if self.onPaySuccess then |
| 157 | cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧 | ||
| 149 | self.onPaySuccess(); | 158 | self.onPaySuccess(); |
| 150 | end | 159 | end |
| 151 | end))); | 160 | end))); | ... | ... |
| 1 | local XyxPayView = dialog.uinode("ui/xyx/tianjin_cucc/XyxPayLayer.csb",import("../BaseViewNew")) | ||
| 2 | -- 天津联通,需要续包月功能 | ||
| 3 | local _index = 1; | ||
| 4 | |||
| 5 | function XyxPayView:ctor() | ||
| 6 | XyxPayView.super.ctor(self); | ||
| 7 | end | ||
| 8 | |||
| 9 | function XyxPayView:show(game_id,onPaySuccessFun) | ||
| 10 | self.game_id = game_id; | ||
| 11 | self.onPaySuccess = onPaySuccessFun; | ||
| 12 | |||
| 13 | local scene = cc.Director:getInstance():getRunningScene() | ||
| 14 | local inst = XyxPayView:create(); | ||
| 15 | scene:addChild(inst, dialog.ZORDER_POP); | ||
| 16 | |||
| 17 | inst:setContentSize(cc.size(display.width,display.height)); | ||
| 18 | ccui.Helper:doLayout(inst); | ||
| 19 | |||
| 20 | inst.scrollView = inst:getChildByName("ScrollView"); | ||
| 21 | |||
| 22 | inst.layer = cc.Layer:create(); | ||
| 23 | inst:addChild(inst.layer,1); | ||
| 24 | --registerScriptTouchEvent(inst.layer,handler(inst,inst.onTouchBegin),handler(inst,inst.onTouchMove),handler(inst,inst.onTouchEnd)); | ||
| 25 | |||
| 26 | inst:init(); | ||
| 27 | |||
| 28 | return inst; | ||
| 29 | end | ||
| 30 | |||
| 31 | function XyxPayView:init() | ||
| 32 | cc.Director:getInstance():setAnimationInterval(1/30); | ||
| 33 | |||
| 34 | self.panel = self:getChildByName("panel"); | ||
| 35 | |||
| 36 | self.btn_close = self.panel:getChildByName("btn_close"); | ||
| 37 | self.btn_close.fn = handler(self,self.onClose); | ||
| 38 | self.btn_close:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_close.fn)end); | ||
| 39 | |||
| 40 | self.btn_buy = self.panel:getChildByName("btn_buy"); | ||
| 41 | self.btn_buy.fn = handler(self,self.onBuyClick); | ||
| 42 | self.btn_buy:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_buy.fn)end); | ||
| 43 | |||
| 44 | --[[self.btn_vip_month = self.panel:getChildByName("btn_vip_month"); | ||
| 45 | self.btn_vip_month.fn = handler(self,self.onMonthVipClick); | ||
| 46 | self.btn_vip_month:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_vip_month.fn)end); | ||
| 47 | |||
| 48 | self.btn_vip_year = self.panel:getChildByName("btn_vip_year"); | ||
| 49 | self.btn_vip_year.fn = handler(self,self.onYearVipClick); | ||
| 50 | self.btn_vip_year:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_vip_year.fn)end);--]] | ||
| 51 | |||
| 52 | local game_info = SingleGameInfo.get_game_info(self.game_id); | ||
| 53 | self.panel:getChildByName("txt_name"):setString(game_info.name); | ||
| 54 | local icon_url = "res/ui/xyx/xyx_"..self.game_id..".png"; | ||
| 55 | print("sssssssss",icon_url) | ||
| 56 | if cc.FileUtils:getInstance():isFileExist(icon_url) then | ||
| 57 | self.panel:getChildByName("img"):setSpriteFrame(cc.Sprite:create(icon_url):getSpriteFrame()); | ||
| 58 | end | ||
| 59 | |||
| 60 | local vipList = ShopInfo.getVipList(); | ||
| 61 | --self.panel:getChildByName("txt_month"):setString(vipList[1].rmb.."元"); | ||
| 62 | --self.panel:getChildByName("txt_year"):setString(vipList[2].rmb.."元"); | ||
| 63 | |||
| 64 | local game_info = SingleGameInfo.get_game_info(self.game_id); | ||
| 65 | -- local shopInfo = ShopInfo.getPayInfo(game_info.payid); | ||
| 66 | self.panel:getChildByName("txt_price"):setString(game_info.diamond.."钻石"); | ||
| 67 | |||
| 68 | --self.nodes[#self.nodes+1] = {self.btn_close}; | ||
| 69 | self.nodes[#self.nodes+1] = {self.btn_buy,self.btn_close}; | ||
| 70 | |||
| 71 | self:updateSelectedState(self.btn_buy); | ||
| 72 | |||
| 73 | EventListener.addEventListener(self,EnumEvent.UPDATE_DIAMOND,handler(self,self.onDiamondUpdate)); | ||
| 74 | end | ||
| 75 | |||
| 76 | function XyxPayView:onDiamondUpdate(params) | ||
| 77 | if UserModel.getDiamond() > 0 then | ||
| 78 | if self.shop_reciever then | ||
| 79 | self.shop_reciever:close(); | ||
| 80 | self.shop_reciever = nil; | ||
| 81 | end | ||
| 82 | self:runAction(cc.Sequence:create(cc.DelayTime:create(0.3),cc.CallFunc:create(function () | ||
| 83 | self:close(); | ||
| 84 | if self.onPaySuccess then | ||
| 85 | self.onPaySuccess(); | ||
| 86 | end | ||
| 87 | end))); | ||
| 88 | end | ||
| 89 | end | ||
| 90 | |||
| 91 | function XyxPayView:onTouchBegin(event) | ||
| 92 | self.begin_touch_pos = self.layer:getParent():convertToWorldSpace(event:getLocation()); | ||
| 93 | self.isMoved = false; | ||
| 94 | return true; | ||
| 95 | end | ||
| 96 | |||
| 97 | function XyxPayView:onTouchMove(event) | ||
| 98 | local move_touch_pos = self.layer:getParent():convertToWorldSpace(event:getLocation()); | ||
| 99 | local _distance = Point.distance(self.begin_touch_pos,move_touch_pos); | ||
| 100 | if _distance > 5 then | ||
| 101 | self.isMoved = true; | ||
| 102 | end | ||
| 103 | end | ||
| 104 | |||
| 105 | function XyxPayView:onTouchEnd(event) | ||
| 106 | local p = self.layer:convertToWorldSpace(event:getLocation()); | ||
| 107 | end | ||
| 108 | |||
| 109 | function XyxPayView:onMonthVipClick(ref,event) | ||
| 110 | local vipList = ShopInfo.getVipList(); | ||
| 111 | local shopInfo = ShopInfo.getPayInfo(vipList[1].id); | ||
| 112 | ShopModel.pay(shopInfo.product,shopInfo.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack)); | ||
| 113 | end | ||
| 114 | |||
| 115 | function XyxPayView:onYearVipClick(ref,event) | ||
| 116 | local vipList = ShopInfo.getVipList(); | ||
| 117 | local shopInfo = ShopInfo.getPayInfo(vipList[2].id); | ||
| 118 | ShopModel.pay(shopInfo.product,shopInfo.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack)); | ||
| 119 | end | ||
| 120 | |||
| 121 | function XyxPayView:onBuyClick(ref,event) | ||
| 122 | -- local game_info = SingleGameInfo.get_game_info(self.game_id); | ||
| 123 | -- local shopInfo = ShopInfo.getPayInfo(game_info.payid); | ||
| 124 | -- ShopModel.pay(shopInfo.product,"购买"..game_info.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack),nil,self.game_id); | ||
| 125 | |||
| 126 | --self.shop_reciever = require("app.views.view.ShopView"):show(6); | ||
| 127 | --self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP); | ||
| 128 | --cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever); | ||
| 129 | self.shop_reciever = require("app.views.view.ActivityView"):show("ActivityVipView"); | ||
| 130 | self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP); | ||
| 131 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever); | ||
| 132 | |||
| 133 | -- self:onPayCallBack("success"); | ||
| 134 | end | ||
| 135 | |||
| 136 | function XyxPayView:onPayCallBack(params) | ||
| 137 | if params == "success" then | ||
| 138 | if not TableUtil.IsInTable(UserModel.free_game_id,self.game_id) then | ||
| 139 | table.insert(UserModel.free_game_id,self.game_id); | ||
| 140 | end | ||
| 141 | |||
| 142 | LoadingManager.showDataLoading(); | ||
| 143 | |||
| 144 | self:runAction(cc.Sequence:create(cc.DelayTime:create(1),cc.CallFunc:create(function () | ||
| 145 | self:close(); | ||
| 146 | LoadingManager.removeDataLoading(); | ||
| 147 | if self.onPaySuccess then | ||
| 148 | self.onPaySuccess(); | ||
| 149 | end | ||
| 150 | end))); | ||
| 151 | end | ||
| 152 | logUI("小游戏支付返回:"..params); | ||
| 153 | end | ||
| 154 | |||
| 155 | function XyxPayView:onClose() | ||
| 156 | self:close(); | ||
| 157 | end | ||
| 158 | |||
| 159 | --返回键处理函数 | ||
| 160 | function XyxPayView:onKeypadBack() | ||
| 161 | self:close(); | ||
| 162 | end | ||
| 163 | |||
| 164 | --确认键处理函数 | ||
| 165 | function XyxPayView:onKeypadOk() | ||
| 166 | if self.selected_node and self.selected_node.fn then | ||
| 167 | self.selected_node.fn(); | ||
| 168 | end | ||
| 169 | end | ||
| 170 | |||
| 171 | --上键处理函数 | ||
| 172 | function XyxPayView:onKeypadUp() | ||
| 173 | XyxPayView.super.onKeypadUp(self,false,true,false,false); | ||
| 174 | end | ||
| 175 | |||
| 176 | --下键处理函数 | ||
| 177 | function XyxPayView:onKeypadDown() | ||
| 178 | XyxPayView.super.onKeypadDown(self,false,true,false,false); | ||
| 179 | end | ||
| 180 | |||
| 181 | --左键处理函数 | ||
| 182 | function XyxPayView:onKeypadLeft() | ||
| 183 | XyxPayView.super.onKeypadLeft(self,false,true,false,true,false); | ||
| 184 | end | ||
| 185 | |||
| 186 | --右键处理函数 | ||
| 187 | function XyxPayView:onKeypadRight() | ||
| 188 | XyxPayView.super.onKeypadRight(self,false,true,false,true,false); | ||
| 189 | end | ||
| 190 | |||
| 191 | return XyxPayView | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -51,7 +51,6 @@ | ... | @@ -51,7 +51,6 @@ |
| 51 | <Folder Include="src\app\views\scene\" /> | 51 | <Folder Include="src\app\views\scene\" /> |
| 52 | <Folder Include="src\app\views\shuyishu\" /> | 52 | <Folder Include="src\app\views\shuyishu\" /> |
| 53 | <Folder Include="src\app\views\view\" /> | 53 | <Folder Include="src\app\views\view\" /> |
| 54 | <Folder Include="src\app\views\view\tianjin_cucc\" /> | ||
| 55 | <Folder Include="src\cocos\" /> | 54 | <Folder Include="src\cocos\" /> |
| 56 | <Folder Include="src\cocos\3d\" /> | 55 | <Folder Include="src\cocos\3d\" /> |
| 57 | <Folder Include="src\cocos\cocos2d\" /> | 56 | <Folder Include="src\cocos\cocos2d\" /> |
| ... | @@ -272,7 +271,6 @@ | ... | @@ -272,7 +271,6 @@ |
| 272 | <Compile Include="src\app\views\view\PetTeamEditView.lua" /> | 271 | <Compile Include="src\app\views\view\PetTeamEditView.lua" /> |
| 273 | <Compile Include="src\app\views\view\PetTeamListView.lua" /> | 272 | <Compile Include="src\app\views\view\PetTeamListView.lua" /> |
| 274 | <Compile Include="src\app\views\view\ActivityVipView_tianjin_cucc.lua" /> | 273 | <Compile Include="src\app\views\view\ActivityVipView_tianjin_cucc.lua" /> |
| 275 | <Compile Include="src\app\views\view\tianjin_cucc\XyxPayView.lua" /> | ||
| 276 | <Compile Include="src\app\views\view\UserInfoOtherView.lua" /> | 274 | <Compile Include="src\app\views\view\UserInfoOtherView.lua" /> |
| 277 | <Compile Include="src\app\views\view\XyxPkResultView.lua" /> | 275 | <Compile Include="src\app\views\view\XyxPkResultView.lua" /> |
| 278 | <Compile Include="src\app\views\view\FriendRecommendView.lua" /> | 276 | <Compile Include="src\app\views\view\FriendRecommendView.lua" /> | ... | ... |
No preview for this file type
-
Please register or sign in to post a comment