|
- local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
- local MJMessage = MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
- local MJHandCardView = MJFramework.MJFrameworkClassImprot("mj_luzhougui.luaScript.Views.Game.luzhouguiHandCardView")
-
- local HandCardView = class("luzhouguiHandCardView_Coin", MJHandCardView)
-
- function HandCardView:ctor(viewId, desktopType)
- HandCardView.super.ctor(self, viewId, desktopType)
- end
-
- --发送出牌消息
- function HandCardView:sendOutCard()
- self.handOutCard = true--发送了出牌请求字段,此时收到出牌成功时如果在托管状态不创牌,否则会导致出一次牌,牌桌上有两张牌
- HandCardView.super.sendOutCard(self)
- --[[if not self.isOutCard or not self.touchMJ then return end
-
- local request = MJMessage.Card:new()
- request.card = self.touchMJ.value
- -- logE("LHQRecordView:setOutCardVisible"..table.tostring(request))
- self.ui:sendMsg(app.room, MJDefine.MJEvent.OutCard, request, function(status, response)
- logE("MJHandCardView sendOutCard() response = ", table.tostring(response))
- end)
-
- --音效
- local userInfo=app.room:getUserInfoByViewId(self.viewId)
- if userInfo then
- MJSound.PlayMJSound(userInfo.sex,request.card)
- end
-
-
- self:runOutCardAction(self.touchMJ.value)
- app.room:dispatchEvent({name = MJDefine.MJEvent.OutCardFalg,value=self.touchMJ.value,viewId=self.viewId})
- self:setOutCardEnable(false)
-
- --插牌
- if self.touchMJ==self.handCards[#self.handCards] then
- table.removeItem(self.handCards,self.touchMJ)
- self:resetHandCards()
- else
- table.removeItem(self.handCards,self.touchMJ)
- self:runInsertCardAction()
- end
-
-
- self.touchMJ:removeFromParent()
- self.touchMJ=nil
-
- app.room:dispatchEvent({name = MJDefine.MJEvent.SelectCard})
- app.room:dispatchEvent({name = MJDefine.MJEvent.ShowTing})
- self:setTing(false)
- app.room:resetTings()--]]
-
- --[[ if not self.isOutCard or not self.touchMJ then return end
- self:hideOperate()
- if self.touchMJ.status == MJDefine.MJStatus.Disable then return end
- local request = MJMessage.Card:new()
- request.card = self.touchMJ.value
- self.ui:sendMsg(app.room, MJDefine.MJEvent.OutCard, request, function(status, response)
- logE("MJHandCardView sendOutCard() response = ", table.tostring(response))
- end)
-
- self.touchMJ:restorePostion()
- self.touchMJ:setStatus(MJDefine.MJStatus.Normal)
- app.room:dispatchEvent({name = MJDefine.MJEvent.SelectCard})
- app.room:dispatchEvent({name = MJDefine.MJEvent.ShowTing})
- self.touchMJ = nil --]]
- end
-
- function HandCardView:removeTouchEventOnly()
- self:getEventDispatcher():removeEventListenersForTarget(self)
- end
-
- function HandCardView:setTing(b)
- if b and b == true and (not self:isCanOutCard()) then
- return
- end
- if self:isUseNew3D() then
- self._handcard:setTing(b)
- else
- for k,mj in pairs(self.handCards) do
- mj:setTing(b)
- end
- end
- end
-
- return HandCardView
|