commonH5SDK.js
2.46 KB
import commonH5Proxy from"./commonH5Proxy.js";import commonH5Utils from"./commonH5Utils.js";window.commonH5SDK={sdk_isShowLog:!1,code:{INIT_SUCCESS:1,INIT_FAIL:-1,LOGIN_SUCCESS:10,LOGIN_FAIL:-10,LOGOUT_SUCCESS:100,LOGOUT_FAIL:-100,SWITCH_SUCCESS:1e3,SWITCH_FAIL:-1e3,PAY_SUCCESS:2,PAY_FAIL:-2,PAY_CANCEL:-3,EXIT_SUCCESS:4,EXIT_CANCEL:-4},type:{arriveServerSelectPage:1,createRole:2,enterGame:3,upRoleLevel:4,arriveEntrance:5,enterServer:6,arriveFirstScene:7,arriveLoadingFinish:8,arriveLoadingZero:9,arriveCreateRolePage:10,newcomerFinish:11,checkpointStart:12,checkpointEnd:13,selectRole:14,renameRole:15,newcomerStart:16},expansion_type:{gameSetting:100,downloadMicroClent:101,share:102,focus:103,save2Desktop:104,realVerify:105,back2Game:106,bindPhone:107,msgSecCheck:108,checkBalance:109,showAd:110,score:111,kefu:112,queryProductsInfo:113,userCenter:114,eventTrack:115,realNameVerify:116,mulShare:117,blueVip:118,blueVipBuy:119,whatsNewSubscriptionsSetting:120,subscribeWhatsNew:121,firstEnterGameScene:122,msgSubscribe:123},callback:{},h5Proxy:"",init:function(n,t){this.callback=t;var i=this,r={onCheckConfigSuccess:function(){i.h5Proxy=new commonH5Proxy;i.h5Proxy.init({});i.h5Proxy.hasInit||t(commonH5SDK.code.INIT_SUCCESS,"初始化成功")},onCheckConfigFail:function(){console.log("onCheckConfigFail");i.callback(i.code.INIT_FAIL,"初始化错误")}};commonH5Utils.getInstance().configCheck(n,r)},login:function(n){commonH5Utils.getInstance().submitInfo("event:openSDKLogin",null);this.h5Proxy.loginExt=n;this.h5Proxy.login(n)},pay:function(n){this.h5Proxy.createOrder(n)},hasLogout:function(){return this.h5Proxy.hasLogout},logout:function(){this.h5Proxy.logout()},hasSwitchAccount:function(){return this.h5Proxy.hasSwitchAccount},switchAccount:function(){return this.h5Proxy.switchAccount()},hasShowExitDialog:function(){return this.h5Proxy.hasExitDialog},showExitDialog:function(){this.h5Proxy.showExitDialog()},exitGame:function(){this.h5Proxy.exitGame()},submitData:function(n,t){console.log("submitData type:"+n);switch(n){case this.type.enterGame:commonH5Utils.getInstance().submitInfo("enter",t)}this.h5Proxy.submitData(n,t)},getParamValueByKey:function(n){return commonH5Utils.getInstance().sdkInfo[n]},expansionInterface:function(n,t,i){this.h5Proxy.expansionInterface(n,t,i)},statistics:function(n,t){var i={onStatisticsSuccess:function(){t.onStatisticsSuccess()},onStatisticsFail:function(){t.onStatisticsFail()}};commonH5Utils.getInstance().statistics(n,i)}};module{}.exports=window.commonH5SDK