changhong/lua_probject/extend_project/extend/poker/runfast/EXPlayerInfoView.lua

65 lines
1.8 KiB
Lua
Raw Permalink Normal View History

2025-05-24 14:29:14 +08:00
local PlayerInfoView = require("Game.View.PlayerInfoView")
local M = {}
function M.new(view, mainView)
2025-06-04 22:42:49 +08:00
setmetatable(M, { __index = PlayerInfoView })
local self = setmetatable({}, { __index = M })
2025-05-24 14:29:14 +08:00
self._view = view
self._main_view = mainView
self:init()
2025-06-04 22:42:49 +08:00
self.ctr_piao = view:GetController('piao')
self.view_piao = view:GetChild('mask_piao')
2025-05-24 14:29:14 +08:00
return self
end
function M:FillData(player)
PlayerInfoView.FillData(self, player)
if player.cur_hp ~= nil then
self:UpdateScore(d2ad(player.cur_hp))
else
local rt = 1
if self._main_view._room.hpOnOff == 1 then
rt = self._main_view._room.score_times
end
self:UpdateScore(player.total_score * rt)
end
2025-06-04 22:42:49 +08:00
2025-06-05 18:56:24 +08:00
if player.daNiao ~= nil and player.niao ~= nil then
self.view_piao.title = player.daNiao == 0 and "不打鸟" or string.format("打鸟%d", player.niao)
2025-06-04 22:42:49 +08:00
self.ctr_piao.selectedIndex = 1
end
2025-05-24 14:29:14 +08:00
end
function M:UpdatePiao(piao)
if piao == nil or piao == -1 then
self._view:GetChild("piao").text = ""
elseif piao == 0 then
self._view:GetChild("piao").text = "不飘"
elseif piao == 1 then
self._view:GetChild("piao").text = "飘1分"
elseif piao == 2 then
self._view:GetChild("piao").text = "飘2分"
elseif piao == 3 then
self._view:GetChild("piao").text = "飘3分"
elseif piao == 5 then
self._view:GetChild("piao").text = "飘5分"
elseif piao == 8 then
self._view:GetChild("piao").text = "飘8分"
end
end
2025-06-04 22:42:49 +08:00
function M:ShowPiao(num)
num = num or 0
if num > 0 then
self.view_piao.title = string.format("打鸟%d", num)
self.ctr_piao.selectedIndex = 1
else
self.view_piao.title = string.format("不打鸟")
self.ctr_piao.selectedIndex = 1
end
end
2025-05-24 14:29:14 +08:00
return M