|
- -- 单局战绩单元Layout
- local ZPDanJuItem = class("ZPDanJuItem")
- local ZPDef = ZPFramework.ZPImport("zp_base.luaScript.ZPDef")
-
- function ZPDanJuItem:ctor(gameRule, curJuShuData, jushu,zhanjiInfo, fromClub)
- --玩法,考虑扩展3人4人字牌
- self.gameRule = gameRule;
-
- self.curJuShuData = curJuShuData
-
- self.zhanjiInfo = zhanjiInfo
-
- self.jushu = jushu
-
- self.fromClub = fromClub;
-
- self.ui = loadUI("zp_base/res/ui/ui_zhanji/zipai_zhanji_danju_item_view.ui")
-
- self:initView()
- end
-
- function ZPDanJuItem:initView()
- -- 局数
- --编号
- if self.curJuShuData.flag == ZPDef.XiaoJuEndType.STOP_FLAG_NORMAL then
- self.ui.Items.Text_num:setText(tostring(self.jushu))
- elseif self.curJuShuData.flag == ZPDef.XiaoJuEndType.STOP_FLAG_HUANG_ZHUANG then
- self.ui.Items.Text_num:setText("黄庄")
- elseif self.curJuShuData.flag == ZPDef.XiaoJuEndType.STOP_FLAG_LONG_NOT_END then
- self.ui.Items.Text_num:setText("超时解散")
- elseif self.curJuShuData.flag == ZPDef.XiaoJuEndType.STOP_FLAG_DISBAND_GAME then
- self.ui.Items.Text_num:setText("解散游戏")
- end
-
- local time = os.date("%m-%d %H:%M",self.curJuShuData.endtime)
- self.ui.Items.Text_time:setText(tostring(time))
-
- self.ui.Items.Button:registerClick(handler(self , self.onClickRecord))
-
- self.ui.Items.Layout_Players:removeAllChildren()
-
- -- 所有的玩家
- local uiPlayers = self.ui.Items.Layout_Players
- for uid, score in pairs(self.curJuShuData.score) do
- local item = import("zp_base.luaScript.Views.ZhanJi.ZPZhanJiPlayer"):new(self.gameRule, uid, score)
- if item and item.ui then
- uiPlayers:addChild(item.ui)
- end
- end
- end
-
- function ZPDanJuItem:onClickRecord()
- local function showRecoreView()
- app.waitDialogManager:closeWaitNetworkDialog();
- logE("table.tostring(self.curJuShuData):"..table.tostring(self.curJuShuData))
- self.curJuShuData.nbound = self.zhanjiInfo.nbound
- self.curJuShuData.roomid = self.zhanjiInfo.roomid
- self.curJuShuData.gameRule = self.gameRule
- if not self.curJuShuData then
- showZiPaiPFailedResult("回放数据不存在")
- return
- end
- local haveOper = false
- if self.curJuShuData.ops then
- haveOper = string.len(self.curJuShuData.ops) > 0
- if self.curJuShuData.flag == ZiPai_XIAOJU_OVER_RESULT.STOP_FLAG_NORMAL then
- haveOper = true
- end
- end
- if not self.curJuShuData.user or not haveOper then
- showTooltip("游戏解散了")
- return
- end
- local view = ZiPaiFramework.Import("Views.Room.ZPRecordView"):new(self.curJuShuData);
- view:setAnchorPoint(cc.p(0.5, 0.5))
- app:showWaitDialog(view)
- end
- local protocolZhanJi;
- if self.fromClub then
- protocolZhanJi = app.club_zhanji
- else
- protocolZhanJi = app:getProtocolZhanJi(app.gameId)
- end
- if protocolZhanJi then
- app.waitDialogManager:showWaitNetworkDialog();
- protocolZhanJi:getZhanJiDetail(self.zhanjiInfo.pid, self.curJuShuData.subid, showRecoreView)
- end
- end
-
- return ZPDanJuItem
|