--- --- Created by 谌建军. --- DateTime: 2017/12/19 11:05 --- --require("Game.View.ResultView") local TwoDouDiZhu_ResultView = {} local M = TwoDouDiZhu_ResultView function TwoDouDiZhu_ResultView.new(blur_view, data, roomid, over, win_seat, dissolve, remaincards) setmetatable(M, {__index = BaseWindow}) local self = setmetatable({}, {__index = M}) self.class = "TwoDouDiZhu_ResultView" self._currenIndex = 0 self._close_zone = false --self._blur_view = blur_view self._gamectr = ControllerManager.GetController(GameController) self:init("ui://Extend_Poker_TwoDouDiZhu/clearing", data, roomid, over, win_seat, dissolve, remaincards) return self end function M:init(url, data, roomid, over, win_seat, dissolve, remaincards) BaseWindow.init(self, url) self.big_result = self._view:GetChild("big_result") self.big_result.visible = false self.n47 = self._view:GetChild("n47") self.n47.visible = false --ResultView.init(self, url) --self:InitData(data,roomid) --self:InitData(data,roomid) local player = self.big_result:GetChild("player") player.visible = false if dissolve == 1 then -- body self:InitData(data, win_seat, roomid) else self:InitData_One(data, win_seat, over, roomid, remaincards) end end -- 小结算 function M:InitData_One(data, winseat, over, roomid, remaincards) local room = DataManager.CurrenRoom -- self._view:GetController("sdk").selectedIndex = 1 local _gamectr = ControllerManager.GetController(GameController) local list_view = self._view:GetChild("player_list_1") list_view:RemoveChildrenToPool() for i = 1, #data do local player = data[i] local item = list_view:AddItemFromPool("ui://Extend_Poker_TwoDouDiZhu/clearing_item_1") local boom = item:GetChild("boom") boom.text = player.thisboomnum local piao = item:GetChild("piao") if player.piao <= 0 then piao.text = "0" else piao.text = "" .. player.piao end local nichen = item:GetChild("nichen") if player.nick ~= nil then -- body nichen.text = tostring(player.nick) else nichen.text = tostring(player.self_user.nick_name) end local shengpai = item:GetChild("shengpai") if player.cards ~= nil then -- body shengpai.text = tostring(#player.cards) else shengpai.text = tostring(#player.hand_list) end local rt = 1 if room.hpOnOff == 1 then rt = room.score_times end local hp_nonnegative = room:checkHpNonnegative() local roundScore = player.winscore if hp_nonnegative then local jifen = "" if roundScore > 0 then jifen = "+" .. roundScore else jifen = "" .. roundScore end local tili = "" local limit = "" if player.hp_info.round_actual_hp > 0 then tili = "(+" .. d2ad(player.hp_info.round_actual_hp) .. ")" if player.hp_info.upper_limit then limit = "达到上限" end else tili = "(" .. d2ad(player.hp_info.round_actual_hp) .. ")" if player.hp_info.upper_limit then limit = "达到下限" end end item:GetChild("score").text = jifen .. tili .. limit else local jifen = "" if roundScore >= 0 then jifen = "+" .. roundScore else jifen = "" .. roundScore end jifen = jifen .. " " local tili = "" if room.hpOnOff > 0 then local need = roundScore * rt tili = "(" if roundScore > 0 then tili = tili .. "+" .. tostring(need) else tili = tili .. tostring(need) end tili = tili .. ")" end item:GetChild("score").text = jifen .. tili end if roundScore >= 0 then if room.self_player.seat == player.seat then -- body --self._view:GetController("result").selectedIndex = 1 end else if room.self_player.seat == player.seat then --self._view:GetController("result").selectedIndex = 0 end end end if over == 0 then -- body local btn_confirm = self._view:GetChild("btn_confirm") btn_confirm.onClick:Set(function() self:Destroy() local _gamectr = ControllerManager.GetController(GameController) _gamectr:ConformToNextGame() end) else local btn_confirm = self._view:GetChild("btn_confirm") btn_confirm.onClick:Set(function() --self:Destroy() self:InitData(data, winseat, roomid) -- ViewManager.ChangeView(ViewManager.View_Lobby) end) end self.n47.visible = true self.big_result.visible = false end -- 大结算 function M:InitData(data, winseat, roomid) -- self._view:GetController("sdk").selectedIndex = 0 self.n47.visible = false self.big_result.visible = true local room = DataManager.CurrenRoom local rt = 1 if room.hpOnOff == 1 and room.score_times ~= 1 then rt = room.score_times end -- 赋值result_info,聊天室分享需要 --self:GenerateRoomResultInfo(room.room_config.Times, room.room_config:GetGameName(), room.room_id, room.create_time, player_list) --self:InitBigResult(room) local big_result = self._view:GetChild("big_result") local lst_p = big_result:GetChild("player_list") lst_p:RemoveChildrenToPool() big_result:GetChild('txt_room_id').text = '房号:' .. roomid big_result:GetChild('txt_game_name').text = "二人斗地主" big_result:GetChild('txt_game_data').text = os.date('%Y-%m-%d %H:%M', os.time()) for i = 1, #data do local user = room:GetPlayerBySeat(data[i].seat).self_user local item = lst_p:AddItemFromPool() item:GetChild('txt_name').text = user.nick local head = item:GetChild('head'):GetChild('n4') ImageLoad.Load(data[i].self_user.head_url, head) item:GetChild('txt_navigate').text = tostring(data[i].total_score) end -- local list_param = com_p:GetChild("list_param") for i = 1, lst_p.numChildren do local com_p = lst_p:GetChildAt(i - 1) local list_param = com_p:GetChild("list_param") for j = 1, list_param.numChildren do local tem = list_param:GetChildAt(j - 1) tem:GetChild("txt_value").textFormat.size = 30 end end local btn_close = big_result:GetChild('btn_close') btn_close.onClick:Set( function() self:Destroy() ViewManager.ChangeView(ViewManager.View_Lobby) end ) end return M