首页
社区
课程
招聘
[原创]Lua脚本反编译入门之一
发表于: 2014-4-12 23:20 86676

[原创]Lua脚本反编译入门之一

2014-4-12 23:20
86676
收藏
免费 7
支持
分享
最新回复 (53)
雪    币: 14
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
26
mark 学习
2014-4-21 23:50
0
雪    币: 2673
活跃值: (2947)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
27
期待..
2014-4-24 15:41
0
雪    币: 38
活跃值: (1308)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
28
关注,现在越来越多的lua都被编译成字节码了
2014-6-3 17:20
0
雪    币: 271
活跃值: (196)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
29
关注一下
2014-6-4 11:03
0
雪    币: 27
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
30
好激动。。。。。
2014-6-27 15:09
0
雪    币: 27
活跃值: (90)
能力值: ( LV8,RANK:120 )
在线值:
发帖
回帖
粉丝
31
很精彩的
2014-6-27 15:44
0
雪    币: 27
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
32
已经学会反编译了,so easy,特来感谢楼主
2014-7-2 16:55
0
雪    币: 18
活跃值: (24)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
33
mark一下。
2014-7-2 17:01
0
雪    币: 203
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
34
这个比较牛,可惜看不懂.
2014-7-4 15:50
0
雪    币: 373
活跃值: (496)
能力值: ( LV7,RANK:110 )
在线值:
发帖
回帖
粉丝
35
哎,我老是写一点东西,老是半途而废。各位抱歉了
2014-7-7 15:46
0
雪    币: 406
活跃值: (415)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
36
别夭折了啊,  还期待下文呢
2014-7-7 16:35
0
雪    币: 1
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
37
可以教我如果看lua的源码不.我好想学习.
2014-7-22 14:38
0
雪    币: 100
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
38
lua源码阅读http://www.codingnow.com/download/readinglua.pdf
另外,楼主可否在详细介绍下指令纠正部分。多谢
2014-8-2 14:52
0
雪    币: 79
活跃值: (373)
能力值: ( LV11,RANK:195 )
在线值:
发帖
回帖
粉丝
39
加密lua怎么弄?
2014-8-2 15:59
0
雪    币: 79
活跃值: (373)
能力值: ( LV11,RANK:195 )
在线值:
发帖
回帖
粉丝
40
-- Filen醡t: P,apfkrl.|uQ
i-AttyoD:f錸v
-D錿?121s-49)23
=-P1rDore+ 薤佹圂粐绂╜?宓勄惼褰翅彵鐙刚咓婧ヤ彶
<-         l皰铻曊???鏄甫垕鍕戜笓妲冬瘧ldvtl涌¢%货笅0
巑飀dlE(bPhapfnr}" 4aWk`gt.EeAa鑜8
;rWq駃騟1"Sc2itt+uh/|oWi*/gesvtrziWt?l^cSl餴u

-`g[dabtgOm_d!          urde<_@e鎢v U_鄀鈛v_Mo$e_ms@p`SDo6e=!fplEe._韘KYiSVk?爁plSeJlkcel!pboDo'oX
moraZ Ja閑1=n[l?埢蓹棋攷炜曞嫗讱犁牗鐖︿墶聛+
bdZL]g韓蒼wo =`nml-, |oSa( Woofxg=n韑
Wu\c餴飊1iSP,apfkrl(0..d)> !rttCrJ 芓DtXlg醫衛BtAt5s,)eod
Vu*c@inn1iEATp譼~rT(.??   `ratqro OiCA4pgtnrt
Sn@
鈛cEi]n骦HXsd+($.*.!)  drQttr iiWZ軽BdZ
Wn?奻dnCt)oj ms[YHSTkl ./ 8
  鰁euCn_韘赮ISDkJejd
gu~cDi+nirDtbCg ?? 
 ?騟euRn`_`efuf
unT
NfAnbtxoX Ce餝uk .??1 IfhiwPhaufr](m         =!fplEe
t靍
  鰁魎cn* `ejd !rutEr* Drnt~cYl.e阣fDnQt韔?veTC/nbic(!.>.)N rdtdrX Go阥xg;e\d?鎢cTi/n$gatQlqtVo6mrl`g9 .
?1 Xfi鱌靉efOr-(- 9=!fqlCemt\eo
1  Ve饀cn"Pa鎒靦xmE"J $ejd 0rUt1rZ qr~tYcKl綾pl]SFr韓鏔dnCW)tlPer`m8"We0PXauf~r[NEm?=nXl
醤?<- 迦濁鍗桋箖逅坝浌鍞砮Do
鈛cEi]n頸eSdKh) $ig(ys`l%tRosm9)= 鈇}sT)Fh醤?1  r%qqive!"ccBi4tcnnwiQ/Go阥xgndWb駁?1   2epuvn 0e^dN psoeoUoH ?AlDg[n蒩頰veR:'epIjsua~cU(m:Xo`dAlCgMn?  r醙閟eeRC2awhLaod|eB(m
 moraZ Tl錿woCm|a閑?1pRo4ogoh:ba|lct6iZgGucaiPh詀ca\(g醫衛ptFo2mJaie#,~i\)N psit"Tl錿woCm|a閑爄b" p,apfkrlNqmU)
 hf9pZaPf雛|NPmW ??XOs_y1&)phdn  drQqtice"Wc鰅atc]n鈏?roNf)g[95" 0e\s!iR(qlptPoVm蔭|e= 蟂NPp"itlej
! 0 Be5u]rd 3sUrMp?ro_f[g玞飊wiG_P&
$ ! =-謮族垁鋮斿都. ?1l^cSl閏e  C@igtho~aBy~cFe`tt(
 ?uiRts醫蟗{eCthCGSprhnw:Sr!a@e)18,iWO鬳RTcZa鰃?8
  ` trktncl
c%lXOBFdnUtMo闣xtYNSm醎飊tPAr!m[nkB`c{(s!t}sNptndeGh錼ve,Vi鐃?1 El3emf,pmadf_r)NUmd ,="mO譥AP"t靍?1   2euumrd 2sSr-p@/bof_g c雗wiV_bP??1  -m鎹撫紒鍟呎€? ! }oUaH 鄆rt=C荄閏eiOn!r}:grdade)N  !dxcB:We餙sjTcF(荂觮ciNgzcveetd(!)"-s{pdnCeUhEr鉫3);  騩eoCo,:gahlNCVu^c0i[nViehxaIe踥eaa@a開頾SaCkh"wepIrO`e^R!c\asgt"dMc? e^s醝?alAt&ovmJale0=
fI{S^PVY)Ph醤  r醧鮥ce "3cvitt.cnVi#/WoofxgiPcY?1  -b?瀛€艆佩劶 ! 0l_c%ldhce gC纈rtXo\a鰕篶ceAt%(-
$ ! tiSt~sQtNb{eUt C荢erXnU:鐁錫ee1i,&iwOqe~RUc,aFgd"8
  魊~t^c]l綾醠}OcF5ngtmooWytXN%mQ_nntPWrEm踤~BPcY(錿Xsop%nVegh`rwe, iWt(
1 SlWe韋9p]aFf雛鞱pmE }=$"MOR_DBd"mt\eo
1  Ve鮱xrT s鐁閜e/Co.fmg+cnnviW_B`" 1eZsAi?alPtTo鰉蝍|e =} &IKS^IDOL"tie
  鰁`uXrW 鉹xpT/#ojfmg.cnVi#_]tno}s
 醠beXfp鑑鬴~rMN!ma 9=!"YOc_PdSUOCE)t靍
  鰁駏xrE bsgrmpu/so^f-gcnnwiQ_Ep鬺t";  閟PpPS4ove$=!tbuU
d QlrexfpHa餱~r\NSm??1"iO_OUEIXO^G)0hQn 1 rAq駃ce"Ac鰅餿>cOn&ic/goofygok1a]ynnv"< e鑣tiW(Bl錿鎜cmna-e$=9 #I_SoDNsLD"8t^eJ
?1 CeCu韗?3sCr)pp/goofygc+nRif_xoE_@a阦}e
 ??tlSe)f,phaufr]N%mQ <=1"wn@r雐u_6"璽鑕
  ` veuuhru s'r]pu/roXfMg玞~nWiU_??  e,saib(qlqtVo6mzale1= A阣coXdm9?﹖yeN
` $ vepuyrU fsWrhpe/UoJf韌>c^nTi鉥?PnDr/i`" !e|sUi"(Dl`twoDmja閑1= A阣騩xdu#"- phdn  drQqtice"Wc鰅atc]n鈏?roNf)g[ug" 0e\s!iR(qlptPoVm蔭|e= 頳coIdkc"- uhun: d rdqdiDe"鱟ciAtc雗鎖v/Co.fmg[ktgu
d QlrexfpHa餱~r\NSm??1"an$rki`_el2)t,eZ
! 1 DeUu韗t sQr韕?roNf)g+ckngiw_Ta*gXe#
1 SlWe韋9p]aFf雛鞱pmE }=$"EneriT_ k)!tyeX
 ?ce@u[r?rrIp4/gojfhg?c_n"iS_eu~kC". }sTiT(鬺醫woRmaie$=< 2A^d6o]d^wuj)Ph醤  r醧鮥ce "3cvitt.cnVi#/WoofxgiwEn鄌djXa
?錶beIfhphapfnr}NQm!         =!"PnRrKi郷{f)Fh醤?1  r%qqive!"ccBi4tcnnwiQ/Go阥xgnj[f醤?  e,saib(qlqtVo6mzale1= A阣coXdm3硍醤3) t(ej
$ ! beAu-rQ #srr_pP/鏾fXgc雗鎖v_77aj" !e|sUi"(Dl`twoDmja閑1= A阣騩xdx-"- phdn  drQqtice"Wc鰅atc]n鈏?roNf)g[xmanmy": deXsdiw(FlEt鈕cma_e??3ANd2omd[a{"9 Dh!n> ! 1rSqQi鰁1"Bc@i魌痗~nFi'/gojfhgOa^z,i
! tlEeMf琾}aEf]r镹醡t =`"MOW_{yh" 0hQn 1 _Ms轞ISUk=騯t
  ` veuuhru "7cFiqt>cYnBi?ro_f[g??alAt&ovmJale9
 !lGehf9pZaPf雛|NPmW ??PnDr/i`_~yy"9 Dh!n> ! 1__s~Y躍uk=t鰑?1   2euumrd 8"Cc6iDt.c~nPiC/鏾fXgm"?餷ptFo2mJaie(
0 Ul7e> ! 1rSqQi鰁1(sQr韕?roNf)g+ckngiw_.jpXauf~r[NEm? e\d??xfp,apfkrlNqmU y="@nurYi@_鍅3)tZe??1 Lo#ah `ibt0=CD]cui~nWr]:鐁taEe)??1dIc4:wepOcjucD(Cgtsig cVe錿t(Ro\f韌甮ttap0I`(-)-"qp@I "
! 1 RiGt緎tt~bXe鐃–RSTr)nc:grdadec+nRif.veBATp蟚h()"錺餕ty)J $ $psodoSo(:Waml^CpuJc餴~nfiFh蔭韊NoNeavai_ooRaSkl"]nhtxaZi^e?uiRt
??ceTu2n $eod i"(Dl`twoDmja閑1= A阣騩xdy/uii& nr0p\a0f[rlNpmS =?XOb_Za韒?8 Th%n $ !lcQldd]cu , uC`i鐃xo_a@y綾騟ptE(i
$ $ eist
s!t{bkertCgS餽xnV:Qr醓鬳9cOn&ic.ceuA`pydl),#aapd)?1 d[c?骵eOBj%cp(GCRtbi^g~cFe`tt(UoJf韌?gTtsp鬕鍄9)        ,batpOex"9
 d Drnt~cYlc錶}OrFGn鐃閛WIt(Nema_nnuPQr%mknnBpc](i阨eiPl[z?琩xcT)J $ $rdter^
d Qne 1
 Mf琻~tiAD醔鮣9)        t(ej
$ ! `r_t+c[l;sttwpTI?ro_f[g猤錿PpPI$(-) ! 0pBo0oWom:beBATp蟚h(Ro\f韌甮ttap0Kay,)(
0  4r[tnc~l iJi餴plXzW(??tlSeJ $ $psodoSo(:GeuAapd c雗wiV.Ue餉餻Xdd%bqg,)(
0  4r[tnc~l sAt舙aKTyc雗鎖v.Ge4AtpOex_teRu#() 1 pVo餺ro]:[n韙閍}iZeh) $eod
 i-褠洦邩栨6夰繂
 錸鬷PdDi#tmojSbhudEl!(
! xfpHa餱~r\NSm??1"Io3_ol`nx"9 Dh!n> ! 1  f闍uSYoE(??tnD
` ejd
vu^c0i[n!gttflja閑9 . ??xf p2opogom -=n-ltie
  鰁euCn"餰髏3
  %n`
$ mosa\ *aYe!=1pDoPo鏾}:Ra^l譼騣gfu.cSiphQaba](fgQtQlptPoVm蔭|e,\i??1iF .aie$=< 2ISTvT# ehSn. ?1rTtGr?stPh/na" !e|sUi" Zale1= I薙NAaPaT薘?1tHe.
$ $ seduBnd"UpqseoDe
?tlBe[f醡t =`"MOW_812 Dh!n> ! 1rStQr?39 pZo阤?1 El3emf$n`mu
=d"}OR_AP Ph醤  r醫鮮 p0ploje#
0 Ul7e]f!npmS =?XOb_bP?爐yeN
` $ veuubn"4ppioe
 醠beXfn錷?,= "        OW_MTNO\S 0hQn 1 rAt駌 iFo雔髉yoNeb
$ alreyfn%mQ <=1"Ow_繟_G}E 餳錸   `ratqro 2d\p,oZe#
1 SlWe韋1nPmW ??XOs_ UEI]OOG2 Dh!n> ! 1rStQr?3kHpZo阤?1 El3emf$n`mu
=d"}OR_AGo"t靍
  鰁魎cn "0g}plooe2
 !lGe -< 訙岃;欞甯犲n鋜~iD缵勧狗鍘磅惤玢? ! 1rStQr?ro_f[g猤錿WlAgh) $eode^dN
-!璁浻厑?垎鋳璦?
wuNc4ikn$eotures!rweottr). w(Xsbl錿鎜cm)`=9 bamsu)Dh!n> ! 1- 碌杈曎嚇?╢柤鍦€烘姤鋳忚辰N  !rtqCiVe?bcCiBt玭錿foRkoNatsosk2
 d zeuw~r].Vp?wu_cFi雗?1..`) $ !-= Ro y> ! 1eXd beC.Ql雜錗t" buwev.blsUM!" oi},tVu?
  鰁魎cn* `ejd
! yfP(a@fnr|.QePC駌ce_tbl錿鎜cm)`=9 oPmadf_r)_upqSeoDe
餳tn;  ??ceQu)ra &sbrypD/1ithp>AZeVt衖a";  ??PlEr4Tmp*siogA\e6tGdt]oUaHiBtCi\g苰?zeY_r774&)- ~i\)N  !P}aBfKr閁ei]:]p醤誶}(h4tt:+/rg>zEi=oAxh.ro[/)?1 rWt駌?1 En$

$ hf8P\a0f[rl.veBCQr鰁talSt鈕騧9) =} oPhaufr]_pDSuoce<  c alSt鈕騧?gEtuvranuP|aDf+rY(( ,=ktl錿woCmmc靧雘g* ` $ov QlqtVo6mgdtRuDrAn餚}aEf]r??,= kletbosmOcXu/oZg^di
  雛1P]aFf雛?veTC5rvejtQlqtVo6m)!=, ]PHa餱~r\_Qh駅飊v_LtJ $ $os @lQt"oFm/gttuuVr醤eP]aFf雛?8 =`kTletgobmoc,u_oogNyRm. ?1oC bl錿鎜cmg%tGuvrdndP\a0f[rl(8 =k詌ptWo@m踓鑥zoNgy`g ! 0oB lUtgocmgAt莡crTnFP鑑鬴~rM(i 9=$kQlqtVo6mkldn~vY
 ?~rP^a餱飏|.Ge4Cqrveot@lQt"oFm))1= OP鑑ef^r__鑕頾gopu3h $ !ob `l%tRosm?gStgu鰎tnEP^a餱飏|(         }=$kTl`tvoBmxAnmex
  雛1P]aFf雛?veTC5rvejtQlqtVo6m)!=, ]PHa餱~r\_Di騩?1  o2 Tletgobmg!twusrtnBPHa餱~r\( ?爇AlAt&ovm[3f
0  +rPmaefYrI.鉫eCDr@e阾衛ptFo2m,)$=< {P\a0f[rl_apBv. ?1oC bl錿鎜cmg%tGuvrdndP\a0f[rl(8 =k詌ptWo@m踓鑑~hAo7aj)$tie~
 d FepuxrS s鐁xpE/Gi玹閜>ALe2tPit" 0 A(eFtUia.EhKw舕trE(?俧溁鍦€?( oi|): d rdtdrX
 醤u
 Br雝颿~le.tarTl`tvoBml0
ed<
        -ゅ灃跃ュ=砮彙缁弗叿鍞嶄瓏
Vu*c@inn1gSttl錿woCm|a閑??. i
$ mf)icP\a0f[rl(8 =f錶betZe??1 Re4uvn$"绲涜煏牳欏緝3
 An?1 CeFu鰊燾~nFi'.cepN`mu(
!nP
fdnUtMo?veEP^a餱飏|URlaie, /.> 
d ]f!pcoBoGo?ehTn8 ?爎ttUr. trktncl
c%lXSurxnQFQn鏦xtYPSr錷?veTP,apfkrlNqmU"hn]l(
1 SlWe?1 rWt駌?3tEs4" $eode^dN
RuoceiYni鱈~gXn ??8
  )f,iwPmadf_r)( <=1fWlWe璽ye_
 ?騟euRnJ $ejd 0rUt1rZ qr~tYcKl緄bL^g[n?奺d*
lkgmnCasksa(l=!nxl<fQn鐃xo_ @e鉯髏trlo'ijHenelurC(d..!) PHa餱~r\.@e鉯髏trlo'ijSgrhpdHQn lQr)fdnUtMo?9 UiQt??1  r%qqive!"ccBi4tuui}sLQa裻xl
 ??arIn4_p(&lngynb%c_"-dxcB). ?1 l]c錶爈~gInteta < do^u)bQr)dxcB.Wt錿t);  ?爈~cAl`saswinnOiT y Pibt?s_d. ?1pCi\t?靜viNS4ape$=#,|oWi*S@aue="EeWs韔_Xd"╯錽biOni`) ! 0pBi*ttxpt(ZoCi闟eaEe)??1pRi.t,"hofi~SDa0e=# ?.lKg韓BtPtW)??1iF(,ocijSuade=y )!tyeX
 ?1  Br韓?3pLa4fkri rd{ 讬榄嗙垇寮?)?1   騣tb(b.*.*./.>..j../.?PZaPf雛|.VeFP韉聐BeSs)ojI`./.>..j../.?..
.? "
 ??1 pl!tbovm/stk|o#iZIof~=RiGt?1   靉efOr-.cepPhdRyce7s]ooIu(EeWs韔_Xd
??1   letbosm>sXo3T[omBpr). ?1e]sW
??1 Pr)np(&鐦基櫠遴避搐"8
  ?ceEu@n??1 En$
$ ane)e^dN
-鏅瘑.f駈rtXo\ 鑟鏸( l/gmnFabkSa\ld)> !_}oQiJB錭zCPl^ ?靜viNB!coCelm
0 @r-n@(#stt_Ho鉯BPcYC錶?=_Lo'ijBecjCql\)N  !rtg_sPe鯨~gXnza阣靍cs)J
$ $ hf8iCP(a@fnr|( =plBet靍?1   ` vepusn  deZd 1 pVi阾9"AlSt鈕騧," P,apfkrl.weDC1rFeotAlWtBo鰉9))8 ?爄w(pl!tbovm/gutsu6rQnuP}aBfKr?8 =k詌醫woRmAtpWtnru _rdiGZXXBd](
)ye_
 ??1 Pr)np(&lngyns0a@e<"=PZaPf雛|.VeFC雗鎖v(        .'epLkghnCtQt!()
1   ?xfP^a餱飏|.Ge4Cknbif(9.We0L[ghnBtWtA(?,=P^a餱飏|.Ge4Cknbif(9.[L+g]nrSeaBejo餖~gXnt靍?1   ` $ $ ! beAu-rQ #srr_pP/駃>tXpA鑕騮EiP"J $ $ ! 0  dAXestEiF.Wh雡PlTrF(胑鬖~cAl)zaSprhnwBI(fkQy^1"9"
,xl
8 ??1   ` $raqtibe"7cFiqt>u_/Ho鉯/ppBL雊閚]aYe2" $ ! 0  d Aqp]oQiJL鍄trc@e錿錖~gIn a}ev((;  d  ! 1 rAt駌
  ??tlSe)f,Phaufr].#e@CnnwiQ(
.鉫eL^g[n譼醫t(         }=$Phaufr].#e@CnnwiQ(
.風~gXnAS餫鬳DDiD ocij)uhun: d  ! 1  -?ce@u[r?rrIp4/qi+lngynA4pxofiLWyAr?1   ??1
-`lkcel!uceBn%mQ < RCcsAr纄waDlF:鱤醨tdus%r@ebatld(:#e@SurxnQFKr蟚h(uAe鰊醡t"       
` $ $ ! 0  i-lncplpEs鱳~rU  荂誷trde&aqlp:rhqrUdsQrEewaClP(?veESFr韓鏔~rke9(&pesrwrT"m
 ! 1   ?<-ABp萶鏸LAy%r*lkghnGiDhsQrOa|enBo瑄beCnSm?餫bsWo2d(tvud)+
 d  ! tlEeMf琍}aEf]r?鏴eCOn&ic(-.fedL_g-ngt`tt( =}aEf]r?鏴eCOn&ic(-.jLgYn7S@aueKYnLKg韓8tYe\
??1   ` $ vepuyrU fsWrhpe/Ci l雊xnABp萶鏸LAy%r&
$ ! 0  d  moraZ Qs醨a\e=肬beRD%feuht;sxaBe UGesDtfWuHt?+gTtat鰅頶WoRK%y,"qsdr~a]ef)> ! 1   ?1l^cSl醩bwOr$ 9 GCTsurte"aAlu:bhWrAd裺trueTa駆?8:Ge4SprmnfFr{e=(p`sbwYr@"?1   ??1 ap0LkgmnMaieB.(oSioWxt^UWe鯪pmTI\f?鮯trNa-e( tarsgoBdh Ramst)
 ?1  Wn??1   ` $-) hf8_@i          =!nxloV 踦xd= ?鬶tn* ` $ $ !-=  d FepuxrS s鐁xpE/Gi玹閜>ALe2tPit" 0  d -, 1  el醨eTXps靜鰽}eRthGatHoba|iJetFiogSy"Oe齙 5        2)?頸})* ` $ $ !-=  d Feuucn<  ?1 - 醤?   ` $ $-, yfn+tPmaefYrI.韘UeSuU(?鬶tn* ` $ $ !-=  d xofiSUeJe猯~gXn~o鉯鉙trVe2([pmd(
0  d  ,-1eZsA
?1   ??1  l/cel$sdrfeBI*f[ < BeDvAr萯btgWt萢髏]oGi.Sarres(9
 d  ! <-  trGe@I阥?aiD } [pmd 0  d -, 1  ho鉯SRe\e猯oginInServer(serverInfo)
        -- end
    else
        protocol:login()
    end
end

function fnAdShow( ... )

  local adUrl =  config.getAdShowUrl() .. g_game_version
  print("adUrl: ", adUrl)
  
  local imgHttpClient = CCHttpRequest:open(adUrl, kHttpGet)
    imgHttpClient:sendWithHandler(function (res, hnd)
    if res:getResponseCode() == 200 then
      local cjson = require("cjson")
      local json = cjson.decode(res:getResponseData())
      print("isshow: ", json.isshow)
      if json and json.isshow and json.isshow == 1 then
        local dict = CCDictionary:create()
          protocol:callOCFunctionWithName_oneParam_noBack("adShow",dict)
          print("kldny鎵撳紑骞垮憡:","璋冪敤SDK鏂规硶adShow")
      end
    end
  end)

end

--娉ㄩ攢
function loginOut( ... )
  if(isPlatform() == false)then
    return
  end
  protocol:loginOut()
end

--骞冲彴鐧婚檰鍥炶皟
function registerLoginScriptHandler(pFunc)
  if(isPlatform() == false)then
    return
  end
  protocol:registerLoginScriptHandler(pFunc)
  registerLogoutScriptHandler()
end

--骞冲彴娉ㄩ攢鍥炶皟
function registerLogoutScriptHandler(pFunc)
  if(isPlatform() == false)then
    return
  end
  print("registerLogoutHandler")
  protocol:registerScriptHandlers("logout",function( ... )
    print(GetLocalizeStringBy("key_2382"))
    logout()
  end)
end

function showToolBar( ... )
  if(isPlatform() == false)then
    return
  end
  protocol:showToolBar()
end

function getUin( ... )
  if(isPlatform() == false)then
    return
  end
  return protocol:callStringFuncWithParam("getUin",nil)
end

local _unlockPay = "true"

-- 瑙g鍏呭€煎姛鑳?function fnLockPay( lock )
  _unlockPay = lock
end
function pay(coins)
  if(isPlatform() == false)then
    return
  end

  -- if(isDebug() == true and getPlatformFlag() ~= "Android_91")then
  --   require "script/ui/tip/AlertTip"
  --   AlertTip.showAlert("debug妯″紡涓嶆敮鎸佸厖鍊?", nil)
  -- end
  -- --android灏佹祴涓嶅紑鏀惧厖鍊?  -- if g_system_type ~= kBT_PLATFORM_IOS and _unlockPay == "false" then
  --     require "script/ui/tip/AlertTip"
  --     AlertTip.showAlert("灏佹祴鏈熼棿涓嶅紑鏀惧厖鍊?", nil)
  --     return
  -- end
  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if(platformName == "Android_vivo")then
    --璋冪敤骞冲彴鎺ㄩ€佹帴鍙o紝杩斿洖鍏呭€兼墍闇€鍙傛暟锛屽鏋滄湁鐢ㄥ埌锛岃閲嶆瀯
    local requestCallback = function(res, hnd)
      LoadingUI.reduceLoadingUI()
      if(res:getResponseCode()~=200)then
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert( "缃戠粶寮傚父锛岃绋嶅悗鍐嶈瘯", nil, false, nil)
        return
      end

      local xml = require "script/utils/LuaXml"
      local orderXmlString = res:getResponseData()
      print("pushInterface Call:" .. orderXmlString)
      local xmlTable = LuaXML.eval(orderXmlString)
      
      --淇濆瓨鐧婚檰鏁版嵁
      
      if(xmlTable == nil) then
        -- AlertTip.showAlert("杩炴帴宸叉柇寮€锛岃閲嶆柊鐧诲綍锛?, loginAgain)
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert("鍒涘缓澶辫触銆?, nil)
        return
      end

      local param = config.getPayParam(coins)
      param:setObject(CCString:create(xmlTable:find("vivoSignature")[1]),"vivoSignature")
      param:setObject(CCString:create(xmlTable:find("vivoOrder")[1]),"vivoOrder")
      protocol:pay(param)
    end

    local requestUrl
    if(isDebug())then
      requestUrl = config.getOrderUrl_debug(coins)
    else
      requestUrl = config.getOrderUrl(coins)
    end
    print("getOrderURL:",requestUrl)

    require "script/ui/network/LoadingUI"
    LoadingUI.addLoadingUI()
    local httpClent = CCHttpRequest:open(requestUrl, kHttpGet)
    httpClent:sendWithHandler(requestCallback)

  else
    local param = config.getPayParam(coins)
    protocol:pay(param)
  end  
end

--鍒濆鍖栧钩鍙癝erver
function initPlGroup( ... )
  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if (platformName == "Android_km" or platformName == "Android_ck") then
    protocol:callOCFunctionWithName_oneParam_noBack("initServer",config.getGroupParam())
  end
end
-- 瑙g鍏呭€煎姛鑳?function fnUnlockPay( ... )
  _lockPay = false
end

function getSessionId()
  if(isPlatform() == false)then
    return
  end
    return protocol:callStringFuncWithParam("getSessionId",nil)
end

--鎺ユ敹娓告垙鍐呴儴鐜╁绛夌骇淇℃伅
function sendRoleLevelInfo(level)
  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if(platformName == "ios_kimi") then
    if (tonumber(level) == 5) then
      local dict = CCDictionary:create()
      dict:setObject(CCString:create(level),"level")
      protocol:callOCFunctionWithName_oneParam_noBack("sendRoleLevelInfo",dict)
    end
  end
end

--鑾峰彇鏈嶅姟鍣ㄥ垪琛?function getServerList()
  local platformName = getPlatformFlag()
  if(platformName ~= "IOS_91" and platformName ~= "Android_91") then
     login()
  end
  --閫氱煡SDK绋嬪簭杩涘叆閫夋湇涓婚〉闈?  Platform.sendInformationToPlatform(kComeInMainLayer)
  local httpClent = nil
  require "script/ui/network/LoadingUI"
  -- LoadingUI.addLoadingUI()
  if(not isDebug())then
    httpClent = CCHttpRequest:open(config.getServerListUrl(), kHttpGet)
    print("url",config.getServerListUrl())
  else
    httpClent = CCHttpRequest:open(config.getServerListUrl_debug(), kHttpGet)
    print("url",config.getServerListUrl_debug())
  end

  httpClent:sendWithHandler(function(res, hnd)
    -- LoadingUI.reduceLoadingUI()
    local function resultCallback(resultTable)
      if(resultTable == nil) then
        print("get serverlist failed!!")
          require "script/ui/tip/AlertTip"
          AlertTip.showAlert(GetLocalizeStringBy("key_2847"), function ( ... )
            require "script/Platform"
            Platform.quit()
          end)
        return
      end
      for i=1, #resultTable do
        local v = resultTable[i]
        if v.desc and v.open then
          require "script/ui/login/LoginScene"
          LoginScene.setNotice(v.open, v.desc)
          resultTable[i] = nil
          break
        end
      end

      ServerList.serverListData = resultTable
      LoginScene.createSelectServer()
    end

    --鍒ゆ柇http鐘舵€佹槸鍚﹀悎娉?    if(res:getResponseCode() ~= 200) then
      print("error responseCode :", res:getResponseCode())
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert(GetLocalizeStringBy("key_2847"), function ( ... )
          require "script/Platform"
          Platform.quit()
        end)
    end

    if(res:getResponseData() == "")then
      require "script/ui/tip/AlertTip"
      AlertTip.showAlert(GetLocalizeStringBy("key_3354"), function()
          require "script/Platform"
          Platform.quit()
      end)
      return
    end
    BTUtil:parseServerList(res:getResponseData(), resultCallback)
  end)
end

--鐧婚檰鎴愬姛鍚庤幏鍙杙id
function getPidBySessionId( session_id )
  -- if _pid then
  --   LoginScene.loginLogicServer(_pid)
  --   return
  -- end
  local loginUrl = nil
  if(not isDebug())then
    loginUrl = config.getPidUrl(session_id)
  else
    loginUrl = config.getPidUrl_debug(session_id)
  end
  print("loginUrl=",loginUrl)
  local httpClent = CCHttpRequest:open(loginUrl, kHttpGet)
        require "script/ui/network/LoadingUI"
  LoadingUI.addLoadingUI()
  httpClent:sendWithHandler(

  function(res, hnd)
    require "script/ui/network/LoadingUI"
    LoadingUI.reduceLoadingUI()

    if(res:getResponseCode()~=200)then
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert( GetLocalizeStringBy("key_1810"), nil, false, nil)
        return
    end

    local xml = require "script/utils/LuaXml"
    print("res:getResponseData()=",res:getResponseData())
    local xmlTable = LuaXML.eval(res:getResponseData())
    --淇濆瓨鐧婚檰鏁版嵁
   
    if(xmlTable == nil or xmlTable:find("uid") == nil) then
      Platform.loginOut()
      -- AlertTip.showAlert(GetLocalizeStringBy("key_1889"), loginAgain)
      require "script/ui/tip/AlertTip"
      AlertTip.showAlert(GetLocalizeStringBy("key_3194"), nil)
      CCLuaLog("swap user info error -> uid is nill")
      return
    end
   
    local uid = xmlTable:find("uid")[1]
    local errornu = xmlTable:find("errornu")[1]

    if(errornu == "0") then
      _pid = uid
      print("_pid=",_pid)
      if(type(config.setLoginInfo) == "function")then
        config.setLoginInfo(xmlTable)
      end
      if(_loginBackCall)then
        print("_loginBackCall",_loginBackCall)
        _loginBackCall()
        _loginBackCall=nil
      end
      
    elseif(errornu == "3") then
      require "script/ui/tip/AlertTip"
      AlertTip.showAlert(GetLocalizeStringBy("key_1411"), nil)
      CCLuaLog("swap user info error errornu is not 0")
      return
      
    else
      -- SDK91Share:shareSDK91():loginOut()
      require "script/ui/tip/AlertTip"
      AlertTip.showAlert(GetLocalizeStringBy("key_1414"), nil)
      CCLuaLog("swap user info error errornu is not 0")
      return
    end
  end)
end

-----------------------------涓嶱latform_SDK鐨勪俊鎭氦浜?-----------------------createByBaoXu
--Platform_SDK 瀵瑰簲鐨?鎺ュ彛 Teyp 绫诲瀷
kEnterGameServer      = 0      --浠嶹eb绔幏鍙栧埌Pid鍚庡紑濮嬬櫥褰曟父鎴忔湇鍔″櫒   //Platform           490琛? 璋冪敤
kCreateNewRole        = 1      --鍒涘缓鏂拌鑹?                         //UserHandler         72琛? 璋冪敤
kEnterTheGameHall     = 2      --杩涘叆娓告垙澶у巺                        //BulletinLayer       61琛? 璋冪敤
kOutOfStoryLine       = 3      --鏂版墜鍓ф儏涔嬪悗(鍗宠繘鍏ラ涓壇鏈?          //LoginScene         663琛? 璋冪敤
kRoleLevelInfo        = 4      --娓告垙鍐呴儴鐜╁绛夌骇淇℃伅                 //UserModel          169琛? 璋冪敤
kShareButtonClick     = 5      --璋冪敤鍒嗕韩鎸夐挳
kComeInMainLayer      = 6      --杩涘叆閫夋湇涓婚〉闈?kNewPlatformAccount   = 7      --鏂拌处鍙锋敞鍐?
local beforeGame  = 0      --杩涘叆娓告垙涔嬪墠
local inTheGame   = 1      --宸茬粡杩涘叆娓告垙

--缁熶竴鎺ユ敹娓告垙鍐呴儴浼犺繃鏉ョ殑娑堟伅--messageType鏄笂闈㈠畾涔夌殑鏂规硶绫诲瀷,param鏄檮鍔犲弬鏁?鍙紶闅忔剰鍙傛暟)
function sendInformationToPlatform(messageType, param)
  if(isPlatform() == false)then
    return
  end

  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  local dict = CCDictionary:create()

  if (messageType == kComeInMainLayer) then
      dict:setObject(CCString:create(messageType),"type")
      protocol:callOCFunctionWithName_oneParam_noBack("receiveInformationFromLua",dict)
    return
  end

  --娌℃湁鏂规硶getPlatformName鐨勫钩鍙?缁撴潫璋冪敤,鎰忓懗鐫€涓嶉渶瑕?缁熻鐩稿叧鏁版嵁  
  if(type(config.getUserInfoParam) == "function")then
    --鍒氳繘鍏ラ€昏緫鏈嶅姟鍣ㄧ殑鏃跺€?鏈夎幏鍙栦笉鍒扮殑鍙傛暟 鍥犳鍋氫笅鍖哄垎
    if(messageType == kEnterGameServer)then
      dict = config.getUserInfoParam(beforeGame)
    else
      dict = config.getUserInfoParam(inTheGame)
    end
  end

  --鐩戝惉瑙掕壊鍗囩骇,娣诲姞绛夌骇鍙傛暟
  if(messageType == kRoleLevelInfo)then
    local level = param
    dict:setObject(CCString:create(level),"level")
  end
  
  --娉ㄥ唽鍒嗕韩鍚庣殑鏂规硶鍥炶皟, 骞惰缃垎浜殑鍐呭
  if(messageType == kShareButtonClick)then
    print("registerShareCallback")
    protocol:registerScriptHandlers("shareCallBack",function( param )
      print(GetLocalizeStringBy("key_3190"),param.code)
      require "script/ui/share/ShareLayer"
      ShareLayer.shareCallback(param.code)
    end)
    if(platformName == "ios_kimi") then   
      local feed = GetLocalizeStringBy("key_1647")
      local caption = "銆婃斁闁嬮偅涓夊湅銆嬫柊娲惧崱鐗岋紝璁撴垜鍏堜締锛?
      local description = GetLocalizeStringBy("key_1851")
      local link = "http://click.adzcore.com/1.0.b3e6280ce230d006cbd71de2dd2f2322c"
      local picture = "http://static.kimi.com.tw/web/nsg/images/fb_nsg_icon.png"

      dict:setObject(CCString:create(feed),"feed")
      dict:setObject(CCString:create(caption),"caption")
      dict:setObject(CCString:create(description),"description")
      dict:setObject(CCString:create(link),"link")
      dict:setObject(CCString:create(picture),"picture")
    end
  end

  dict:setObject(CCString:create(messageType),"type")
  protocol:callOCFunctionWithName_oneParam_noBack("receiveInformationFromLua",dict)

end
-----------------------------涓嶱latform_SDK鐨勪俊鎭氦浜?-----------------------createByBaoXu

--android 鐐瑰嚮back鎺ュ彛

function exitSDK( ... )
  if(getPlatformName() == "Android_uc") then
       protocol:callStringFuncWithParam("exitUCSDK",nil)
  else
    exit()
  end
end

function release( ... )
-- body
end

function exit()
  if(isPlatform() == false)then
    return
  end
  protocol:registerScriptHandlers("luaQuit",quit)
  protocol:callOCFunctionWithName_oneParam_noBack("exit",nil)
end

--鍚姩闃叉矇杩峰€掕鏃?local beginSchedule = false
local minute = 0
function antiAddictionSchedule( time )
  if(antiAddictionSchedule == false) then
    antiAddictionSchedule = true
    CCDirector:sharedDirector():getScheduler():scheduleScriptFunc(antiAddictionSchedule, 60, false)
  end

  minute = minute + 1
  if(minute >= 3*60)then
    if((minute - 3*60)%15 == 0)then
      antiAddictionQuery(3)
    end
  elseif(minute >= 5*60)then
    if((minute - 3*60)%5 == 0)then
      antiAddictionQuery(5)
      end
  end

end

--闃叉矇杩?--type绫诲瀷:灏忔椂,3鎴?
function antiAddictionQuery(type)
  --鏆傛椂鍙湁360鏈?  if not (platformName == "Android_360")then
    return
  end
  if(isPlatform() == false)then
    return
  end
  local param = config.getPayParam(0)
  param:setObject(CCString:create(type),"type")
  protocol:callOCFunctionWithName_oneParam_noBack("antiAddictionQuery",param)
end

-- 娉ㄩ攢骞冲彴鐢ㄦ埛
function logout( ... )

    BTEventDispatcher:getInstance():addLuaHandler("failed", function ( ... )
      local scene = CCDirector:sharedDirector():getRunningScene()
      local node = CCNode:create()
      scene:addChild(node)
      node:runAction(CCSequence:createWithTwoActions(CCDelayTime:create(0.1), CCCallFunc:create(function ( ... )
        LoginScene.enter()
      end)))
    end, false)
    require "script/network/Network"
    Network.rpc(function ( ... )
      print("...........rpc................logout")
    end, "user.closeMe", "user.closeMe", nil, true)
    setPid(nil)
end

--android 鐐瑰嚮menu鎺ュ彛
function clickMenu( ... )
  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if not (platformName == "Android_360" or platformName == "Android_dl" or platformName == "Android_xm")then
    return
  end
  function doRevive( flag,hid)
    if(flag==false)then
      
    else
      logout()
      protocol:callOCFunctionWithName_oneParam_noBack("switchAccount",nil)
    end
  end
  require "script/ui/tip/AlertTip"
  AlertTip.showAlert( "鎮ㄨ鎵ц鍝釜鎿嶄綔", doRevive, false, hid,GetLocalizeStringBy("key_2204"))
end

--[[
  add by lichenyang
  @des:   寰楀埌褰撳墠骞冲彴鏍囪瘑
  @ret:   杩斿洖GlobalVars 閲岄潰鐨勫父閲?]]
function getCurrentPlatform( ... )

  if(isDebug() and isPlatform() == false) then
    return kPlatform_debug
  end

  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if(platformName == "IOS_91")then
    return kPlatform_91_ios
  elseif(platformName == "IOS_PP")then
    return kPlatform_pp
  elseif(platformName == "IOS_TBT")then
    return kPlatform_tbt
  elseif(platformName == "ios_pps")then
    return kPlatform_pps
  elseif(platformName == "Android_360")then
    return kPlatform_360
  elseif(platformName == "Android_91")then
    return kPlatform_91_android
  elseif(platformName == "Android_uc") then
    return kPlatform_uc
  elseif(platformName == "Android_dl") then
    return kPlatform_dangle
  elseif(platformName == "Android_dk") then
    return kPlatform_dk
  elseif(platformName == "Android_wdj")then
    return kPlatform_wandoujia
  elseif(platformName == "Android_jf")then
    return kPlatform_jifeng
  elseif(platformName == "Android_kg")then
    return kPlatform_kugou
  elseif(platformName == "Android_pps")then
    return kPlatform_pps
  elseif(platformName == "Android_jinshan")then
    return kPlatform_jinshan
  elseif(platformName == "Android_37wan") then
    return kPlatform_37wan
  elseif(platformName == "Android_xm") then
    return kPlatform_xiaomi
  elseif(platformName == "Android_az") then
    return kPlatform_anzhi
  elseif(platformName == "IOS_APPSTORE") then
    return kPlatform_AppStore
  elseif(platformName == "IOS_PGY") then
    return kPlatform_pingguoyuan
  elseif(platformName == "IOS_DANGLE") then
    return kPlatform_dangleios
  elseif(platformName == "IOS_PP2") then
    return kPlatform_pp2
  elseif(platformName == "IOS_ITOOLS") then
    return kPlatform_iTools
  elseif(platformName == "IOS_KUAIYONG") then
    return kPlatform_kuaiyong
  elseif(platformName == "ios_kldny") then
    return kPlatform_kldny
  elseif(platformName == "Android_ck") then
    return kPlatform_chukong
  elseif(platformName == "Android_oppo") then
    return kPlatform_oppo
  elseif(platformName == "Android_pptv") then
    return kPlatform_pptv
  elseif(platformName == "Android_kuwo") then
    return kPlatform_kuwo
  elseif(platformName == "Android_huawei") then
    return kPlatform_huawei
  elseif(platformName == "Android_sogou") then
    return kPlatform_sogou
  elseif(platformName == "Android_youmi") then
    return kPlatform_youmi
  elseif(platformName == "Android_mumayi") then
    return kPlatform_mumayi
  elseif(platformName == "Android_yyh") then
    return kPlatform_yingyonghui
  elseif(platformName == "Android_xl") then
    return kPlatform_xunlei
  elseif(platformName == "Android_lenovo") then
    return kPlatform_lenovo
  elseif(platformName == "Android_vivo") then
    return kPlatform_vivo
  elseif(platformName == "Android_ck_dianxin") then
    return kPlatform_chukong_dx
  elseif(platformName == "Android_ck_liantong") then
    return kPlatform_chukong_lt
  elseif(platformName == "Android_ck_yidongMM") then
    return kPlatform_chukong_ydm
  elseif(platformName == "Android_ck_yidongGame") then
    return kPlatform_chukong_ydg
  elseif(platformName == "Android_3g") then
    return kPlatform_3g
  elseif(platformName == "Android_lenovoPush") then
    return kPlatform_lenovoPush
  elseif(platformName == "Android_chaohaowan") then
    return kPlatform_chaohaowan
  else
    return kPlatform_91_ios
  end

end

--[[
  @des:寰楀埌鐢ㄦ埛pid
]]
function getPid( ... )
  return _pid
  -- return "d66d39b609e16384"
end

--[[
  @des:璁剧疆pid
]]
function setPid( pidStr )
  _pid = pidStr
end

local AppPurchaseDebugUrl  = "http://192.168.1.38/phone/exchange?pl=appstore&os=ios&gn=sanguo"
local AppPurchaseRelaseUrl = "http://mapifknsg.zuiyouxi.com/phone/exchange?pl=appstore&os=ios&gn=sanguo"

--[[
  @des:鏀粯鐩戝惉澶?]]
function addPurchaseListener( ... )
  local orderId    = CCUserDefault:sharedUserDefault():getStringForKey("purchase_orderId")
  local serverInfo = ServerList.getSelectServerInfo()
  --鏀粯澶辫触骞冲彴鏁版嵁澶勭悊
  local failRequestCallback = function ( res,hnd )
    if(res:getResponseCode()~=200)then
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert( GetLocalizeStringBy("key_1810"), nil, false, nil)
        return
    end
    removeWaiteLayer()
    local loginJsonString = res:getResponseData()
    print("purchase failedCall:" , loginJsonString)
    local cjson = require "cjson"
    local cancelInfo = cjson.decode(loginJsonString)
    print_t(cancelInfo)
  end

  --鏀粯澶辫触浜嬩欢澶勭悊
  local failedCall = function ( ... )
    local requestUrl = ""
    if(BTUtil:getDebugStatus()) then
      requestUrl = AppPurchaseDebugUrl
      requestUrl = requestUrl .. "&issandbox=1"
    else
      requestUrl = AppPurchaseRelaseUrl
      requestUrl = requestUrl .. "&issandbox=0"
    end
    requestUrl = requestUrl .. "&pid="            .. getPid()
    requestUrl = requestUrl .. "&orderId="        .. orderId
    requestUrl = requestUrl .. "&action=cancel"
    requestUrl = requestUrl .. "&serverKey="      .. serverInfo.group

    local newUrl = nil
    require "script/ui/login/LoginScene"
    local bIsLarger = LoginScene.fnVersionCmp(g_publish_version, "1.1.8")
    if bIsLarger then
      newUrl = addMd5ForVerifyUrl(requestUrl)
    end
    if newUrl == nil then
      newUrl = requestUrl
    end
    local httpClent = CCHttpRequest:open(newUrl, kHttpGet)

    httpClent:sendWithHandler(failRequestCallback)
    print("requestUrl:", requestUrl)
  end

  BTApplePurchase:shareApplePurchse():regisertPurchaseHandle(function ( pruchaseType, data )
      print(GetLocalizeStringBy("key_1764"))
      if(pruchaseType == "successed") then
        CCMessageBox( GetLocalizeStringBy("key_1377"), GetLocalizeStringBy("key_3301"))
        removeWaiteLayer()
      elseif(pruchaseType == "failed") then
        CCMessageBox(GetLocalizeStringBy("key_1917"), GetLocalizeStringBy("key_3301"))
        failedCall()
        removeWaiteLayer()
      elseif(pruchaseType == "purchaseCallback") then
        local oldUrl = BTApplePurchase:shareApplePurchse():getVerifyUrl()
        local newUrl = addMd5ForVerifyUrl(oldUrl)
        BTApplePurchase:shareApplePurchse():setMd5VerifyUrl(newUrl)
      end
      print(pruchaseType, data)
  end)
end

local function fnSortUrlParams(pUrl)
  require "script/utils/LuaUtil"
  local result = ""
  local fullUrl = pUrl --.. "&BabeltimeSanguo"
  print("fullUrl : ", fullUrl)
  local aData01 = string.splitByChar(fullUrl, "?")
  if #aData01 > 1 then
    local params = ""
    for i=2, #aData01 do
      params = params .. aData01[i]
    end
    local aData02 = string.splitByChar(params, "&")
    if #aData02 > 1 then
      table.sort(aData02, function (p01, p02)
        return p01 < p02
      end)
    end
    result = table.concat(aData02, "")
  end

  return result
end

--local str = "action=create&gn=sanguo&pid=90f34efb71454d0d&pl=appstore&product_id=com.babeltime.cardSango.6rmb&time=201401271010&BabeltimeSanguo"

-- oldUrl="http://www.zuiyouxi.com/?action=confirm&key01=value01"
-- newUrl="http://www.zuiyouxi.com/?action=confirm&key01=value01&sign=xxxxxxxx"

--[[
  @des:   妫€娴嬫敮浠樻暟鎹槸鍚︽甯?--]]
function addMd5ForVerifyUrl(pOldUrl)
    pOldUrl = pOldUrl .. "&uuid=" .. g_dev_udid
    local sortedParams = fnSortUrlParams (pOldUrl)
    sortedParams = sortedParams .. "BabeltimeSanguo"
    print("sortedParams = ", sortedParams)
    local sign = BTUtil:getMd5SumByString(sortedParams)
    --浠ヤ笅璁$畻md5鐮?    local newUrl = pOldUrl .. "&sign=" .. sign
    print("lua new url:", newUrl)
    return newUrl
end

--[[
  @des: app store 鏀粯
]]
function payOfAppStore( product_id )
    showWaitLayer()

    require "db/DB_Apple_iap"
    local iapInfo = DB_Apple_iap.getDataById(product_id)
    local serverInfo = ServerList.getSelectServerInfo()
    local createOrderCallback = function ( res,hnd )
      if(res:getResponseCode()~=200)then
        require "script/ui/tip/AlertTip"
        AlertTip.showAlert( GetLocalizeStringBy("key_1810"), nil, false, nil)
        return
      end
      -- removeWaiteLayer()
      local loginJsonString = res:getResponseData()
      print("purchase create Call:" .. loginJsonString)
      local cjson = require "cjson"
      local createOrderInfo = cjson.decode(loginJsonString)
      if(createOrderInfo == nil) then
        print(GetLocalizeStringBy("key_2648"))
        LoadingUI.setVisiable(false)
        return
      end

      if(createOrderInfo.status == "0") then
        print(GetLocalizeStringBy("key_2114"), createOrderInfo.msg)

        CCUserDefault:sharedUserDefault():setStringForKey("purchase_orderId", createOrderInfo.orderId)
        CCUserDefault:sharedUserDefault():flush()

        print("寮€濮媋pp store 鏀粯")
        BTApplePurchase:shareApplePurchse():buyProduct(iapInfo.productId)
      else
        print(GetLocalizeStringBy("key_2254"), createOrderInfo.status, GetLocalizeStringBy("key_3366"), createOrderInfo.msg)
      end
    end

    local requestUrl = ""
    if(BTUtil:getDebugStatus()) then
    requestUrl = AppPurchaseDebugUrl
    requestUrl = requestUrl .. "&issandbox=1"
    else
    requestUrl = AppPurchaseRelaseUrl
    requestUrl = requestUrl .. "&issandbox=0"
    end
    requestUrl = requestUrl .. "&pid="            .. getPid()
    requestUrl = requestUrl .. "&action=create"
    requestUrl = requestUrl .. "&serverKey="      .. serverInfo.group
    requestUrl = requestUrl .. "&product_id="     .. iapInfo.productId

    local newUrl = nil
    require "script/ui/login/LoginScene"
    local bIsLarger = LoginScene.fnVersionCmp(g_publish_version, "1.1.8")
    if bIsLarger then
      newUrl = addMd5ForVerifyUrl(requestUrl)
    end
    if newUrl == nil then
      newUrl = requestUrl
    end
    local httpClent = CCHttpRequest:open(newUrl, kHttpGet)
    httpClent:sendWithHandler(createOrderCallback)
    print("requestUrl:", requestUrl)
end

local waitLayer = nil
function showWaitLayer( ... )
    require "script/utils/BaseUI"
    waitLayer =  BaseUI.createMaskLayer(-5000)
    local runningScene = CCDirector:sharedDirector():getRunningScene()
    runningScene:addChild(waitLayer,999999999,90901)

    local loadingSprite = CCSprite:create("images/common/bg/connectbg.png")
    loadingSprite:setAnchorPoint(ccp(0.5, 0.5))
    loadingSprite:setPosition(ccp(runningScene:getContentSize().width/2 , runningScene:getContentSize().height/2))
    loadingSprite:setScale(g_fScaleX)
    waitLayer:addChild(loadingSprite)
    -- 鍔ㄧ敾
    local loadEffectSprite = CCLayerSprite:layerSpriteWithName(CCString:create("images/base/effect/load/load4"), -1,CCString:create(""));
    loadEffectSprite:retain()
    loadEffectSprite:setAnchorPoint(ccp(0.5, 0.5))
    loadEffectSprite:setPosition(ccp(loadingSprite:getContentSize().width*0.45, loadingSprite:getContentSize().height*0.5))
    loadEffectSprite:setScale(0.4)
    loadingSprite:addChild(loadEffectSprite)
    loadEffectSprite:release()
end

function removeWaiteLayer( ... )
  if(waitLayer ~= nil) then
    waitLayer:removeFromParentAndCleanup(true)
    waitLayer=nil
  end

end

function openUrl( url )
  if(url == nil)then
    return
  end
    print("url=",url)
    if(g_system_type == kBT_PLATFORM_ANDROID )then
      local dict = CCDictionary:create()
      dict:setObject(CCString:create(url),"url")
      protocol:callOCFunctionWithName_oneParam_noBack("openUrl",dict)
    else
        PlatformUtil:openUrl(url)
    end
end

function registerCrashHandler( ... )
    print("registerCrashHandler")
    protocol:registerScriptHandlers("handleCrash",function( param )
        print("handleCrash")
        print("param",param)
        -- local cjson = require "cjson"
        -- local dict = cjson.decode(param)
        local param = ""
        local dumpPath=""
        param = param .. "&pid=" .. (_pid or 0)
        param = param .. "&env=lua"
        param = param .. "&gn=sanguo"
        param = param .. "&os="..getOS()
        param = param .. "&pl="..getPlName()

        local serverInfo = ServerList.getSelectServerInfo()
        param = param .. "&server="..serverInfo.host .. ":" .. serverInfo.port
        param = param .. "&server_group="..serverInfo.group
        -- for k,v in pairs(dict) do
        --     if(k == "functionName")then

        --     else
        --         print(k .. "=" .. v)
        --         param = param .. "&" .. k .. "=" .. v
        --     end
        -- end

        local url = "http://debug.zuiyouxi.com:17801/index.php?" .. param .. "&lua_traceback=" ..debug.traceback() .. "&lua_tracebackex=" .. tracebackex()
        url1 = string.gsub(url,"\n","<br>")
        url = nil
        url2 = string.gsub(url1,"\r","<br>")
        url1 = nil

        print("url=",url2)
        local dict = CCDictionary:create()
        dict:setObject(CCString:create(url2),"url")
        protocol:callOCFunctionWithName_oneParam_noBack("sendToServer",dict)
    end)
end

function tracebackex()  
local ret = ""  
local level = 3  
ret = ret .. "stack traceback:\n"  
while true do  
   --get stack info  
   local info = debug.getinfo(level, "Sln")  
   if not info then break end  
   if info.what == "C" then                -- C function  
    ret = ret .. tostring(level) .. "\tC function\n"  
   else           -- Lua function  
    ret = ret .. string.format("\t[%s]:%d in function `%s`\n", info.short_src, info.currentline, info.name or "")  
   end  
   --get local vars  
   local i = 1  
   while true do  
    local name, value = debug.getlocal(level, i)  
    if not name then break end  
    ret = ret .. "\t\t" .. name .. " =\t" .. tostringex(value, 3) .. "\n"  
    i = i + 1  
   end   
   level = level + 1  
end  
return ret  
end  
  
function tostringex(v, len)  
if len == nil then len = 0 end  
local pre = string.rep('\t', len)  
local ret = ""  
if type(v) == "table" then  
   if len > 5 then return "\t{ ... }" end  
   local t = ""  
   for k, v1 in pairs(v) do  
    t = t .. "\n\t" .. pre .. tostring(k) .. ":"  
    t = t .. tostringex(v1, len + 1)  
   end  
   if t == "" then  
    ret = ret .. pre .. "{ }\t(" .. tostring(v) .. ")"  
   else  
    if len > 0 then  
     ret = ret .. "\t(" .. tostring(v) .. ")\n"  
    end  
    ret = ret .. pre .. "{" .. t .. "\n" .. pre .. "}"  
   end  
else  
   ret = ret .. pre .. tostring(v) .. "\t(" .. type(v) .. ")"  
end  
return ret  
end   

OS_IOS="ios"
OS_ANDROID="android"

function getOS( ... )
  local OS = "ios"
    if g_system_type == kBT_PLATFORM_ANDROID then
        OS = "android"
    end
    return OS
end

function getGameName( ... )
    return "sanguo"
end

function getUrlParam( ... )
  return "&pl=" .. config.getFlag() .. "&gn=" .. getGameName() .. "&os=" .. getOS()
end
-- added by hechao
function quit( ... )
  if g_system_type == kBT_PLATFORM_ANDROID then
    local dict = CCDictionary:create()
    protocol:callOCFunctionWithName_oneParam_noBack("quit",dict)
  else
    CCDirector:sharedDirector():endToLua()
    os.exit()
  end
  BTUtil:exitNow()
end

function getOperatorsFlag( ... )
  local platformName = protocol:callStringFuncWithParam("getPlatformName",nil)
  if(platformName == "Android_ck")then
    return protocol:callStringFuncWithParam("getOperatorsFlag",nil)
  end

  return ""
end
这种全是乱码
2014-8-2 16:00
0
雪    币: 36
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
41
这个帖子有点没看懂啊
2014-8-10 17:02
0
雪    币: 40
活跃值: (14)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
42
用 chunkspy 来分析 luac 格式比较好
2014-10-9 22:15
0
雪    币: 1574
活跃值: (1379)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
43
楼主打算什么时候更新?来看了一遍又一遍了。。
2014-10-22 18:10
0
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
44
正好最近也在学lua, 收着回头看
2014-10-27 16:14
0
雪    币: 8
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
45
感谢分享谢谢,想知道用unluac.jar反编译为什么会出现0字节
2014-10-28 17:57
0
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
46
这个略吊。收藏了
2014-11-11 22:21
0
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
47
:3楼主去哪了
2014-11-12 09:35
0
雪    币: 2
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
48
lua源码阅读http://www.codingnow.com/download/readinglua.pdf
这个不错 可以收藏一下
2014-11-12 18:22
0
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
49
现在刚刚学习这个。。。
2014-12-26 10:40
0
雪    币: 40
活跃值: (1157)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
50
以前没觉得这个东西有什么用,研究了python的opcode。才感兴趣!
2015-12-17 10:29
0
游客
登录 | 注册 方可回帖
返回
//