bool HandleLeftClick(ProductionItem item, ProductionIcon icon, int handleCount) { if (PickUpCompletedBuildingIcon(icon, item)) { Game.Sound.Play(SoundType.UI, TabClick); return(true); } if (item != null && item.Paused) { // Resume a paused item Game.Sound.Play(SoundType.UI, TabClick); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return(true); } var buildable = CurrentQueue.BuildableItems().FirstOrDefault(a => a.Name == icon.Name); if (buildable != null) { // Queue a new item Game.Sound.Play(SoundType.UI, TabClick); string notification; var canQueue = CurrentQueue.CanQueue(buildable, out notification); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", notification, World.LocalPlayer.Faction.InternalName); if (canQueue) { World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount)); return(true); } } return(false); }
/// <summary> /// Gets Daily production Average for month of (Month,) last year. /// </summary> /// <param name="Month">Month Number, 1-12</param> /// <returns>(double) Daily production Average for (Month)</returns> public static double GetDailyAvgForMonth(int Month) { var AssemblyData = Read.GenericRead($@"{Paths.SourceDir}\PRODUCTS{Month}.BAK"); /// dict<productnumber, number assembled></productnumber> Dictionary <int, int> Assembled = new Dictionary <int, int>(); double SecondsOfProduction = 0; AssemblyData.ToList().ForEach(item => { var Item = new ProductionItem(item); if (!Assembled.ContainsKey(Item.ProductNumber)) { Assembled.Add(Item.ProductNumber, 0); } Assembled[Item.ProductNumber] += Item.NumberAssembled; }); Products.ForEach(item => { if (Assembled.ContainsKey(item.Number)) { SecondsOfProduction += (Assembled[item.Number] * item.AssemblyTime); } }); return((SecondsOfProduction * .00027777777778) * (1 / WeekdaysInMonth(Month))); }
/// <summary> /// Item is Being Baught from station /// </summary> /// <param name="itemName"></param> /// <param name="itemType"></param> /// <param name="itemAmount"></param> /// <param name="buyer"></param> /// <returns></returns> internal Items Buy(Items buyItem, IdentityModel buyer) { foreach (ProductionItem item in factory.outputItems) { if (item.name == buyItem.name) { if (buyItem.amount > item.amount) { buyItem.amount = item.amount; } ProductionItem soldItem = (ProductionItem)buyItem; soldItem.price = item.price; soldItem.totalPrice = soldItem.price * soldItem.amount; money += soldItem.totalPrice; item.amount -= buyItem.amount; buyer.money -= soldItem.totalPrice; buyItem.amount = 0; buyItem.pendingAmount = soldItem.amount; return(buyItem); } } return(buyItem * 0); }
bool HandleRightClick(ProductionItem item, ProductionIcon icon, bool handleMultiple) { if (item == null) { return(false); } Sound.Play(TabClick); if (item.Paused || item.Done || item.TotalCost == item.RemainingCost) { // Instant cancel of things we have not started yet and things that are finished Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, handleMultiple ? 5 : 1)); } else { // Pause an existing item Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.OnHoldAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, true)); } return(true); }
void ITick.Tick(Actor self) { if (productionItem == null) { return; } if (productionItem.Done) { productionItem.Queue.EndProduction(productionItem); productionItem = null; wsb.CancelCustomAnimation(self); while (step < Steps) { health.InflictDamage(self, self, new Damage(healthSteps[step] - healthSteps[++step]), true); } OnComplete(self); return; } var progress = Math.Max(0, Math.Min(Steps * (productionItem.TotalTime - productionItem.RemainingTime) / Math.Max(1, productionItem.TotalTime), Steps - 1)); if (progress != step) { while (step < progress) { health.InflictDamage(self, self, new Damage(healthSteps[step] - healthSteps[++step]), true); } wsb.PlayCustomAnimationRepeating(self, Info.Sequence.Substring(0, Info.Sequence.Length - 1) + step); } }
/// <summary> /// Loads this instance from json. /// </summary> internal void Load(JToken Json) { if (Json != null) { JArray Slots = (JArray)Json["slots"]; if (Slots != null) { foreach (JToken Token in Slots) { ProductionItem Item = new ProductionItem(); Item.Load(Token); this.Productions.Add(Item); } if (this.Productions.Count > 0) { if (JsonHelper.GetJsonNumber(Json, "t", out int Time)) { this.Timer.StartTimer(this.Level.Time, Time); } } } } }
void INotifyCreated.Created(Actor self) { if (spawnType == SpawnType.PlaceBuilding) { var productionQueue = self.Owner.PlayerActor.TraitsImplementing <SelfConstructingProductionQueue>().First(q => q.AllItems().Contains(self.Info)); var valued = self.Info.TraitInfoOrDefault <ValuedInfo>(); productionItem = new SelfConstructingProductionItem(productionQueue, self, valued == null ? 0 : valued.Cost, null, null); productionQueue.BeginProduction(productionItem, false); health = self.Trait <Health>(); healthSteps = new List <int>(); for (var i = 0; i <= Steps; i++) { healthSteps.Add(health.MaxHP * (i + 1) / (Steps + 1)); } self.World.AddFrameEndTask(world => health.InflictDamage(self, self, new Damage(health.MaxHP - healthSteps[0]), true)); wsb.CancelCustomAnimation(self); wsb.PlayCustomAnimationRepeating(self, Info.Sequence.Substring(0, Info.Sequence.Length - 1) + 0); } else if (spawnType == SpawnType.Deploy) { wsb.CancelCustomAnimation(self); wsb.PlayCustomAnimation(self, "deploy", () => OnComplete(self)); } else { OnComplete(self); } }
bool HandleLeftClick(ProductionItem item, ProductionIcon icon, int handleCount) { if (PickUpCompletedBuildingIcon(icon, item)) { Game.Sound.Play(SoundType.UI, TabClick); return(true); } if (item != null && item.Paused) { // Resume a paused item Game.Sound.Play(SoundType.UI, TabClick); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return(true); } if (CurrentQueue.BuildableItems().Any(a => a.Name == icon.Name)) { // Queue a new item Game.Sound.Play(SoundType.UI, TabClick); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount)); return(true); } return(false); }
bool HandleLeftClick(ProductionItem item, ProductionIcon icon, bool handleMultiple) { if (PickUpCompletedBuildingIcon(icon, item)) { Sound.Play(TabClick); return(true); } if (item != null && item.Paused) { // Resume a paused item Sound.Play(TabClick); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return(true); } if (CurrentQueue.BuildableItems().Any(a => a.Name == icon.Name)) { // Queue a new item Sound.Play(TabClick); Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Country.Race); World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleMultiple ? 5 : 1)); return(true); } return(false); }
internal void AddUnit(CharacterData Data, int Count) { if (this.CanProduce(Data, Count)) { if (this.Timer.Started) { /* * ProductionItem First = this.Productions.Find(T => !T.Terminate); * * if (First.Data == Data) * { * First.Count += Count; * return; * } */ ProductionItem Last = this.Productions.FindLast(T => T.ItemData == Data && !T.Terminate); if (Last != null) { Last.Count += Count; return; } } else { this.Timer.StartTimer(this.Level.Player.LastTick, this.GetTrainingTime(Data)); } this.Productions.Add(new ProductionItem(Data, Count)); } }
private void CreateProductionItemViewModel(ProductionItem newItem) { var pivm = new ProductionItemViewModel(newItem); pivm.PropertyChanged += ProductionItemPropertyChanged; m_ProductionItemViewModels.Add(pivm); }
void INotifyCreated.Created(Actor self) { var valued = self.Info.TraitInfoOrDefault <ValuedInfo>(); var cost = valued != null ? valued.Cost : 0; var pm = self.Owner.PlayerActor.TraitOrDefault <PowerManager>(); var productionQueue = self.TraitsImplementing <BuilderQueue>().First(q => q.AllItems().Contains(self.Info)); productionItem = new ProductionItem(productionQueue, self.Info.Name, cost, pm, null); productionQueue.BeginProduction(productionItem); if (productionItem == null) { return; } health = self.Trait <Health>(); healthSteps = new List <int>(); for (var i = 0; i <= Info.Steps; i++) { healthSteps.Add(health.MaxHP * (i + 1) / (Info.Steps + 1)); } health.InflictDamage(self, self, new Damage(health.MaxHP - healthSteps[0]), true); wsb.CancelCustomAnimation(self); wsb.PlayCustomAnimationRepeating(self, "building"); }
public static ProductionItem New(GameObject prGameObject, Sprite prItemImage, float prDuration, Action prOnCompletion, Action prOnCancelation) { ProductionItem newItem = prGameObject.AddComponent <ProductionItem>(); newItem.duration = prDuration; newItem.ItemImage = prItemImage; newItem.Oncompletion = prOnCompletion; newItem.OnCancelation = prOnCancelation; return(newItem); }
protected bool PickUpCompletedBuildingIcon(ProductionIcon icon, ProductionItem item) { var actor = World.Map.Rules.Actors[icon.Name]; if (item != null && item.Done && actor.HasTraitInfo <BuildingInfo>()) { World.OrderGenerator = new PlaceBuildingOrderGenerator(currentQueue, icon.Name, worldRenderer); return(true); } return(false); }
public override Action GetClickAction() { return(delegate() { if (Player.Credits >= Cost) { GetComponent <ProductionManager>().addItemToProductionQueue(ProductionItem.New(gameObject, ButtonIcon, BuildTime, completionAction, cancellationAction)); Player.Credits -= Cost; } }); }
/// <summary> /// /// </summary> /// <param name="Item"></param> public void Add(ProductionItem Item) { foreach (ProductionItem item in items) { if (item.Text == Item.Text) throw new Exception(Item.Text + ": Продукция с данным именем уже существует!"); if (item.Id == Item.Id) throw new Exception(Item.Text + ": Продукция с данным идентификатором уже существует!"); } items.Add((ProductionItem)Item.Clone()); }
public void addItemToProductionQueue(ProductionItem NewItem) { if (productionQueue.Count < maxQueue) { productionQueue.Add(NewItem); } else { NewItem.OnCancelation.Invoke(); Destroy(NewItem); } }
static string GetOverlayForItem(ProductionItem item) { if (item.Paused) { return("ON HOLD"); } if (item.Done) { return("READY"); } return(WidgetUtils.FormatTime(item.RemainingTimeActual)); }
string GetOverlayForItem(ProductionItem item) { if (item.Paused) { return(HoldText); } if (item.Done) { return(ReadyText); } return(WidgetUtils.FormatTime(item.RemainingTimeActual)); }
internal ProductionItemDto ConvertProductionItem(ProductionItem productionItem) { var productionItemDto = new ProductionItemDto() { Id = productionItem.Id, Title = productionItem.Title, Description = productionItem.Description, ProductionItemQuantums = productionItem.ProductionItemQuantums != null?productionItem.ProductionItemQuantums.Select(d => ConvertProductionItemQuantum(d)).ToList() : null }; return(productionItemDto); }
public override void Init(EntityAlive _theEntity) { base.Init(_theEntity); this.MutexBits = 3; this.executeDelay = 0.5f; // There is too many values that we need to read in from the entity, so we'll read them directly from the entityclass EntityClass entityClass = EntityClass.list[_theEntity.entityClass]; this.lstFoodBins = ConfigureEntityClass("FoodBins", entityClass); this.lstFoodItems = ConfigureEntityClass("FoodItems", entityClass); this.lstWaterBins = ConfigureEntityClass("WaterBins", entityClass); this.lstWaterItems = ConfigureEntityClass("WaterItems", entityClass); this.lstHomeBlocks = ConfigureEntityClass("HomeBlocks", entityClass); this.lstHungryBuffs = ConfigureEntityClass("HungryBuffs", entityClass); this.lstThirstyBuffs = ConfigureEntityClass("ThirstyBuffs", entityClass); this.lstSanitation = ConfigureEntityClass("ToiletBlocks", entityClass); this.lstSanitationBuffs = ConfigureEntityClass("SanitationBuffs", entityClass); if (entityClass.Properties.Values.ContainsKey("SanitationBlock")) { this.strSanitationBlock = entityClass.Properties.Values["SanitationBlock"]; } this.lstBeds = ConfigureEntityClass("Beds", entityClass); this.lstProductionBuffs = ConfigureEntityClass("ProductionFinishedBuff", entityClass); if (entityClass.Properties.Classes.ContainsKey("ProductionItems")) { DynamicProperties dynamicProperties3 = entityClass.Properties.Classes["ProductionItems"]; foreach (KeyValuePair <string, object> keyValuePair in dynamicProperties3.Values.Dict.Dict) { ProductionItem item = new ProductionItem(); item.item = ItemClass.GetItem(keyValuePair.Key, false); item.Count = int.Parse(dynamicProperties3.Values[keyValuePair.Key]); String strCvar = "Nothing"; if (dynamicProperties3.Params1.TryGetValue(keyValuePair.Key, out strCvar)) { item.cvar = strCvar; } this.lstProductionItem.Add(item); DisplayLog("Adding Production Item: " + keyValuePair.Key + " with a count of: " + item.Count + " and will reset: " + strCvar); } } }
string GetOverlayForItem(ProductionItem item) { if (item.Paused) { return(HoldText); } if (item.Done) { return(orderManager.LocalFrameNumber / 9 % 2 == 0 ? ReadyText : ""); } return(WidgetUtils.FormatTime(item.RemainingTimeActual)); }
internal ProductionItem ConvertProductionItem(ProductionItemDto productionItemDto) { var productionItem = new ProductionItem() { Title = productionItemDto.Title, Description = productionItemDto.Description, ChildrenProductionItemsIds = String.Join(",", productionItemDto.AddingItems.Where(p => p.Type == ProductDto.ProductType.ProductionItem).Select(p => p.Id.ToString()).ToArray()), ProductionItemQuantums = productionItemDto.AddingItems.Where(p => p.Type == ProductDto.ProductType.Detail) .Select(d => ConvertProductDto(d)).ToList(), OneItemIncome = productionItemDto.OneItemIncome }; return(productionItem); }
internal ProductionItemDto ConvertProductionItemForView(ProductionItem productionItem) { var productionItemDto = new ProductionItemDto() { Id = productionItem.Id, Title = productionItem.Title, Description = productionItem.Description, DetailsCount = productionItem.ProductionItemQuantums.Count, ChildrenProductionItemsCount = productionItem.ChildrenProductionItemsIds.Length == 0 ? 0 : productionItem.ChildrenProductionItemsIds.Split(',').Length, OneItemIncome = productionItem.OneItemIncome }; return(productionItemDto); }
bool HandleMiddleClick(ProductionItem item, ProductionIcon icon, int handleCount) { if (item == null) { return(false); } // Directly cancel, skipping "on-hold" Game.Sound.Play(SoundType.UI, TabClick); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.CancelledAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.CancelProduction(CurrentQueue.Actor, icon.Name, handleCount)); return(true); }
public ProductionItem TryAbort(Actor self) { if (productionItem == null) { return(null); } var item = productionItem; productionItem.Queue.EndProduction(productionItem); productionItem = null; OnComplete(self); return(item); }
public override IEnumerable <ProductionItem> AllQueued() { // Pretend to have items queued, to allow direct placement. return(BuildableItems().Select(buildableItem => { // Cost == 0 to not consume money at this point. var item = new ProductionItem(this, buildableItem.Name, 0, null, null); // Required for GetBuildTime, else the production wont be ready after below Tick(). expectFakeProductionItemRequest = true; // Tick once, so the item is done. item.Tick(playerResources); return item; }).ToList()); }
public void Initialize() { storageInfo = new BuildableItemStorageInformation(BuildableItemEnum.White_Flour.ToString()); bitem = new ProductionItem { ItemCode = BuildableItemEnum.White_Pizza_Dough, Stats = new List<BuildableItemStat> { new BuildableItemStat { RequiredLevel = 2, CoinCost = 50, Experience = 100, BuildSeconds = 60, CouponCost = 0, SpeedUpCoupons = 1, SpeedUpSeconds = 60, RequiredItems = new List<ItemQuantity> { new ItemQuantity { ItemCode = BuildableItemEnum.White_Flour, StoredQuantity = 1 }, new ItemQuantity { ItemCode = BuildableItemEnum.Salt, StoredQuantity = 1 }, new ItemQuantity { ItemCode = BuildableItemEnum.Yeast, StoredQuantity = 1 } } } }, ProductionStats = new List<ProductionItemStat> { new ProductionItemStat { Capacity = 2 } } }; }
void IssueOrderForEachSelectedQueue(ProductionItem item, ProductionIcon icon, Func <ProductionQueue, Order> orderProducer) { var queues = World.Selection.Actors .Where(a => a.IsInWorld && a.World.LocalPlayer == a.Owner) .SelectMany(a => a.TraitsImplementing <ProductionQueue>()) .Where(q => q.Enabled && q.BuildableItems().Any(a => a.Name == icon.Name)); if (queues.Count() == 0) { World.IssueOrder(orderProducer(currentQueue)); } else { foreach (ProductionQueue queue in queues) { World.IssueOrder(orderProducer(queue)); } } }
public int CreateProductionItem(ProductionItem productionItem) { var productionItemQuantums = new List <ProductionItemQuantum>(); foreach (var productionItemQuantum in productionItem.ProductionItemQuantums) { _context.ProductionItemQuantums.Add(new ProductionItemQuantum() { Count = productionItemQuantum.Count, DetailId = productionItemQuantum.DetailId, }); } productionItem.ProductionItemQuantums = productionItemQuantums; productionItem.ChildrenProductionItemsIds = productionItem.ChildrenProductionItemsIds; _context.ProductionItems.Add(productionItem); _context.SaveChanges(); return(productionItem.Id); }
bool HandleLeftClick(ProductionItem item, ProductionIcon icon, int handleCount, Modifiers modifiers) { if (PickUpCompletedBuildingIcon(icon, item)) { Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); return(true); } if (item != null && item.Paused) { // Resume a paused item Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, World.LocalPlayer.Faction.InternalName); World.IssueOrder(Order.PauseProduction(CurrentQueue.Actor, icon.Name, false)); return(true); } var buildable = CurrentQueue.BuildableItems().FirstOrDefault(a => a.Name == icon.Name); if (buildable != null) { // Queue a new item Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Sounds", ClickSound, null); string notification; var canQueue = CurrentQueue.CanQueue(buildable, out notification); if (!CurrentQueue.AllQueued().Any()) { Game.Sound.PlayNotification(World.Map.Rules, World.LocalPlayer, "Speech", notification, World.LocalPlayer.Faction.InternalName); } if (canQueue) { var queued = !modifiers.HasModifier(Modifiers.Ctrl); World.IssueOrder(Order.StartProduction(CurrentQueue.Actor, icon.Name, handleCount, queued)); return(true); } } return(false); }
void ITick.Tick(Actor self) { if (productionItem == null) { return; } if (productionItem.Done) { productionItem.Queue.EndProduction(productionItem); productionItem = null; OnComplete(self); return; } var progress = Math.Min(Info.Steps * (productionItem.TotalTime - productionItem.RemainingTime) / Math.Max(1, productionItem.TotalTime), Info.Steps - 1); if (healthStep != progress) { healthStep = progress; health.InflictDamage(self, self, new Damage(healthSteps[Math.Max(0, progress - 1)] - healthSteps[progress]), true); } }
int2? ChooseBuildLocation(ProductionItem item) { var bi = Rules.Info[item.Item].Traits.Get<BuildingInfo>(); for (var k = 0; k < MaxBaseDistance; k++) foreach (var t in world.FindTilesInCircle(baseCenter, k)) if (world.CanPlaceBuilding(item.Item, bi, t, null)) if (bi.IsCloseEnoughToBase(world, p, item.Item, t)) if (NoBuildingsUnder(ExpandFootprint( FootprintUtils.Tiles( item.Item, bi, t )))) return t; return null; // i don't know where to put it. }
static string GetOverlayForItem(ProductionItem item) { if (item.Paused) return "ON HOLD"; if (item.Done) return "READY"; return WidgetUtils.FormatTime(item.RemainingTimeActual); }
/// <summary> /// Загружает доступные продукции. /// </summary> /// <param name="XMLProductLists"></param> private void LoadProducts(XmlNodeList XMLProductLists) { // очищаем список productions.Clear(); // перебируем все списки содержащие доступные продукции foreach (XmlNode Product in XMLProductLists) { XmlNodeList SameProlList = Product.ChildNodes; foreach (XmlNode item in SameProlList) { // проверяем узел на возможность обработки if (item.Name == "ProductItem") { // получаем идентификатор XmlNode XMLItemAttribute = item.Attributes["id"]; if (XMLItemAttribute == null) throw new Exception("Узел \"Saw\" не содержит обязательный атрибут \"id\""); int ItemId = -1; try { ItemId = Convert.ToInt32(XMLItemAttribute.Value); } catch (Exception ex) { throw new Exception("\"id\": " + ex.Message); } // считываем имя продукции XMLItemAttribute = item.Attributes["Name"]; if (XMLItemAttribute == null) throw new Exception("Узел \"ProductItem\" не содержит обязательный атрибут \"Name\""); string ProductionName = XMLItemAttribute.Value; ProductionItem NewProductionItem = new ProductionItem(ItemId, ProductionName); XmlNodeList SupportedSizes = item.ChildNodes; if (SupportedSizes != null) { foreach (XmlNode SupportedSize in SupportedSizes) { if (SupportedSize.Name != "Size") throw new Exception("Не поддерживаемый дочерний узел: \"" + item.Name + "\" для узла ProductItem. Единственный допустимый тег: \"Size\""); // считываем индекс XMLItemAttribute = SupportedSize.Attributes["Index"]; if (XMLItemAttribute == null) throw new Exception("Узел \"ProductItem\" не содержит обязательный атрибут \"Index\""); int Index = 0; if (XMLItemAttribute.Value.Length > 0) { try { Index = Convert.ToInt32(XMLItemAttribute.Value); } catch (Exception ex) { throw new Exception("Атрибут \"Index\": " + ex.Message); } } // считываем длину заготовки XMLItemAttribute = SupportedSize.Attributes["Length"]; if (XMLItemAttribute == null) throw new Exception("Узел \"ProductItem\" не содержит обязательный атрибут \"Length\""); double Length = 0; if (XMLItemAttribute.Value.Length > 0) { try { Length = Convert.ToDouble(XMLItemAttribute.Value); } catch (Exception ex) { throw new Exception("Атрибут \"Length\": " + ex.Message); } } // считываем ширину заготовки XMLItemAttribute = SupportedSize.Attributes["Width"]; if (XMLItemAttribute == null) throw new Exception("Узел \"ProductItem\" не содержит обязательный атрибут \"Width\""); double Width = 0; if (XMLItemAttribute.Value.Length > 0) { try { Width = Convert.ToDouble(XMLItemAttribute.Value); } catch (Exception ex) { throw new Exception("Атрибут \"Width\": " + ex.Message); } } // считываем высоту заготовки XMLItemAttribute = SupportedSize.Attributes["Height"]; if (XMLItemAttribute == null) throw new Exception("Узел \"ProductItem\" не содержит обязательный атрибут \"Height\""); double Height = 0; if (XMLItemAttribute.Value.Length > 0) { try { Height = Convert.ToDouble(XMLItemAttribute.Value); } catch (Exception ex) { throw new Exception("Атрибут \"Height\": " + ex.Message); } } NewProductionItem.SupSizes.Add(new ProductionSize(Index, Length, Width, Height)); } } productions.Add(NewProductionItem); } else throw new Exception("Не поддерживаемый дочерний узел: \"" + item.Name + "\" для узла Devices. Допустимые узлы: \"Saw\", \"Grinder\"."); } } }
protected void BeginProduction( ProductionItem item ) { Queue.Add(item); }
string GetOverlayForItem(ProductionItem item) { if (item.Paused) return HoldText; if (item.Done) return ReadyText; return WidgetUtils.FormatTime(item.RemainingTimeActual); }