private void WindowUpdate(QuantumStorageControllerMachine controller) { if (controller.HasPower()) { manager.UpdateLabel(StorageSizeLabel, controller.GetItems().GetItemCount() + "/" + controller.GetMaxCapacity(), Color.white); manager.UpdateLabel(InputStatusLabel, controller.IsInputEnabled() ? "Input enabled" : "Input disabled", Color.white); manager.UpdateLabel(OutputStatusLabel, controller.IsOutputEnabled() ? "Output enabled" : "Output disabled", Color.white); manager.UpdateLabel(StatusLabel, "POWER OK", Color.white); } if (!controller.HasPower()) { manager.UpdateLabel(StorageSizeLabel, string.Empty, Color.white); manager.UpdateLabel(InputStatusLabel, string.Empty, Color.white); manager.UpdateLabel(OutputStatusLabel, string.Empty, Color.white); manager.UpdateIcon(InputRuleItemIcon, "empty", Color.white); manager.UpdateLabel(StatusLabel, "LOW POWER", Color.red); } if (controller.HasPower() && !controller.IsOperating()) { manager.UpdateLabel(StorageSizeLabel, string.Empty, Color.white); manager.UpdateLabel(InputStatusLabel, string.Empty, Color.white); manager.UpdateLabel(OutputStatusLabel, string.Empty, Color.white); manager.UpdateIcon(InputRuleItemIcon, "empty", Color.white); manager.UpdateLabel(StatusLabel, "ERROR - ANOTHER CONTROLLER DETECTED", Color.red); } for (int i = 0; i < controller.GetItemInputRules().Count; i++) { if (!controller.IsOperating()) { manager.UpdateIcon(InputRuleItemIcon + i, "empty", Color.white); manager.UpdateLabel(InputRuleItemLabel + i, string.Empty, Color.white); } else { var itemIcon = ItemManager.GetItemIcon(controller.GetItemInputRules()[i].Item); var limit = controller.GetItemInputRules()[i].MaxInput; manager.UpdateIcon(InputRuleItemIcon + i, itemIcon, Color.white); manager.UpdateLabel(InputRuleItemLabel + i, "" + limit, Color.white); } } Dirty = false; }
private void WindowUpdate(QuantumStorageControllerMachine quantumStorageController) { if (UpdateWindowCooldown > 0) { --UpdateWindowCooldown; return; } else { UpdateWindowCooldown = UpdateTreshold; } var items = quantumStorageController.GetItems(); if (quantumStorageController.HasPower()) { manager.UpdateLabel(StorageSizeLabel, quantumStorageController.GetItems().GetItemCount() + "/" + quantumStorageController.GetMaxCapacity(), Color.white); manager.UpdateLabel(StatusLabel, "POWER OK", Color.white); } if (!quantumStorageController.HasPower()) { manager.UpdateLabel(StorageSizeLabel, string.Empty, Color.white); manager.UpdateLabel(StatusLabel, "LOW POWER", Color.red); } if (!quantumStorageController.IsOperating()) { manager.UpdateLabel(StorageSizeLabel, string.Empty, Color.white); manager.UpdateLabel(StatusLabel, "ERROR - ANOTHER CONTROLLER DETECTED", Color.red); } for (var index = 0; index < items.Count; index++) { if (!quantumStorageController.IsOperating()) { manager.UpdateIcon("iconItem" + index, "empty", Color.white); manager.UpdateLabel("labelItem" + index, string.Empty, Color.white); manager.UpdateIcon("iconItem" + items.Count, "empty", Color.white); manager.UpdateLabel("labelItem" + items.Count, string.Empty, Color.white); continue; } manager.UpdateIcon("iconItem" + items.Count, "empty", Color.white); var itemBase = items[index]; if (itemBase != null) { var itemIcon = ItemManager.GetItemIcon(itemBase); var currentStackSize = ItemManager.GetCurrentStackSize(itemBase); var label = currentStackSize != 100 ? (currentStackSize >= 10 ? " " + currentStackSize : " " + currentStackSize) : currentStackSize.ToString(); manager.UpdateIcon("iconItem" + index, itemIcon, Color.white); manager.UpdateLabel("labelItem" + index, label, Color.white); } } }