AllowTool.Designator_MassSelect.UpdateSelectionConstraints C# (CSharp) Метод

UpdateSelectionConstraints() приватный Метод

private UpdateSelectionConstraints ( ) : void
Результат void
		private void UpdateSelectionConstraints() {
			constraintsNeedReindexing = false;
			selectionConstraints.Clear();
			// get defs of selected objects, count duplicates
			foreach (var selectedObject in Find.Selector.SelectedObjects) {
				var thing = selectedObject as Thing;
				if (thing == null || thing.def == null || !thing.def.selectable) continue;
				int constraintHash = GetConstraintHashForThing(thing);
				SelectionDefConstraint constraint;
				selectionConstraints.TryGetValue(constraintHash, out constraint);
				if (constraint == null) selectionConstraints[constraintHash] = constraint = new SelectionDefConstraint(thing.def, thing.Stuff);
				constraint.occurences++;
			}
			var constraintList = selectionConstraints.Values.ToList();
			var builder = new StringBuilder();
			constraintList.Sort((e1, e2) => -e1.occurences.CompareTo(e2.occurences)); // sort by number of occurences, descending
			// list constraints for the tooltip
			for (int i = 0; i < constraintList.Count; i++) {
				var isLastEntry = i >= constraintList.Count - 1;
				var constraint = constraintList[i];
				if (i < MaxNumListedConstraints - 1 || isLastEntry) {
					if (constraint.thingDef.label == null) continue;
					builder.Append(constraint.thingDef.label.CapitalizeFirst());
					if (constraint.stuffDef != null && constraint.stuffDef.label != null) {
						builder.AppendFormat(" ({0})", constraint.stuffDef.label.CapitalizeFirst());
					}
					if (!isLastEntry) builder.Append(ConstraintListSeparator);
				} else {
					builder.Append("MassSelect_numMoreTypes".Translate(constraintList.Count - i));
					break;
				}
			}
			cachedConstraintReadout = builder.ToString();
			if (cachedConstraintReadout.Length == 0) cachedConstraintReadout = "MassSelect_anything".Translate(); // nothing was selected
		}