2025-04-01 10:48:36 +08:00
|
|
|
local PlayerInfoView = require("Game.View.PlayerInfoView")
|
2025-04-11 16:27:29 +08:00
|
|
|
local PlayerInfoView_copy = require("Game.View.PlayerInfoView_copy")
|
2025-04-01 10:48:36 +08:00
|
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
|
|
function M.new(view, mainView)
|
2025-04-11 16:27:29 +08:00
|
|
|
if mainView._room.room_config.people_num == 2 then
|
|
|
|
|
setmetatable(M, { __index = PlayerInfoView_copy })
|
|
|
|
|
else
|
|
|
|
|
setmetatable(M, { __index = PlayerInfoView })
|
|
|
|
|
end
|
|
|
|
|
local self = setmetatable({}, { __index = M })
|
2025-04-01 10:48:36 +08:00
|
|
|
self._view = view
|
|
|
|
|
self._main_view = mainView
|
|
|
|
|
self:init()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:init()
|
2025-04-11 16:27:29 +08:00
|
|
|
if self._main_view._room.room_config.people_num ~= 2 then
|
|
|
|
|
PlayerInfoView.init(self)
|
|
|
|
|
self._tex_score = self._view:GetChild("info"):GetChild("tex_score1")
|
|
|
|
|
self._tex_score2 = self._view:GetChild("info"):GetChild("tex_score2")
|
|
|
|
|
self._ct_score = self._view:GetChild("info"):GetController("score")
|
|
|
|
|
else
|
|
|
|
|
PlayerInfoView_copy.init(self)
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
2025-04-12 10:24:08 +08:00
|
|
|
function M:ShowInteraction(type, str)
|
2025-04-01 10:48:36 +08:00
|
|
|
if type == 3 then
|
|
|
|
|
Voice.DownLoad(str, function(clip)
|
2025-04-12 10:24:08 +08:00
|
|
|
if (clip) then
|
2025-04-01 10:48:36 +08:00
|
|
|
self:ShowMaskVoice(clip.length)
|
|
|
|
|
GameApplication.Instance:PlayVoice(clip)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
elseif type == 4 then
|
|
|
|
|
self:SetChat(str)
|
|
|
|
|
elseif type == 2 then
|
|
|
|
|
local chat_index = tonumber(str)
|
2025-04-12 10:24:08 +08:00
|
|
|
self._main_view:PlayChatSound(self._player.self_user.sex, chat_index)
|
2025-04-01 10:48:36 +08:00
|
|
|
local language, index = self._main_view:GetChatMsgLanguage(chat_index)
|
|
|
|
|
self:SetChat(self._main_view.Fix_Msg_Chat[index])
|
|
|
|
|
elseif type == 1 then
|
2025-04-12 10:24:08 +08:00
|
|
|
self:SetBiaoqing("ui://Chat/" .. str)
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateRemainCard(card_num, hide)
|
|
|
|
|
if hide then
|
2025-04-12 10:24:08 +08:00
|
|
|
self._view:GetController("show_remain").selectedIndex = 0
|
2025-04-01 10:48:36 +08:00
|
|
|
else
|
2025-04-12 10:24:08 +08:00
|
|
|
self._view:GetController("show_remain").selectedIndex = 1
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:FillData(player)
|
2025-04-11 16:27:29 +08:00
|
|
|
if self._main_view._room.room_config.people_num == 2 then
|
|
|
|
|
PlayerInfoView_copy.FillData(self, player)
|
|
|
|
|
else
|
|
|
|
|
PlayerInfoView.FillData(self, player)
|
|
|
|
|
self:UpdateScore(player.total_score)
|
|
|
|
|
end
|
2025-04-01 10:48:36 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function M:UpdateScore()
|
|
|
|
|
local score = self._player.total_score
|
|
|
|
|
local room = DataManager.CurrenRoom
|
|
|
|
|
if room:checkHpNonnegative() then
|
|
|
|
|
score = d2ad(self._player.cur_hp)
|
|
|
|
|
end
|
|
|
|
|
if not score then
|
|
|
|
|
score = 0
|
|
|
|
|
end
|
|
|
|
|
if score < 0 then
|
|
|
|
|
self._ct_score.selectedIndex = 1
|
|
|
|
|
self._tex_score2.text = score
|
|
|
|
|
else
|
|
|
|
|
self._ct_score.selectedIndex = 0
|
|
|
|
|
if not room:checkHpNonnegative() then
|
|
|
|
|
score = "+" .. score
|
|
|
|
|
end
|
|
|
|
|
self._tex_score.text = score
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return M
|