145 lines
5.2 KiB
Lua
145 lines
5.2 KiB
Lua
---
|
|
--- Created by 谌建军.
|
|
--- DateTime: 2017/12/19 11:05
|
|
---
|
|
require("Game.View.ResultView")
|
|
|
|
local RunFast_ResultView = {}
|
|
|
|
local M = RunFast_ResultView
|
|
|
|
function RunFast_ResultView.new(root, data, roomid, over, win_seat, dissolve, remaincards)
|
|
setmetatable(M, { __index = ResultView })
|
|
local self = setmetatable({}, { __index = M })
|
|
|
|
self.class = "RunFast_ResultView"
|
|
self._currenIndex = 0
|
|
self._close_zone = false
|
|
self._root_runFast = root
|
|
self._gamectr = ControllerManager.GetController(GameController)
|
|
self:init("ui://Extend_Poker_RunFastNew/clearing_new", data, roomid, over, win_seat, dissolve, remaincards)
|
|
print("=======================lingmengresult", data, roomid, over, win_seat, dissolve, remaincards)
|
|
return self
|
|
end
|
|
|
|
function M:init(url, data, roomid, over, win_seat, dissolve, remaincards)
|
|
ResultView.init(self, url, true)
|
|
|
|
local room = DataManager.CurrenRoom
|
|
self._view:GetController('over').selectedIndex = 0
|
|
|
|
--按钮功能全部未开放
|
|
self._view:GetChild('btn_shareRecord').onClick:Set(function()
|
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
|
end)
|
|
self._view:GetChild('btn_copyRecord').onClick:Set(function()
|
|
ViewUtil.ErrorMsg(self._view, "", "该功能还未开放")
|
|
end)
|
|
------------------
|
|
|
|
--只有一人直接退,有两人才进正常结算
|
|
if not over and #data == 1 then
|
|
ViewManager.ChangeView(ViewManager.View_Family)
|
|
end
|
|
|
|
self._view:GetChild('btn_over1Close').onClick:Set(function()
|
|
self:Close()
|
|
self._root_runFast._ctr_inClear.selectedIndex = 1
|
|
if over ~= 1 then
|
|
self._view:GetController('over').selectedIndex = 1
|
|
end
|
|
end)
|
|
|
|
self._view:GetChild('btn_nextRound').onClick:Set(function()
|
|
if over == 0 then
|
|
self:Destroy()
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
_gamectr:ConformToNextGame()
|
|
else
|
|
self._view:GetController('over').selectedIndex = 1
|
|
end
|
|
end)
|
|
|
|
self.ClearReady = function()
|
|
if over == 0 then
|
|
self:Destroy()
|
|
local _gamectr = ControllerManager.GetController(GameController)
|
|
_gamectr:ConformToNextGame()
|
|
else
|
|
self._view:GetController('over').selectedIndex = 1
|
|
end
|
|
end
|
|
|
|
self._view:GetChild('btn_closeRound').onClick:Set(function()
|
|
ViewManager.ChangeView(ViewManager.View_Family)
|
|
end)
|
|
|
|
self._view:GetController('win').selectedIndex = win_seat == room.self_player.seat and 1 or 0
|
|
|
|
local over0List = self._view:GetChild('list_over0')
|
|
over0List:SetVirtual()
|
|
over0List.itemRenderer = function(index, obj)
|
|
local info = data[index + 1]
|
|
local playerInfo = room:GetPlayerBySeat(info.seat)
|
|
obj:GetChild('name').text = playerInfo.self_user.nick_name
|
|
obj:GetChild('residue').text = #info.handCards
|
|
obj:GetChild('bomb').text = info.thisboomnum
|
|
obj:GetChild('score').text = info.winscore > 0 and string.format("+%d", info.winscore) or info.winscore
|
|
end
|
|
over0List.numItems = #data
|
|
|
|
|
|
if over == 1 or (not over and #data == 2) then
|
|
local bigSeat = 0
|
|
local bigScore = 0
|
|
for i = 1, #data do
|
|
if data[i].total_score > bigScore then
|
|
bigSeat = i
|
|
bigScore = data[i].total_score
|
|
end
|
|
end
|
|
self._view:GetChild('text_roomID').text = room.room_id
|
|
self._view:GetChild('text_time').text = os.date('%m-%d %H:%M', os.time())
|
|
self._view:GetChild('text_groupID').text = room.group_id or 0
|
|
for i = 1, #data do
|
|
local info = data[i]
|
|
local playerInfo = room:GetPlayerBySeat(info.seat)
|
|
printlog("lingmeng clear", playerInfo.nick_name, info.total_score, i == bigSeat)
|
|
self:FillPlayerInfoEnd(self._view:GetChild(string.format("comp_playerInfo%d_over1", i)), info, playerInfo,
|
|
i == bigSeat)
|
|
end
|
|
coroutine.start(function()
|
|
coroutine.wait(2)
|
|
self._view:GetController('over').selectedIndex = 1
|
|
end)
|
|
end
|
|
end
|
|
|
|
function M:FillPlayerInfoEnd(view, info, playerInfo, bigWin)
|
|
local room = DataManager.CurrenRoom
|
|
|
|
self:FillPlayerHead(view:GetChild('comp_playerInfo'), playerInfo, bigWin)
|
|
|
|
local detailList = view:GetChild('list_detail')
|
|
|
|
self:FillDetailChild(detailList:AddItemFromPool(), 0, info.settle_log.maxscore)
|
|
self:FillDetailChild(detailList:AddItemFromPool(), 1, info.settle_log.boomnum)
|
|
self:FillDetailChild(detailList:AddItemFromPool(), 2,
|
|
string.format("%d赢%d输", info.settle_log.winnum, room.room_config.Times - info.settle_log.winnum))
|
|
self:FillDetailChild(detailList:AddItemFromPool(), 3, info.total_score)
|
|
end
|
|
|
|
function M:FillPlayerHead(view, playerInfo, bigWin)
|
|
ImageLoad.Load(playerInfo.self_user.head_url, view:GetChild('btn_head')._iconObject)
|
|
view:GetChild('text_name').text = playerInfo.self_user.nick_name
|
|
view:GetChild('text|_ID').text = playerInfo.self_user.account_id
|
|
view:GetController('bigWin').selectedIndex = bigWin and 1 or 0
|
|
end
|
|
|
|
function M:FillDetailChild(view, index, value)
|
|
view:GetController('ShowTitle').selectedIndex = index
|
|
view:GetChild('text_value').text = value
|
|
end
|
|
|
|
return M
|