public void OnPartsRemoved(System.Collections.ICollection removedPartsSet) { if (_bar != null) { if (Parts.Contains(_bar.ID) == false) { Parts.Add(_tarPane, _bar); } } }
public double GetFinalCost(Hero h) { var resultCost = Cost; var gottenParts = h.Items.Where(i => Parts.Contains(i)); var tempParts = new List <Item>(Parts); foreach (var i in gottenParts) { if (tempParts.Contains(i)) { tempParts.Remove(i); resultCost -= i.Cost; } } return(resultCost); }
/// <summary> /// Проверяет, выполняется ли в этом контексте отслеживание указанного объекта /// </summary> /// <param name="entity">Искомый объект</param> /// <returns>Если объект отслеживается - true, в противном случае - false</returns> public bool IsObjectTracked(object entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } bool contained = false; if (entity is Part) { contained = Parts.Contains((Part)entity); } else if (entity is DeviceDetail) { contained = DeviceDetails.Contains((DeviceDetail)entity); } return(contained); }
public bool Contains(IPartView item) { return(Parts.Contains((AdvancedPart)item)); }
public bool Contains(EquipmentSetPart part) { return(Parts.Contains(part)); }
/// <summary> /// Adds a child KmlItem to this nodes lists of children, depending of its /// derived class KmlNode, KmlPart, KmlAttrib or further derived from these. /// When an KmlAttrib "Name", "Type" or "Root" are found, their value /// will be used for the corresponding property of this node. /// </summary> /// <param name="beforeItem">The KmlItem where the new item should be inserted before</param> /// <param name="newItem">The KmlItem to add</param> protected override void Add(KmlItem beforeItem, KmlItem newItem) { if (newItem is KmlAttrib) { KmlAttrib attrib = (KmlAttrib)newItem; if (attrib.Name.ToLower() == "type" && Type.Length == 0) { Type = attrib.Value; // Get notified when Type changes attrib.AttribValueChanged += Type_Changed; attrib.CanBeDeleted = false; } else if (attrib.Name.ToLower() == "sit" && Situation.Length == 0) { Situation = attrib.Value; // Get notified when Type changes attrib.AttribValueChanged += Situation_Changed; attrib.CanBeDeleted = false; } else if (attrib.Name.ToLower() == "root" && RootPart == null) { SetRootPart(attrib.Value); // Get notified when Type changes attrib.AttribValueChanged += Root_Changed; attrib.CanBeDeleted = false; } } else if (newItem is KmlPart) { KmlPart part = (KmlPart)newItem; if (beforeItem != null) { KmlPart beforePart = null; int allIndex = AllItems.IndexOf(beforeItem); for (int i = allIndex; i < AllItems.Count; i++) { if (AllItems[i] is KmlPart && Parts.Contains((KmlPart)AllItems[i])) { beforePart = (KmlPart)AllItems[i]; break; } } if (beforePart != null) { beforePart.InsertionPreparation(); Parts.Insert(Parts.IndexOf(beforePart), part); beforePart.InsertionFinalization(); } else { Parts.Add(part); } } else { Parts.Add(part); } if (Parts.Count == rootPartIndex + 1) { RootPart = Parts[rootPartIndex]; } if (part.Flag != "" && !Flags.Any(x => x.ToLower() == part.Flag.ToLower())) { Flags.Add(part.Flag); } if (part.HasResources) { foreach (string resType in part.ResourceTypes) { ResourceTypes.Add(resType); } } KmlAttrib flag = part.GetAttrib("flag"); if (flag != null) { flag.AttribValueChanged += Flag_Changed; } } base.Add(beforeItem, newItem); }
/// <summary> /// Determines whether the specified source contains role. /// </summary> /// <param name="source">The source.</param> /// <returns><c>true</c> if the specified source contains role; otherwise, <c>false</c>.</returns> public bool ContainsRole(IRole source) { return(Parts.Contains(source)); }
private bool ContainsButton(IMenuButton button) { return(Parts.Contains(button)); }