|
- local PKDef = PKFramework.PKImport("pk_base.luaScript.PKDef")
- local PKFuc = PKFramework.PKImport("pk_base.luaScript.PKFunctions")
- local PKAnimationCompnent=PKFramework.PKImport("pk_base.luaScript.Views.Component.PKAnimationCompnent")
- local PKSound = PKFramework.PKImport("pk_base.luaScript.PKSound")
- local PKRoomView = PKFramework.PKFrameworkClassImprot("pk_base.luaScript.Views.Room.PKRoomView")
- local bzpRoomView = class("bzpRoomView", PKRoomView)
-
- function bzpRoomView:ctor()
- bzpRoomView.super.ctor(self)
- end
-
- function bzpRoomView:onEnter()
- bzpRoomView.super.onEnter(self)
- end
-
- function bzpRoomView:onExit()
- bzpRoomView.super.onExit(self)
- self:cleanCache() -- jxtd 记得验证是否要删除
- end
-
- -- 清理缓存,用于测试
- function bzpRoomView:cleanCache()
- local preload = package.loaded
- for k, v in pairs(package.loaded or {}) do
- local res1 = string.find( k, "pk_banzipao.luaScript") or 0
- if res1 > 0 then
- package.loaded[k] = nil
- end
- end
- end
-
- function bzpRoomView:initBaseNode()
- bzpRoomView.super.initBaseNode(self)
- if PKFuc.getIsForbidChat() then
- if self.toolView.chatView then
- self.toolView.chatView:setBtnFaceVisible(false)
- end
- end
- end
-
- function bzpRoomView:loadTextureCache()
- bzpRoomView.super.loadTextureCache(self)
-
- --
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_Bzp.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_GL.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_GT.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_QD.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_SZ.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_TP.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_ZD.plist")
- loadSpriteFrameFile("pk_base/res/ui/zy_fangjian/ani/pkAni_BJ.plist")
- end
-
- function bzpRoomView:initGameButton()
- self.ui.Items.Layout_Touch:registerClick(function ()
- if not self.toolView.ui.Items.Button_Menu:isBright() then
- self.toolView:onClickMenu()
- end
- self:BanlanceAllCard()
- if app.room.roomInfo.nStatus == PKDef.ReconnectState.GAME_STATUS_PLAYING then
- if self.operationView:ChoiceViewIsVisible() then
- self.operationView:setOperatorPanelView(true,self.outCardOpType)
- end
- self.operationView:setChoiceCardView(false)
- end
- end)
- end
-
- -- 重写发牌动画
- function bzpRoomView:showGetCardAni(onEnd)
- local screenWidth = getWinSize().width;
- local max = table.nums(self.handCardItem)
- local function secondAction(idx)
- local index2 = 0;
- local idx = idx
- local j = idx
- -- for j = max,1,-1 do
- local card = self.handCardItem[j];
- local seq2 = cc.Sequence:create(cc.DelayTime:create(0.04),
- cc.CallFunc:create(function ()
- PKFuc.logCard(card.value);
- local fileName = PKFuc.getPKCardImgByValue(card.value);
- card:loadTextureFromPlist(fileName);
- end),
- cc.CallFunc:create(function ()
- index2 = index2 + 1;
- if idx == max then
- logD("only do once!")
- --注册点击
- self:registerCardTouch();
- --排序
- self:RankCard();
- if app.room.roomInfo.playerList then
- for k,v in pairs(app.room.roomInfo.playerList) do
- local nUserID = v.nUserId
- local viewId = app.room:getViewIdByUserId(nUserID)
- --显示剩余牌
- self.PlayerView:setLeftCardNum(viewId,true,self.leftCardNum[viewId])
- end
- end
- if onEnd then
- onEnd();
- end
- end
- end)
- )
- card:getParent():runAction(seq2);
- -- end
- end
-
- local index = 0;
- for i = 1, max do
- local card = self.handCardItem[i];
- card:getParent():setOpacity(0);
- local srcPos = card:getParent():getPosition();
-
- local fileName = PKFuc.getPKCardImgByValue(0xff);
- card:loadTextureFromPlist(fileName);
- card:getParent():setPositionX(screenWidth + 300);
-
- local spawn = cc.Spawn:create(cc.FadeIn:create(0.13), cc.MoveTo:create(0.07, srcPos));
- local seq = cc.Sequence:create(cc.DelayTime:create(0.025 * i), cc.CallFunc:create(function ()
- PKSound.PlayGetCard()
- end),spawn,cc.CallFunc:create(function ()
- index = index + 1
- -- if index == max then
- logD("first action only do once!")
- secondAction(i);
- -- end
- end));
- card:getParent():runAction(seq);
- end
- end
-
- return bzpRoomView
|