local PlayerInfoView = require("Game.View.PlayerInfoView") local M = {} function M.new(view, mainView) setmetatable(M, { __index = PlayerInfoView }) local self = setmetatable({}, { __index = M }) self._view = view self._main_view = mainView self:init() self.ctr_piao = view:GetController('piao') self.view_piao = view:GetChild('mask_piao') 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 if player.piao ~= nil and player.piao >= 0 then self.view_piao.title = player.piao == 0 and "不打鸟" or string.format("打鸟%d", player.piao) self.ctr_piao.selectedIndex = 1 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 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 return M