static bool Prefix(Pawn __instance, ref WorkTags __result) { if (LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkPassionSkills) { WorkTags workTags = (__instance.story != null) ? __instance.story.DisabledWorkTagsBackstoryAndTraits : WorkTags.None; WorkTags disabledRoyalTags = WorkTags.None; if (__instance.royalty?.MostSeniorTitle?.def?.seniority > 100) { foreach (RoyalTitle royalTitle in __instance.royalty.AllTitlesForReading) { if (royalTitle.conceited) { disabledRoyalTags |= royalTitle.def.disabledWorkTags; } } var namelist = new List <string>(); if (LoadedModManager.GetMod <RoyaltyTweaksMod>().GetSettings <RoyaltyTweaksSettings>().willWorkOnlyMajorPassionSkills) { namelist = __instance.skills.skills.Where(a => a.passion == Passion.Major).Select(b => b.def.defName).ToList(); } else { namelist = __instance.skills.skills.Where(a => a.passion != Passion.None).Select(b => b.def.defName).ToList(); } var list = DefDatabase <WorkTypeDef> .AllDefsListForReading; if (namelist != null && namelist.Any()) { var worklist = list.Where(a => a.relevantSkills != null && a.relevantSkills.Any() && namelist.Contains(a.relevantSkills.First().defName)).Select(b => b.workTags); if (worklist != null && worklist.Any()) { foreach (var worklistItem in worklist) { disabledRoyalTags &= ~worklistItem; } } } } workTags |= disabledRoyalTags; if (__instance.health != null && __instance.health.hediffSet != null) { foreach (Hediff hediff in __instance.health.hediffSet.hediffs) { HediffStage curStage = hediff.CurStage; if (curStage != null) { workTags |= curStage.disabledWorkTags; } } } __result = workTags; return(false); } return(true); }
public override void DoWindowContents(Rect inRect) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.UpperCenter; string title; if (file == null) { title = "MpHostIngame".Translate(); } else if (file.replay) { title = "MpHostReplay".Translate(); } else { title = "MpHostSavefile".Translate(); } Widgets.Label(inRect.Down(0), title); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; var entry = new Rect(0, 45, inRect.width, 30f); var labelWidth = 110f; settings.gameName = TextEntryLabeled(entry, $"{"MpGameName".Translate()}: ", settings.gameName, labelWidth); entry = entry.Down(40); TextFieldNumericLabeled(entry.Width(labelWidth + 30f), $"{"MpMaxPlayers".Translate()}: ", ref settings.maxPlayers, ref maxPlayersBuffer, labelWidth, 0, 999); TextFieldNumericLabeled(entry.Right(150f).Width(labelWidth + 85f), $"{"MpAutosaveEvery".Translate()} ", ref settings.autosaveInterval, ref autosaveBuffer, labelWidth + 45f, 0, 999); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(entry.Right(200f).Right(labelWidth + 35f), $" {"MpAutosaveDays".Translate()}"); Text.Anchor = TextAnchor.UpperLeft; entry = entry.Down(40); /*const char passChar = '\u2022'; * if (Event.current.type == EventType.Repaint || Event.current.isMouse) * TextEntryLabeled(entry.Width(200), "Password: "******"Password: "******"{"MpPauseOnAutosave".Translate()}: "; var pauseOnAutosaveLabelWidth = Text.CalcSize(pauseOnAutosaveLabel).x; var pauseOnAutosaveCheckboxWidth = pauseOnAutosaveLabelWidth + 30f; CheckboxLabeled(entry.Width(pauseOnAutosaveCheckboxWidth), pauseOnAutosaveLabel, ref settings.pauseOnAutosave, placeTextNearCheckbox: true); entry = entry.Down(30); var directLabel = $"{"MpDirect".Translate()}: "; var directLabelWidth = Text.CalcSize(directLabel).x; CheckboxLabeled(entry.Width(checkboxWidth), directLabel, ref settings.direct, placeTextNearCheckbox: true); if (settings.direct) { settings.directAddress = Widgets.TextField(entry.Width(checkboxWidth + 10).Right(checkboxWidth + 10), settings.directAddress); } entry = entry.Down(30); var lanRect = entry.Width(checkboxWidth); CheckboxLabeled(lanRect, $"{"MpLan".Translate()}: ", ref settings.lan, placeTextNearCheckbox: true); TooltipHandler.TipRegion(lanRect, $"{"MpLanDesc1".Translate()}\n\n{"MpLanDesc2".Translate(settings.lanAddress)}"); entry = entry.Down(30); if (SteamManager.Initialized) { CheckboxLabeled(entry.Width(checkboxWidth), $"{"MpSteam".Translate()}: ", ref settings.steam, placeTextNearCheckbox: true); entry = entry.Down(30); } // AsyncTime { TooltipHandler.TipRegion(entry.Width(checkboxWidth), $"{"MpAsyncTimeDesc".Translate()}\n\n{"MpExperimentalFeature".Translate()}"); CheckboxLabeled(entry.Width(checkboxWidth), $"{"MpAsyncTime".Translate()}: ", ref MultiplayerWorldComp.asyncTime, placeTextNearCheckbox: true, disabled: asyncTimeLocked); entry = entry.Down(30); } TooltipHandler.TipRegion(entry.Width(checkboxWidth), $"{"MpLogDesyncTracesDesc".Translate()}\n\n{"MpExperimentalFeature".Translate()}"); CheckboxLabeled(entry.Width(checkboxWidth), $"{"MpLogDesyncTraces".Translate()}: ", ref logDesyncTraces, placeTextNearCheckbox: true); entry = entry.Down(30); // Arbiter if (MpVersion.IsDebug) { TooltipHandler.TipRegion(entry.Width(checkboxWidth), "MpArbiterDesc".Translate()); CheckboxLabeled(entry.Width(checkboxWidth), $"{"MpRunArbiter".Translate()}: ", ref settings.arbiter, placeTextNearCheckbox: true); entry = entry.Down(30); } if (Prefs.DevMode) { CheckboxLabeled(entry.Width(checkboxWidth), "Debug mode: ", ref debugMode, placeTextNearCheckbox: true); entry = entry.Down(30); } if (Event.current.type == EventType.Layout && height != entry.yMax) { height = entry.yMax; SetInitialSizeAndPosition(); } var buttonRect = new Rect((inRect.width - 100f) / 2f, inRect.height - 35f, 100f, 35f); if (Widgets.ButtonText(buttonRect, "MpHostButton".Translate())) { LoadedModManager.GetMod <MultiplayerMod>().WriteSettings(); TryHost(); } }
public override void DoWindowContents(Rect inRect) { Listing_Standard listingStandard = new Listing_Standard(); listingStandard.Begin(inRect); listingStandard.Label(string.Format("{0} {1}{2}</color>", "WeaponQualityIndicatorChangeColor".Translate(), qualityColor, ("QualityCategory_" + quality.CapitalizeFirst()).Translate())); listingStandard.Gap(10f); listingStandard.Label(string.Format("<color=#FF0000>{0}</color>", "WeaponQualityIndicatorRed".Translate())); Rect rectR = listingStandard.GetRect(22f); colorR = Widgets.HorizontalSlider(rectR, colorR, 0f, 255f, false, colorR.ToString(), "0", "255", 1f); listingStandard.Gap(10f); listingStandard.Label(string.Format("<color=#00FF00>{0}</color>", "WeaponQualityIndicatorGreen".Translate())); Rect rectG = listingStandard.GetRect(22f); colorG = Widgets.HorizontalSlider(rectG, colorG, 0f, 255f, false, colorG.ToString(), "0", "255", 1f); listingStandard.Gap(10f); listingStandard.Label(string.Format("<color=#0000FF>{0}</color>", "WeaponQualityIndicatorBlue".Translate())); Rect rectB = listingStandard.GetRect(22f); colorB = Widgets.HorizontalSlider(rectB, colorB, 0f, 255f, false, colorB.ToString(), "0", "255", 1f); listingStandard.Gap(10f); if (listingStandard.ButtonText("WeaponQualityIndicatorResetDefault".Translate())) { qualityColor = defaultQualityColor; SetRGBColors(); } listingStandard.End(); qualityColor = "<color=#" + String.Format("{0:X2}{1:X2}{2:X2}", (int)colorR, (int)colorG, (int)colorB) + ">"; Vector2 buttonSize = new Vector2(120f, 40f); float positionButtonY = InitialSize.y - buttonSize.y - 36f; float positionOk = InitialSize.x / 2 - buttonSize.x - 5f - 18f; float positionCancel = positionOk + buttonSize.x + 10f; Rect rectOk = new Rect(positionOk, positionButtonY, buttonSize.x, buttonSize.y); Rect rectCancel = new Rect(positionCancel, positionButtonY, buttonSize.x, buttonSize.y); if (Widgets.ButtonText(rectOk, "OK".Translate())) { switch (quality) { case "awful": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorAwful = qualityColor; break; case "poor": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorPoor = qualityColor; break; case "normal": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorNormal = qualityColor; break; case "good": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorGood = qualityColor; break; case "excellent": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorExcellent = qualityColor; break; case "masterwork": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorMasterwork = qualityColor; break; case "legendary": LoadedModManager.GetMod <WeaponQualityIndicatorMod>().GetSettings <WeaponQualityIndicatorModSettings>().colorLegendary = qualityColor; break; default: break; } this.Close(true); Event.current.Use(); } if (Widgets.ButtonText(rectCancel, "CancelButton".Translate())) { this.Close(true); Event.current.Use(); } }
public static Settings Get() { return(LoadedModManager.GetMod <Replace_Stuff.Mod>().GetSettings <Settings>()); }
public void Save() { LoadedModManager.GetMod <PackedMeat>().GetSettings <Settings>().Write(); }
private void DrawResources(int x, int y, int spacing) { foreach (ResourceType resourceType in ResourceUtils.resourceTypes) { ResourceFC resource = settlement.getResource(resourceType); float rectY = scroll + y + 70 + (int)resourceType * (45 + spacing); //Don't draw if outside view if ((int)resourceType * ScrollSpacing + scroll < 0) { continue; } bool titheDisabled = false; if (ShouldTitheBeLockedForResouceType(resourceType)) { titheDisabled = true; } else if (Widgets.ButtonImage(new Rect(x - 15, scroll + y + 65 + (int)resourceType * (45 + spacing) + 8, 20, 20), TexLoad.iconCustomize)) { TitheCustomizationClicked(resource, resourceType); } Widgets.Checkbox(new Vector2(x + 8, scroll + y + 65 + (int)resourceType * (45 + spacing) + 8), ref resource.isTithe, 24, titheDisabled); DoTitheCheckboxAction(resource.isTithe != resource.isTitheBool, resource); DoResourceDescriptionButton(resource, resourceType, x, y, spacing); //Production Efficiency Widgets.DrawBox(new Rect(x + 80, rectY, 100, 20)); Widgets.FillableBar(new Rect(x + 80, rectY, 100, 20), (float)Math.Min(resource.baseProductionMultiplier, 1.0)); Widgets.Label(new Rect(x + 80, scroll + y + 90 + (int)resourceType * (45 + spacing), 100, 20), "Workers".Translate() + ": " + resource.assignedWorkers); if (Widgets.ButtonText(new Rect(x + 80, scroll + y + 90 + (int)resourceType * (45 + spacing), 20, 20), "<")) { IncreaseWorkers(resourceType, true); } if (Widgets.ButtonText(new Rect(x + 160, scroll + y + 90 + (int)resourceType * (45 + spacing), 20, 20), ">")) { IncreaseWorkers(resourceType); } //Base Production Widgets.Label(new Rect(x + 195, rectY, 45, 40), FactionColonies.FloorStat(resource.baseProduction)); //Final Modifier Widgets.Label(new Rect(x + 250, rectY, 50, 40), FactionColonies.FloorStat(resource.endProductionMultiplier)); //Final Base Widgets.Label(new Rect(x + 310, rectY, 45, 40), (FactionColonies.FloorStat(resource.endProduction))); //Est Income Widgets.Label(new Rect(x + 365, rectY, 45, 40), (FactionColonies.FloorStat(resource.endProduction * LoadedModManager .GetMod <FactionColoniesMod>().GetSettings <FactionColonies>().silverPerResource))); //Tithe Percentage resource.returnTaxPercentage(); string taxPercentage = FactionColonies.FloorStat(resource.taxPercentage) + "%"; Widgets.Label(new Rect(x + 420, rectY, 45, 40), taxPercentage); } }
List <FloatMenuOption> IAddonMenu.MenuOptions() => new List <FloatMenuOption> { new FloatMenuOption("Settings", delegate() { Window_ModSettings window = new Window_ModSettings(LoadedModManager.GetMod <TwitchToolkit>()); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Events", delegate() { StoreIncidentsWindow window = new StoreIncidentsWindow(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Items", delegate() { StoreItemsWindow window = new StoreItemsWindow(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Commands", delegate() { Window_Commands window = new Window_Commands(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Viewers", delegate() { Window_Viewers window = new Window_Viewers(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Name Queue", delegate() { QueueWindow window = new QueueWindow(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Tracker", delegate() { Window_Trackers window = new Window_Trackers(); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); }), new FloatMenuOption("Toggle Earning Coins", delegate() { ToolkitSettings.EarningCoins = !ToolkitSettings.EarningCoins; if (ToolkitSettings.EarningCoins) { Messages.Message("Earning Coins is Enabled", MessageTypeDefOf.NeutralEvent); } else { Messages.Message("Earning Coins is Disabled", MessageTypeDefOf.NeutralEvent); } }), new FloatMenuOption("Debug Fix", delegate() { Helper.playerMessages = new List <string>(); Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>(); }) };
public void Save() { LoadedModManager.GetMod <CommonSense>().GetSettings <Settings>().Write(); }
public static Settings Get() { return(LoadedModManager.GetMod <What_Is_My_Purpose.Mod>().GetSettings <Settings>()); }
protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; PawnKindDef pawnKindDef; IntVec3 intVec; IntVec3 intVec2; return(this.TryFindAnimalKind(map.Tile, out pawnKindDef) && this.TryFindStartAndEndCells(map, out intVec, out intVec2) && LoadedModManager.GetMod <AlphaAnimals_Mod>().GetSettings <AlphaAnimals_Settings>().flagSummitCrab); }
public static List<Thing> generateTithe(double valueBase, double valueDiff, int multiplier, int resourceID, double traitValueMod ) { FactionFC faction = Find.World.GetComponent<FactionFC>(); List <Thing> things = new List<Thing>(); ThingSetMaker thingSetMaker = new ThingSetMaker_MarketValue(); ThingSetMakerParams param = new ThingSetMakerParams(); param.totalMarketValueRange = new FloatRange((float)((valueBase* LoadedModManager.GetMod<FactionColoniesMod>().GetSettings<FactionColonies>().silverPerResource )- ((valueDiff + traitValueMod) *multiplier)), (float)((valueBase * LoadedModManager.GetMod<FactionColoniesMod>().GetSettings<FactionColonies>().silverPerResource) + ((valueDiff + traitValueMod) * multiplier))); param.filter = new ThingFilter(); param.techLevel = FactionColonies.getPlayerColonyFaction().def.techLevel; switch (resourceID) { case 0: //food param.filter.SetAllow(ThingCategoryDefOf.FoodMeals, true); param.countRange = new IntRange(1, 5+multiplier); break; case 1: //weapons param.filter.SetAllow(ThingCategoryDefOf.Weapons, true); param.countRange = new IntRange(1, 4+(2*multiplier)); break; case 2: //apparel param.filter.SetAllow(ThingCategoryDefOf.Apparel, true); param.countRange = new IntRange(1, 4+ (3*multiplier)); break; case 3: //animals thingSetMaker = new ThingSetMaker_Animals(); param.techLevel = TechLevel.Undefined; //param.countRange = new IntRange(1,4); break; case 4: //Logging param.filter.SetAllow(ThingDefOf.WoodLog, true); param.countRange = new IntRange(1, 5*multiplier); break; case 5: //Mining param.filter.SetAllow(StuffCategoryDefOf.Metallic, true); param.filter.SetAllow(ThingDefOf.Silver, false); //Android shit? param.filter.SetAllow(DefDatabase<ThingDef>.GetNamedSilentFail("Teachmat"), false); //Remove RimBees Beeswax param.filter.SetAllow(DefDatabase<StuffCategoryDef>.GetNamedSilentFail("RB_Waxy"), false); //Remove Alpha Animals skysteel param.filter.SetAllow(DefDatabase<ThingDef>.GetNamedSilentFail("AA_SkySteel"), false); param.countRange = new IntRange(1, 4*multiplier); break; case 6: //research Log.Message("generateTithe - Research Tithe - How did you get here?"); break; case 7: //Power Log.Message("generateTithe - Power Tithe - How did you get here?"); break; case 8: //Medicine/Bionics param.filter.SetAllow(ThingCategoryDefOf.Medicine, true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsNatural"), true); switch (faction.techLevel) { case TechLevel.Archotech: case TechLevel.Ultra: param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsUltra"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsBionic"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsProsthetic"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsNatural"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BionicProstheses") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BionicProstheses"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("AdvancedProstheses") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("AdvancedProstheses"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("SyntheticOrgans") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("SyntheticOrgans"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("Neurotrainers") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("Neurotrainers"), true); break; case TechLevel.Spacer: param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsBionic"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsProsthetic"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsNatural"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BionicProstheses") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BionicProstheses"), true); if (DefDatabase<ThingCategoryDef>.GetNamedSilentFail("SyntheticOrgans") != null) param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("SyntheticOrgans"), true); break; case TechLevel.Industrial: param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsProsthetic"), true); param.filter.SetAllow(DefDatabase<ThingCategoryDef>.GetNamedSilentFail("BodyPartsNatural"), true); break; default: break; } param.countRange = new IntRange(1, 2 * multiplier); break; } //Log.Message(resourceID.ToString()); //thingSetMaker.root things = thingSetMaker.Generate(param); return things; }
public void Save() { LoadedModManager.GetMod <AndroidTiersPP>().GetSettings <Settings>().Write(); }
public static void SaveGame_Postfix() { var mod = LoadedModManager.GetMod <TwitchToolkit>(); SaveHelper.SaveAllModData(); }
public void DrawProductionHeaderLower(int x, int y, int spacing) { Text.Anchor = TextAnchor.MiddleRight; Text.Font = GameFont.Small; //Assigned workers Widgets.Label(new Rect(x, y, 410, 30), "AssignedWorkers".Translate() + ": " + settlement.getTotalWorkers().ToString() + " / " + settlement.workersMax.ToString() + " / " + settlement.workersUltraMax.ToString()); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Tiny; //Item Headers Widgets.DrawHighlight(new Rect(x, y + 30, 40, 40)); Widgets.Label(new Rect(x, y + 30, 40, 40), "IsTithe".Translate() + "?"); Widgets.DrawHighlight(new Rect(x + 80, y + 30, 100, 40)); Widgets.Label(new Rect(x + 80, y + 30, 100, 40), "ProductionEfficiency".Translate()); Widgets.DrawHighlight(new Rect(x + 195, y + 30, 45, 40)); Widgets.Label(new Rect(x + 195, y + 30, 45, 40), "Base".Translate()); Widgets.DrawHighlight(new Rect(x + 250, y + 30, 50, 40)); Widgets.Label(new Rect(x + 250, y + 30, 50, 40), "Modifier".Translate()); Widgets.DrawHighlight(new Rect(x + 310, y + 30, 45, 40)); Widgets.Label(new Rect(x + 310, y + 30, 45, 40), "Final".Translate()); Widgets.DrawHighlight(new Rect(x + 365, y + 30, 45, 40)); Widgets.Label(new Rect(x + 365, y + 30, 45, 40), "EstimatedProfit".Translate()); //Per resource for (int i = 0; i < settlement.getNumberResource(); i++) { if ((i * scrollSpacing) + scroll < 0) { //if outside view } else { //loop through each resource //isTithe bool disabled = false; switch (i) { case 6: case 7: disabled = true; break; } Widgets.Checkbox(new Vector2(x + 8, scroll + y + 65 + (i * (45 + spacing)) + 8), ref settlement.returnResourceByInt(i).isTithe, 24, disabled); if (settlement.returnResourceByInt(i).isTithe != settlement.returnResourceByInt(i).isTitheBool) { settlement.returnResourceByInt(i).isTitheBool = settlement.returnResourceByInt(i).isTithe; //Log.Message("changed tithe"); settlement.updateProfitAndProduction(); WindowUpdateFC(); } //Icon if (Widgets.ButtonImage(new Rect(x + 45, scroll + y + 75 + (i * (45 + spacing)), 30, 30), settlement.returnResourceByInt(i).getIcon())) { Find.WindowStack.Add(new descWindowFC("SettlementProductionOf".Translate() + ": " + settlement.returnResourceByInt(i).label, char.ToUpper(settlement.returnResourceByInt(i).label[0]) + settlement.returnResourceByInt(i).label.Substring(1))); } ; //Production Efficiency Widgets.DrawBox(new Rect(x + 80, scroll + y + 70 + (i * (45 + spacing)), 100, 20)); Widgets.FillableBar(new Rect(x + 80, scroll + y + 70 + (i * (45 + spacing)), 100, 20), (float)Math.Min(settlement.returnResourceByInt(i).baseProductionMultiplier, 1.0)); Widgets.Label(new Rect(x + 80, scroll + y + 90 + (i * (45 + spacing)), 100, 20), "Workers".Translate() + ": " + settlement.returnResourceByInt(i).assignedWorkers.ToString()); if (Widgets.ButtonText(new Rect(x + 80, scroll + y + 90 + (i * (45 + spacing)), 20, 20), "<")) { //if clicked to lower amount of workers settlement.increaseWorkers(i, -1); WindowUpdateFC(); } if (Widgets.ButtonText(new Rect(x + 160, scroll + y + 90 + (i * (45 + spacing)), 20, 20), ">")) { //if clicked to lower amount of workers settlement.increaseWorkers(i, 1); WindowUpdateFC(); } //Base Production Widgets.Label(new Rect(x + 195, scroll + y + 70 + (i * (45 + spacing)), 45, 40), FactionColonies.FloorStat(settlement.returnResourceByInt(i).baseProduction)); //Final Modifier Widgets.Label(new Rect(x + 250, scroll + y + 70 + (i * (45 + spacing)), 50, 40), FactionColonies.FloorStat(settlement.returnResourceByInt(i).endProductionMultiplier)); //Final Base Widgets.Label(new Rect(x + 310, scroll + y + 70 + (i * (45 + spacing)), 45, 40), (FactionColonies.FloorStat(settlement.returnResourceByInt(i).endProduction))); //Est Income Widgets.Label(new Rect(x + 365, scroll + y + 70 + (i * (45 + spacing)), 45, 40), (FactionColonies.FloorStat(settlement.returnResourceByInt(i).endProduction *LoadedModManager.GetMod <FactionColoniesMod>().GetSettings <FactionColonies>().silverPerResource))); } } //Scroll window for resources if (Event.current.type == EventType.ScrollWheel) { scrollWindow(Event.current.delta.y); } }
public Dialog_AddShow(UserShowDef userShow = null, RimFlixMod mod = null) { // Window properties this.doCloseX = true; this.doCloseButton = false; this.forcePause = true; this.absorbInputAroundWindow = true; // Initialize object this.settings = LoadedModManager.GetMod <RimFlixMod>().GetSettings <RimFlixSettings>(); this.refreshTex = ContentFinder <Texture2D> .Get("UI/Buttons/Refresh", true); Vector2 v1 = Text.CalcSize("RimFlix_TimeSeconds".Translate()); Vector2 v2 = Text.CalcSize("RimFlix_TimeTicks".Translate()); this.timeUnitWidth = Math.Max(v1.x, v2.x) + this.padding * 2; this.timeInputWidth = this.optionsWidth - this.timeUnitWidth - this.padding * 2; this.timeUnitMenu = new List <FloatMenuOption> { new FloatMenuOption("RimFlix_TimeSeconds".Translate(), delegate { this.timeUnit = TimeUnit.Second; }), new FloatMenuOption("RimFlix_TimeTicks".Translate(), delegate { this.timeUnit = TimeUnit.Tick; }) }; this.timeUnitLabels = new string[] { "RimFlix_TimeSeconds".Translate(), "RimFlix_TimeTicks".Translate() }; string s = new string(Path.GetInvalidFileNameChars()); this.pathValidator = new Regex(string.Format("[^{0}]*", Regex.Escape(s))); try { this.drives = Directory.GetLogicalDrives(); } catch (Exception ex) { Log.Message($"RimFlix: Exception for GetLogicalDrives():\n{ex}"); this.filesWidth += this.drivesWidth; this.drivesWidth = 0; } // Show properties if (userShow != null) { this.showName = userShow.label; this.currentPath = userShow.path; this.timeValue = userShow.secondsBetweenFrames; this.playTube = userShow.televisionDefStrings.Contains("TubeTelevision"); this.playFlat = userShow.televisionDefStrings.Contains("FlatscreenTelevision"); this.playMega = userShow.televisionDefStrings.Contains("MegascreenTelevision"); } else { this.showName = "RimFlix_DefaultName".Translate(); this.currentPath = Directory.Exists(this.settings.lastPath) ? this.settings.lastPath : this.settings.defaultPath; this.timeValue = 10; this.playTube = false; this.playFlat = false; this.playMega = false; } this.currentUserShow = userShow; this.mod = mod; }
public void Save() { LoadedModManager.GetMod <Controller>().WriteSettings(); }
public static Settings Get() { return(LoadedModManager.GetMod <SmartMedicine.Mod>().GetSettings <Settings>()); }
protected override bool CanFireNowSub(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 intVec; return(map.mapTemperature.SeasonAndOutdoorTemperatureAcceptableFor(ThingDef.Named("AA_ArcticLion")) && this.TryFindEntryCell(map, out intVec) && LoadedModManager.GetMod <AlphaAnimals_Mod>().GetSettings <AlphaAnimals_Settings>().flagStalkingLions); }
public override void DoWindowContents(Rect inRect) { base.DoWindowContents(inRect); float padding = 5f; float btnWidth = 100f; float btnHeight = 30f; var rectBtn = new Rect(padding, 0, btnWidth, btnHeight); if (Widgets.ButtonText(rectBtn, "Chat Window") && !Find.WindowStack.TryRemove(typeof(ChatWindow), true)) { ChatWindow chatwnd = new ChatWindow(); Toolkit.client.activeChatWindow = chatwnd; Find.WindowStack.Add(chatwnd); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Events")) { Type type = typeof(StoreIncidentsWindow); Find.WindowStack.TryRemove(type); Window window = new StoreIncidentsWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Items")) { Type type = typeof(StoreItemsWindow); Find.WindowStack.TryRemove(type); Window window = new StoreItemsWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Settings")) { Mod mod = LoadedModManager.GetMod(typeof(TwitchToolkit)); Type type = typeof(SettingsWindow); Find.WindowStack.TryRemove(type); Window window = new SettingsWindow(mod); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Toolkit.client != null) { if (Toolkit.client.client != null && Toolkit.client.client.Connected) { if (Widgets.ButtonText(rectBtn, "TwitchToolkitReconnect".Translate())) { Toolkit.client.Reconnect(); Helper.playerMessages = new List <string>(); Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>(); } } } rectBtn.x = padding; rectBtn.y += padding + 28f; if (Widgets.ButtonText(rectBtn, "Name Queue")) { Type type = typeof(QueueWindow); Find.WindowStack.TryRemove(type); Window window = new QueueWindow(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Viewers")) { Type type = typeof(Window_Viewers); Find.WindowStack.TryRemove(type); Window window = new Window_Viewers(); Find.WindowStack.Add(window); } rectBtn.x += btnWidth + padding; if (Widgets.ButtonText(rectBtn, "Debug Fix")) { Helper.playerMessages = new List <string>(); Purchase_Handler.viewerNamesDoingVariableCommands = new List <string>(); } //rectBtn.x += btnWidth + padding; //if (Widgets.ButtonText(rectBtn, "Badges")) //{ // TwitchBadges.GetBadgeInfo(); //} var rectMessages = new Rect(padding, rectBtn.height + 36f, inRect.width - (padding * 2), 180f); if (Toolkit.client != null) { Widgets.TextArea(rectMessages, string.Join("\r\n", Toolkit.client.MessageLog), true); } btnWidth = inRect.width - (padding / 2); rectBtn = new Rect(padding, rectMessages.y + rectMessages.height, btnWidth, btnHeight); Widgets.CheckboxLabeled(rectBtn, "TwitchToolkitStoreOpen".Translate(), ref ToolkitSettings.StoreOpen); rectBtn.y += btnHeight + padding; Widgets.CheckboxLabeled(rectBtn, "TwitchToolkitEarningCoins".Translate(), ref ToolkitSettings.EarningCoins); rectBtn.y += btnHeight + padding; Widgets.CheckboxLabeled(rectBtn, "Auto Reconnect", ref reconnecter.autoReconnect); }
public static Settings Get() { return(LoadedModManager.GetMod <Mining_Priority.Mod>().GetSettings <Settings>()); }
/// <summary> /// Used on both the instigator and the target. /// </summary> public static bool ShouldDisplayDamage(this Thing target, Thing instigator) { return(LoadedModManager.GetMod <DMMod>().settings.ShouldDisplayDamageAccordingToSettings(target, instigator)); }
public void Save() { LoadedModManager.GetMod <UnLimited>().GetSettings <ULSettings>().Write(); }
public override void PreClose() { base.PreClose(); LoadedModManager.GetMod <Mod>().WriteSettings(); }
public void Save() { LoadedModManager.GetMod <AnimalControls>().GetSettings <Settings>().Write(); }
// Token: 0x06000018 RID: 24 RVA: 0x0000252B File Offset: 0x0000072B public void Save() { LoadedModManager.GetMod <SetUpCamp>().GetSettings <SetUpCampSettings>().Write(); }
static Start() { Settings settings = LoadedModManager.GetMod <LevelUpMod>().GetSettings <Settings>(); Patcher.Patch(settings); }
public static Settings Get() { return(LoadedModManager.GetMod <Stockpile_Ranking.Mod>().GetSettings <Settings>()); }
static bool Prefix(SkillRecord __instance) { return(!LoadedModManager.GetMod <Mod_RW_Tweak>().Setting.noXPDown); }
public GameComponent(Game game) : base() { Settings = LoadedModManager.GetMod <Mod>().GetSettings <Settings>(); }
public override void DoWindowContents(Rect inRect) { //grab before anchor/font GameFont fontBefore = Text.Font; TextAnchor anchorBefore = Text.Anchor; //Settlement Tax Collection Header Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Medium; Widgets.Label(new Rect(2, 0, 300, 60), header); //settlement buttons Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Tiny; //0 tithe total string //1 source - -1 //2 due/delivery date //3 Silver (- || +) //4 tithe if (settlement.settlementLevel < LoadedModManager.GetMod <FactionColoniesMod>() .GetSettings <FactionColonies>().settlementMaxLevel) //if settlement is not max level { if (Widgets.ButtonText(new Rect(xoffset + ((335 - 150) / 2), height + 10, 150, 40), "UpgradeSettlement".Translate() + ": " + settlementUpgradeCost)) { //if upgrade button clicked //if max level if (settlement.settlementLevel < LoadedModManager.GetMod <FactionColoniesMod>() .GetSettings <FactionColonies>().settlementMaxLevel) //if below max level { if (PaymentUtil.getSilver() > settlementUpgradeCost) //if have enough monies to pay { foreach (FCEvent evt in Find.World.GetComponent <FactionFC>().events) { if (evt.def == FCEventDefOf.upgradeSettlement && evt.location == settlement.mapLocation) { //if already existing event Messages.Message("AlreadyUpgradeSettlement".Translate(), MessageTypeDefOf.RejectInput); return; } } if (settlement.isUnderAttack) { Messages.Message("SettlementUnderAttack".Translate(), MessageTypeDefOf.RejectInput); return; } PaymentUtil.paySilver(settlementUpgradeCost); //settlement.upgradeSettlement(); FCEvent tmp = new FCEvent(true); tmp.def = FCEventDefOf.upgradeSettlement; tmp.location = settlement.mapLocation; tmp.planetName = settlement.planetName; int triggerTime = (settlement.settlementLevel + 1) * 60000 * 2; if (factionfc.hasPolicy(FCPolicyDefOf.isolationist)) { triggerTime /= 2; } tmp.timeTillTrigger = Find.TickManager.TicksGame + triggerTime; //Log.Message(list[i].enactDuration.ToString()); //Log.Message(tmp.timeTillTrigger.ToString()); Find.World.GetComponent <FactionFC>().addEvent(tmp); Find.WindowStack.TryRemove(this); Find.WindowStack.WindowOfType <SettlementWindowFc>().windowUpdateFc(); Messages.Message("StartUpgradeSettlement".Translate(), MessageTypeDefOf.NeutralEvent); } else { //if don't have enough monies Messages.Message("NotEnoughSilverUpgrade".Translate(), MessageTypeDefOf.RejectInput); } } else { Messages.Message(settlement.name + " " + "AlreadyMaxLevel".Translate() + "!", MessageTypeDefOf.RejectInput); } } } else //if settlement is max level { desc = "CannotBeUpgradedPastMax".Translate() + ": " + LoadedModManager.GetMod <FactionColoniesMod>() .GetSettings <FactionColonies>().settlementMaxLevel; } Widgets.Label(new Rect(xoffset + 2, yoffset - yspacing + 2, length - 4, height - 4 + yspacing * 2), desc); Widgets.DrawBox(new Rect(xoffset, yoffset - yspacing, length, height - yspacing * 2)); //reset anchor/font Text.Font = fontBefore; Text.Anchor = anchorBefore; }