hengyang_client/lua_probject/extend_project/extend/majiang/changsha/EXPlayerInfoView.lua

68 lines
2.0 KiB
Lua

local PlayerInfoView_copy = require("Game.View.PlayerInfoView copy")
local PlayerInfoView = require("Game.View.PlayerInfoView")
local M = {}
function M.new(view, mainView)
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 })
self._view = view
self._main_view = mainView
self:init()
return self
end
function M:init()
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
end
function M:ShowInteraction(type, str)
if type == 3 then
Voice.DownLoad(str, function(clip)
if (clip) then
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)
self._main_view:PlayChatSound(self._player.self_user.sex, chat_index)
local language, index = self._main_view:GetChatMsgLanguage(chat_index)
self:SetChat(self._main_view.Fix_Msg_Chat[index])
elseif type == 1 then
self:SetBiaoqing("ui://Chat/" .. str)
end
end
function M:UpdateRemainCard(card_num, hide)
if hide then
self._view:GetController("show_remain").selectedIndex = 0
else
self._view:GetController("show_remain").selectedIndex = 1
end
self._view:GetChild("com_remain"):GetChild("tex_remain").text = card_num
end
function M:FillData(player)
if self._main_view._room.room_config.people_num == 2 then
PlayerInfoView_copy.FillData(self, player)
else
PlayerInfoView.FillData(self, player)
end
end
return M