|
- local PdkGameResult = class("PdkGameResult", cc.UIView)
- local PdkSoundHelper = require("pk_paodekuai.luaScript.Views.Room.PdkSoundHelper"):new()
- function PdkGameResult:ctor( o )
- self._data = o
- local ui = loadUI("pk_paodekuai/res/ui/ui_room/ui_pdk_gameresult.ui")
- self.ui = ui
- self:addChild(ui)
-
- self:initUi()
- self:showPlayers()
- --是否是game over 前的最后一局
- self.btnSure:setVisible(self._data.isLast==true)
- self.ui.Items.btnContinue:setVisible(self._data.isLast==false)
- end
-
- function PdkGameResult:initUi()
- self.ui.Items.btnContinue:registerClick(handler(self , self.onClickContinue))
- self.txtRoomID = self.ui.Items.txtRoomID
- self.txtRoundNum = self.ui.Items.txtRoundNum
- self.btnSure = self.ui.Items.btnSure
- local roomInfo = app.room:getRoomInfo()
- self.txtRoomID:setString(string.format("房号:%d ", roomInfo.nTableId or 0))
- self.txtRoundNum:setString(string.format("%s 局数:%d/%d", os.date("%m-%d %H:%M", os.time()), self._data.gameStartCount, self._data.totalGamenum))
- self.ui.Items.txtRoomRule:setString(self._data.ruleString or "")
- self.btnSure:registerClick(handler(self , self.onClickSure))
- self.btnSure:setVisible(false)
- end
-
- function PdkGameResult:showPlayers()
- for i,v in ipairs(self._data.players) do
- v.turnScore = tonumber(v.turnScore)
- self.ui.Items.Layout_player:addChild(self:createItem(v))
- if app.room:isMyself(v.userId) then
- if v.turnScore > 0 then --win
- PdkSoundHelper:win()
- self.ui.Items.ImageView_title:loadTexture("pk_paodekuai/res/ui/zy_gameresult/pdk_gameresult_img_title_win.png", 0)
- else
- PdkSoundHelper:lose()
- self.ui.Items.ImageView_title:loadTexture("pk_paodekuai/res/ui/zy_gameresult/pdk_gameresult_img_title_lose.png", 0)
- end
- end
- end
- end
-
- function PdkGameResult:onClickContinue( sender )
- playBtnEffect()
- self.ui:sendMsg(app.room, "callReadyRequestPdk", function() print("根本没调用") end)
- performWithDelay(self, function()
- app.room:dispatchEvent({name = "pdkNormalEvent_show_game_over"})
- self:removeFromParent()
- end, 0.1)
- end
-
- function PdkGameResult:onClickSure( sender )
- playBtnEffect()
- app.room:dispatchEvent({name = "pdkNormalEvent_show_game_over"})
- self:removeFromParent()
- end
-
- function PdkGameResult:createItem( info )
- info.turnScore = tonumber(info.turnScore)
- local node = loadUI("pk_paodekuai/res/ui/ui_room/ui_pdk_gameresult_item.ui")
- node.Items.txtNick:setString(getSubStringNickname(info.nickname or ""))
- node.Items.txtID:setString("ID:"..info.userId)
-
- --显示隐藏游戏内选手id(主办人和管理员不限制,只针对海选赛) -- todo lwq
- -- begin
- local ClubDefine = require("luaScript.Protocol.Club.ClubDefine")
- if app.club_php.clubID and app.club_php.clubID ~= 0 then
- if app.club_php:getCestIsOpen(app.club_php.clubID) then
- --隐私数据
- local clubInfo = app.club_php.clubList[app.club_php.clubID]
- self.cliext = clubInfo.groupext and clubInfo.groupext.cliext
- if not self.cliext or not self.cliext.is_hideUid or (self.cliext and self.cliext.is_hideUid == 1) then
- if clubInfo.role == ClubDefine.Job.Creator or clubInfo.role == ClubDefine.Job.Manager then
- node.Items.txtID:setVisible(true)
- else
- node.Items.txtID:setVisible(false)
- end
- end
- end
- end
- if info.userId == tonumber(app.user.loginInfo.uid) then
- node.Items.txtID:setVisible(true)
- end
- -- end
-
- node.Items.txtLeft:setString(""..info.leftNum)
- node.Items.txtBomb:setString(""..info.bombTimes)
- node.Items.ImageView_chuntian:setVisible(info.bSpring==1)
- node.Items.ImageView_fanchuntian:setVisible(info.bSpring==2)
- node.Items.ImageView_zhaniao:setVisible(info.haveRedTen==1 and self._data.isZhaniao)
- setPlayerHeadImage(info.userId, info.headimgurl, node.Items.imgHead)
- if info.turnScore > 0 then--win
- node.Items.ImageView:loadTexture("pk_paodekuai/res/ui/zy_gameresult/pdk_gameresult_img_yellow_bg.png", 0)
- local txtColor = cc.c3b(255, 228, 128)
- node.Items.txtLeft:setColor(txtColor)
- node.Items.txtBomb:setColor(txtColor)
- node.Items.txtScore:setColor(txtColor)
- local fntConfg = node.Items.txtLeft:getFontConfig()
- fntConfg.effectColor = {a=255, r=132, g=59, b=11}
- node.Items.txtLeft:setFontConfig(fntConfg)
- node.Items.txtBomb:setFontConfig(fntConfg)
- node.Items.txtScore:setText("+"..info.turnScore)
- else
- node.Items.ImageView:loadTexture("pk_paodekuai/res/ui/zy_gameresult/pdk_gameresult_img_blue_bg.png", 0)
- local fntConfg = node.Items.txtLeft:getFontConfig()
- node.Items.txtScore:setText(""..info.turnScore)
- end
-
- return node
- end
-
- return PdkGameResult
-
- --[[
-
-
- --[[
- "self._data" = {
- "bankSeatId" = 0
- "gameStartCount" = 1
- "leftCards" = {
- 1 = 12
- 2 = 24
- 3 = 9
- 4 = 53
- 5 = 44
- 6 = 4
- 7 = 58
- 8 = 10
- 9 = 61
- 10 = 5
- 11 = 56
- 12 = 23
- 13 = 37
- 14 = 8
- 15 = 25
- 16 = 54
- }
- "players" = {
- 1 = {
- "bSpring" = 0
- "bombTimes" = 0
- "haveRedTen" = 0
- "totalScore" = 9
- "turnScore" = 9
- "userId" = 1023496
- "leftNum"
- }
- 2 = {
- "bSpring" = 0
- "bombTimes" = 0
- "haveRedTen" = 0
- "totalScore" = -9
- "turnScore" = -9
- "userId" = 1023544
- "leftNum"
- }
- }
- "totalGamenum" = 10
- }
- ]]
|