|
- --
- -- xx : 2018 3 27
- -- 跑得快战绩单轮详情界面
-
- local PdkDef = require("luaScript.SubGameDefine.Poker.luzhouPdkWanFa")
-
- local PdkDanJuItem = class("PdkDanJuItem")
-
- -- lunshuInfo : 轮数的意思是,一个房间里面会打多局,可能因为流局的原因,某一局要打多轮
- -- 标记是否来自俱乐部的作用是:在获取回放数据的时候,确定是使用俱乐部的协议还是子游戏的协议
- function PdkDanJuItem:ctor(lunshuInfo, isFromClub)
- -- 本局详细信息
- self.lunshuInfo = lunshuInfo;
- -- 是否来自俱乐部
- self.isFromClub = isFromClub;
- self.ui = loadUI("pk_luzhoupdk/res/ui/ui_zhanji/ui_lzpdk_zhanji_danju_item.ui")
- self.txtScores = {}
- for i=1,4 do
- local scoreLayout = self.ui.Items["Layout_player_score_"..i]
- scoreLayout:setVisible(false)
- self.txtScores[i] = self.ui.Items["Text_score_"..i]
- self.txtScores[i]:setString("")
- end
- self:loadData()
-
- self.ui.Items.Button_share:setVisible(false)
- -- self.ui.Items.Button_detail:setVisible(false)
- self.ui.Items.Button_detail:registerClick(handler(self , self.onClickButtonDetail))
- end
-
- function PdkDanJuItem:loadData()
- self.ui.Items.Text_xuhao:setString(string.format("%d", self.lunshuInfo.idx))
- self.ui.Items.Text_time:setString(os.date("%m-%d %H:%M:%S", self.lunshuInfo.endtime))
- if self.lunshuInfo.flag and (self.lunshuInfo.flag == 8 or self.lunshuInfo.flag == 9) then
- self.ui.Items.ImageView_Flag:setVisible(true)
- else
- self.ui.Items.ImageView_Flag:setVisible(false)
- end
- local endFlag = self.lunshuInfo.flag
- local jiesanInfo
- if self.lunshuInfo.ext and self.lunshuInfo.ext.disbandStatus then
- jiesanInfo = self.lunshuInfo.ext.disbandStatus
- end
- local count = 0
- local scoreCount = table.nums(self.lunshuInfo.score)
- for uid,score in pairs(self.lunshuInfo.score) do
- count = count + 1
- if score>0 then
- self.txtScores[count]:setFntFile("res/fonts/zhanji_win.fnt")
- self.txtScores[count]:setString(string.format("+%d", score))
- else
- self.txtScores[count]:setFntFile("res/fonts/zhanji_lose.fnt")
- self.txtScores[count]:setString(string.format("%d", score))
- end
-
- --昵称
- local playerInfo = app.playerInfoManager:getPlayerInfo(uid);
- if playerInfo then
- local len = string.len(playerInfo.name)
- if len == 0 then
- playerInfo.name = "未知昵称"
- end
- playerInfo.name = getSubStringNickname(playerInfo.name)
- local nameNode = string.format("Text_player_name_%d",count)
- self.ui.Items[nameNode]:setText(playerInfo.name)
- end
-
- local jsNameNode = string.format("Text_jiesanInfo_%d",count)
- local jsItemNode = self.ui.Items[jsNameNode]
- if endFlag == 9 and jiesanInfo then
- jsItemNode:setVisible(true)
- if jiesanInfo[uid] and jiesanInfo[uid] == 0 then
- jsItemNode:setText("超时解散")
- jsItemNode:setColor(cc.c3b(0,255,0))
- elseif jiesanInfo[uid] and jiesanInfo[uid] == 1 then
- jsItemNode:setText("申请解散")
- jsItemNode:setColor(cc.c3b(255,0,0))
- elseif jiesanInfo[uid] and jiesanInfo[uid] == 2 then
- jsItemNode:setText("同意解散")
- jsItemNode:setColor(cc.c3b(0,255,0))
- elseif jiesanInfo[uid] and jiesanInfo[uid] == 3 then
- jsItemNode:setText("拒绝解散")
- end
- elseif endFlag == 8 then--系统解散
- jsItemNode:setVisible(true)
- jsItemNode:setText("系统解散")
- jsItemNode:setColor(cc.c3b(255,0,0))
- else
- jsItemNode:setVisible(false)
- end
-
- local scoreLayout = self.ui.Items["Layout_player_score_"..count]
- scoreLayout:setSize(cc.size(1028/scoreCount,90))
- scoreLayout:setVisible(true)
- end
- end
-
- function PdkDanJuItem:getRoot()
- return self.ui
- end
-
- function PdkDanJuItem:onEnter()
- PdkDanJuItem.super.onEnter()
- end
-
- function PdkDanJuItem:onExit()
- end
-
- function PdkDanJuItem:onClickButtonDetail( sender )
- playBtnEffect()
- --[[if self.lunshuInfo.flag == 9 then
- showTooltip("本局提前解散")
- return
- end--]]
- local protocolZhanJi
- if self.isFromClub then
- protocolZhanJi = app.club_zhanji
- else
- protocolZhanJi = app:getProtocolZhanJi(GAME_IDS.luzhouPaoDeKuai)
- end
-
- local function showRecoreView( )
- app.waitDialogManager:closeWaitNetworkDialog()
- local recordData = nil
- local zhanjiInfo = protocolZhanJi.zhanjiInfoList[self.lunshuInfo.pid]
- if zhanjiInfo and zhanjiInfo.detail then
- local rdata
- for k,v in pairs(zhanjiInfo.detail) do
- local d = v["1"]
- if d then
- if d.subid == self.lunshuInfo.subid then
- recordData = d
- break
- end
- end
- end
- end
- if recordData and recordData.ops then--回放数据
- recordData.nbound = self.lunshuInfo.nbound
- recordData.roomid = self.lunshuInfo.roomid
- local view = import("pk_luzhoupdk.luaScript.Views.Room.luzhouPdkRoomPlayView"):new(recordData)
- view:setAnchorPoint(cc.p(0.5, 0.5))
- app:showWaitDialog(view)
- else
- showTooltip("本局数据不支持回放")
- end
- end
-
- if protocolZhanJi then
- app.waitDialogManager:showWaitNetworkDialog()
- protocolZhanJi:getZhanJiDetail(self.lunshuInfo.pid, self.lunshuInfo.subid, showRecoreView)
- end
- end
-
- return PdkDanJuItem
|