Commit 76519f8b 76519f8b437e2fc2fe223ac8b0803c9411825105 by jinwawa

fix game fps problem

1 parent 3c583b51
......@@ -6,7 +6,7 @@
<isMusic>1</isMusic>
<isEffect>1</isEffect>
<best>4186</best>
<game_play_cnt>8</game_play_cnt>
<game_play_cnt>10</game_play_cnt>
<is_game_vip>1</is_game_vip>
<cake_best>1</cake_best>
<cake_best>5</cake_best>
</userDefaultRoot>
......
......@@ -8,14 +8,14 @@
<versionnum>201801291657</versionnum>
<isMusic>0</isMusic>
<isEffect>1</isEffect>
<fanpai_best>116</fanpai_best>
<fanpai_best>117</fanpai_best>
<fanpai_game_play_cnt>5</fanpai_game_play_cnt>
<best>2</best>
<game_play_cnt>17</game_play_cnt>
<cake_best>157</cake_best>
<haidao_best>689</haidao_best>
<haidao_best>1109</haidao_best>
<guess_game_play_cnt>2</guess_game_play_cnt>
<guess_best>18</guess_best>
<guess_best>113</guess_best>
<candy_best>91</candy_best>
<candy_game_play_cnt>3</candy_game_play_cnt>
<shuyishu_best>11</shuyishu_best>
......@@ -26,7 +26,7 @@
<new_guide_step>4</new_guide_step>
<is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide>
<feiyanzoubi_best>603</feiyanzoubi_best>
<uid>1060100010142873</uid>
<uid>1030100010142927</uid>
<is_bird_game_guide>1</is_bird_game_guide>
<bird_best>1107</bird_best>
<is_haidao_game_guide>1</is_haidao_game_guide>
......
......@@ -15,7 +15,8 @@ function ShopModel.onPayResFun(params)
UmengHelper.onEvent("diamond_buy_" .. payInfo.itemList[1].num);
print("购买钻石:" .. "diamond_buy_" .. payInfo.itemList[1].num);
elseif payInfo.type == 2 then
UserModel.addVip(payInfo.id); --更新会员信息
UserModel.addVip(payInfo.id);
-- 更新会员信息
params = payInfo.rmb .. "&" .. 1;
if payInfo.id == 201 then
UmengHelper.onEvent("buy_vip_month");
......@@ -140,7 +141,7 @@ end
-- 天津联通支付
function ShopModel.payCucc(productId, productName, productPrice, callBack, timeoutCallBack, gameid)
logUI("ShopModel------------------------------>"..productId);
logUI("ShopModel------------------------------>" .. productPrice);
local function onGetPayIDSuccessFun(_params)
local data = json.decode(_params);
if data.pay_id == "" then
......@@ -176,6 +177,8 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo
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 });
local scene = cc.Director:getInstance():getRunningScene();
scene.keypadManager:addKeypadReceiver(reciever);
else
MEMBER_TYPE = 0;
end
logUI(params);
end
......@@ -187,9 +190,9 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo
end
local pay_params = tradeNo .. "," .. productId .. "," .. subject .. "," .. amount .. "," .. notificationURL .. "," .. peng_bo_shi_token;
logUI("ShopModel payCucc pay_params= "..pay_params);
local payInfo = ShopInfo.getPayInfoByProduct(productId);
logUI("ShopModel payCucc payInfo.id= "..payInfo.id);
logUI("ShopModel payCucc pay_params= " .. pay_params);
local payInfo = ShopInfo.getPayInfoByProduct(productId);
logUI("ShopModel payCucc payInfo.id= " .. payInfo.id);
if payInfo.id == 301 then
DeviceUtil.cycleBilling(pay_params, payCallbackFromJava);
else
......@@ -205,12 +208,13 @@ function ShopModel.payCucc(productId, productName, productPrice, callBack, timeo
gameid = gameid or 0;
gameid = tostring(gameid);
--local get_pay_id_url = string.gsub(GAME_LOGIN_URL, "login", "pay_get_id");
local get_pay_id_url = string.sub(GAME_LOGIN_URL, 1, -6).."pay_get_id"; --将后几位的login截取掉,并拼接上pay_get_id
-- local get_pay_id_url = string.gsub(GAME_LOGIN_URL, "login", "pay_get_id");
local get_pay_id_url = string.sub(GAME_LOGIN_URL, 1, -6) .. "pay_get_id";
-- 将后几位的login截取掉,并拼接上pay_get_id
if CHANNEL == "cucc" and cc.Application:getInstance():getTargetPlatform() == cc.PLATFORM_OS_ANDROID then
local paramsStr = "uid=" .. UserModel.getStringUID() .. "&product=" .. productId .. "&account=" .. UserModel.account .. "&gameid=" .. gameid;
--logUI("ShopModel sendHttpRequest------------------------------>");
logUI("ShopModel sendHttpRequest------------------------------>".."POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr);
-- logUI("ShopModel sendHttpRequest------------------------------>");
logUI("ShopModel sendHttpRequest------------------------------>" .. "POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr);
DeviceUtil.sendHttpRequest("POST," .. get_pay_id_url .. "," .. PROXY_HTTP_ADDR .. "," .. paramsStr, onGetPayIDSuccessFun);
else
HttpRequest:getInstance():post(get_pay_id_url, { uid = UserModel.getStringUID(), product = productId, account = UserModel.account, gameid = gameid }, onGetPayIDSuccessFun, onGetPayIDFaildFun);
......@@ -280,26 +284,29 @@ end
-- 上海电信支付
function ShopModel.payShdx(productId, productName, productPrice, callBack, timeoutCallBack, gameid)
--logD("支付类型---------------------------->"..MEMBER_TYPE);
local pay_params =productId .. "," .. productName .. "," .. productPrice;
--local payInfo = ShopInfo.getPayInfoByProduct(productId);
-- logD("支付类型---------------------------->"..MEMBER_TYPE);
local pay_params = productId .. "," .. productName .. "," .. productPrice;
-- local payInfo = ShopInfo.getPayInfoByProduct(productId);
local function callbackLua(params)
local arr = StringUtil.split(params,",");
--logUI("支付返回的信息:"..arr[1].."-----------orderId:"..arr[2].."-------------orderSn:"..arr[3]);
if arr[1] and arr[1] == "success" then --成功
local arr = StringUtil.split(params, ",");
-- logUI("支付返回的信息:"..arr[1].."-----------orderId:"..arr[2].."-------------orderSn:"..arr[3]);
if arr[1] and arr[1] == "success" then
-- 成功
if callBack then
callBack(params);
end
--Alert.showOne(strings.msg_3001);
-- Alert.showOne(strings.msg_3001);
elseif arr[1] and arr[1] == "cancel" then
MEMBER_TYPE=0;
Alert.showOne(strings.msg_3003); --取消
MEMBER_TYPE = 0;
Alert.showOne(strings.msg_3003);
-- 取消
else
MEMBER_TYPE=0;
Alert.showOne(strings.msg_3002); --失败
MEMBER_TYPE = 0;
Alert.showOne(strings.msg_3002);
-- 失败
end
--logUI(params);
-- logUI(params);
end
local function payCallbackFromJava(params)
......@@ -308,11 +315,11 @@ function ShopModel.payShdx(productId, productName, productPrice, callBack, timeo
end );
end
--if payInfo.id == 301 then
-- if payInfo.id == 301 then
-- DeviceUtil.cycleBilling(pay_params, payCallbackFromJava);
--else
DeviceUtil.sendBilling(pay_params, payCallbackFromJava);
--end
-- else
DeviceUtil.sendBilling(pay_params, payCallbackFromJava);
-- end
end
return ShopModel
\ No newline at end of file
......
......@@ -55,7 +55,7 @@ UserModel.new_chenghao_list = { };
UserModel.team_id = 0;
UserModel.pet_team = { };
UserModel.single_game_cnt = { }; --每天玩游戏的免费次数
UserModel.single_game_cnt = { }; -- 每天玩游戏的免费次数
local items = { };
local task_list = { };
......@@ -466,21 +466,31 @@ function UserModel.onConnectSuccess(params)
local function callbackLua(params)
logUI("天津鉴权返回数据: " .. params);
if params == "success" then
MEMBER_TYPE = 1;
MEMBER_TYPE = 301;
-- 初始化会员全局变量
SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 1 });
-- SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 1 });
SocketClient:getInstance():send("gateway_msg.login_msg",
{
platform = PLATFORM,
account = account,
session = session,
shanghai_dianxin_pay_id=301,
} );
else
-- 还不是会员,鉴权返回的productid保存再AppActivity中
SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 0 });
-- SocketClient:getInstance():send("gateway_msg.update_msg", { valid = 0 });
SocketClient:getInstance():send("gateway_msg.login_msg",
{
platform = PLATFORM,
account = account,
session = session,
-- shanghai_dianxin_pay_id=tonumber(arr[2]),
} );
end
end
SocketClient:getInstance():send("gateway_msg.login_msg",
{
platform = PLATFORM,
account = account,
session = session,
-- shanghai_dianxin_pay_id=tonumber(arr[2]),
} );
local vipList = ShopInfo.getVipList();
-- 续包月这里应该是server和content,但是配置表配反了
......@@ -610,11 +620,11 @@ function UserModel.onLoginSuccessFun(params)
return aa.val3 < bb.val3;
end );
--小游戏免费使用过的次数 key:小游戏id,v1:次数
-- 小游戏免费使用过的次数 key:小游戏id,v1:次数
logD("free num===================>"..#params.data.single_game_cnt);
logD("free num===================>" .. #params.data.single_game_cnt);
for i, v in ipairs(params.data.single_game_cnt) do
logD("free num-------------------->"..v.val1);
logD("free num-------------------->" .. v.val1);
UserModel.single_game_cnt[i] = { key = v.key, val1 = v.val1, val2 = v.val2, val3 = v.val3 };
end
......@@ -1044,8 +1054,8 @@ function UserModel.getLeftVipDay()
end
end
--302
if CHANNEL=="shdx" then
-- 302
if CHANNEL == "shdx" then
local vipInfo4 = vipList[4];
if vipInfo4 then
local data4 = UserModel.getVipByID(vipInfo4.id);
......@@ -1055,13 +1065,13 @@ function UserModel.getLeftVipDay()
day4 = 9999;
end
left_day_num = math.max(left_day_num, day4);
-- 理论上这里是续包月,应该通过鉴权判断是否是VIP
left_day_num = math.max(left_day_num, day4);
-- 理论上这里是续包月,应该通过鉴权判断是否是VIP
end
end
end
if CHANNEL == "gzdt" or CHANNEL=="sxyd" then
if CHANNEL == "gzdt" or CHANNEL == "sxyd" then
-- 大唐版本所有的用户都是VIP
left_day_num = 100;
end
......
......@@ -20,6 +20,7 @@ end
function MainScene:onCreate(params)
logD("enter MainScene----------------------------->");
--cc.Director:getInstance():setDisplayStats(true); --显示FPS等调试信息
self.keypadManager = KeypadManager:create(self);
self.ui = cc.CSLoader:createNode("ui/MainScene.csb");
......
......@@ -147,6 +147,7 @@ function XyxPayView:onPayCallBack(params)
self:close();
LoadingManager.removeDataLoading();
if self.onPaySuccess then
cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧
self.onPaySuccess();
end
end)));
......
......@@ -163,6 +163,7 @@ function XyxPayView:onPayCallBack(params)
self:close();
LoadingManager.removeDataLoading();
if self.onPaySuccess then
cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧
self.onPaySuccess(); --各个游戏GameScene中启动游戏的回调
else --从活动跳过去的在跳回去(打补丁,焦点框跳转的有问题)
local reciever = require("app.views.view.ActivityView"):show();
......
......@@ -130,22 +130,31 @@ function XyxPayView:onBuyClick(ref,event)
self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP);
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever);--]]
local vipList = ShopInfo.getVipList();
MEMBER_TYPE=vipList[3].id;
local shopInfo = ShopInfo.getPayInfo(vipList[3].id);
ShopModel.pay(shopInfo.product, shopInfo.name, shopInfo.costList[1].num);
ShopModel.pay(shopInfo.product, shopInfo.name, shopInfo.costList[1].num,handler(self,self.onPayCallBack));
end
function XyxPayView:onPayCallBack(params)
logUI("XyxpayView_tianjin_cucc--------->"..params);
if params == "success" then
SocketClient:getInstance():send("gateway_msg.shanghai_dianxin_pay_msg",
{
shanghai_dianxin_pay_id = MEMBER_TYPE,
order_number=0,
order_number=0,
} );
if not TableUtil.IsInTable(UserModel.free_game_id,self.game_id) then
table.insert(UserModel.free_game_id,self.game_id);
end
LoadingManager.showDataLoading();
self:runAction(cc.Sequence:create(cc.DelayTime:create(1),cc.CallFunc:create(function ()
self:close();
LoadingManager.removeDataLoading();
if self.onPaySuccess then
cc.Director:getInstance():setAnimationInterval(1/60); --进入游戏将帧率恢复为60帧
self.onPaySuccess();
end
end)));
......
local XyxPayView = dialog.uinode("ui/xyx/tianjin_cucc/XyxPayLayer.csb",import("../BaseViewNew"))
-- 天津联通,需要续包月功能
local _index = 1;
function XyxPayView:ctor()
XyxPayView.super.ctor(self);
end
function XyxPayView:show(game_id,onPaySuccessFun)
self.game_id = game_id;
self.onPaySuccess = onPaySuccessFun;
local scene = cc.Director:getInstance():getRunningScene()
local inst = XyxPayView:create();
scene:addChild(inst, dialog.ZORDER_POP);
inst:setContentSize(cc.size(display.width,display.height));
ccui.Helper:doLayout(inst);
inst.scrollView = inst:getChildByName("ScrollView");
inst.layer = cc.Layer:create();
inst:addChild(inst.layer,1);
--registerScriptTouchEvent(inst.layer,handler(inst,inst.onTouchBegin),handler(inst,inst.onTouchMove),handler(inst,inst.onTouchEnd));
inst:init();
return inst;
end
function XyxPayView:init()
cc.Director:getInstance():setAnimationInterval(1/30);
self.panel = self:getChildByName("panel");
self.btn_close = self.panel:getChildByName("btn_close");
self.btn_close.fn = handler(self,self.onClose);
self.btn_close:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_close.fn)end);
self.btn_buy = self.panel:getChildByName("btn_buy");
self.btn_buy.fn = handler(self,self.onBuyClick);
self.btn_buy:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_buy.fn)end);
--[[self.btn_vip_month = self.panel:getChildByName("btn_vip_month");
self.btn_vip_month.fn = handler(self,self.onMonthVipClick);
self.btn_vip_month:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_vip_month.fn)end);
self.btn_vip_year = self.panel:getChildByName("btn_vip_year");
self.btn_vip_year.fn = handler(self,self.onYearVipClick);
self.btn_vip_year:addTouchEventListener(function(ref,type) self:onButtonClick(ref,type,self.btn_vip_year.fn)end);--]]
local game_info = SingleGameInfo.get_game_info(self.game_id);
self.panel:getChildByName("txt_name"):setString(game_info.name);
local icon_url = "res/ui/xyx/xyx_"..self.game_id..".png";
print("sssssssss",icon_url)
if cc.FileUtils:getInstance():isFileExist(icon_url) then
self.panel:getChildByName("img"):setSpriteFrame(cc.Sprite:create(icon_url):getSpriteFrame());
end
local vipList = ShopInfo.getVipList();
--self.panel:getChildByName("txt_month"):setString(vipList[1].rmb.."元");
--self.panel:getChildByName("txt_year"):setString(vipList[2].rmb.."元");
local game_info = SingleGameInfo.get_game_info(self.game_id);
-- local shopInfo = ShopInfo.getPayInfo(game_info.payid);
self.panel:getChildByName("txt_price"):setString(game_info.diamond.."钻石");
--self.nodes[#self.nodes+1] = {self.btn_close};
self.nodes[#self.nodes+1] = {self.btn_buy,self.btn_close};
self:updateSelectedState(self.btn_buy);
EventListener.addEventListener(self,EnumEvent.UPDATE_DIAMOND,handler(self,self.onDiamondUpdate));
end
function XyxPayView:onDiamondUpdate(params)
if UserModel.getDiamond() > 0 then
if self.shop_reciever then
self.shop_reciever:close();
self.shop_reciever = nil;
end
self:runAction(cc.Sequence:create(cc.DelayTime:create(0.3),cc.CallFunc:create(function ()
self:close();
if self.onPaySuccess then
self.onPaySuccess();
end
end)));
end
end
function XyxPayView:onTouchBegin(event)
self.begin_touch_pos = self.layer:getParent():convertToWorldSpace(event:getLocation());
self.isMoved = false;
return true;
end
function XyxPayView:onTouchMove(event)
local move_touch_pos = self.layer:getParent():convertToWorldSpace(event:getLocation());
local _distance = Point.distance(self.begin_touch_pos,move_touch_pos);
if _distance > 5 then
self.isMoved = true;
end
end
function XyxPayView:onTouchEnd(event)
local p = self.layer:convertToWorldSpace(event:getLocation());
end
function XyxPayView:onMonthVipClick(ref,event)
local vipList = ShopInfo.getVipList();
local shopInfo = ShopInfo.getPayInfo(vipList[1].id);
ShopModel.pay(shopInfo.product,shopInfo.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack));
end
function XyxPayView:onYearVipClick(ref,event)
local vipList = ShopInfo.getVipList();
local shopInfo = ShopInfo.getPayInfo(vipList[2].id);
ShopModel.pay(shopInfo.product,shopInfo.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack));
end
function XyxPayView:onBuyClick(ref,event)
-- local game_info = SingleGameInfo.get_game_info(self.game_id);
-- local shopInfo = ShopInfo.getPayInfo(game_info.payid);
-- ShopModel.pay(shopInfo.product,"购买"..game_info.name,shopInfo.costList[1].num,handler(self,self.onPayCallBack),nil,self.game_id);
--self.shop_reciever = require("app.views.view.ShopView"):show(6);
--self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP);
--cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever);
self.shop_reciever = require("app.views.view.ActivityView"):show("ActivityVipView");
self.shop_reciever:setLocalZOrder(dialog.ZORDER_POP);
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(self.shop_reciever);
-- self:onPayCallBack("success");
end
function XyxPayView:onPayCallBack(params)
if params == "success" then
if not TableUtil.IsInTable(UserModel.free_game_id,self.game_id) then
table.insert(UserModel.free_game_id,self.game_id);
end
LoadingManager.showDataLoading();
self:runAction(cc.Sequence:create(cc.DelayTime:create(1),cc.CallFunc:create(function ()
self:close();
LoadingManager.removeDataLoading();
if self.onPaySuccess then
self.onPaySuccess();
end
end)));
end
logUI("小游戏支付返回:"..params);
end
function XyxPayView:onClose()
self:close();
end
--返回键处理函数
function XyxPayView:onKeypadBack()
self:close();
end
--确认键处理函数
function XyxPayView:onKeypadOk()
if self.selected_node and self.selected_node.fn then
self.selected_node.fn();
end
end
--上键处理函数
function XyxPayView:onKeypadUp()
XyxPayView.super.onKeypadUp(self,false,true,false,false);
end
--下键处理函数
function XyxPayView:onKeypadDown()
XyxPayView.super.onKeypadDown(self,false,true,false,false);
end
--左键处理函数
function XyxPayView:onKeypadLeft()
XyxPayView.super.onKeypadLeft(self,false,true,false,true,false);
end
--右键处理函数
function XyxPayView:onKeypadRight()
XyxPayView.super.onKeypadRight(self,false,true,false,true,false);
end
return XyxPayView
\ No newline at end of file
......@@ -51,7 +51,6 @@
<Folder Include="src\app\views\scene\" />
<Folder Include="src\app\views\shuyishu\" />
<Folder Include="src\app\views\view\" />
<Folder Include="src\app\views\view\tianjin_cucc\" />
<Folder Include="src\cocos\" />
<Folder Include="src\cocos\3d\" />
<Folder Include="src\cocos\cocos2d\" />
......@@ -272,7 +271,6 @@
<Compile Include="src\app\views\view\PetTeamEditView.lua" />
<Compile Include="src\app\views\view\PetTeamListView.lua" />
<Compile Include="src\app\views\view\ActivityVipView_tianjin_cucc.lua" />
<Compile Include="src\app\views\view\tianjin_cucc\XyxPayView.lua" />
<Compile Include="src\app\views\view\UserInfoOtherView.lua" />
<Compile Include="src\app\views\view\XyxPkResultView.lua" />
<Compile Include="src\app\views\view\FriendRecommendView.lua" />
......