临时提交
This commit is contained in:
@ -80,8 +80,30 @@ public partial class ProductionLineItem : Panel
|
||||
|
||||
// 设置基本信息
|
||||
nameLabel.Text = productionLine.Name;
|
||||
timeLabel.Text = $"{productionLine.ProductionTime:F1}s";
|
||||
powerLabel.Text = $"{productionLine.PowerConsumption}W";
|
||||
|
||||
// 设置时间显示:发电设备显示"持续",其他显示具体时间
|
||||
if (productionLine.PowerGeneration > 0 && productionLine.ProductionTime <= 0)
|
||||
{
|
||||
timeLabel.Text = "持续";
|
||||
timeLabel.Modulate = new Color(0.3f, 1.0f, 0.3f); // 绿色表示持续运行
|
||||
}
|
||||
else
|
||||
{
|
||||
timeLabel.Text = $"{productionLine.ProductionTime:F1}s";
|
||||
timeLabel.Modulate = new Color(1.0f, 1.0f, 1.0f); // 默认白色
|
||||
}
|
||||
|
||||
// 设置功耗或发电量显示
|
||||
if (productionLine.PowerGeneration > 0)
|
||||
{
|
||||
powerLabel.Text = $"+{productionLine.PowerGeneration}W";
|
||||
powerLabel.Modulate = new Color(0.3f, 1.0f, 0.3f); // 绿色表示发电
|
||||
}
|
||||
else
|
||||
{
|
||||
powerLabel.Text = $"{productionLine.PowerConsumption}W";
|
||||
powerLabel.Modulate = new Color(1.0f, 0.9f, 0.7f); // 原来的颜色表示耗电
|
||||
}
|
||||
|
||||
// 设置建筑需求信息
|
||||
if (productionLine.BuildingRequirements != null && productionLine.BuildingRequirements.Count > 0)
|
||||
@ -176,14 +198,24 @@ public partial class ProductionLineItem : Panel
|
||||
// 更新设备数量
|
||||
deviceLabel.Text = $"设备: {activeLine.BuildingCount}";
|
||||
|
||||
// 更新产出率
|
||||
if (activeLine.IsActive && activeLine.ProductionRate > 0)
|
||||
// 更新产出率或发电量显示
|
||||
if (productionLine.PowerGeneration > 0 && productionLine.ProductionTime <= 0)
|
||||
{
|
||||
// 发电设备显示发电量
|
||||
float totalGeneration = productionLine.PowerGeneration * activeLine.BuildingCount;
|
||||
productionLabel.Text = $"{totalGeneration}W";
|
||||
productionLabel.Modulate = new Color(0.3f, 1.0f, 0.3f); // 绿色表示发电
|
||||
}
|
||||
else if (activeLine.IsActive && activeLine.ProductionRate > 0)
|
||||
{
|
||||
// 普通生产设备显示产出率
|
||||
productionLabel.Text = $"{activeLine.ProductionRate:F1}/s";
|
||||
productionLabel.Modulate = new Color(1.0f, 1.0f, 1.0f); // 白色
|
||||
}
|
||||
else
|
||||
{
|
||||
productionLabel.Text = "0/s";
|
||||
productionLabel.Modulate = new Color(0.7f, 0.7f, 0.7f); // 灰色表示未激活
|
||||
}
|
||||
|
||||
// 更新进度条(添加边界检查,避免闪烁)
|
||||
|
||||
Reference in New Issue
Block a user