|
- local MJDefine = MJFramework.MJImport("mj.luaScript.MJDefine")
- local MJ = MJFramework.MJImport("mj.luaScript.Views.Game.MJ")
- local MJRoomDaJuView=MJFramework.MJImport("mj.luaScript.Views.Room.MJRoomDaJuView")
- local MJWanFa=MJFramework.ImportWanFa("luaScript.SubGameDefine.MaJiang.MJWanFa")
- local MJRoomXiaoJuView = MJFramework.MJFrameworkClassImprot("mj.luaScript.Views.Room.MJRoomXiaoJuView")
- local MJMessage=MJFramework.MJImport("mj.luaScript.Protocol.MJMessage")
-
- -- 房间设置界面
- local huamajiangRoomXiaoJuView = class("huamajiangRoomXiaoJuView", MJRoomXiaoJuView)
-
- local MJ_WIDTH=47
- --起始位置
- local MJ_HAND_CARD_INIT_X=130+50
- local MJ_HAND_CARD_INIT_Y=40
- local MJ_GROUP_CARD_INIT_X=100
- --麻将组间隔
- local MJ_GROUP_PADDING_X= 10
- --麻将直接间隔
- local MJ_PADDING_X=-3
- --胡牌麻将间隔
- local MJ_HU_X=8
- --暗杠上面的牌Y轴偏移量
- local GANG_OFFSET_Y=16
-
- function huamajiangRoomXiaoJuView:ctor(...)
- huamajiangRoomXiaoJuView.super.ctor(self,...)
- self.desktopType = MJDefine.DesktopType.TwoD
- end
-
- function huamajiangRoomXiaoJuView:loadUI()
- local ui = loadUI("mj_huamajiang/res/ui_fangjian/mj_huamajiang_xiaoju_jiesuan.ui")
- self.ui = ui
- self:addChild(ui)
- end
-
- function huamajiangRoomXiaoJuView:onEnter()
- huamajiangRoomXiaoJuView.super.onEnter(self)
-
- self:createTransparentFlowBtn()
- end
- ---
- -- 创建一个透明的流水按钮,查牌界面需要用到
- --
- function huamajiangRoomXiaoJuView:createTransparentFlowBtn()
-
- if self._btnFlow then
- return
- end
-
- self._btnFlow = cc.Layout:create()
- self._btnFlow:setSize(cc.size(77, 77))
- self._btnFlow:setAnchorPoint(cc.p(0.5, 0.5))
- self._btnFlow:setPosition(cc.p(1234, 354))
- self._btnFlow:registerClick(handler(self, self.onButtonFlowClicked))
-
- -- 需要调整位置,可反注释下面这句代码看效果
- -- self._btnFlow:setBackGroundColorType(cc.LayoutBackGroundColorType.solid);
- -- self._btnFlow:setBackGroundColor(cc.c3b(255, 0, 0))
-
- self.ui.Items.Layout_Sure:addChild(self._btnFlow)
- end
- ---
- -- 透明按钮点击事件,打开流水之口
- --
- function huamajiangRoomXiaoJuView:onButtonFlowClicked()
- logD("huamajiangRoomXiaoJuView:onButtonFlowClicked")
- playBtnEffect();
-
- local request = MJMessage.GameFlowReq:new()
- request.nUserId = app.room:getMyUserId()
- self.ui:sendMsg(app.room, MJDefine.MJEvent.ReqFlowInfo, request)
-
- --app.room:dispatchEvent({name = MJDefine.MJEvent.EVENT_BTN_SHOW_FLOW_VIEW_CLICKED, response = nil});
- end
-
- function huamajiangRoomXiaoJuView:initPlayerView()
- local roomInfo=app.room.roomInfo
- self.ui.Items.Layout_Player:removeAllChildren()
-
- self.items={}
-
- for k,v in pairs(roomInfo.memberList) do
- --local i = v.nSeatId+1
- local userId = app.room:getViewIdByUserId(v.nUserId)
- local nSeatId = app.room:getSeatIdByViewId(userId)
- local i = nSeatId+1
- local item=self:createPlayerItem()
- item.index = i;
- self:setPlayerItemInfo(item,v)
- self.items[i]=item
- -- table.insert(self.items,)
- end
-
- table.sort(self.items, function(a, b)
- return a.index < b.index;
- end);
-
- for k, v in pairs(self.items or {}) do
- self.ui.Items.Layout_Player:addChild(self.items[k])
- end
- end
-
- function huamajiangRoomXiaoJuView:createPlayerItem()
- local ui=loadUI("mj_huamajiang/res/ui_fangjian/mj_huamajiang_xiaoju_item.ui")
- autoAdapt(ui)
- return ui
- end
-
- function huamajiangRoomXiaoJuView:setPlayerItemInfo(ui,player)
- local roomInfo=app.room.roomInfo
- local resultInfo=roomInfo.memberList
-
- local nodeBg = ui.Items["ImageView_ItemBg"]
- -- local nodeBg2 = ui.Items[bg2]
- -- local nodeLose = self.ui.Items[lose]
- local nodeHead = ui.Items["ImageView_Head"]
- local nodeName = ui.Items["Text_Name"]
- local nodeBenJu = ui.Items["TextBMFont_Score"]
- local bmFontScore = true
- if not nodeBenJu then
- nodeBenJu = ui.Items["Text_Score"]
- bmFontScore = false
- end
- local nodeHu = ui.Items["ImageView_Hu"]
- local nodeBanker= ui.Items["ImageView_Banker"]
- local nodeResult= ui.Items["Text_ResultInfo"]
- local btnDetail = ui.Items["Button_Detail"];
- local imgViewId = ui.Items["ImageView_ViewId"];
-
- btnDetail:registerClick(function ()
- local roomInfo = app.room.roomInfo;
- local data = {};
- local allPlayerScoreInfo = roomInfo.allPlayerScoreInfo;
- local luoboCards = roomInfo:getLuoBoCards();
- luoboCards = roomInfo:getLuoBoCardsSummary(luoboCards)
- data.luoboCards = luoboCards;
-
- if allPlayerScoreInfo[player.nUserId] then
- local scoreData = {};
- for k, v in ipairs(allPlayerScoreInfo[player.nUserId]) do
- table.insert(scoreData, json.decode(v));
- end
- data.detail = scoreData
- app.room:dispatchEvent({name = MJDefine.MJEvent.EVENT_BTN_SHOW_FLOW_VIEW_CLICKED, response = data});
- else
- local request = MJMessage.GameFlowReq:new()
- request.nUserId = player.nUserId
- self.ui:sendMsg(app.room, MJDefine.MJEvent.ReqFlowInfo, request)
- end
-
- -- local roomInfo = app.room.roomInfo;
- -- local data = {};
- -- local scoreInfo = player.scoreInfo;
- -- local luoboCards = roomInfo:getLuoBoCards();
-
- -- luoboCards = roomInfo:getLuoBoCardsSummary(luoboCards)
-
- -- local scoreData = {};
- -- for k, v in ipairs(scoreInfo) do
- -- table.insert(scoreData, json.decode(v));
- -- end
-
- -- data.detail = scoreData
- -- data.luoboCards = luoboCards;
-
- -- app.room:dispatchEvent({name = MJDefine.MJEvent.EVENT_BTN_SHOW_FLOW_VIEW_CLICKED, response = data});
- end);
- local viewOrder = player.nSeatId + 1;
- imgViewId:loadTexture(string.format("mj_huamajiang/res/zy_fangjian/player/huamajiang_seat_%s.png", viewOrder));
- --[[local huType = {
- [1] = "自摸(",
- [2] = "接炮(",
- [3] = "抢杠胡(",
- }--]]
- --[[local infoTab = {
- ["agang"] = "暗杠(x",
- ["bgang"] = "补杠(x",
- ["diangang_cnt"] = "点杠(x",
- ["mgang"] = "明杠(x",
- }--]]
- local color = (app.room:getMyUserId() == player.nUserId) and cc.c3b(255,243,176) or cc.c3b(230,192,117);
- local infoStr = self:setHuType(player.nUserId)
- nodeResult:setText(infoStr)
- nodeResult:setColor(color);
-
-
- local userInfo = app.room:getUserInfo(player.nUserId)
-
- --先设置默认头像
- local width = nodeHead:getContentSize().width
-
- local nickname = ""
- if userInfo and userInfo.nickname then
- nickname = getSubStringNickname(userInfo.nickname)
- self:updateUserHead(nodeHead,player.nUserId, userInfo.sex, userInfo.headimgurl);
- end
-
- nodeName:setText(nickname)
-
- nodeHu:setVisible(false)
- if table.nums(player.huCards) > 0 then
- nodeHu:setVisible(true)
- nodeHu:loadTexture("mj_huamajiang/res/zy_fangjian/operate/huamajiang_effect_hu.png")
- end
-
- --黄庄才会查叫和查花猪
- if roomInfo:getStopFlag() == MJDefine.StopFlag.STOP_FLAG_HUANG_ZHUANG then
- if table.nums(player.huCards) <= 0 then
- if player.isDj == 1 then
- nodeHu:loadTexture("mj/res/ui/zy_fangjian/operate/mj_effect_chajiao.png")
- nodeHu:setVisible(true)
- nodeHu:setScale(0.4)
- end
- end
- end
-
- local bankSeatId = roomInfo:getBankSeatId();
- if app.room:getUserIdBySeatId(bankSeatId) ~= player.nUserId then
- nodeBanker:setVisible(false)
- end
-
- if app.room:getMyUserId() == player.nUserId then
- nodeBg:loadTexture("xj_my_bg.png",cc.TextureResType.plistType)
- --[[else
- nodeBg:loadTexture("xj_other_bg.png",cc.TextureResType.plistType)--]]
- end
-
- if tonumber(player.nTurnScore) > 0 then
- nodeBenJu:setText("+"..player.nTurnScore)
- else
- nodeBenJu:setText(player.nTurnScore)
- if tonumber(player.nTurnScore) < 0 and bmFontScore == true then
- nodeBenJu:setFntFile("res/fonts/dt_jian_num.fnt")
- end
- end
-
- -- --番数
- ui.Items.Text_FanShu:setVisible(false);
- -- ui.Items.Text_FanShu:setText(player.fanshu.."番")
-
- --[[ local viewId = app.room:getViewIdByUserId(player.nUserId)
- if viewId and viewId>0 and viewId<=4 then
- if viewId == 4 then
- ui.Items.ImageView_Pos:loadTexture("result_pos_0.png",1)
- else
- ui.Items.ImageView_Pos:loadTexture(string.format("result_pos_%d.png", viewId), 1)
- end
-
- else
- ui.Items.ImageView_Pos:setVisible(false)
- end--]]
- --现在是飘
- ui.Items.ImageView_Pos:setVisible(player.isPiao==1)
- end
-
- function huamajiangRoomXiaoJuView:setHuType(userId)
- do
- -- 暂时不走这个方法
- return "";
- end
- local roomInfo = app.room.roomInfo
- local strGameInfo = roomInfo:getGameRule();
- local str = ""
- local huType1 = {
- [1] = "自摸(",
- [2] = "接炮(",
- [3] = "抢杠胡(",
- }
- local huOrder1 = 0
- local player = roomInfo.memberList[userId]
- if player then
-
- huOrder1 = player.huOrder
- --胡牌顺序
- if player.result == MJDefine.MJGameHuType.HU_ZIMO then
- local huNum = 0
- --快速成局时,strGameInfo.playnum默认传来的是4人
- if strGameInfo.isfaststart == 1 then
- huNum = roomInfo:getMaxPlayerCount() - player.huOrder
- else
- huNum = strGameInfo.playnum - player.huOrder
- end
- str = str..huType1[player.result]..huNum.."家) "
- elseif player.result == MJDefine.MJGameHuType.HU_DIANPAO or player.result == MJDefine.MJGameHuType.HU_QIANGGANG then
- local viewId = app.room:getViewIdBySeatId(player.dpSeatId)
- local userInfo = app.room:getUserInfoByViewId(viewId)
- local nickname = getSubStringNickname(userInfo.nickname)
- str = str..huType1[player.result]..nickname..") "
- end
- --牌型
- -- for k,v in pairs(MJDefine.MJGamePaiType) do
- -- local newType = self:_and(player.huType,v)
- -- if self:_and(player.huType,v) ~= 0 then
- -- local newType = self:_and(player.huType,v)
- -- str = str..MJDefine.MJGameHuStr[newType].." "
- -- end
- -- end
- str = str .. self:getPaiTypeStr(player)
- if player.result > 0 or player.huType > 0 then
- if player.isPiao == 1 then
- str = str.."飘".." "
- end
- if player.luoboNum > 0 then
- str = str.."萝卜x"..player.luoboNum.." "
- end
- else
- if player.isPiao == 1 then
- str = str.."飘".." "
- end
- if player.isBaoPai == 1 then
- str = str.."报叫".." "
- elseif player.isBaoPai == 2 then
- str = str.."博自摸".." "
- end
- end
- local ganginfo = json.decode(player.ganginfo)
- if ganginfo then
- if ganginfo.agang then
- str = str.."暗杠x"..ganginfo.agang.." "
- end
- if ganginfo.mgang then
- str = str.."明杠x"..ganginfo.mgang.." "
- end
- if ganginfo.bgang then
- str = str.."巴杠x"..ganginfo.bgang.." "
- end
- if ganginfo.dgang then
- str = str.."点杠x"..ganginfo.dgang.." "
- end
- if ganginfo.guogang then
- str = str.."过手杠x"..ganginfo.guogang.." "
- end
- end
- end
- return str
- end
-
- --合并牌型得到最终的字符串
- function huamajiangRoomXiaoJuView:getPaiTypeStr(player)
- local strTab = {}
- -- 花麻将没有huType
- -- for k,v in pairs(MJDefine.MJGamePaiType) do
- -- local newType = self:_and(player.huType,v)
- -- if newType ~= 0 then
- -- table.insert(strTab,MJDefine.MJGameHuStr[newType] or "")
- -- end
- -- end
-
- -- if player.result > 0 or player.huType > 0 then
- -- if player.genCount > 0 then
- -- table.insert(strTab,player.genCount.."归")
- -- end
- -- end
- dump(strTab)
- --logD(table.toString(strTab))
- for _,v in pairs(MJDefine.MJGameHuMargeTab) do
- local list = v.tab
- local str = v.name
- dump(list)
- local indexs= {}
- for _,v in pairs(list) do
- local index = table.indexOf(strTab, v)
- if index~= -1 then
- table.insert(indexs,index)
- end
- end
- if #indexs == #list then --如果都找到则合并
- for k,v in pairs(list) do
- table.removeItem(strTab,v)
- end
- -- logD(str)
- table.insert(strTab,str)
- end
- end
-
- local info = ""
- for k,v in pairs(strTab) do
- info = info..v.." "
- end
- return info
- end
-
- function huamajiangRoomXiaoJuView:createHandCards(layer,arg,seatId)
- for k,v in pairs(arg) do
- local mj=MJ:new(v.card,MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
- layer:addChild(mj)
- self:checkIsLuoBo(mj)
- mj:setPosition(cc.p(self.initX[seatId],MJ_HAND_CARD_INIT_Y))
- self.initX[seatId]=self.initX[seatId]+mj:getContentSize().width+MJ_PADDING_X
- end
- end
-
- function huamajiangRoomXiaoJuView:createHuCard(layer,card,seatId)
- local mj=MJ:new(card,MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
- self:checkIsLuoBo(mj)
- layer:addChild(mj)
- mj:setPosition(cc.p(self.initX[seatId],MJ_HAND_CARD_INIT_Y))
- self.initX[seatId]=self.initX[seatId]+mj:getContentSize().width+MJ_PADDING_X
-
- local flag = cc.Sprite:create("mj/res/ui/zy_fangjian/mj_hu_flag.png")
- mj:addChild(flag)
- flag:setPosition(cc.p(16,55))
- end
-
-
- function huamajiangRoomXiaoJuView:createChi(values)
- local node=cc.Layer:create()--Color:create(cc.c4b(255,0,0,255))
- node:setAnchorPoint(cc.p(0.5,0.5))
- node:ignoreAnchorPointForPosition(false)
- local width=0
- local height=0
-
- for i=1,3 do
- if values[i] then
- local mj = MJ:new(values[i],MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
- if i == 1 then
- self:checkIsLuoBo(mj)
- end
- node:addChild(mj)
- local mjWidth=mj:getContentSize().width
- local mjHeight=mj:getContentSize().height
- local x=mjWidth/2+(i-1)*(mjWidth+MJ_PADDING_X)
- local y=mjHeight/2
- width=width+mjWidth
- height=mjHeight
- mj:setPosition(x,y)
- end
- end
- node:setContentSize(cc.size(width,height))
- return node
- end
-
- function huamajiangRoomXiaoJuView:createGang(values, cardNum)
- local node=cc.Layer:create()--Color:create(cc.c4b(255,0,0,255))
- node:setAnchorPoint(cc.p(0.5,0.5))
- node:ignoreAnchorPointForPosition(false)
- local width=0
- local height=0
- for i=1,4 do
- if values[i] then
- local mj = MJ:new(values[i],MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
- if i == 1 then
- self:checkIsLuoBo(mj)
- end
- node:addChild(mj)
- local mjWidth=mj:getContentSize().width
- local mjHeight=mj:getContentSize().height
-
- if i <= 3 then
- local x=mjWidth/2+(i-1)*(mjWidth+MJ_PADDING_X)
- local y=mjHeight/2
- width=width+mjWidth
- height=mjHeight
- mj:setPosition(x,y)
- else
- local x = mjWidth/2+(2-1)*(mjWidth+MJ_PADDING_X)
- local y=mjHeight/2 + 12
- height = mjHeight
- mj:setPosition(x,y)
- mj:refreshCardNum(cardNum);
- end
- mj:setTag(1000 + i);
- end
- end
- node:setContentSize(cc.size(width,height))
- return node
- end
-
- function huamajiangRoomXiaoJuView:createAnGang(values, cardNum)
- local node=cc.Layer:create()--Color:create(cc.c4b(255,0,0,255))
- node:setAnchorPoint(cc.p(0.5,0.5))
- node:ignoreAnchorPointForPosition(false)
- local width=0
- local height=0
- for i=1,4 do
- if values[i] then
- local mj
- if i <= 3 then
- mj=MJ:new(0,MJDefine.MJType.OutBlack,MJDefine.MyViewId,self.desktopType)
- if self.desktopType == MJDefine.DesktopType.TwoD or self.desktopType == MJDefine.DesktopType.TwoDGold then
- mj:setAutoSize(false)
- mj:setSize(cc.size(44,68))
- end
- else
- mj=MJ:new(values[i],MJDefine.MJType.Out,MJDefine.MyViewId,self.desktopType)
- mj:refreshCardNum(cardNum);
- end
- node:addChild(mj)
-
- local offsetY = 0;
-
- local mjWidth=mj:getContentSize().width
- local mjHeight=mj:getContentSize().height
- if i <= 3 then
- local x=mjWidth/2+(i-1)*(mjWidth+MJ_PADDING_X) + 4
- local y=mjHeight/2 + 4 - offsetY
- width=width+mjWidth
- height=mjHeight
- mj:setPosition(x,y)
- else
- local x=mjWidth/2+(2-1)*(mjWidth+MJ_PADDING_X) + 2
- local y=mjHeight/2 + 10 + 2 - offsetY
- height=mjHeight
- mj:setPosition(x, y);
- end
- if i == 1 then
- local luoboCount = app.room.roomInfo:getLuoBoCardCount(values[i]);
- mj:setLuoBoVisible(luoboCount > 0, luoboCount);
- end
- end
- end
- node:setContentSize(cc.size(width,height))
- return node
- end
-
- function huamajiangRoomXiaoJuView:createBaGang(values, cardNum)
- local node = self:createGang(values, cardNum);
- local mj = node:getChildByTag(1000 + 4);
- if mj then
- mj:setOutBlackImage(0, MJDefine.MyViewId);
- end
- return node;
- end
-
- -- function huamajiangRoomXiaoJuView:createAnGang(values)
- -- local node=cc.Layer:create()--Color:create(cc.c4b(255,0,0,255))
- -- node:setAnchorPoint(cc.p(0.5,0.5))
- -- node:ignoreAnchorPointForPosition(false)
- -- local width=0
- -- local height=0
- -- for i=1,4 do
- -- if values[i] then
- -- local mj
- -- if i <= 3 then
- -- mj=MJ:new(values[i],MJDefine.MJType.OutBlack,MJDefine.MyViewId,self.desktopType)
- -- else
- -- mj=MJ:new(values[i],MJDefine.MJType.Out,MJDefine.MyViewId)
- -- end
- -- self:checkIsLuoBo(mj)
- -- node:addChild(mj)
- -- local mjWidth=mj:getContentSize().width
- -- local mjHeight=mj:getContentSize().height
- -- local x=mjWidth/2+(i-1)*(mjWidth+MJ_PADDING_X)
- -- local y=mjHeight/2
- -- width=width+mjWidth
- -- height=mjHeight
- -- mj:setPosition(x,y)
- -- end
- -- end
- -- node:setContentSize(cc.size(width,height))
- -- return node
- -- end
-
- function huamajiangRoomXiaoJuView:createGroupCards(layer,arg,seatId)
- local handlers={
- [MJDefine.MJGroupType.Chi]=handler(self,self.createChi),
- [MJDefine.MJGroupType.Peng]=handler(self,self.createChi),
- [MJDefine.MJGroupType.Gang]=handler(self,self.createGang),
- [MJDefine.MJGroupType.AnGang]=handler(self,self.createAnGang),
- [MJDefine.MJGroupType.BaGang] = handler(self, self.createBaGang),
- }
-
- for k,v in pairs(arg) do
- if handlers[v.opType] then
- local group=handlers[v.opType](v.values, v.cardNum)
- local w=(group:getContentSize().width-MJ_WIDTH)/2
- group:setPosition(cc.p(self.initX[seatId]+w,MJ_HAND_CARD_INIT_Y))
- if k<#arg then
- self.initX[seatId]=self.initX[seatId]+group:getContentSize().width+MJ_GROUP_PADDING_X
- else
- self.initX[seatId]=self.initX[seatId]+group:getContentSize().width+MJ_GROUP_PADDING_X
- end
- layer:addChild(group)
- end
- end
- end
-
- -- 获取组合牌组
- function huamajiangRoomXiaoJuView:getChangeGruopDatas(g)
- -- dump(g, "getChangeGruopDatas")
- local opType=MJDefine.MJOperateToGroupType[g.opType]
- local showType=MJDefine.MJOperateToGroupType[g.opType]
- local opCard=g.opCard
- local cardNum = g.cardNum
- local fromViewId = nil
- local targetSeatId = g.targetSeatId--操作位置座位号
- local fromUserId = g.opUserId or g.fromUserId --触发操作玩家
- if fromUserId<=0 or targetSeatId==nil then
- else
- fromViewId = app.room:transPos( targetSeatId, app.room:getSeatIdByUserId(fromUserId))
- --判断是否是对面玩家,对面玩家的话要做一次翻转
- local opViewId = app.room:getViewIdBySeatId(targetSeatId)
- if opViewId == 2 then --对面
- if fromViewId==1 then fromViewId = 3
- elseif fromViewId==3 then fromViewId = 1 end
- end
- --三人玩只有上下家
- if app.room:getMaxPlayerCount()==3 and fromViewId==2 then fromViewId = 3 end
- if app.room:getMaxPlayerCount()==2 and fromViewId~=0 then
- if showType == MJDefine.MJGroupType.Peng then
- fromViewId = 2
- else
- fromViewId = 4
- end
- end
- end
- --组合一下牌
- local group={
- opType=opType,
- showType=showType,
- values={},
- opCard = opCard,
- cardNum = cardNum,
- fromViewId = fromViewId
- }
- if MJDefine.MJGroupType.Chi==showType then
- elseif MJDefine.MJGroupType.Peng==showType then
- group.values={opCard,opCard,opCard}
- else
- group.values={opCard,opCard,opCard,opCard}
- end
-
- return group
- end
-
-
- function huamajiangRoomXiaoJuView:initWeaveCard()
- local roomInfo=app.room.roomInfo
- self.initX={}
- for k,v in pairs(roomInfo.memberList) do
- local userId = app.room:getViewIdByUserId(v.nUserId)
- local nSeatId = app.room:getSeatIdByViewId(userId)
- local i = nSeatId+1
- local groups={}
- for _, group in pairs(v.operates) do
- table.insert(groups, self:getChangeGruopDatas(group))
- end
- self.initX[i]=MJ_HAND_CARD_INIT_X
- self:createGroupCards(self.items[i].Items.Layout_Player,groups,i)
- self.initX[i] = self.initX[i]
- self:createHandCards(self.items[i].Items.Layout_Player,v.handCards,i)
- -- 花麻将不需要显示胡的牌
- -- --创建胡的牌
- -- if v.huCard and v.huCard ~= 0 then
- -- self.initX[i]=self.initX[i]+MJ_HU_X
- -- self:createHuCard(self.items[i].Items.Layout_Player,v.huCard,i)
- -- -- self:createHandCards(self.items[i].Items.Layout_Player,{{card=v.huCard}},i)
- -- end
- end
- end
-
- function huamajiangRoomXiaoJuView:initOther()
- local roomInfo = app.room.roomInfo
-
- self.ui.Items.Text_Round:setText("局数:"..roomInfo.nGameStartCount..'/'..roomInfo.nTotalGameNum)
-
- --规则
- local ruleAll = MJWanFa.getWanFaInfo(roomInfo:getStrGameInfo())
- -- self.ui.Items.Text_Rule:setText(ruleAll)
-
- local item = self.ui.Items.Text_Rule:getCopied()
- item:setVisible(true)
- item:setText(ruleAll)
-
- self.ui.Items.ListView:addChild(item)
- self.ui.Items.ListView:hideAllBar()
- self.ui.Items.ListView:getInnerContainer():setAutoSize(true)
- self.ui.Items.ListView:requestDoLayout();
- self.ui.Items.ListView:doLayout();
-
- --时间
- self.ui.Items.Text_Time:setText(os.date("%m-%d %X"))--(getTimeString())
- --房号
- self.ui.Items.Text_RoomNum:setText("房号:" .. roomInfo:getShowTableId());
-
- if roomInfo:getStopFlag() == MJDefine.StopFlag.STOP_FLAG_HUANG_ZHUANG then
- self.ui.Items.ImageView_Title:loadTexture("xj_liuju.png",cc.TextureResType.plistType)
- end
- end
-
- -- function huamajiangRoomXiaoJuView:d2b(arg)
- -- self.data32={}
- -- for i=1,32 do
- -- self.data32[i]=2^(32-i)
- -- end
- -- local tr={}
- -- for i=1,32 do
- -- if arg >= self.data32[i] then
- -- tr[i]=1
- -- arg=arg-self.data32[i]
- -- else
- -- tr[i]=0
- -- end
- -- end
- -- return tr
- -- end
-
- -- function huamajiangRoomXiaoJuView:b2d(arg)
- -- local nr=0
- -- for i=1,32 do
- -- if arg[i] ==1 then
- -- nr=nr+2^(32-i)
- -- end
- -- end
- -- return nr
- -- end
-
- -- function huamajiangRoomXiaoJuView:_and(a,b)
- -- local op1=self:d2b(a)
- -- local op2=self:d2b(b)
- -- local r={}
-
- -- for i=1,32 do
- -- if op1[i]==1 and op2[i]==1 then
- -- r[i]=1
- -- else
- -- r[i]=0
- -- end
- -- end
- -- local c = self:b2d(r)
- -- return c
-
- -- end
- --[[
- 检查是否萝卜牌
- ]]
- function huamajiangRoomXiaoJuView:checkIsLuoBo(mj)
- if not mj then return end
- local count = app.room:getLuoBoCardCount(mj.value) or 0;
- mj:setLuoBoVisible(count > 0, count)
- end
-
- function huamajiangRoomXiaoJuView:onBtnSureClicked()
- if app.room.roomInfo:getStopFlag() == MJDefine.StopFlag.STOP_FLAG_DISBAND_GAME then
- huamajiangRoomXiaoJuView.super.onClickZongJieSuan(self)
- else
- huamajiangRoomXiaoJuView.super.onBtnSureClicked(self)
- end
- end
-
- return huamajiangRoomXiaoJuView
|