2023-07-14 19:35:33 +00:00
|
|
|
local XUiGridDoomsdayInhabitantAttr = require("XUi/XUiDoomsday/XUiGridDoomsdayInhabitantAttr")
|
|
|
|
local XUiGridDoomsdayInhaibitantAttrNormal = require("XUi/XUiDoomsday/XUiGridDoomsdayInhaibitantAttrNormal")
|
|
|
|
|
|
|
|
local XUiDoomsdayPeople = XLuaUiManager.Register(XLuaUi, "UiDoomsdayPeople")
|
|
|
|
|
|
|
|
function XUiDoomsdayPeople:OnAwake()
|
|
|
|
self:AutoAddListener()
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiDoomsdayPeople:OnStart(stageId)
|
|
|
|
self.StageId = stageId
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiDoomsdayPeople:OnEnable()
|
|
|
|
local stageId = self.StageId
|
|
|
|
local stageData = XDataCenter.DoomsdayManager.GetStageData(stageId)
|
|
|
|
|
|
|
|
--居民信息
|
|
|
|
self:BindViewModelPropertiesToObj(
|
|
|
|
stageData,
|
|
|
|
function(idleCount, count)
|
|
|
|
self.TxtPeopleNum.text =
|
2024-09-01 20:49:41 +00:00
|
|
|
string.format("%d/%d", idleCount, count)
|
|
|
|
-- .. XDataCenter.DoomsdayManager.GetInhabitantDeadCountText(stageId)
|
2023-07-14 19:35:33 +00:00
|
|
|
end,
|
|
|
|
"_IdleInhabitantCount",
|
|
|
|
"_InhabitantCount"
|
|
|
|
)
|
|
|
|
|
|
|
|
--居民异常状态
|
|
|
|
self:BindViewModelPropertyToObj(
|
|
|
|
stageData,
|
|
|
|
function(unhealthyInhabitantInfoList)
|
|
|
|
--只显示不健康状态下的属性
|
|
|
|
self:RefreshTemplateGrids(
|
|
|
|
self.PanelTool6,
|
|
|
|
unhealthyInhabitantInfoList,
|
|
|
|
self.PanelList,
|
|
|
|
function()
|
|
|
|
return XUiGridDoomsdayInhabitantAttr.New(true)
|
|
|
|
end,
|
|
|
|
"InhabitantAttrGrids"
|
|
|
|
)
|
|
|
|
end,
|
|
|
|
"_UnhealthyInhabitantInfoList"
|
|
|
|
)
|
|
|
|
|
|
|
|
--居民属性
|
|
|
|
self:RefreshTemplateGrids(
|
|
|
|
self.GridAttr,
|
|
|
|
stageData:GetProperty("_AverageInhabitantAttrList"),
|
|
|
|
self.PanelState,
|
|
|
|
function()
|
|
|
|
return XUiGridDoomsdayInhaibitantAttrNormal.New(stageId)
|
|
|
|
end,
|
|
|
|
"InhabitantNormalAttrGrids"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiDoomsdayPeople:AutoAddListener()
|
|
|
|
self.BtnClose.CallBack = handler(self, self.Close)
|
|
|
|
end
|