var Global = require("Global"); var MakeLoginXieYi = require("MakeLoginXieYi"); var ProtocolLoginServer = require("ProtocolLoginServer"); var popScence = require("popScence"); var UIHelper = require("UIHelper"); var LanguageKey = require("LanguageKey"); var WebView = require("WebView"); window.HomeStaticFunc = cc.Class({ extends: cc.Component, properties: { }, statics:{ //回到前台 applicationWillEnterForeground: function() { Global.print("HomeStaticFunc applicationWillEnterForeground::"); cc.audioEngine.resumeAll(); if (cc.find("Canvas")) { var homeStartJS = cc.vv.GetHallScript(); if (homeStartJS) { //VIP充值后回到游戏,刷新界面 if(homeStartJS._VIP && homeStartJS._VIP.active) { UIHelper.showWaitNode("reqServer", ""); homeStartJS._VIP.runAction(cc.sequence(cc.delayTime(2), cc.callFunc(function() { homeStartJS._VIP.getComponent("homeVIP").reqVipInfo(true, true); }))); } if (homeStartJS._kaijiang && homeStartJS._kaijiang.active) { //开奖直接购买回调查询 homeStartJS._kaijiang.getChildByName("rootNode").getChildByName("plane_list").getChildByName("plane1").getComponent("tradePlane").checkPayResult(); } //homeStartJS.checkKanJiaCode() } } }, //监听安卓返回键事件 onKeyBack: function() { Global.print("homeStaticFunc_onKeyDown") if(cc.sys.os == cc.sys.OS_ANDROID && cc.sys.isNative){ if(WebView && WebView.isActive()){ WebView.close(); Global.print("homeStaticFunc_onKeyDown WebView.close"); return; } var Ok = function() { cc.game.end(); }; popScence.initPopScence(LanguageKey.PopScence.rootNode_tip_label0, null, Ok, function(){}); } }, //TODO 苹果支付验证 //需要将此信息传给服务端进行支付成功的验证 AppPayCheckReceipt: function(receipt) { var OrderID = Global.getLocalStorageVaule("OrderID", "0"); var orderData = ProtocolLoginServer.CMD_GP_SendIOSVerify.data(); orderData.UserID = cc.vv.globalUserInfo.getUserID(); orderData.OrderID = parseInt(OrderID); orderData.verifyKey = receipt; var dataOrder= MakeLoginXieYi.makeSendIOSVerify(orderData); var homeStartNode = cc.vv.GetHallScript(); if (homeStartNode) { homeStartNode.sendDataByMainSub(ProtocolLoginServer.MDM_GP_USER_SERVICE, ProtocolLoginServer.SUB_GP_SEND_IOS_VERIFY, dataOrder); } } } }); module.exports = HomeStaticFunc;