public List<Designation> DesignationsOfOn( DesignationDef def, Utilities_Livestock.AgeAndSex ageSex ) { return Designations.Where( des => des.def == def && des.target.HasThing && des.target.Thing is Pawn && ( (Pawn)des.target.Thing ).PawnIsOfAgeSex( ageSex ) ) .ToList(); }
private bool TryRemoveDesignation( Utilities_Livestock.AgeAndSex ageSex, DesignationDef def ) { // get current designations List<Designation> currentDesignations = DesignationsOfOn( def, ageSex ); // if none, return false if ( currentDesignations.Count == 0 ) { return false; } // else, remove one from the game as well as our managed list. (delete last - this should be the youngest/oldest). Designations.Remove( currentDesignations.Last() ); currentDesignations.Last().Delete(); return true; }
private void DoCountField( Rect rect, Utilities_Livestock.AgeAndSex ageSex ) { if ( _newCounts == null || _newCounts[ageSex] == null ) { _newCounts = _selectedCurrent?.Trigger?.CountTargets.ToDictionary( k => k.Key, v => v.Value.ToString() ); } if ( !_newCounts[ageSex].IsInt() ) { GUI.color = Color.red; } else { _selectedCurrent.Trigger.CountTargets[ageSex] = int.Parse( _newCounts[ageSex] ); } _newCounts[ageSex] = Widgets.TextField( rect.ContractedBy( 1f ), _newCounts[ageSex] ); GUI.color = Color.white; }