Skip to content

Commit

Permalink
新增progress-percentage与老版本progress匹配,以便UI使用
Browse files Browse the repository at this point in the history
  • Loading branch information
Funny-ppt committed Apr 2, 2024
1 parent ad14f62 commit be345f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions InfrastSim/TimeDriven/ManufacturingStation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,12 @@ protected override void WriteDerivedContent(Utf8JsonWriter writer, bool detailed
writer.WriteNumber("progress", Progress);

if (detailed) {
if (Product != null) writer.WriteString("product", Product.Name);
else writer.WriteNull("product");
if (Product != null) {
writer.WriteString("product", Product.Name);
writer.WriteNumber("progress-percentage", (double)Progress / Product.ProduceTicks);
} else {
writer.WriteNull("product");
}
writer.WriteNumber("remains", (RemainTicks + TicksHelper.TicksPerSecond - 1) / TicksHelper.TicksPerSecond);
writer.WriteNumber("base-capacity", BaseCapacity);
writer.WriteNumber("capacity", Capacity);
Expand Down

0 comments on commit be345f4

Please sign in to comment.