public override float DoEditInterface(PawnFilterListing list) { Rect rect = list.GetPawnFilterPartRect(this, RowHeight * 2); // Add skill chooser button. Rect skillButtonRect = new Rect(rect.x, rect.y, rect.width, rect.height / 2); if (Widgets.ButtonText(skillButtonRect, this.skill.LabelCap)) { // Fill dropdown. List <FloatMenuOption> options = new List <FloatMenuOption>(); foreach (SkillDef def in PawnFilter.allSkills) { options.Add(new FloatMenuOption(def.LabelCap, () => this.skill = def)); } Find.WindowStack.Add(new FloatMenu(options)); } // Add passion chooser button. Rect passionButtonRect = new Rect(rect.x, rect.y + skillButtonRect.height, rect.width, rect.height / 2); if (Widgets.ButtonText(passionButtonRect, this.passionLevel.ToString().CapitalizeFirst())) { // Fill dropdown. List <FloatMenuOption> options = new List <FloatMenuOption>(); foreach (Passion passionLevel in Enum.GetValues(typeof(Passion))) { options.Add(new FloatMenuOption(passionLevel.ToString().CapitalizeFirst(), () => this.passionLevel = passionLevel)); } Find.WindowStack.Add(new FloatMenu(options)); } return(RowHeight * 2); }
//public static bool operator !=(Blueprint b1, Blueprint b2) //{ // return b1.KindDef != b2.KindDef || // b1.BodyGraphicDef != b2.BodyGraphicDef || // b1.HeadGraphicDef != b2.HeadGraphicDef || // b1.WorkPackages != b2.WorkPackages || // b1.StartingSkillLevel != b2.StartingSkillLevel || // b1.SkillPassion != b2.SkillPassion || // b1.ExplodeOnDeath != b2.ExplodeOnDeath || // b1.ExplosionRadius != b2.ExplosionRadius || // b1.BatteryDef != b2.BatteryDef; //} //public static bool operator ==(Blueprint b1, Blueprint b2) //{ // return b1.KindDef == b2.KindDef && // b1.BodyGraphicDef == b2.BodyGraphicDef && // b1.HeadGraphicDef == b2.HeadGraphicDef && // b1.WorkPackages == b2.WorkPackages && // b1.StartingSkillLevel == b2.StartingSkillLevel && // b1.SkillPassion == b2.SkillPassion && // b1.ExplodeOnDeath == b2.ExplodeOnDeath && // b1.ExplosionRadius == b2.ExplosionRadius && // b1.BatteryDef == b2.BatteryDef; //} public override string ToString() { StringBuilder b = new StringBuilder(); b.AppendLine("BpName" + BpName); if (KindDef != null) { b.AppendLine("KindDef: " + KindDef.defName); } if (BodyGraphicDef != null) { b.AppendLine("BodyGraphicDef: " + BodyGraphicDef.defName); } if (HeadGraphicDef != null) { b.AppendLine("HeadGraphicDef: " + HeadGraphicDef.defName); } if (WorkPackages != null) { b.AppendLine("Work packages: "); foreach (var p in WorkPackages) { b.AppendLine(p.label); } b.AppendLine(); } b.AppendLine("Starting skill: " + StartingSkillLevel.ToString()); b.AppendLine("Passion: " + SkillPassion.ToString()); b.AppendLine("Explode on death: " + ExplodeOnDeath.ToString()); b.AppendLine("Explosion radius: " + ExplosionRadius.ToString()); if (BatteryDef != null) { b.AppendLine("Battery: " + BatteryDef.defName); } b.AppendLine("Name: " + Name); return(b.ToString()); }
protected override IEnumerable <string> ApplyPartWorker(Pawn pawn, object cause) { SkillRecord realSkill = pawn.skills.GetSkill(skill); Passion adjustedPassion = (Passion)MathUtility.MoveTowardsOperationClamped((byte)realSkill.passion, (byte)target, delta, operation); yield return(MessageSkillPassionChanged.Translate(pawn.LabelShort, skill.label, adjustedPassion.ToString().ToLower(), ParseCause(cause))); realSkill.passion = adjustedPassion; // We're done here. yield break; }