local MJDefine=MJFramework.MJImport("mj.luaScript.MJDefine") -- 单局战绩单元Layout local MJZhanJiDanJuItem = class("MJZhanJiDanJuItem", cc.UIView) -- require("SanRenXingDef") --[[ jushu:局数 curJuShuData:每一个小局数据 totalRoomJuShuData:该房间所有的局数数据 ]] function MJZhanJiDanJuItem:ctor(jushu,curJuShuData,zhanjiInfo,fromClub) self.ui = loadUI("mj/res/ui/ui_zhanji/mj_dt_danju_zhanji_tiao.ui") self.curJuShuData = curJuShuData self.jushu = jushu self.zhanjiInfo = zhanjiInfo self.fromClub=fromClub if self.fromClub then self.protocolZhanJi = app.club_zhanji else self.protocolZhanJi = app:getProtocolZhanJi(app.gameId) end self:init() print(table.tostring(zhanjiInfo)) --self:bindEvent(self.protocolZhanJi , "getZhanJiDetailResponse" , handler(self , self.goToRecordView)); end function MJZhanJiDanJuItem:init() --回放 self.ui.Items.Button_replay:registerClick(handler(self, self.onClickRecord)) --时间 -- local time = os.date("%m-%d %H:%M",self.curJuShuData.endtime ) local time = os.date("%Y-%m-%d %H:%M",self.curJuShuData.endtime) self.ui.Items.Text_time:setText(time) --编号 self.ui.Items.Text_num:setText("第"..(self.jushu or 0).."局") -- 所有的玩家 local index=1 for uid, score in pairs(self.curJuShuData.score) do local playerInfo = app.playerInfoManager:getPlayerInfo(uid) if playerInfo then -- 名称 local name=playerInfo.name and getSubStringNickname(playerInfo.name) or "" self.ui.Items["name_"..index]:setText(name) end --分数 self.ui.Items["score_"..index]:setText(score) index=index+1 end for i=1,4 do if index-1 0 if self.curJuShuData.flag == MJDefine.StopFlag.STOP_FLAG_NORMAL then haveOper = true end end if not self.curJuShuData.user or not haveOper then showTooltip("游戏解散了") return end local MJRoomReplayView=MJFramework.MJImport("mj.luaScript.Views.Room.MJRoomReplayView") local view = MJRoomReplayView:new(self.curJuShuData) view:setAnchorPoint(cc.p(0.5, 0.5)) app:showWaitDialog(view) end) end --showTooltip("敬请期待") --self.isQuest = true --self.protocolZhanJi:getZhanJiDetail(self.totalRoomJuShuData.pid,self.curJuShuData.subid,self.curJuShuData.logid) end -- function MJZhanJiDanJuItem:goToRecordView() -- if not self.isQuest then -- return -- end -- self.isQuest = false -- local zhanjiInfo = self.protocolZhanJi.zhanjiInfoList[self.totalRoomJuShuData.pid] -- local detil=zhanjiInfo.detail[tostring(self.curJuShuData.turn)]["1"] -- detil.roomid=self.totalRoomJuShuData.roomid -- detil.nbound=self.totalRoomJuShuData.nbound -- print(table.tostring(detil)) -- local roomData = self.protocolZhanJi.roomData -- roomData.result.curCount = self.jushu -- roomData.result.totalCount = self.totalRoomJuShuData.nbound -- roomData.result.roomNum = self.totalRoomJuShuData.roomid -- local roomData = roomData.result -- logD("roomData:"..table.tostring(roomData)) -- if not roomData or not roomData.user then -- showPHPFailedResult("回放数据不存在") -- return -- end -- for k,v in pairs(roomData.user) do -- if not v.hand then -- showTooltip("游戏解散了") -- return -- end -- end -- local MJRoomReplayView=MJFramework.MJImport("mj.luaScript.Views.Room.MJRoomReplayView") -- local view = MJRoomReplayView:new(detil) -- -- app:gotoView(MJRoomReplayView:new(detil)) -- view:setAnchorPoint(cc.p(0.5, 0.5)) -- app:showWaitDialog(view) -- end return MJZhanJiDanJuItem