private bool IsRobotInContainer() { bool flag = this.container == null; bool result; if (flag) { this.ClearContainer(); result = false; } else { bool flag2 = GenText.NullOrEmpty(this.spawnThingDef); if (flag2) { result = false; } else { bool flag3 = this.thingDefSpawn == null; if (flag3) { this.thingDefSpawn = DefDatabase <ThingDef> .GetNamedSilentFail(this.spawnThingDef); } bool flag4 = this.thingDefSpawn == null || this.NumContained(this.container, this.thingDefSpawn) == 0; result = !flag4; } } return(result); }
private void Button_SpawnBot() { bool flag = this.robot != null || this.robotIsDestroyed; if (!flag) { bool flag2 = GenText.NullOrEmpty(this.spawnThingDef); if (flag2) { Log.Error("Robot Recharge Station: Wanted to spawn robot, but spawnThingDef is null or empty!"); } else { bool flag3 = !this.IsRobotInContainer(); ArcBaseRobot bot; if (flag3) { bot = Building_BaseRobotCreator.CreateRobot(this.spawnThingDef, base.Position, base.Map, Faction.OfPlayer); } else { bot = this.container [0]; this.container.Remove(bot); bot = (GenSpawn.Spawn(bot, base.Position, base.Map) as ArcBaseRobot); } this.robot = bot; this.robot.rechargeStation = this; this.robotSpawnedOnce = true; this.SpawnRobotAfterRecharge = true; } } }
public override string GetInspectString() { StringBuilder stringBuilder = new StringBuilder(); string inspectString = base.GetInspectString(); bool flag = GenText.NullOrEmpty(inspectString); if (flag) { stringBuilder.Append("..."); } else { stringBuilder.Append(base.GetInspectString()); } bool flag2 = this.robot != null && this.robot.Spawned; if (flag2) { stringBuilder.AppendLine().Append(Translator.Translate("AIRobot_RobotIs") + " " + this.robot.LabelShort); } else { bool flag3 = this.robotIsDestroyed; if (flag3) { stringBuilder.AppendLine().Append(Translator.Translate("AIRobot_RobotIsDestroyed")); } } return(stringBuilder.ToString()); }
// Token: 0x060000F2 RID: 242 RVA: 0x0000AA98 File Offset: 0x00008C98 protected override bool ApplyWorker(XmlDocument xml) { bool flag = false; bool flag2 = GenText.NullOrEmpty(this.defName); bool result; if (flag2) { result = false; } else { foreach (object obj in xml.SelectNodes("Defs/ThingDef[defName=\"" + this.defName + "\"]")) { flag = true; XmlNode xmlNode = obj as XmlNode; XmlContainer xmlContainer = this.statBases; bool flag3 = xmlContainer != null && xmlContainer.node.HasChildNodes; if (flag3) { this.AddOrReplaceStatBases(xml, xmlNode); } XmlContainer xmlContainer2 = this.costList; bool flag4 = xmlContainer2 != null && xmlContainer2.node.HasChildNodes; if (flag4) { this.AddOrReplaceCostList(xml, xmlNode); } bool flag5 = this.Properties != null && this.Properties.node.HasChildNodes; if (flag5) { this.AddOrReplaceVerbPropertiesCE(xml, xmlNode); } bool flag6 = this.AmmoUser != null || this.FireModes != null; if (flag6) { this.AddOrReplaceCompsCE(xml, xmlNode); } bool flag7 = this.weaponTags != null && this.weaponTags.node.HasChildNodes; if (flag7) { this.AddOrReplaceWeaponTags(xml, xmlNode); } bool flag8 = this.researchPrerequisite != null; if (flag8) { this.AddOrReplaceResearchPrereq(xml, xmlNode); } bool flag9 = ModLister.HasActiveModWithName("RunAndGun") && !this.AllowWithRunAndGun; if (flag9) { this.AddRunAndGunExtension(xml, xmlNode); } } result = flag; } return(result); }
public virtual string GetInspectString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(this.shieldField.GetInspectString()); if (this.power != null) { string str = ((ThingComp)this.power).CompInspectStringExtra(); if (!GenText.NullOrEmpty(str)) { stringBuilder.AppendLine(str); } } return(stringBuilder.ToString()); }
// Token: 0x0600001C RID: 28 RVA: 0x0000272C File Offset: 0x0000092C public override string GetInspectString() { string text = base.GetInspectString(); if (!GenText.NullOrEmpty(text)) { text += "\n"; } if (this.Armed) { text += Translator.Translate("TrapArmed"); } else { text += Translator.Translate("TrapNotArmed"); } return(text); }
// Token: 0x06000003 RID: 3 RVA: 0x00002294 File Offset: 0x00000494 internal static bool TryGetGraphicApparel(Apparel apparel, BodyTypeDef bodyType, out ApparelGraphicRecord rec) { Color drawColor = apparel.DrawColor; Color white = Color.white; bool flag = bodyType == null; if (flag) { Log.Error("Getting apparel graphic with undefined body type.", false); bodyType = BodyTypeDefOf.Male; } bool flag2 = GenText.NullOrEmpty(apparel.def.apparel.wornGraphicPath); bool result; if (flag2) { rec = new ApparelGraphicRecord(null, null); result = false; } else { Shader shader = ShaderDatabase.Cutout; bool flag3 = apparel.def.graphicData.shaderType == ShaderTypeDefOf.CutoutComplex; if (flag3) { shader = ShaderDatabase.CutoutComplex; } bool flag4 = apparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead; string text; if (flag4) { text = apparel.def.apparel.wornGraphicPath; } else { text = apparel.def.apparel.wornGraphicPath + "_" + bodyType.ToString(); } Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(text, shader, apparel.def.graphicData.drawSize, drawColor, white); rec = new ApparelGraphicRecord(graphic, apparel); result = true; } return(result); }
// Token: 0x060000F2 RID: 242 RVA: 0x0000979C File Offset: 0x0000799C protected override bool ApplyWorker(XmlDocument xml) { bool result = false; if (GenText.NullOrEmpty(this.defName)) { return(false); } foreach (object obj in xml.SelectNodes("*/ThingDef[defName=\"" + this.defName + "\"]")) { result = true; XmlNode xmlNode = obj as XmlNode; XmlContainer xmlContainer = this.statBases; if (xmlContainer != null && xmlContainer.node.HasChildNodes) { this.AddOrReplaceStatBases(xml, xmlNode); } XmlContainer xmlContainer2 = this.costList; if (xmlContainer2 != null && xmlContainer2.node.HasChildNodes) { this.AddOrReplaceCostList(xml, xmlNode); } if (this.Properties != null && this.Properties.node.HasChildNodes) { this.AddOrReplaceVerbPropertiesCE(xml, xmlNode); } if (this.AmmoUser != null || this.FireModes != null) { this.AddOrReplaceCompsCE(xml, xmlNode); } if (this.weaponTags != null && this.weaponTags.node.HasChildNodes) { this.AddOrReplaceWeaponTags(xml, xmlNode); } if (this.researchPrerequisite != null) { this.AddOrReplaceResearchPrereq(xml, xmlNode); } } return(result); }
// Token: 0x06000029 RID: 41 RVA: 0x00003844 File Offset: 0x00001A44 public static void FloatRange(this Listing_Standard ls, string label, ref FloatRange range, float min = 0f, float max = 1f, string tooltip = null, ToStringStyle valueStyle = ToStringStyle.FloatTwo) { Rect rect = ls.GetRect(Text.LineHeight); Rect rect2 = GenUI.Rounded(GenUI.LeftPart(rect, 0.7f)); Rect rect3 = GenUI.Rounded(GenUI.LeftPart(GenUI.Rounded(GenUI.RightPart(rect, 0.3f)), 0.9f)); rect3.yMin -= 5f; TextAnchor anchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect2, label); Text.Anchor = TextAnchor.MiddleRight; int hashCode = ls.CurHeight.GetHashCode(); Widgets.FloatRange(rect3, hashCode, ref range, min, max, null, valueStyle); if (!GenText.NullOrEmpty(tooltip)) { TooltipHandler.TipRegion(rect, tooltip); } Text.Anchor = anchor; ls.Gap(ls.verticalSpacing); }
// Token: 0x06000028 RID: 40 RVA: 0x0000377C File Offset: 0x0000197C public static void SliderLabeled(this Listing_Standard ls, string label, ref float val, string format, float min = 0f, float max = 1f, string tooltip = null) { Rect rect = ls.GetRect(Text.LineHeight); Rect rect2 = GenUI.Rounded(GenUI.LeftPart(rect, 0.7f)); Rect rect3 = GenUI.Rounded(GenUI.LeftPart(GenUI.Rounded(GenUI.RightPart(rect, 0.3f)), 0.67f)); Rect rect4 = GenUI.Rounded(GenUI.RightPart(rect, 0.1f)); TextAnchor anchor = Text.Anchor; Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect2, label); float num = Widgets.HorizontalSlider(rect3, val, min, max, true, null, null, null, -1f); val = num; Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(rect4, string.Format(format, val)); if (!GenText.NullOrEmpty(tooltip)) { TooltipHandler.TipRegion(rect, tooltip); } Text.Anchor = anchor; ls.Gap(ls.verticalSpacing); }
// Token: 0x060000B5 RID: 181 RVA: 0x0000A040 File Offset: 0x00008240 public virtual Graphic GetPath(Pawn pawn, ref int sharedIndex, int?savedIndex = null) { List <AlienPartGenerator.BodyAddonBackstoryGraphic> list = this.backstoryGraphics; AlienPartGenerator.BodyAddonBackstoryGraphic bodyAddonBackstoryGraphic; string text; int num; if ((bodyAddonBackstoryGraphic = ((list != null) ? list.FirstOrDefault((AlienPartGenerator.BodyAddonBackstoryGraphic babgs) => pawn.story.AllBackstories.Any((Backstory bs) => bs.identifier == babgs.backstory)) : null)) != null) { text = bodyAddonBackstoryGraphic.path; num = bodyAddonBackstoryGraphic.variantCount; } else { List <AlienPartGenerator.BodyAddonHediffGraphic> list2 = this.hediffGraphics; AlienPartGenerator.BodyAddonHediffGraphic bodyAddonHediffGraphic; if ((bodyAddonHediffGraphic = ((list2 != null) ? list2.FirstOrDefault((AlienPartGenerator.BodyAddonHediffGraphic bahgs) => GenCollection.Any <Hediff>(pawn.health.hediffSet.hediffs, (Hediff h) => h.def.defName == bahgs.hediff)) : null)) != null) { text = bodyAddonHediffGraphic.path; num = bodyAddonHediffGraphic.variantCount; } else { text = this.path; num = this.variantCount; } } if (GenText.NullOrEmpty(text)) { return(null); } int num2; return(GraphicDatabase.Get <Graphic_Multi>(text += (((num2 = ((savedIndex != null) ? (sharedIndex = savedIndex.Value) : (this.linkVariantIndexWithPrevious ? (sharedIndex % num) : (sharedIndex = Rand.Range(0, num))))) == 0) ? "" : num2.ToString()), (ContentFinder <Texture2D> .Get(text + "_northm", false) == null) ? ShaderDatabase.Cutout : ShaderDatabase.CutoutComplex, this.drawSize * 1.5f, this.useSkinColor ? pawn.story.SkinColor : pawn.story.hairColor, this.useSkinColor ? ((ThingDef_Race)pawn.def).alienRace.generalSettings.alienPartGenerator.SkinColor(pawn, false) : pawn.story.hairColor)); }
public static void Yautja_SpecificHatPatch(ref Apparel apparel, ref BodyTypeDef bodyType, ref ApparelGraphicRecord rec) { bool flag = bodyType == YautjaDefOf.RRYYautjaFemale || bodyType == YautjaDefOf.RRYYautjaMale; if (flag) { bool flag2 = apparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead; if (flag2) { string text = apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName; bool flag3 = ContentFinder <Texture2D> .Get(text + "_north", false) == null || ContentFinder <Texture2D> .Get(text + "_east", false) == null || ContentFinder <Texture2D> .Get(text + "_south", false) == null; if (!flag3) { Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(text, ShaderDatabase.Cutout, apparel.def.graphicData.drawSize, apparel.DrawColor); rec = new ApparelGraphicRecord(graphic, apparel); } } else { bool flag4 = !GenText.NullOrEmpty(apparel.def.apparel.wornGraphicPath); if (flag4) { string text2 = apparel.def.apparel.wornGraphicPath + "_" + bodyType.defName; bool flag5 = ContentFinder <Texture2D> .Get(text2 + "_north", false) == null || ContentFinder <Texture2D> .Get(text2 + "_east", false) == null || ContentFinder <Texture2D> .Get(text2 + "_south", false) == null; if (flag5) { text2 = apparel.def.apparel.wornGraphicPath + "_Female"; Graphic graphic2 = GraphicDatabase.Get <Graphic_Multi>(text2, ShaderDatabase.Cutout, apparel.def.graphicData.drawSize, apparel.DrawColor); rec = new ApparelGraphicRecord(graphic2, apparel); } } } } }
public override void ResolveReferences() { base.ResolveReferences(); if (!this.addToDatabase) { return; } if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier)) { return; } Backstory backstory = new Backstory(); if (GenText.NullOrEmpty(this.title)) { return; } backstory.SetTitle(this.title, this.title); if (!GenText.NullOrEmpty(this.titleShort)) { backstory.SetTitleShort(this.titleShort, this.titleShort); } else { backstory.SetTitleShort(backstory.title, backstory.title); } if (!GenText.NullOrEmpty(this.baseDescription)) { backstory.baseDesc = this.baseDescription; } else { backstory.baseDesc = "Empty."; } Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal); Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale); Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale); backstory.slot = this.slot; backstory.shuffleable = this.shuffleable; if (GenList.NullOrEmpty <string>(this.spawnCategories)) { return; } backstory.spawnCategories = this.spawnCategories; if (this.workDisables.Count > 0) { using (List <WorkTags> .Enumerator enumerator2 = this.workDisables.GetEnumerator()) { while (enumerator2.MoveNext()) { WorkTags workTags2 = enumerator2.Current; backstory.workDisables |= workTags2; } goto IL_1E9; } } backstory.workDisables = 0; IL_1E9: backstory.ResolveReferences(); backstory.PostLoad(); backstory.identifier = this.saveKeyIdentifier; bool flag = false; foreach (string text in backstory.ConfigErrors(false)) { if (!flag) { flag = true; } } if (!flag) { BackstoryDatabase.AddBackstory(backstory); } }
// Token: 0x060000B4 RID: 180 RVA: 0x00009F74 File Offset: 0x00008174 public virtual bool CanDrawAddon(Pawn pawn) { return(((GenList.NullOrEmpty <string>(this.hiddenUnderApparelTag) && GenList.NullOrEmpty <BodyPartGroupDef>(this.hiddenUnderApparelFor)) || !GenCollection.Any <Apparel>(pawn.apparel.WornApparel, (Apparel ap) => GenCollection.Any <BodyPartGroupDef>(ap.def.apparel.bodyPartGroups, (BodyPartGroupDef bpgd) => this.hiddenUnderApparelFor.Contains(bpgd)) || GenCollection.Any <string>(ap.def.apparel.tags, (string s) => this.hiddenUnderApparelTag.Contains(s)))) && (PawnUtility.GetPosture(pawn) == null || (RestUtility.InBed(pawn) && this.drawnInBed) || this.drawnOnGround) && (GenText.NullOrEmpty(this.backstoryRequirement) || pawn.story.AllBackstories.Any((Backstory b) => b.identifier == this.backstoryRequirement)) && (GenText.NullOrEmpty(this.bodyPart) || pawn.health.hediffSet.GetNotMissingParts(0, 0, null, null).Any((BodyPartRecord bpr) => bpr.untranslatedCustomLabel == this.bodyPart || bpr.def.defName == this.bodyPart))); }
public override void ResolveReferences() { if (BackstoryDatabase.allBackstories.ContainsKey(this.saveKeyIdentifier)) { Log.Error(this.defName + " contains a saveKeyIdentifier value " + saveKeyIdentifier + " which is used already. It won't be added as a def. Make sure that the identifier is unique."); return; } Backstory backstory = new Backstory(); if (this.forcedTraits?.Any() ?? false) { backstory.forcedTraits = new List <TraitEntry>(); foreach (var trait in this.forcedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance)) { backstory.forcedTraits.Add(new TraitEntry(trait.defName, trait.degree)); } } if (this.disallowedTraits?.Any() ?? false) { backstory.disallowedTraits = new List <TraitEntry>(); foreach (var trait in this.disallowedTraits.Where(x => Rand.RangeInclusive(0, 100) < x.chance)) { backstory.disallowedTraits.Add(new TraitEntry(trait.defName, trait.degree)); } } backstory.SetTitle(this.title, this.title); if (!GenText.NullOrEmpty(this.titleShort)) { backstory.SetTitleShort(this.titleShort, this.titleShort); } else { backstory.SetTitleShort(backstory.title, backstory.title); } if (!GenText.NullOrEmpty(this.baseDescription)) { backstory.baseDesc = this.baseDescription; } Traverse.Create(backstory).Field("bodyTypeGlobal").SetValue(this.bodyTypeGlobal); Traverse.Create(backstory).Field("bodyTypeMale").SetValue(this.bodyTypeMale); Traverse.Create(backstory).Field("bodyTypeFemale").SetValue(this.bodyTypeFemale); if (skillGains?.Any() ?? false) { var skillGainsDict = skillGains.ToDictionary(x => x.skill.defName, y => y.minLevel); Traverse.Create(backstory).Field("skillGains").SetValue(skillGainsDict); } backstory.slot = this.slot; backstory.shuffleable = this.shuffleable; backstory.spawnCategories = this.spawnCategories; if (this.workDisables.Any()) { foreach (var workTag in this.workDisables) { backstory.workDisables |= workTag; } } else { backstory.workDisables = WorkTags.None; } backstory.PostLoad(); backstory.ResolveReferences(); backstory.identifier = this.saveKeyIdentifier; if (!backstory.ConfigErrors(true).Any()) { BackstoryDatabase.AddBackstory(backstory); } else { foreach (var err in backstory.ConfigErrors(true)) { Log.Error(backstory + " - " + err); } } }
public override void DoWindowContents(Rect inRect) { AddRenameButton(inRect); AddRenamedLabel(); #region Origianl Text.Font = GameFont.Small; Rect rect2 = new Rect(0f, 50f, 180f, inRect.height - 50f); Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.Begin(rect2); if (bill.suspended) { if (listing_Standard.ButtonText("Suspended".Translate(), null)) { bill.suspended = false; } } else if (listing_Standard.ButtonText("NotSuspended".Translate(), null)) { bill.suspended = true; } #endregion AddAssignWorkerButton(listing_Standard); if (listing_Standard.ButtonText(bill.repeatMode.GetLabel(), null)) { BillRepeatModeUtility.MakeConfigFloatMenu(bill); } var label = ("BillStoreMode_" + bill.storeMode).Translate(); if (listing_Standard.ButtonText(label, null)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (BillStoreModeDef current in from bsm in DefDatabase <BillStoreModeDef> .AllDefs orderby bsm.listOrder select bsm) { BillStoreModeDef smLocal = current; list.Add(new FloatMenuOption(("BillStoreMode_" + current).Translate(), delegate { this.bill.storeMode = smLocal; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } listing_Standard.Gap(12f); if (bill.repeatMode == BillRepeatModeDefOf.RepeatCount) { listing_Standard.Label("RepeatCount".Translate(bill.RepeatInfoText)); listing_Standard.IntSetter(ref bill.repeatCount, 1, "1", 42f); listing_Standard.IntAdjuster(ref bill.repeatCount, 1, 25, 1); // changed listing_Standard.IntAdjuster(ref bill.repeatCount, 10, 250, 1); } else if (bill.repeatMode == BillRepeatModeDefOf.TargetCount) { var text = "CurrentlyHave".Translate() + ": "; text += bill.recipe.WorkerCounter.CountProducts(bill); text += " / "; text += bill.targetCount >= 999999 ? "Infinite".Translate().ToLower() : bill.targetCount.ToString(); var text2 = bill.recipe.WorkerCounter.ProductsDescription(bill); if (!text2.NullOrEmpty()) { var text3 = text; text = string.Concat(text3, "\n", "CountingProducts".Translate(), ": ", text2); } listing_Standard.Label(text); // changed // todo : extract method listing_Standard.IntSetter(ref bill.targetCount, 1, "1", 42f); listing_Standard.IntAdjuster(ref bill.targetCount, 1, 25, 1); listing_Standard.IntAdjuster(ref bill.targetCount, 10, 250, 1); } listing_Standard.Gap(12f); listing_Standard.Label("IngredientSearchRadius".Translate() + ": " + bill.ingredientSearchRadius.ToString("F0")); bill.ingredientSearchRadius = listing_Standard.Slider(bill.ingredientSearchRadius, 3f, 100f, null); // changed if (bill.ingredientSearchRadius >= 100f) { bill.ingredientSearchRadius = 999f; } //listing_Standard.Gap(-4f); // °¸ ��»ף if (bill.recipe.workSkill != null) { listing_Standard.Label("AllowedSkillRange".Translate(bill.recipe.workSkill.label.ToLower())); listing_Standard.IntRange(ref bill.allowedSkillRange, 0, 20); } AddMinBarButton(listing_Standard); #region original listing_Standard.End(); Rect rect3 = new Rect(rect2.xMax + 6f, 50f, 280f, -1f); rect3.yMax = inRect.height - this.CloseButSize.y - 6f; ThingFilterUI.DoThingFilterConfigWindow(rect3, ref this.scrollPosition, this.bill.ingredientFilter, this.bill.recipe.fixedIngredientFilter, 4, null, null); Rect rect4 = new Rect(rect3.xMax + 6f, rect3.y + 30f, 0f, 0f); rect4.xMax = inRect.xMax; rect4.yMax = inRect.height - this.CloseButSize.y - 6f; StringBuilder stringBuilder = new StringBuilder(); if (this.bill.recipe.description != null) { stringBuilder.AppendLine(this.bill.recipe.description); stringBuilder.AppendLine(); } stringBuilder.AppendLine(Translator.Translate("WorkAmount") + ": " + GenText.ToStringWorkAmount(this.bill.recipe.WorkAmountTotal(null))); stringBuilder.AppendLine(); for (int i = 0; i < this.bill.recipe.ingredients.Count; i++) { IngredientCount ingredientCount = this.bill.recipe.ingredients[i]; if (!GenText.NullOrEmpty(ingredientCount.filter.Summary)) { stringBuilder.AppendLine(this.bill.recipe.IngredientValueGetter.BillRequirementsDescription(this.bill.recipe, ingredientCount)); } } stringBuilder.AppendLine(); string text5 = this.bill.recipe.IngredientValueGetter.ExtraDescriptionLine(this.bill.recipe); if (text5 != null) { stringBuilder.AppendLine(text5); stringBuilder.AppendLine(); } stringBuilder.AppendLine(Translator.Translate("MinimumSkills")); stringBuilder.AppendLine(this.bill.recipe.MinSkillString); Text.Font = GameFont.Small; string text6 = stringBuilder.ToString(); if (Text.CalcHeight(text6, rect4.width) > rect4.height) { Text.Font = GameFont.Tiny; } Widgets.Label(rect4, text6); Text.Font = GameFont.Small; if (this.bill.recipe.products.Count == 1) { Widgets.InfoCardButton(rect4.x, rect3.y, this.bill.recipe.products[0].thingDef); } #endregion }