yunque9/lua_probject/extend_project/extend/poker/shengsidu/ShengSiDu_ResultView.lua

251 lines
7.6 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
--- Created by 谌建军.
--- DateTime: 2017/12/19 11:05
---
require("Game.View.ResultView")
local RunFast_ResultView = {}
local M = RunFast_ResultView
function RunFast_ResultView.new(blur_view, 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._blur_view = blur_view
self._gamectr = ControllerManager.GetController(GameController)
self:init("ui://Extend_Poker_ShengSiDu/clearing", 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)
--self:InitData(data,roomid)
--self:InitData(data,roomid)
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_ShengSiDu/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 and 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
end
-- 大结算
function M:InitData(data, winseat, roomid)
self._view:GetController("sdk").selectedIndex = 0
local room = DataManager.CurrenRoom
local rt = 1
if room.hpOnOff == 1 and room.score_times ~= 1 then
rt = room.score_times
end
-- 赋值result_info聊天室分享需要
local player_list = {}
for i = 1, #data do
player_list[i] = {}
local user = room:GetPlayerBySeat(data[i].seat).self_user
player_list[i].id = user.account_id
player_list[i].score = data[i].score
player_list[i].hp_info = data[i].hp_info
player_list[i].house = room.owner_id == player_list[i].id and 1 or 0
player_list[i].nick = user.nick_name
player_list[i].seat = data[i].seat
player_list[i].head_url = data[i].self_user.head_url
if data[i].entrust ~= nil then
player_list[i].entrust = data[i].entrust > 0
else
player_list[i].entrust = false
end
player_list[i].param = {}
player_list[i].param[1] = {}
player_list[i].param[1].key = "赢局数:"
player_list[i].param[1].value = tostring(data[i].settle_log.winnum)
player_list[i].param[2] = {}
player_list[i].param[2].key = "打出炸弹数:"
player_list[i].param[2].value = tostring(data[i].settle_log.boomnum)
player_list[i].param[3] = {}
player_list[i].param[3].key = "春天次数:"
player_list[i].param[3].value = tostring(data[i].settle_log.springnum)
player_list[i].param[4] = {}
player_list[i].param[4].key = "当局最高分:"
player_list[i].param[4].value = tostring(data[i].settle_log.maxscore * rt)
if data[i].daniao > 0 then
player_list[i].flag = {"打鸟"}
end
end
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")
-- 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
end
return M