初中道德与法治七年级下册在集体中成长道德与法治-憧憬美好集体-周欣媛_第1页
初中道德与法治七年级下册在集体中成长道德与法治-憧憬美好集体-周欣媛_第2页
初中道德与法治七年级下册在集体中成长道德与法治-憧憬美好集体-周欣媛_第3页
初中道德与法治七年级下册在集体中成长道德与法治-憧憬美好集体-周欣媛_第4页
初中道德与法治七年级下册在集体中成长道德与法治-憧憬美好集体-周欣媛_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

this.widgetTable.Button_close:addTouchEventListener(close_Clicked) end this.widgetTable.Image_ytime=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_bg,"Image_ytime"),"ImageView") this.widgetTable.Image_ytime:loadTexture(imagePath.."pic_yy.png") this.widgetTable.Image_cue1=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_bg,"Image_cue1"),"ImageView") this.widgetTable.Image_cue1:loadTexture(imagePath.."box_yyy.png") this.widgetTable.Image_cue2=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_bg,"Image_cue2"),"ImageView") this.widgetTable.Image_cue2:loadTexture(imagePath.."box_ts.png") this.widgetTable.Button_shake=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_bg,"Button_shake"),"Button") this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj.png","","") localfunctionshake_Clicked(sender,eventType) ifeventType==2then Log.d("shake_Clicked") this.sendMsgToCtrl(9,11) this.shakeshake() endend ifthis.widgetTable.Button_shakethen this.widgetTable.Button_shake:addTouchEventListener(shake_Clicked) end this.widgetTable.Button_gift=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_bg,"Button_gift"),"Button") localfunctiongift_Clicked(sender,eventType) ifeventType==2then Log.d("gift_Clicked") this.sendMsgToCtrl(9,14) this.giftPanelshow() endend ifthis.widgetTable.Button_giftthen this.widgetTable.Button_gift:addTouchEventListener(gift_Clicked) end --Image_ytimeChildren this.widgetTable.Label_time1=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Image_ytime,"Label_time1"),"Label") UITools.setGameFont(this.widgetTable.Label_time1,"FZCuYuan-M03S","fzcyt.ttf") --Button_shakeChildren this.widgetTable.Label_shake=tolua.cast(UIHelper:seekWidgetByName(this.widgetTable.Button_shake,"Label_shake"),"Label") this.accelerate=Accelerate.new(layerColor) this.hbShow() UITools.setGameFont(this.widgetTable.mainWidget,"FZCuYuan-M03S","fzcyt.ttf") this.canupdate=true --test --this.rockcount=0endfunctionthis.removeLayer() Log.i("PokerShakePanelremoveLayer") ifthis.widgetTablethen this.widgetTable={} end ifthis.dataTablethen this.dataTable={} end ifthis.mainLayerthen this.mainLayer=nil endendfunctionthis.updateWithShowData(showdata) Log.i("PokerShakePanelupdateWithShowData") ifnotthis.mainLayerthen Log.w("PokerShakePanelmainLayerisnotready") return end ifnotshowdatathen Log.w("PokerShakePanelshowdataisnotready") return else this.dataTable.showData=showdata ifthis.canupdatethen this.setShakePanel(1) end PLTable.print(showdata,"PokerShakePanelshowdata") endendfunctionthis.show(showdata) Log.i("PokerShakePanelshow") ifnotthis.mainLayerthen this.initLayer() end ifshowdataandthis.mainLayerthen this.updateWithShowData(showdata) end ifthis.mainLayerthen pushNewLayer(this.mainLayer) endendfunctionthis.close() Log.i("PokerShakePanelclose") ifthis.mainLayerthen popLayer(this.mainLayer) end this.closeCountdown() this.removeLayer()this:dispose()endfunctionthis.sendMsgToCtrl(msgtype,msgdata,msgflag) Log.i("PokerShakePanel.sendMsgToCtrlmsgtype=="..msgtype) PokerShakeCtrl.getMsgFromPanel(msgtype,msgdata,msgflag)endfunctionthis.getMsgFromCtrl(msgtype,msgdata,msgflag) ifmsgtype==5then--避免循环输出else Log.i("PokerShakePanel.getMsgFromCtrlmsgtype=="..msgtype)endifmsgtype==1thenthis.initLayer()elseifmsgtype==2then ifthis.mainLayerthen Log.w("PokerShakePanelmainLayerisindontneedcreatenewlayer") return endthis.initLayer()this.show(msgdata)elseifmsgtype==3thenthis.updateWithShowData(msgdata)elseifmsgtype==4thenthis.close()elseifmsgtype==5then ifnotthis.mainLayerthen Log.w("PokerShakePanelmainLayerisnotready") return end ifthis.widgetTable.Label_shakethen localtimestr=os.date("!%H:%M:%S",msgdata.counttime) this.timetype=msgdata.timetype ifmsgdata.timetype==1then this.widgetTable.Label_shake:setText("距离下次红包掉落还剩"..timestr) this.widgetTable.Label_shake:setPosition(CCPointMake(7,0)) this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj1.png","","") elseifmsgdata.timetype==2then this.widgetTable.Label_shake:setText("本次红包掉落剩余时间为"..timestr) this.widgetTable.Label_shake:setPosition(CCPointMake(7,-15)) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj.png","","") ifthis.panelType==2orthis.panelType==3then this.widgetTable.Button_shake:setTouchEnabled(false) else this.widgetTable.Button_shake:setTouchEnabled(true) end elseifmsgdata.timetype==3then this.widgetTable.Label_shake:setText("活动已结束") this.widgetTable.Label_shake:setPosition(CCPointMake(7,0)) this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj1.png","","") elseifmsgdata.timetype==5then this.widgetTable.Label_shake:setText("参与玩家过多,请重试") this.widgetTable.Label_shake:setPosition(CCPointMake(7,0)) this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj1.png","","") else --todo end endelseifmsgtype==6then this.dataTable.giftlist=msgdata --this.shortGiftlistByLevel(this.dataTable.giftlist)elseifmsgtype==7then --弹出获奖界面 localshorttable=this.shortGiftlistByLevel(msgdata) PLTable.print(shorttable) this.getGiftPanelshow(shorttable)elseLog.w("PokerShakePanel.getMsgFromPanelmsgtypeisout")endend--道具按照等级排序functionthis.shortGiftlistByLevel(giftlist) Log.i("PokerShakePanelshortGiftlistByLevel") localshorttable={} shorttable.itemlist={} --地主福袋 localdzTable={["30050015"]=1,["30050016"]=1,["30050017"]=1,["30050018"]=1,["30050019"]=1,["30050020"]=1} --农民福袋 localnmTable={["30050013"]=1,["30050014"]=1} shorttable.isbig=0 ifgiftlistandtype(giftlist)=="table"then forkey,valueinpairs(this.dataTable.giftlist)do fork,vinpairs(giftlist)do ifdzTable[tostring(v.iItemCode)]==1then v.iItemCode="30050015" end ifnmTable[tostring(v.iItemCode)]==1then v.iItemCode="30050013" end --print(k,v.iItemCode,v.iItemCount,v.sItemName) iftostring(value.giftid)==tostring(v.iItemCode)andtonumber(value.num)==tonumber(v.iItemCount)then shorttable.itemlist[#shorttable.itemlist+1]=value ifvalue.share==1then shorttable.isbig=1 end if#shorttable.itemlist==#giftlistthen returnshorttable end else --todo end end end else Log.w("giftlistisnottable") end returnshorttableend--获奖记录排序functionthis.shorthasCollectItems(itemslist) Log.i("PokerShakePanelshorthasCollectItems") localshorttable={} ifitemslistandtype(itemslist)=="table"then fork,vinpairs(itemslist)do --print(k,v.dtGetPackageTime,v.sPackageName,v.iPackageId) ifnotshorttable[v.dtGetPackageTime]then shorttable[v.dtGetPackageTime]=v.sPackageName else shorttable[v.dtGetPackageTime]=shorttable[v.dtGetPackageTime]..","..v.sPackageName end --ifnotshorttable[#shorttable]then -- shorttable[#shorttable]={name=v.sPackageName,time=v.dtGetPackageTime} --else -- ifshorttable[#shorttable].time==v.dtGetPackageTimethen -- shorttable[#shorttable].name=shorttable[#shorttable].name..","..v.sPackageName -- else -- shorttable[#shorttable+1]={name=v.sPackageName,time=v.dtGetPackageTime} -- end --end --shorttable[v.dtGetPackageTime][#shorttable[v.dtGetPackageTime]+1]={name=v.sPackageName,packageid=v.iPackageId} end else Log.w("itemslistisnottable") returnfalse end returnshorttableend--摇奖事件functionthis.shakeshake() Log.i("PokerShakePanelshakeshake") this.setTipsButtonEnble(false) this.setShakePanel(2) counttime=0 this.shaketype=1 this.closeCountdown() this.shaketime=os.time() this.canupdate=false cdTimer=this:setInterval(1000,this.countdown) this.widgetTable.Label_time:setText(5-counttime)end--æ·»åŠ

红包functionthis.hbShow() Log.i("PokerShakePanelhbShow") localImage_panel=ImageView:create() Image_panel:ignoreContentAdaptWithSize(false) Image_panel:setSize(CCSizeMake(this.widgetTable.Image_box:getSize().width,this.widgetTable.Image_box:getSize().height)) Image_panel:setPosition(CCPointMake(this.widgetTable.Image_box:getSize().width/2,this.widgetTable.Image_box:getSize().height/2)) this.widgetTable.Image_box:addChild(Image_panel) this.widgetTable.shakehbbg=Image_panel this.widgetTable.shakehbtable={} fori=1,12do localgiftImage=ImageView:create() giftImage:loadTexture(imagePath.."icon_hb.png") giftImage:setPosition(CCPointMake((i-1)%4*107-159,113-(math.floor((i-1)/4)*101))) this.widgetTable.Image_box:addChild(giftImage) this.widgetTable.shakehbtable[#this.widgetTable.shakehbtable+1]=giftImage endend--摇奖动画functionthis.startShakeAction() Log.i("PokerShakePanelstartShakeAction") --摇晃动画 fork,vinpairs(this.widgetTable.shakehbtable)do localshake=CCSequence:createWithTwoActions(CCRotateTo:create(0.2,-6),CCRotateTo:create(0.2,6)) localback=CCSequence:createWithTwoActions(CCRepeat:create(shake,22),CCRotateTo:create(0.1,0)) --localrepeatshake=CCRepeatForever:create(shake) v:runAction(back) end end--停止动画functionthis.stopShakeAction() Log.i("PokerShakePanelstopShakeAction") --摇晃动画 fork,vinpairs(this.widgetTable.shakehbtable)do --v:stopAllActions() localturnback=CCRotateTo:create(0.2,0) v:runAction(turnback) v:stopAllActions() endend--摇奖界面状态functionthis.setShakePanel(panelType) this.panelType=panelType --按钮显示状态 ifpanelType==1then this.widgetTable.Button_shake:setTouchEnabled(true) this.widgetTable.Button_shake:setVisible(true) this.widgetTable.Image_ytime:setVisible(true) this.widgetTable.Image_box:setVisible(false) this.widgetTable.Image_cue1:setVisible(false) this.widgetTable.Image_cue2:setVisible(true) ifthis.timetype==1then this.widgetTable.Button_shake:setTouchEnabled(false) elseifthis.timetype==2then this.widgetTable.Button_shake:setTouchEnabled(true) elseifthis.timetype==3then this.widgetTable.Label_shake:setText("活动已结束") this.widgetTable.Label_shake:setPosition(CCPointMake(7,0)) this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj1.png","","") elseifthis.timetype==5then this.widgetTable.Label_shake:setText("参与玩家过多,请重试") this.widgetTable.Label_shake:setPosition(CCPointMake(7,0)) this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:loadTextures(imagePath.."btn_kscj1.png","","") else --todo end --等待摇一摇状态 elseifpanelType==2then this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:setVisible(false) this.widgetTable.Image_ytime:setVisible(false) this.widgetTable.Image_box:setVisible(true) this.widgetTable.Image_cue1:setVisible(true) this.widgetTable.Image_cue2:setVisible(false) --摇奖状态 elseifpanelType==3then this.widgetTable.Button_shake:setTouchEnabled(false) this.widgetTable.Button_shake:setVisible(false) this.widgetTable.Image_ytime:setVisible(true) this.widgetTable.Image_box:setVisible(true) this.widgetTable.Image_cue1:setVisible(true) this.widgetTable.Image_cue2:setVisible(false) else --todo endend--关闭倒计时functionthis.closeCountdown() this.canupdate=true ifcdTimerthencdTimer:dispose()endend--倒计时functionthis.countdown()--print("PokerShakeCtrlcountdown")counttime=os.time()-this.shaketimeifcounttime<0orcounttime>14then Log.w("counttimeisout") this.closeCountdown() this.setShakePanel(1) this.setTipsButtonEnble(true) this.shaketype=1elseifcounttime==0then --todo elseifcounttime>=5andcounttime<13then ifthis.shaketype==1then this.setShakePanel(3) this.accelerate:startRock() this.widgetTable.Label_time1:setText(13-counttime) this.startShakeAction() this.shaketype=2 end elseifcounttime>=13then ifthis.shaketype==2then this.closeCountdown() this.accelerate:stopRock() --test --this.rocktable={0,9,10,11,25,26,40,41,42} --ifthis.rockcount>#this.rocktablethen -- this.rockcount=1 --else -- this.rockcount=this.rockcount+1 --end --this.accelerate.rock=this.rocktable[this.rockcount] ifthis.accelerate.rock>=1then this.accelerate.rock=this.accelerate.rock-1 end Log.i("摇动次数:"..tostring(this.accelerate.rock)) this.stopShakeAction() this.dataTable.shakenum=this.accelerate.rock this.sendMsgToCtrl(3,this.accelerate.rock) --test --localshorttable=this.shortGiftlistByLevel(json.decode(this.testgiftdata)) --PLTable.print(shorttable) --this.getGiftPanelshow(shorttable) --this.setShakePanel(1) this.setTipsButtonEnble(true) this.shaketype=1endendthis.widgetTable.Label_time:setText(5-counttime)localx=13-counttimeifx<0then x=0endthis.widgetTable.Label_time1:setText(x)end--屏蔽二级面板按钮functionthis.setTipsButtonEnble(isEnabled) Log.i("PokerShakePanelsetTipsButtonEnble") this.widgetTable.Button_info:setTouchEnabled(isEnabled) this.widgetTable.Button_record:setTouchEnabled(isEnabled) this.widgetTable.Button_gift:setTouchEnabled(isEnabled) this.widgetTable.Button_close:setTouchEnabled(isEnabled)end--活动规则面板functionPanelshow() Log.i("PokerShakePanelinfoPanelshow") ifthis.widgetTable.tipsTouchBgthen Log.w("PokerShakePaneltipsTouchBgisexist,pleasecloseoldtipsTouchBg") return end localmainWidget=GUIReader:shareReader():widgetFromJsonFile(jsonPath.."tipsbg.json") ifnotmainWidgetthen Log.e("PokerShakePanelReadtipsbgWidgetFromJsonFileFail") return end --防止穿透bg localwinSize=CCDirector:sharedDirector():getWinSize() this.widgetTable.tipsTouchBg=tolua.cast(UIHelper:seekWidgetByName(mainWidget,"ScrollViewbg"),"ScrollView") this.widgetTable.tipsTouchBg:setSize(winSize) this.widgetTable.tipsTouchBg:setPosition(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setAnchorPoint(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setTouchEnabled(true) this.widgetTable.tipsTouchBg:removeFromParent() this.widgetTable.mainWidget:addChild(this.widgetTable.tipsTouchBg) --this.widgetTable.tipsTouchBg=touchBg this.widgetTable.Image_infoPanel=ImageView:create() this.widgetTable.Image_infoPanel:loadTexture(imagePath.."bg_popup02.png") this.widgetTable.Image_infoPanel:setPosition(CCPointMake(winSize.width/2,winSize.height/2)) this.widgetTable.tipsTouchBg:addChild(this.widgetTable.Image_infoPanel) this.widgetTable.Button_infoPanelclose=Button:create() this.widgetTable.Button_infoPanelclose:loadTextures(imagePath.."btn_close.png","","") this.widgetTable.Button_infoPanelclose:setPosition(CCPointMake(315,197)) localfunctioninfoPanelclose_Clicked(sender,eventType) ifeventType==2then Log.d("infoPanelclose_Clicked") this.tipsPanelclose() endend ifthis.widgetTable.Button_infoPanelclosethen this.widgetTable.Button_infoPanelclose:addTouchEventListener(infoPanelclose_Clicked) end this.widgetTable.Image_infoPanel:addChild(this.widgetTable.Button_infoPanelclose) UITools.setGameFont(this.widgetTable.tipsTouchBg,"FZCuYuan-M03S","fzcyt.ttf")end--获奖记录面板functionthis.recordPanelshow() Log.i("PokerShakePanelrecordPanelshow") ifthis.widgetTable.tipsTouchBgthen Log.w("PokerShakePaneltipsTouchBgisexist,pleasecloseoldtipsTouchBg") return end localmainWidget=GUIReader:shareReader():widgetFromJsonFile(jsonPath.."tipsbg.json") ifnotmainWidgetthen Log.e("PokerShakePanelReadtipsbgWidgetFromJsonFileFail") return end --防止穿透bg localwinSize=CCDirector:sharedDirector():getWinSize() this.widgetTable.tipsTouchBg=tolua.cast(UIHelper:seekWidgetByName(mainWidget,"ScrollViewbg"),"ScrollView") this.widgetTable.tipsTouchBg:setSize(winSize) this.widgetTable.tipsTouchBg:setPosition(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setAnchorPoint(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setTouchEnabled(true) this.widgetTable.tipsTouchBg:removeFromParent() this.widgetTable.mainWidget:addChild(this.widgetTable.tipsTouchBg) --this.widgetTable.tipsTouchBg=touchBg localImage_panel=ImageView:create() Image_panel:loadTexture(imagePath.."bg_popup01.png") Image_panel:setPosition(CCPointMake(winSize.width/2,winSize.height/2)) this.widgetTable.tipsTouchBg:addChild(Image_panel) localImage_title=ImageView:create() Image_title:loadTexture(imagePath.."txt_hjjl.png") Image_title:setPosition(CCPointMake(-5,125)) Image_panel:addChild(Image_title) localButton_panelclose=Button:create() Button_panelclose:loadTextures(imagePath.."btn_close.png","","") Button_panelclose:setPosition(CCPointMake(313,170)) localfunctioninfoPanelclose_Clicked(sender,eventType) ifeventType==2then Log.d("infoPanelclose_Clicked") this.tipsPanelclose() endend ifButton_panelclosethen Button_panelclose:addTouchEventListener(infoPanelclose_Clicked) end Image_panel:addChild(Button_panelclose) localtimeLabel=Label:create() timeLabel:setPosition(CCPointMake(-235,70)) timeLabel:setText("获奖时间") timeLabel:setFontSize(18) timeLabel:setColor(ccc3(240,212,128)) Image_panel:addChild(timeLabel) localgiftLabel=Label:create() giftLabel:setPosition(CCPointMake(-45,70)) giftLabel:setText("获奖物品") giftLabel:setFontSize(18) giftLabel:setColor(ccc3(240,212,128)) Image_panel:addChild(giftLabel) --处理获奖记录 localshorttable=this.shorthasCollectItems(this.dataTable.showData.ams_resp.hasCollectItems) --PLTable.print(shorttable) localgiftbg=ScrollView:create() giftbg:setSize(CCSizeMake(587,280)) giftbg:setClippingType(1) giftbg:setPosition(CCPointMake(-302,-238)) giftbg:setAnchorPoint(CCPointMake(0,0)) giftbg:setEnabled(true) giftbg:setTouchEnabled(true) giftbg:setBounceEnabled(false) Image_panel:addChild(giftbg) localscollHeight=280 localmathheight=0 localkey_table={} --取出所有的键 forkey,_inpairs(shorttable)do table.insert(key_table,key) end --对所有键进行排序 table.sort(key_table) for_,keyinpairs(key_table)do --print(key,shorttable[key]) locallineImage=ImageView:create() lineImage:loadTexture(imagePath.."line.png") lineImage:setAnchorPoint(CCPointMake(0.5,0)) lineImage:setPosition(CCPointMake(293,mathheight+10)) giftbg:addChild(lineImage) localgiftLabel=Label:create() giftLabel:setFontSize(18) giftLabel:setColor(ccc3(255,227,200)) giftLabel:setAnchorPoint(CCPointMake(0,1)) giftLabel:ignoreContentAdaptWithSize(false) giftLabel:setText(shorttable[key]) print("giftLabel:getStringLength()",giftLabel:getStringLength()) localgiftLabelheight=math.ceil(giftLabel:getStringLength()/57)*25 giftLabel:setSize(CCSizeMake(350,giftLabelheight)) mathheight=mathheight+giftLabelheight+20 giftLabel:setPosition(CCPointMake(220,mathheight)) giftbg:addChild(giftLabel) localtimeLabel=Label:create() timeLabel:setFontSize(18) timeLabel:setColor(ccc3(255,227,200)) timeLabel:setAnchorPoint(CCPointMake(0,1)) timeLabel:ignoreContentAdaptWithSize(false) timeLabel:setText(key) print("timeLabel:getStringLength()",timeLabel:getStringLength()) localtimeLabelheight=math.ceil(timeLabel:getStringLength()/30)*25 timeLabel:setSize(CCSizeMake(180,giftLabelheight)) timeLabel:setPosition(CCPointMake(25,mathheight)) giftbg:addChild(timeLabel) end ifmathheight<scollHeightthen giftbg:setPosition(CCPointMake(-302,-238+scollHeight-mathheight)) end giftbg:setContentSize(CCSizeMake(587,mathheight)) giftbg:setInnerContainerSize(CCSizeMake(587,mathheight)) UITools.setGameFont(this.widgetTable.tipsTouchBg,"FZCuYuan-M03S","fzcyt.ttf")end--全部奖æ±

面板functionthis.giftPanelshow() Log.i("PokerShakePanelgiftPanelshow") ifthis.widgetTable.tipsTouchBgthen Log.w("PokerShakePaneltipsTouchBgisexist,pleasecloseoldtipsTouchBg") return end localmainWidget=GUIReader:shareReader():widgetFromJsonFile(jsonPath.."tipsbg.json") ifnotmainWidgetthen Log.e("PokerShakePanelReadtipsbgWidgetFromJsonFileFail") return end --防止穿透bg localwinSize=CCDirector:sharedDirector():getWinSize() this.widgetTable.tipsTouchBg=tolua.cast(UIHelper:seekWidgetByName(mainWidget,"ScrollViewbg"),"ScrollView") this.widgetTable.tipsTouchBg:setSize(winSize) this.widgetTable.tipsTouchBg:setPosition(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setAnchorPoint(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setTouchEnabled(true) this.widgetTable.tipsTouchBg:removeFromParent() this.widgetTable.mainWidget:addChild(this.widgetTable.tipsTouchBg) --this.widgetTable.tipsTouchBg=touchBg localImage_panel=ImageView:create() Image_panel:loadTexture(imagePath.."bg_popup01.png") Image_panel:setPosition(CCPointMake(winSize.width/2,winSize.height/2)) this.widgetTable.tipsTouchBg:addChild(Image_panel) localImage_title=ImageView:create() Image_title:loadTexture(imagePath.."txt_qbjc.png") Image_title:setPosition(CCPointMake(-5,125)) Image_panel:addChild(Image_title) localButton_panelclose=Button:create() Button_panelclose:loadTextures(imagePath.."btn_close.png","","") Button_panelclose:setPosition(CCPointMake(313,170)) localfunctioninfoPanelclose_Clicked(sender,eventType) ifeventType==2then Log.d("infoPanelclose_Clicked") this.tipsPanelclose() endend ifButton_panelclosethen Button_panelclose:addTouchEventListener(infoPanelclose_Clicked) end Image_panel:addChild(Button_panelclose) localgiftbg=ScrollView:create() giftbg:setSize(CCSizeMake(587,340)) giftbg:setClippingType(1) giftbg:setPosition(CCPointMake(-302,-238)) giftbg:setAnchorPoint(CCPointMake(0,0)) giftbg:setEnabled(true) giftbg:setTouchEnabled(true) giftbg:setBounceEnabled(false) Image_panel:addChild(giftbg) localscollHeight=340 localmathheight=math.ceil(#this.dataTable.giftlist/5)*110 ifmathheight>scollHeightthen scollHeight=mathheight end giftbg:setContentSize(CCSizeMake(587,scollHeight)) giftbg:setInnerContainerSize(CCSizeMake(587,scollHeight)) fori=1,#this.dataTable.giftlistdo localgiftImage=ImageView:create() giftImage:loadTexture(imagePath.."giftpic/"..this.dataTable.giftlist[i].pic..".png") giftImage:setPosition(CCPointMake((i-1)%5*110+73,scollHeight-(math.floor((i-1)/5)*110+55))) --giftImage:setPosition(CCPointMake(0,0)) giftbg:addChild(giftImage) end UITools.setGameFont(this.widgetTable.tipsTouchBg,"FZCuYuan-M03S","fzcyt.ttf")end--获奖面板functionthis.getGiftPanelshow(shorttable) Log.i("PokerShakePanelgetGiftPanelshow") ifthis.widgetTable.tipsTouchBgthen Log.w("PokerShakePaneltipsTouchBgisexist,pleasecloseoldtipsTouchBg") return end localmainWidget=GUIReader:shareReader():widgetFromJsonFile(jsonPath.."tipsbg.json") ifnotmainWidgetthen Log.e("PokerShakePanelReadtipsbgWidgetFromJsonFileFail") return end --防止穿透bg localwinSize=CCDirector:sharedDirector():getWinSize() this.widgetTable.tipsTouchBg=tolua.cast(UIHelper:seekWidgetByName(mainWidget,"ScrollViewbg"),"ScrollView") this.widgetTable.tipsTouchBg:setSize(winSize) this.widgetTable.tipsTouchBg:setPosition(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setAnchorPoint(CCPointMake(0,0)) this.widgetTable.tipsTouchBg:setTouchEnabled(true) this.widgetTable.tipsTouchBg:removeFromParent() this.widgetTable.mainWidget:addChild(this.widgetTable.tipsTouchBg) --this.widgetTable.tipsTouchBg=touchBg localImage_panel=ImageView:create() Image_panel:loadTexture(imagePath.."bg_popup03.png") Image_panel:setPosition(CCPointMake(winSize.width/2,winSize.height/2)) this.widgetTable.tipsTouchBg:addChild(Image_panel) localButton_panelclose=Button:create() Button_panelclose:loadTextures(imagePath.."btn_close.png","","") Button_panelclose:setPosition(CCPointMake(323,179)) localfunctioninfoPanelclose_Clicked(sender,eventType) ifeventType==2then Log.d("infoPanelclose_Clicked") this.tipsPanelclose() endend ifButton_panelclosethen Button_panelclose:addTouchEventListener(infoPanelclose_Clicked) end Image_panel:addChild(Button_panelclose) localtopLabel=Label:create() topLabel:setPosition(CCPointMake(0,130)) topLabel:setText("厉害!ä½

在秒内摇了次") topLabel:setFontSize(24) topLabel:setColor(ccc3(255,247,196)) Image_panel:addChild(topLabel) localbottomLabel=Label:create() bottomLabel:setPosition(CCPointMake(0,80)) math.randomseed(tostring(os.time()):reverse():sub(1,7))--math.randomseed(this.dataTable.timestamp)localrandomx=math.random(1,2)localnameTable={{"长旺发动机","运财大神"},{"摇钱小马达","Go快达人"},{"快手全能旺","手速旺旺"},{"长寿拖拉机","贵仙人"}} localnametext=nameTable[1][randomx] iftonumber(this.dataTable.shakenum)>55then nametext=nameTable[1][randomx] elseiftonumber(this.dataTable.shakenum)>35then nametext=nameTable[2][randomx] elseiftonumber(this.dataTable.shakenum)>10then nametext=nameTable[3][randomx] else nametext=nameTable[4][randomx] end bottomLabel:setText("被封为:"..nametext) bottomLabel:setFontSize(22) bottomLabel:setColor(ccc3(255,247,196)) Image_panel:addChild(bottomLabel) localtimeLabel=Label:create() timeLabel:setPosition(CCPointMake(-35,130)) timeLabel:setText("08") timeLabel:setFontSize(34) timeLabel:setColor(ccc3(253,255,99)) Image_panel:addChild(timeLabel) localcountLabel=Label:create() countLabel:setPosition(CCPointMake(122,130)) countLabel:setText(tostring(this.dataTable.shakenum)) countLabel:setFontSize(34) countLabel:setColor(ccc3(253,255,99)) Image_panel:addChild(countLabel) --道具 localitemcount=#shorttable.itemlist fori=1,itemcountdo localgiftImage=ImageView:create() giftImage:loadTexture(imagePath.."giftpic/"..shorttable.itemlist[i].pic..".png") giftImage:setPosition(CCPointMake(600/(itemcount+1)*i-300,-15)) --giftImage:setPosition(CCPointMake(0,0)) Image_panel:addChild(giftImage) localitemLabel=Label:create() itemLabel:setPosition(CCPointMake(600/(itemcount+1)*i-300,-95)) itemLabel:setText(shorttable.itemlist[i].name) itemLabel:setFontSize(16) itemLabel:setColor(ccc3(240,212,128)) Image_panel:addChild(itemLabel) end --绘制分享图片 localbgRT=CCRenderTexture:create(834,500) ifshorttable.isbig==1then localshareSprite=CCSprite:create(imagePath.."bg_01.png") shareSprite:setPosition(ccp(417,250)) localshareSpritegift=CCSprite:create(imagePath.."giftpic/"..shorttable.itemlist[1].pic..".png") shareSpritegift:setPosition(ccp(417,250-15)) shareSpritegift:setScaleX(1.3) shareSpritegif

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论