71 lines
2.0 KiB
Lua
71 lines
2.0 KiB
Lua
|
|
local PlayerInfoView = require("Game.View.PlayerInfoView2")
|
||
|
|
|
||
|
|
local M = {}
|
||
|
|
|
||
|
|
function M.new(view, mainView, flag_witness)
|
||
|
|
setmetatable(M, { __index = PlayerInfoView })
|
||
|
|
local self = setmetatable({}, { __index = M })
|
||
|
|
self._view = view
|
||
|
|
self._main_view = mainView
|
||
|
|
self:init(flag_witness)
|
||
|
|
return self
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:init(flag_witness)
|
||
|
|
getmetatable(M).__index.init(self)
|
||
|
|
|
||
|
|
--互动表情的父类
|
||
|
|
self._hudon = self._view:GetChild('comp_hudon')
|
||
|
|
PlayerInfoView.init(self, flag_witness)
|
||
|
|
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
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:SetBaoDan(flag)
|
||
|
|
self._view:GetController('baodan').selectedIndex = flag and 1 or 0
|
||
|
|
end
|
||
|
|
|
||
|
|
function M:PlayScore(score)
|
||
|
|
if score >= 0 then
|
||
|
|
self._view:GetController('piaoWin').selectedIndex = 1
|
||
|
|
self._view:GetChild('text_piaoScoreAdd').text = "+" .. score
|
||
|
|
else
|
||
|
|
self._view:GetController('piaoWin').selectedIndex = 0
|
||
|
|
self._view:GetChild('text_piaoScoreLess').text = score
|
||
|
|
end
|
||
|
|
self._view:GetTransition('piaoScore'):Play(1, 0, function()
|
||
|
|
|
||
|
|
end)
|
||
|
|
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
|
||
|
|
|
||
|
|
return M
|