private static void InterfaceToggleTab(InspectTabBase tab, IInspectPane pane) { if (!TutorSystem.TutorialMode || InspectPaneUtility.IsOpen(tab, pane) || TutorSystem.AllowAction("ITab-" + tab.tutorTag + "-Open")) { InspectPaneUtility.ToggleTab(tab, pane); } }
public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo) { mouseoverGizmo = null; try { InspectGizmoGrid.objList.Clear(); InspectGizmoGrid.objList.AddRange(selectedObjects); InspectGizmoGrid.gizmoList.Clear(); for (int i = 0; i < InspectGizmoGrid.objList.Count; i++) { ISelectable selectable = InspectGizmoGrid.objList[i] as ISelectable; if (selectable != null) { InspectGizmoGrid.gizmoList.AddRange(selectable.GetGizmos()); } } for (int j = 0; j < InspectGizmoGrid.objList.Count; j++) { Thing t = InspectGizmoGrid.objList[j] as Thing; if (t != null) { List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators; for (int k = 0; k < allDesignators.Count; k++) { Designator des = allDesignators[k]; if (des.CanDesignateThing(t).Accepted) { Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = des.LabelCapReverseDesignating(t); float iconAngle; Vector2 iconOffset; command_Action.icon = des.IconReverseDesignating(t, out iconAngle, out iconOffset); command_Action.iconAngle = iconAngle; command_Action.iconOffset = iconOffset; command_Action.defaultDesc = des.DescReverseDesignating(t); command_Action.order = ((!(des is Designator_Uninstall)) ? -20f : -11f); command_Action.action = delegate() { if (TutorSystem.AllowAction(des.TutorTagDesignate)) { des.DesignateThing(t); des.Finalize(true); } }; command_Action.hotKey = des.hotKey; command_Action.groupKey = des.groupKey; InspectGizmoGrid.gizmoList.Add(command_Action); } } } } InspectGizmoGrid.objList.Clear(); GizmoGridDrawer.DrawGizmoGrid(InspectGizmoGrid.gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + 20f, out mouseoverGizmo); InspectGizmoGrid.gizmoList.Clear(); } catch (Exception ex) { Log.ErrorOnce(ex.ToString(), 3427734, false); } }
protected override bool CanDoNext() { bool result; if (!base.CanDoNext()) { result = false; } else { int selectedTile = Find.WorldInterface.SelectedTile; if (selectedTile < 0) { Messages.Message("MustSelectLandingSite".Translate(), MessageTypeDefOf.RejectInput, false); result = false; } else { StringBuilder stringBuilder = new StringBuilder(); if (!TileFinder.IsValidTileForNewSettlement(selectedTile, stringBuilder)) { Messages.Message(stringBuilder.ToString(), MessageTypeDefOf.RejectInput, false); result = false; } else { Tile tile = Find.WorldGrid[selectedTile]; result = TutorSystem.AllowAction("ChooseBiome-" + tile.biome.defName + "-" + tile.hilliness.ToString()); } } } return(result); }
protected override bool CanDoNext() { if (!base.CanDoNext()) { return(false); } int selectedTile = Find.WorldInterface.SelectedTile; if (selectedTile < 0) { Messages.Message("MustSelectStartingSite".TranslateWithBackup("MustSelectLandingSite"), MessageTypeDefOf.RejectInput, historical: false); return(false); } StringBuilder stringBuilder = new StringBuilder(); if (!TileFinder.IsValidTileForNewSettlement(selectedTile, stringBuilder)) { Messages.Message(stringBuilder.ToString(), MessageTypeDefOf.RejectInput, historical: false); return(false); } Tile tile = Find.WorldGrid[selectedTile]; if (!TutorSystem.AllowAction("ChooseBiome-" + tile.biome.defName + "-" + tile.hilliness.ToString())) { return(false); } return(true); }
public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo) { mouseoverGizmo = null; try { objList.Clear(); objList.AddRange(selectedObjects); gizmoList.Clear(); for (int i = 0; i < objList.Count; i++) { ISelectable selectable = objList[i] as ISelectable; if (selectable != null) { gizmoList.AddRange(selectable.GetGizmos()); } } for (int j = 0; j < objList.Count; j++) { Thing t = objList[j] as Thing; if (t == null) { continue; } List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators; for (int k = 0; k < allDesignators.Count; k++) { Designator des = allDesignators[k]; if (!des.CanDesignateThing(t).Accepted) { continue; } Command_Action command_Action = new Command_Action(); command_Action.defaultLabel = des.LabelCapReverseDesignating(t); command_Action.icon = des.IconReverseDesignating(t, out var angle, out var offset); command_Action.iconAngle = angle; command_Action.iconOffset = offset; command_Action.defaultDesc = des.DescReverseDesignating(t); command_Action.order = ((des is Designator_Uninstall) ? (-11f) : (-20f)); command_Action.action = delegate { if (TutorSystem.AllowAction(des.TutorTagDesignate)) { des.DesignateThing(t); des.Finalize(somethingSucceeded: true); } }; command_Action.hotKey = des.hotKey; command_Action.groupKey = des.groupKey; gizmoList.Add(command_Action); } } objList.Clear(); GizmoGridDrawer.DrawGizmoGrid(gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + GizmoGridDrawer.GizmoSpacing.y, out mouseoverGizmo); gizmoList.Clear(); } catch (Exception ex) { Log.ErrorOnce(ex.ToString(), 3427734); } }
public static bool AllowAction(EventPack ep) { if (!TutorSystem.TutorialMode) { return(true); } if (DebugViewSettings.logTutor) { Log.Message("AllowAction: " + ep); } if (ep.Cells != null && ep.Cells.Count <IntVec3>() == 1) { return(TutorSystem.AllowAction(new EventPack(ep.Tag, ep.Cells.First <IntVec3>()))); } if (Find.ActiveLesson.Current != null) { AcceptanceReport acceptanceReport = Find.ActiveLesson.Current.AllowAction(ep); if (!acceptanceReport.Accepted) { string text = acceptanceReport.Reason.NullOrEmpty() ? Find.ActiveLesson.Current.DefaultRejectInputMessage : acceptanceReport.Reason; Messages.Message(text, MessageTypeDefOf.RejectInput); return(false); } } return(true); }
private void RandomizeCurPawn() { if (TutorSystem.AllowAction("RandomizePawn")) { this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn); TutorSystem.Notify_Event("RandomizePawn"); } }
protected virtual bool CanDoNext() { if (TutorSystem.TutorialMode) { return(TutorSystem.AllowAction("GotoNextPage")); } return(true); }
private void RandomizeCurPawn() { if (TutorSystem.AllowAction("RandomizePawn")) { int num = 0; do { curPawn = StartingPawnUtility.RandomizeInPlace(curPawn); num++; }while (num <= 20 && !StartingPawnUtility.WorkTypeRequirementsSatisfied()); TutorSystem.Notify_Event("RandomizePawn"); } }
public override void DesignateSingleCell(IntVec3 c) { if (TutorSystem.TutorialMode && !TutorSystem.AllowAction(new EventPack(base.TutorTagDesignate, c))) { return; } if (DebugSettings.godMode || entDef.GetStatValueAbstract(StatDefOf.WorkToBuild, stuffDef) == 0f) { if (entDef is TerrainDef) { base.Map.terrainGrid.SetTerrain(c, (TerrainDef)entDef); } else { Thing thing = ThingMaker.MakeThing((ThingDef)entDef, stuffDef); thing.SetFactionDirect(Faction.OfPlayer); GenSpawn.Spawn(thing, c, base.Map, placingRot); } } else { GenSpawn.WipeExistingThings(c, placingRot, entDef.blueprintDef, base.Map, DestroyMode.Deconstruct); GenConstruct.PlaceBlueprintForBuild(entDef, c, base.Map, placingRot, Faction.OfPlayer, stuffDef); } MoteMaker.ThrowMetaPuffs(GenAdj.OccupiedRect(c, placingRot, entDef.Size), base.Map); ThingDef thingDef = entDef as ThingDef; if (thingDef != null && thingDef.IsOrbitalTradeBeacon) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BuildOrbitalTradeBeacon, KnowledgeAmount.Total); } if (TutorSystem.TutorialMode) { TutorSystem.Notify_Event(new EventPack(base.TutorTagDesignate, c)); } if (entDef.PlaceWorkers != null) { for (int i = 0; i < entDef.PlaceWorkers.Count; i++) { entDef.PlaceWorkers[i].PostPlace(base.Map, entDef, c, placingRot); } } }
private void RandomizeCurPawn() { if (!TutorSystem.AllowAction("RandomizePawn")) { return; } int num = 0; do { this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn); num++; if (num > 20) { break; } }while (!StartingPawnUtility.WorkTypeRequirementsSatisfied()); TutorSystem.Notify_Event("RandomizePawn"); }
private void DrawPawnList(Rect rect) { Rect rect2 = rect; rect2.height = 60f; rect2 = rect2.ContractedBy(4f); int groupID = ReorderableWidget.NewGroup(delegate(int from, int to) { if (TutorSystem.AllowAction("ReorderPawn")) { Pawn item = Find.GameInitData.startingAndOptionalPawns[from]; Find.GameInitData.startingAndOptionalPawns.Insert(to, item); Find.GameInitData.startingAndOptionalPawns.RemoveAt((from < to) ? from : (from + 1)); TutorSystem.Notify_Event("ReorderPawn"); if (to < Find.GameInitData.startingPawnCount && from >= Find.GameInitData.startingPawnCount) { TutorSystem.Notify_Event("ReorderPawnOptionalToStarting"); } } }, ReorderableDirection.Vertical); rect2.y += 15f; DrawPawnListLabelAbove(rect2, "StartingPawnsSelected".Translate()); for (int i = 0; i < Find.GameInitData.startingAndOptionalPawns.Count; i++) { if (i == Find.GameInitData.startingPawnCount) { rect2.y += 30f; DrawPawnListLabelAbove(rect2, "StartingPawnsLeftBehind".Translate()); } Pawn pawn = Find.GameInitData.startingAndOptionalPawns[i]; GUI.BeginGroup(rect2); Rect rect3 = new Rect(Vector2.zero, rect2.size); Widgets.DrawOptionBackground(rect3, curPawn == pawn); MouseoverSounds.DoRegion(rect3); GUI.color = new Color(1f, 1f, 1f, 0.2f); GUI.DrawTexture(new Rect(110f - PawnSelectorPortraitSize.x / 2f, 40f - PawnSelectorPortraitSize.y / 2f, PawnSelectorPortraitSize.x, PawnSelectorPortraitSize.y), PortraitsCache.Get(pawn, PawnSelectorPortraitSize)); GUI.color = Color.white; Rect rect4 = rect3.ContractedBy(4f).Rounded(); NameTriple nameTriple = pawn.Name as NameTriple; Widgets.Label(label: (nameTriple == null) ? pawn.LabelShort : (string.IsNullOrEmpty(nameTriple.Nick) ? nameTriple.First : nameTriple.Nick), rect: rect4.TopPart(0.5f).Rounded()); if (Text.CalcSize(pawn.story.TitleCap).x > rect4.width) { Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleShortCap); } else { Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleCap); } if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect3)) { curPawn = pawn; SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(); } GUI.EndGroup(); if (ReorderableWidget.Reorderable(groupID, rect2.ExpandedBy(4f))) { Widgets.DrawRectFast(rect2, Widgets.WindowBGFillColor * new Color(1f, 1f, 1f, 0.5f)); } if (Mouse.IsOver(rect2)) { TooltipHandler.TipRegion(rect2, new TipSignal("DragToReorder".Translate(), pawn.GetHashCode() * 3499)); } rect2.y += 60f; } }
public virtual void InterfaceTryActivate() { if (!TutorSystem.TutorialMode || !this.def.canBeTutorDenied || Find.MainTabsRoot.OpenTab == this.def || TutorSystem.AllowAction("MainTab-" + this.def.defName + "-Open")) { this.Activate(); } }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 35f; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = (rect.width - 34f) / 3f; listing_Standard.Begin(rect); Text.Font = GameFont.Medium; listing_Standard.Label("Audiovisuals".Translate(), -1f, null); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); listing_Standard.Label("GameVolume".Translate(), -1f, null); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate(), -1f, null); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate(), -1f, null); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height))) { List <FloatMenuOption> list = new List <FloatMenuOption>(); using (IEnumerator <Resolution> enumerator = (from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates where x.width >= 1024 && x.height >= 768 orderby x.width, x.height select x).GetEnumerator()) { while (enumerator.MoveNext()) { Resolution res = enumerator.Current; list.Add(new FloatMenuOption(Dialog_Options.ResToString(res.width, res.height), delegate() { if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false); } else { ResolutionUtility.SafeSetResolution(res); } }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } if (!list.Any <FloatMenuOption>()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale.ToString() + "x")) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); for (int i = 0; i < Dialog_Options.UIScales.Length; i++) { float scale = Dialog_Options.UIScales[i]; list2.Add(new FloatMenuOption(Dialog_Options.UIScales[i].ToString() + "x", delegate() { if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, false); } else { ResolutionUtility.SafeSetUIScale(scale); } }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list2)); } bool customCursorEnabled = Prefs.CustomCursorEnabled; listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null); Prefs.CustomCursorEnabled = customCursorEnabled; bool fullScreen = Screen.fullScreen; bool flag = fullScreen; listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null); if (fullScreen != flag) { ResolutionUtility.SafeSetFullscreen(fullScreen); } listing_Standard.Gap(12f); bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null); if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = hatsOnlyOnMap; bool plantWindSway = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null); Prefs.PlantWindSway = plantWindSway; bool showRealtimeClock = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null); Prefs.ShowRealtimeClock = showRealtimeClock; if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman())) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); IEnumerator enumerator2 = Enum.GetValues(typeof(AnimalNameDisplayMode)).GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj = enumerator2.Current; AnimalNameDisplayMode localMode2 = (AnimalNameDisplayMode)obj; AnimalNameDisplayMode localMode = localMode2; list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate() { Prefs.AnimalNameMode = localMode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list3)); } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Gameplay".Translate(), -1f, null); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null)) { Find.WindowStack.Add(new Dialog_KeyBindings()); } if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null)) { if (Current.ProgramState == ProgramState.Playing) { Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, false); } else { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (LoadedLanguage localLang2 in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = localLang2; list4.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate() { LanguageDatabase.SelectLanguage(localLang); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list4)); } } if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null)) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); } } else if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate(), null)) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath), null, null, null, null, null, false, null, null)); } if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null)) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, false); PlayerKnowledgeDatabase.ResetPersistent(); } bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null); Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled; bool runInBackground = Prefs.RunInBackground; listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null); Prefs.RunInBackground = runInBackground; bool edgeScreenScroll = Prefs.EdgeScreenScroll; listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null); Prefs.EdgeScreenScroll = edgeScreenScroll; bool pauseOnLoad = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null); Prefs.PauseOnLoad = pauseOnLoad; bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter; listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null); Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter; int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements; listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(new object[] { maxNumberOfPlayerSettlements }), -1f, null); int num = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerSettlements, 1f, 5f)); Prefs.MaxNumberOfPlayerSettlements = num; if (maxNumberOfPlayerSettlements != num && num > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list5 = new List <FloatMenuOption>(); IEnumerator enumerator4 = Enum.GetValues(typeof(TemperatureDisplayMode)).GetEnumerator(); try { while (enumerator4.MoveNext()) { object obj2 = enumerator4.Current; TemperatureDisplayMode localTmode2 = (TemperatureDisplayMode)obj2; TemperatureDisplayMode localTmode = localTmode2; list5.Add(new FloatMenuOption(localTmode.ToString(), delegate() { Prefs.TemperatureMode = localTmode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } } finally { IDisposable disposable2; if ((disposable2 = (enumerator4 as IDisposable)) != null) { disposable2.Dispose(); } } Find.WindowStack.Add(new FloatMenu(list5)); } float autosaveIntervalDays = Prefs.AutosaveIntervalDays; string text = "Days".Translate(); string text2 = "Day".Translate().ToLower(); if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2))) { List <FloatMenuOption> list6 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list6.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate() { Prefs.AutosaveIntervalDays = 0.125f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate() { Prefs.AutosaveIntervalDays = 0.25f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } list6.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate() { Prefs.AutosaveIntervalDays = 0.5f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate() { Prefs.AutosaveIntervalDays = 1f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(3.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 3f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(7.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 7f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list6.Add(new FloatMenuOption(14.ToString() + " " + text, delegate() { Prefs.AutosaveIntervalDays = 14f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); Find.WindowStack.Add(new FloatMenu(list6)); } if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(new object[] { 1f }), -1f, null); GUI.color = Color.white; } if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller")) { Find.WindowStack.Add(new Page_SelectStorytellerInGame()); } if (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate(), null)) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate { DevModePermanentlyDisabledUtility.Disable(); }, true, null)); } if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode) { bool devMode = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null); Prefs.DevMode = devMode; } bool testMapSizes = Prefs.TestMapSizes; listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref testMapSizes, null); Prefs.TestMapSizes = testMapSizes; if (Prefs.DevMode) { bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null); Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash; bool logVerbose = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null); Prefs.LogVerbose = logVerbose; } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(string.Empty, -1f, null); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("ModSettings".Translate(), null)) { Find.WindowStack.Add(new Dialog_ModSettings()); } listing_Standard.Label(string.Empty, -1f, null); listing_Standard.Label("NamesYouWantToSee".Translate(), -1f, null); List <string> preferredNames = Prefs.PreferredNames; if (Dialog_Options.< > f__mg$cache0 == null) { Dialog_Options.< > f__mg$cache0 = new Predicate <string>(GenText.NullOrEmpty); } preferredNames.RemoveAll(Dialog_Options.< > f__mg$cache0); for (int j = 0; j < Prefs.PreferredNames.Count; j++) { string name = Prefs.PreferredNames[j]; PawnBio pawnBio = (from b in SolidBioDatabase.allBios where b.name.ToString() == name select b).FirstOrDefault <PawnBio>(); if (pawnBio == null) { name += " [N]"; } else { PawnBioType bioType = pawnBio.BioType; if (bioType != PawnBioType.BackstoryInGame) { if (bioType == PawnBioType.PirateKing) { name += " [PK]"; } } else { name += " [B]"; } } Rect rect2 = listing_Standard.GetRect(24f); Widgets.Label(rect2, name); Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f); if (Widgets.ButtonImage(butRect, TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.Tick_Low.PlayOneShotOnCamera(null); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null)) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.Label(string.Empty, -1f, null); if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate(), null)) { this.RestoreToDefaultSettings(); } listing_Standard.End(); }
private void DrawPawnList(Rect rect) { Rect rect2 = rect; rect2.height = 60f; rect2 = rect2.ContractedBy(4f); int groupID = ReorderableWidget.NewGroup(delegate(int from, int to) { if (TutorSystem.AllowAction("ReorderPawn")) { Pawn item = Find.GameInitData.startingPawns[from]; Find.GameInitData.startingPawns.RemoveAt(from); Find.GameInitData.startingPawns.Insert(to, item); TutorSystem.Notify_Event("ReorderPawn"); } }); rect2.y += 15f; this.DrawPawnListLabelAbove(rect2, "StartingPawnsSelected".Translate()); for (int i = 0; i < Find.GameInitData.startingPawns.Count; i++) { if (i == Find.GameInitData.startingPawnCount) { rect2.y += 30f; this.DrawPawnListLabelAbove(rect2, "StartingPawnsLeftBehind".Translate()); } Pawn pawn = Find.GameInitData.startingPawns[i]; GUI.BeginGroup(rect2); Rect rect3 = new Rect(Vector2.zero, rect2.size); Widgets.DrawOptionBackground(rect3, this.curPawn == pawn); MouseoverSounds.DoRegion(rect3); GUI.color = new Color(1f, 1f, 1f, 0.2f); Vector2 pawnSelectorPortraitSize = Page_ConfigureStartingPawns.PawnSelectorPortraitSize; double x = 110.0 - pawnSelectorPortraitSize.x / 2.0; Vector2 pawnSelectorPortraitSize2 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize; double y = 40.0 - pawnSelectorPortraitSize2.y / 2.0; Vector2 pawnSelectorPortraitSize3 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize; float x2 = pawnSelectorPortraitSize3.x; Vector2 pawnSelectorPortraitSize4 = Page_ConfigureStartingPawns.PawnSelectorPortraitSize; GUI.DrawTexture(new Rect((float)x, (float)y, x2, pawnSelectorPortraitSize4.y), PortraitsCache.Get(pawn, Page_ConfigureStartingPawns.PawnSelectorPortraitSize, default(Vector3), 1f)); GUI.color = Color.white; Rect rect4 = rect3.ContractedBy(4f).Rounded(); NameTriple nameTriple = pawn.Name as NameTriple; string label = (nameTriple == null) ? pawn.LabelShort : ((!string.IsNullOrEmpty(nameTriple.Nick)) ? nameTriple.Nick : nameTriple.First); Widgets.Label(rect4.TopPart(0.5f).Rounded(), label); Vector2 vector = Text.CalcSize(pawn.story.Title); if (vector.x > rect4.width) { Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.TitleShort); } else { Widgets.Label(rect4.BottomPart(0.5f).Rounded(), pawn.story.Title); } if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect3)) { this.curPawn = pawn; SoundDefOf.TickTiny.PlayOneShotOnCamera(null); } GUI.EndGroup(); if (ReorderableWidget.Reorderable(groupID, rect2.ExpandedBy(4f))) { Widgets.DrawRectFast(rect2, Widgets.WindowBGFillColor * new Color(1f, 1f, 1f, 0.5f), null); } TooltipHandler.TipRegion(rect2, new TipSignal("DragToReorder".Translate(), pawn.GetHashCode() * 3499)); rect2.y += 60f; } }
protected virtual bool CanDoNext() { return(!TutorSystem.TutorialMode || TutorSystem.AllowAction("GotoNextPage")); }
protected virtual bool CanDoBack() { return(!TutorSystem.TutorialMode || TutorSystem.AllowAction("GotoPrevPage")); }
public override void PostOpen() { base.PostOpen(); Find.GameInitData.ChooseRandomStartingTile(); LessonAutoActivator.TeachOpportunity(ConceptDefOf.WorldCameraMovement, OpportunityType.Important); TutorSystem.Notify_Event("PageStart-SelectStartingSite"); tutorialStartTilePatch = null; if (!TutorSystem.TutorialMode || Find.Tutor.activeLesson == null || Find.Tutor.activeLesson.Current == null || Find.Tutor.activeLesson.Current.Instruction != InstructionDefOf.ChooseLandingSite) { return; } Find.WorldCameraDriver.ResetAltitude(); Find.WorldCameraDriver.Update(); List <int> list = new List <int>(); float[] array = new float[Find.WorldGrid.TilesCount]; WorldGrid worldGrid = Find.WorldGrid; Vector2 a = new Vector2((float)Screen.width / 2f, (float)Screen.height / 2f); float num = Vector2.Distance(a, Vector2.zero); for (int i = 0; i < worldGrid.TilesCount; i++) { Tile tile = worldGrid[i]; if (TutorSystem.AllowAction("ChooseBiome-" + tile.biome.defName + "-" + tile.hilliness.ToString())) { tmpTileVertices.Clear(); worldGrid.GetTileVertices(i, tmpTileVertices); Vector3 zero = Vector3.zero; for (int j = 0; j < tmpTileVertices.Count; j++) { zero += tmpTileVertices[j]; } zero /= (float)tmpTileVertices.Count; Vector3 v = Find.WorldCamera.WorldToScreenPoint(zero) / Prefs.UIScale; v.y = (float)UI.screenHeight - v.y; v.x = Mathf.Clamp(v.x, 0f, UI.screenWidth); v.y = Mathf.Clamp(v.y, 0f, UI.screenHeight); float num2 = 1f - Vector2.Distance(a, v) / num; Vector3 normalized = (zero - Find.WorldCamera.transform.position).normalized; float num3 = Vector3.Dot(Find.WorldCamera.transform.forward, normalized); array[i] = num2 * num3; } else { array[i] = float.NegativeInfinity; } } for (int k = 0; k < 16; k++) { for (int l = 0; l < array.Length; l++) { list.Clear(); worldGrid.GetTileNeighbors(l, list); float num4 = array[l]; if (num4 < 0f) { continue; } for (int m = 0; m < list.Count; m++) { float num5 = array[list[m]]; if (!(num5 < 0f)) { num4 += num5; } } array[l] = num4 / (float)list.Count; } } float num6 = float.NegativeInfinity; int num7 = -1; for (int n = 0; n < array.Length; n++) { if (array[n] > 0f && num6 < array[n]) { num6 = array[n]; num7 = n; } } if (num7 != -1) { tutorialStartTilePatch = num7; } }
public override void DesignateMultiCell(IEnumerable <IntVec3> cells) { List <IntVec3> list = cells.ToList(); bool flag = false; if (list.Count == 1) { Zone zone = base.Map.zoneManager.ZoneAt(list[0]); if (zone != null) { if (zone.GetType() == this.zoneTypeToPlace) { this.SelectedZone = zone; } return; } } if (this.SelectedZone == null) { Zone zone2 = null; foreach (IntVec3 cell in cells) { Zone zone3 = base.Map.zoneManager.ZoneAt(cell); if (zone3 != null && zone3.GetType() == this.zoneTypeToPlace) { if (zone2 == null) { zone2 = zone3; } else if (zone3 != zone2) { zone2 = null; break; } } } this.SelectedZone = zone2; } list.RemoveAll((IntVec3 c) => base.Map.zoneManager.ZoneAt(c) != null); if (list.Count != 0 && (!TutorSystem.TutorialMode || TutorSystem.AllowAction(new EventPack(base.TutorTagDesignate, list)))) { if (this.SelectedZone == null) { this.SelectedZone = this.MakeNewZone(); this.SelectedZone.AddCell(list[0]); list.RemoveAt(0); } while (true) { flag = true; int count = list.Count; for (int num = list.Count - 1; num >= 0; num--) { bool flag2 = false; for (int i = 0; i < 4; i++) { IntVec3 c2 = list[num] + GenAdj.CardinalDirections[i]; if (c2.InBounds(base.Map) && base.Map.zoneManager.ZoneAt(c2) == this.SelectedZone) { flag2 = true; break; } } if (flag2) { this.SelectedZone.AddCell(list[num]); list.RemoveAt(num); } } if (list.Count != 0) { if (list.Count == count) { this.SelectedZone = this.MakeNewZone(); this.SelectedZone.AddCell(list[0]); list.RemoveAt(0); } continue; } break; } this.SelectedZone.CheckContiguous(); base.Finalize(flag); TutorSystem.Notify_Event(new EventPack(base.TutorTagDesignate, list)); } }
public virtual void InterfaceTryActivate() { if (TutorSystem.TutorialMode && this.def.canBeTutorDenied && Find.MainTabsRoot.OpenTab != this.def && !TutorSystem.AllowAction("MainTab-" + this.def.defName + "-Open")) { return; } this.Activate(); }
public override void DesignateMultiCell(IEnumerable <IntVec3> cells) { List <IntVec3> list = cells.ToList <IntVec3>(); if (list.Count == 1) { Zone zone = base.Map.zoneManager.ZoneAt(list[0]); if (zone != null) { if (zone.GetType() == this.zoneTypeToPlace) { this.SelectedZone = zone; } return; } } if (this.SelectedZone == null) { Zone zone2 = null; foreach (IntVec3 c3 in cells) { Zone zone3 = base.Map.zoneManager.ZoneAt(c3); if (zone3 != null && zone3.GetType() == this.zoneTypeToPlace) { if (zone2 == null) { zone2 = zone3; } else if (zone3 != zone2) { zone2 = null; break; } } } this.SelectedZone = zone2; } list.RemoveAll((IntVec3 c) => base.Map.zoneManager.ZoneAt(c) != null); if (list.Count == 0) { return; } if (TutorSystem.TutorialMode && !TutorSystem.AllowAction(new EventPack(base.TutorTagDesignate, list))) { return; } if (this.SelectedZone == null) { this.SelectedZone = this.MakeNewZone(); base.Map.zoneManager.RegisterZone(this.SelectedZone); this.SelectedZone.AddCell(list[0]); list.RemoveAt(0); } bool somethingSucceeded; for (;;) { somethingSucceeded = true; int count = list.Count; for (int i = list.Count - 1; i >= 0; i--) { bool flag = false; for (int j = 0; j < 4; j++) { IntVec3 c2 = list[i] + GenAdj.CardinalDirections[j]; if (c2.InBounds(base.Map)) { if (base.Map.zoneManager.ZoneAt(c2) == this.SelectedZone) { flag = true; break; } } } if (flag) { this.SelectedZone.AddCell(list[i]); list.RemoveAt(i); } } if (list.Count == 0) { break; } if (list.Count == count) { this.SelectedZone = this.MakeNewZone(); base.Map.zoneManager.RegisterZone(this.SelectedZone); this.SelectedZone.AddCell(list[0]); list.RemoveAt(0); } } this.SelectedZone.CheckContiguous(); base.Finalize(somethingSucceeded); TutorSystem.Notify_Event(new EventPack(base.TutorTagDesignate, list)); }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 45f; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = (rect.width - 34f) / 3f; listing_Standard.Begin(rect); Text.Font = GameFont.Medium; listing_Standard.Label("Audiovisuals".Translate(), -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); listing_Standard.Label("GameVolume".Translate(), -1f); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate(), -1f); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate(), -1f); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), Dialog_Options.ResToString(Screen.width, Screen.height))) { Find.WindowStack.Add(new Dialog_ResolutionPicker()); } bool customCursorEnabled = Prefs.CustomCursorEnabled; listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref customCursorEnabled, null); Prefs.CustomCursorEnabled = customCursorEnabled; bool fullScreen = Screen.fullScreen; bool flag = fullScreen; listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref fullScreen, null); if (fullScreen != flag) { ResolutionUtility.SafeSetFullscreen(fullScreen); } listing_Standard.Label("UIScale".Translate(), -1f); float[] uIScales = Dialog_Options.UIScales; for (int i = 0; i < uIScales.Length; i++) { float num = uIScales[i]; if (listing_Standard.RadioButton(num.ToString() + "x", Prefs.UIScale == num, 8f)) { if (!ResolutionUtility.UIScaleSafeWithResolution(num, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput); } else { ResolutionUtility.SafeSetUIScale(num); } } } listing_Standard.Gap(12f); bool hatsOnlyOnMap = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref hatsOnlyOnMap, null); if (hatsOnlyOnMap != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = hatsOnlyOnMap; listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Gameplay".Translate(), -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("KeyboardConfig".Translate(), null)) { Find.WindowStack.Add(new Dialog_KeyBindings()); } if (listing_Standard.ButtonText("ChooseLanguage".Translate(), null)) { if (Current.ProgramState == ProgramState.Playing) { Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput); } else { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (LoadedLanguage current in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = current; list.Add(new FloatMenuOption(localLang.FriendlyNameNative, delegate { LanguageDatabase.SelectLanguage(localLang); }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list)); } } if ((Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) && listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate(), null)) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); } bool adaptiveTrainingEnabled = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref adaptiveTrainingEnabled, null); Prefs.AdaptiveTrainingEnabled = adaptiveTrainingEnabled; if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate(), null)) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion); PlayerKnowledgeDatabase.ResetPersistent(); } bool runInBackground = Prefs.RunInBackground; listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref runInBackground, null); Prefs.RunInBackground = runInBackground; bool edgeScreenScroll = Prefs.EdgeScreenScroll; listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref edgeScreenScroll, null); Prefs.EdgeScreenScroll = edgeScreenScroll; bool pauseOnLoad = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref pauseOnLoad, null); Prefs.PauseOnLoad = pauseOnLoad; bool pauseOnUrgentLetter = Prefs.PauseOnUrgentLetter; listing_Standard.CheckboxLabeled("PauseOnUrgentLetter".Translate(), ref pauseOnUrgentLetter, null); Prefs.PauseOnUrgentLetter = pauseOnUrgentLetter; bool showRealtimeClock = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref showRealtimeClock, null); Prefs.ShowRealtimeClock = showRealtimeClock; bool plantWindSway = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref plantWindSway, null); Prefs.PlantWindSway = plantWindSway; int maxNumberOfPlayerHomes = Prefs.MaxNumberOfPlayerHomes; listing_Standard.Label("MaxNumberOfPlayerHomes".Translate(new object[] { maxNumberOfPlayerHomes }), -1f); int num2 = Mathf.RoundToInt(listing_Standard.Slider((float)maxNumberOfPlayerHomes, 1f, 5f)); Prefs.MaxNumberOfPlayerHomes = num2; if (maxNumberOfPlayerHomes != num2 && num2 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerHomes); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); foreach (TemperatureDisplayMode localTmode2 in Enum.GetValues(typeof(TemperatureDisplayMode))) { TemperatureDisplayMode localTmode = localTmode2; list2.Add(new FloatMenuOption(localTmode.ToString(), delegate { Prefs.TemperatureMode = localTmode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list2)); } float autosaveIntervalDays = Prefs.AutosaveIntervalDays; string text = "Days".Translate(); string text2 = "Day".Translate().ToLower(); if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays != 1f) ? text : text2))) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list3.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.125f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.25f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } list3.Add(new FloatMenuOption("0.5 " + text + string.Empty, delegate { Prefs.AutosaveIntervalDays = 0.5f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(1.ToString() + " " + text2, delegate { Prefs.AutosaveIntervalDays = 1f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(3.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 3f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(7.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 7f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); list3.Add(new FloatMenuOption(14.ToString() + " " + text, delegate { Prefs.AutosaveIntervalDays = 14f; }, MenuOptionPriority.Default, null, null, 0f, null, null)); Find.WindowStack.Add(new FloatMenu(list3)); } if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(new object[] { 1f }), -1f); GUI.color = Color.white; } if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller")) { Find.WindowStack.Add(new Page_SelectStorytellerInGame()); } if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman())) { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (AnimalNameDisplayMode localMode2 in Enum.GetValues(typeof(AnimalNameDisplayMode))) { AnimalNameDisplayMode localMode = localMode2; list4.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; }, MenuOptionPriority.Default, null, null, 0f, null, null)); } Find.WindowStack.Add(new FloatMenu(list4)); } bool devMode = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref devMode, null); Prefs.DevMode = devMode; if (Prefs.DevMode) { bool resetModsConfigOnCrash = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref resetModsConfigOnCrash, null); Prefs.ResetModsConfigOnCrash = resetModsConfigOnCrash; bool logVerbose = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref logVerbose, null); Prefs.LogVerbose = logVerbose; } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(string.Empty, -1f); Text.Font = GameFont.Small; listing_Standard.Gap(12f); listing_Standard.Gap(12f); if (listing_Standard.ButtonText("ModSettings".Translate(), null)) { Find.WindowStack.Add(new Dialog_ModSettings()); } listing_Standard.Label(string.Empty, -1f); listing_Standard.Label("NamesYouWantToSee".Translate(), -1f); Prefs.PreferredNames.RemoveAll(new Predicate <string>(GenText.NullOrEmpty)); for (int j = 0; j < Prefs.PreferredNames.Count; j++) { string name = Prefs.PreferredNames[j]; PawnBio pawnBio = (from b in SolidBioDatabase.allBios where b.name.ToString() == name select b).FirstOrDefault <PawnBio>(); if (pawnBio == null) { name += " [N]"; } else { PawnBioType bioType = pawnBio.BioType; if (bioType != PawnBioType.BackstoryInGame) { if (bioType == PawnBioType.PirateKing) { name += " [PK]"; } } else { name += " [B]"; } } Rect rect2 = listing_Standard.GetRect(24f); Widgets.Label(rect2, name); Rect butRect = new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f); if (Widgets.ButtonImage(butRect, TexButton.DeleteX)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.TickLow.PlayOneShotOnCamera(null); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...", null)) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.End(); }
public override void DoWindowContents(Rect inRect) { Rect rect = inRect.AtZero(); rect.yMax -= 35f; Listing_Standard listing_Standard = new Listing_Standard(); listing_Standard.ColumnWidth = (rect.width - 34f) / 3f; listing_Standard.Begin(rect); Text.Font = GameFont.Medium; listing_Standard.Label("Audiovisuals".Translate()); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); listing_Standard.Label("GameVolume".Translate()); Prefs.VolumeGame = listing_Standard.Slider(Prefs.VolumeGame, 0f, 1f); listing_Standard.Label("MusicVolume".Translate()); Prefs.VolumeMusic = listing_Standard.Slider(Prefs.VolumeMusic, 0f, 1f); listing_Standard.Label("AmbientVolume".Translate()); Prefs.VolumeAmbient = listing_Standard.Slider(Prefs.VolumeAmbient, 0f, 1f); if (listing_Standard.ButtonTextLabeled("Resolution".Translate(), ResToString(Screen.width, Screen.height))) { List <FloatMenuOption> list = new List <FloatMenuOption>(); foreach (Resolution res in from x in UnityGUIBugsFixer.ScreenResolutionsWithoutDuplicates where x.width >= 1024 && x.height >= 768 orderby x.width, x.height select x) { list.Add(new FloatMenuOption(ResToString(res.width, res.height), delegate { if (!ResolutionUtility.UIScaleSafeWithResolution(Prefs.UIScale, res.width, res.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { ResolutionUtility.SafeSetResolution(res); } })); } if (!list.Any()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null)); } Find.WindowStack.Add(new FloatMenu(list)); } if (listing_Standard.ButtonTextLabeled("UIScale".Translate(), Prefs.UIScale + "x")) { List <FloatMenuOption> list2 = new List <FloatMenuOption>(); for (int i = 0; i < UIScales.Length; i++) { float scale = UIScales[i]; list2.Add(new FloatMenuOption(UIScales[i] + "x", delegate { if (scale != 1f && !ResolutionUtility.UIScaleSafeWithResolution(scale, Screen.width, Screen.height)) { Messages.Message("MessageScreenResTooSmallForUIScale".Translate(), MessageTypeDefOf.RejectInput, historical: false); } else { ResolutionUtility.SafeSetUIScale(scale); } })); } Find.WindowStack.Add(new FloatMenu(list2)); } bool checkOn = Prefs.CustomCursorEnabled; listing_Standard.CheckboxLabeled("CustomCursor".Translate(), ref checkOn); Prefs.CustomCursorEnabled = checkOn; bool checkOn2 = Screen.fullScreen; bool flag = checkOn2; listing_Standard.CheckboxLabeled("Fullscreen".Translate(), ref checkOn2); if (checkOn2 != flag) { ResolutionUtility.SafeSetFullscreen(checkOn2); } listing_Standard.Gap(); bool checkOn3 = Prefs.HatsOnlyOnMap; listing_Standard.CheckboxLabeled("HatsShownOnlyOnMap".Translate(), ref checkOn3); if (checkOn3 != Prefs.HatsOnlyOnMap) { PortraitsCache.Clear(); } Prefs.HatsOnlyOnMap = checkOn3; bool checkOn4 = Prefs.PlantWindSway; listing_Standard.CheckboxLabeled("PlantWindSway".Translate(), ref checkOn4); Prefs.PlantWindSway = checkOn4; bool checkOn5 = Prefs.ShowRealtimeClock; listing_Standard.CheckboxLabeled("ShowRealtimeClock".Translate(), ref checkOn5); Prefs.ShowRealtimeClock = checkOn5; if (listing_Standard.ButtonTextLabeled("ShowAnimalNames".Translate(), Prefs.AnimalNameMode.ToStringHuman())) { List <FloatMenuOption> list3 = new List <FloatMenuOption>(); foreach (AnimalNameDisplayMode value in Enum.GetValues(typeof(AnimalNameDisplayMode))) { AnimalNameDisplayMode localMode = value; list3.Add(new FloatMenuOption(localMode.ToStringHuman(), delegate { Prefs.AnimalNameMode = localMode; })); } Find.WindowStack.Add(new FloatMenu(list3)); } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label("Gameplay".Translate()); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); if (listing_Standard.ButtonText("KeyboardConfig".Translate())) { Find.WindowStack.Add(new Dialog_KeyBindings()); } if (listing_Standard.ButtonText("ChooseLanguage".Translate())) { if (Current.ProgramState == ProgramState.Playing) { Messages.Message("ChangeLanguageFromMainMenu".Translate(), MessageTypeDefOf.RejectInput, historical: false); SoundDefOf.Click.PlayOneShotOnCamera(); } else { List <FloatMenuOption> list4 = new List <FloatMenuOption>(); foreach (LoadedLanguage allLoadedLanguage in LanguageDatabase.AllLoadedLanguages) { LoadedLanguage localLang = allLoadedLanguage; list4.Add(new FloatMenuOption(localLang.DisplayName, delegate { LanguageDatabase.SelectLanguage(localLang); })); } Find.WindowStack.Add(new FloatMenu(list4)); } } if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor) { if (listing_Standard.ButtonText("OpenSaveGameDataFolder".Translate())) { Application.OpenURL(GenFilePaths.SaveDataFolderPath); SoundDefOf.Click.PlayOneShotOnCamera(); } if (listing_Standard.ButtonText("OpenLogFileFolder".Translate())) { Application.OpenURL(Application.persistentDataPath); SoundDefOf.Click.PlayOneShotOnCamera(); } } else { if (listing_Standard.ButtonText("ShowSaveGameDataLocation".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(GenFilePaths.SaveDataFolderPath))); } if (listing_Standard.ButtonText("ShowLogFileLocation".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox(Path.GetFullPath(Application.persistentDataPath))); } } if (listing_Standard.ButtonText("ResetAdaptiveTutor".Translate())) { Messages.Message("AdaptiveTutorIsReset".Translate(), MessageTypeDefOf.TaskCompletion, historical: false); PlayerKnowledgeDatabase.ResetPersistent(); SoundDefOf.Click.PlayOneShotOnCamera(); } bool checkOn6 = Prefs.AdaptiveTrainingEnabled; listing_Standard.CheckboxLabeled("LearningHelper".Translate(), ref checkOn6); Prefs.AdaptiveTrainingEnabled = checkOn6; bool checkOn7 = Prefs.RunInBackground; listing_Standard.CheckboxLabeled("RunInBackground".Translate(), ref checkOn7); Prefs.RunInBackground = checkOn7; bool checkOn8 = Prefs.EdgeScreenScroll; listing_Standard.CheckboxLabeled("EdgeScreenScroll".Translate(), ref checkOn8); Prefs.EdgeScreenScroll = checkOn8; float mapDragSensitivity = Prefs.MapDragSensitivity; listing_Standard.Label("MapDragSensitivity".Translate() + ": " + mapDragSensitivity.ToStringPercent("F0")); Prefs.MapDragSensitivity = (float)Math.Round(listing_Standard.Slider(mapDragSensitivity, 0.8f, 2.5f), 2); bool checkOn9 = Prefs.PauseOnLoad; listing_Standard.CheckboxLabeled("PauseOnLoad".Translate(), ref checkOn9); Prefs.PauseOnLoad = checkOn9; AutomaticPauseMode automaticPauseMode = Prefs.AutomaticPauseMode; if (listing_Standard.ButtonTextLabeled("AutomaticPauseModeSetting".Translate(), Prefs.AutomaticPauseMode.ToStringHuman())) { List <FloatMenuOption> list5 = new List <FloatMenuOption>(); foreach (AutomaticPauseMode value2 in Enum.GetValues(typeof(AutomaticPauseMode))) { AutomaticPauseMode localPmode = value2; list5.Add(new FloatMenuOption(localPmode.ToStringHuman(), delegate { Prefs.AutomaticPauseMode = localPmode; })); } Find.WindowStack.Add(new FloatMenu(list5)); } Prefs.AutomaticPauseMode = automaticPauseMode; int maxNumberOfPlayerSettlements = Prefs.MaxNumberOfPlayerSettlements; listing_Standard.Label("MaxNumberOfPlayerSettlements".Translate(maxNumberOfPlayerSettlements)); int num2 = (Prefs.MaxNumberOfPlayerSettlements = Mathf.RoundToInt(listing_Standard.Slider(maxNumberOfPlayerSettlements, 1f, 5f))); if (maxNumberOfPlayerSettlements != num2 && num2 > 1) { TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.MaxNumberOfPlayerSettlements); } if (listing_Standard.ButtonTextLabeled("TemperatureMode".Translate(), Prefs.TemperatureMode.ToStringHuman())) { List <FloatMenuOption> list6 = new List <FloatMenuOption>(); foreach (TemperatureDisplayMode value3 in Enum.GetValues(typeof(TemperatureDisplayMode))) { TemperatureDisplayMode localTmode = value3; list6.Add(new FloatMenuOption(localTmode.ToStringHuman(), delegate { Prefs.TemperatureMode = localTmode; })); } Find.WindowStack.Add(new FloatMenu(list6)); } float autosaveIntervalDays = Prefs.AutosaveIntervalDays; string text = "Days".Translate(); string text2 = "Day".Translate().ToLower(); if (listing_Standard.ButtonTextLabeled("AutosaveInterval".Translate(), autosaveIntervalDays + " " + ((autosaveIntervalDays == 1f) ? text2 : text))) { List <FloatMenuOption> list7 = new List <FloatMenuOption>(); if (Prefs.DevMode) { list7.Add(new FloatMenuOption("0.125 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.125f; })); list7.Add(new FloatMenuOption("0.25 " + text + "(debug)", delegate { Prefs.AutosaveIntervalDays = 0.25f; })); } list7.Add(new FloatMenuOption(("0.5 " + text) ?? "", delegate { Prefs.AutosaveIntervalDays = 0.5f; })); list7.Add(new FloatMenuOption(1 + " " + text2, delegate { Prefs.AutosaveIntervalDays = 1f; })); list7.Add(new FloatMenuOption(3 + " " + text, delegate { Prefs.AutosaveIntervalDays = 3f; })); list7.Add(new FloatMenuOption(7 + " " + text, delegate { Prefs.AutosaveIntervalDays = 7f; })); list7.Add(new FloatMenuOption(14 + " " + text, delegate { Prefs.AutosaveIntervalDays = 14f; })); Find.WindowStack.Add(new FloatMenu(list7)); } if (Current.ProgramState == ProgramState.Playing && Current.Game.Info.permadeathMode && Prefs.AutosaveIntervalDays > 1f) { GUI.color = Color.red; listing_Standard.Label("MaxPermadeathAutosaveIntervalInfo".Translate(1f)); GUI.color = Color.white; } if (Current.ProgramState == ProgramState.Playing && listing_Standard.ButtonText("ChangeStoryteller".Translate(), "OptionsButton-ChooseStoryteller") && TutorSystem.AllowAction("ChooseStoryteller")) { Find.WindowStack.Add(new Page_SelectStorytellerInGame()); } if (!DevModePermanentlyDisabledUtility.Disabled && listing_Standard.ButtonText("PermanentlyDisableDevMode".Translate())) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmPermanentlyDisableDevMode".Translate(), delegate { DevModePermanentlyDisabledUtility.Disable(); }, destructive: true)); } bool checkOn10 = Prefs.TestMapSizes; listing_Standard.CheckboxLabeled("EnableTestMapSizes".Translate(), ref checkOn10); Prefs.TestMapSizes = checkOn10; if (!DevModePermanentlyDisabledUtility.Disabled || Prefs.DevMode) { bool checkOn11 = Prefs.DevMode; listing_Standard.CheckboxLabeled("DevelopmentMode".Translate(), ref checkOn11); Prefs.DevMode = checkOn11; } if (Prefs.DevMode) { bool checkOn12 = Prefs.ResetModsConfigOnCrash; listing_Standard.CheckboxLabeled("ResetModsConfigOnCrash".Translate(), ref checkOn12); Prefs.ResetModsConfigOnCrash = checkOn12; bool checkOn13 = Prefs.LogVerbose; listing_Standard.CheckboxLabeled("LogVerbose".Translate(), ref checkOn13); Prefs.LogVerbose = checkOn13; if (Current.ProgramState != ProgramState.Playing) { bool checkOn14 = Prefs.SimulateNotOwningRoyalty; listing_Standard.CheckboxLabeled("SimulateNotOwningRoyalty".Translate(), ref checkOn14); Prefs.SimulateNotOwningRoyalty = checkOn14; } } listing_Standard.NewColumn(); Text.Font = GameFont.Medium; listing_Standard.Label(""); Text.Font = GameFont.Small; listing_Standard.Gap(); listing_Standard.Gap(); if (listing_Standard.ButtonText("ModSettings".Translate())) { Find.WindowStack.Add(new Dialog_ModSettings()); } listing_Standard.Label(""); listing_Standard.Label("NamesYouWantToSee".Translate()); Prefs.PreferredNames.RemoveAll((string n) => n.NullOrEmpty()); for (int j = 0; j < Prefs.PreferredNames.Count; j++) { string name = Prefs.PreferredNames[j]; PawnBio pawnBio = SolidBioDatabase.allBios.Where((PawnBio b) => b.name.ToString() == name).FirstOrDefault(); if (pawnBio == null) { name += " [N]"; } else { switch (pawnBio.BioType) { case PawnBioType.BackstoryInGame: name += " [B]"; break; case PawnBioType.PirateKing: name += " [PK]"; break; } } Rect rect2 = listing_Standard.GetRect(24f); Widgets.Label(rect2, name); if (Widgets.ButtonImage(new Rect(rect2.xMax - 24f, rect2.y, 24f, 24f), TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor)) { Prefs.PreferredNames.RemoveAt(j); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); } } if (Prefs.PreferredNames.Count < 6 && listing_Standard.ButtonText("AddName".Translate() + "...")) { Find.WindowStack.Add(new Dialog_AddPreferredName()); } listing_Standard.Label(""); if (listing_Standard.ButtonText("RestoreToDefaultSettings".Translate())) { Find.WindowStack.Add(new Dialog_MessageBox("ResetAndRestartConfirmationDialog".Translate(), "Yes".Translate(), delegate { RestoreToDefaultSettings(); }, "No".Translate())); } listing_Standard.End(); }
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth) { // this.defaultDesc = this.ability.def.GetTooltip(this.ability.pawn); var rect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f); var isMouseOver = false; if (Mouse.IsOver(rect)) { isMouseOver = true; GUI.color = GenUI.MouseoverColor; } var badTex = icon; if (badTex == null) { badTex = BaseContent.BadTex; } GUI.DrawTexture(rect, BGTex); MouseoverSounds.DoRegion(rect, SoundDefOf.Mouseover_Command); GUI.color = IconDrawColor; Widgets.DrawTextureFitted(new Rect(rect), badTex, iconDrawScale * 0.85f, iconProportions, iconTexCoords); GUI.color = Color.white; var isUsed = false; //Rect rectFil = new Rect(topLeft.x, topLeft.y, this.Width, this.Width); var keyCode = hotKey != null ? hotKey.MainKey : KeyCode.None; if (keyCode != KeyCode.None && !GizmoGridDrawer.drawnHotKeys.Contains(keyCode)) { var rect2 = new Rect(rect.x + 5f, rect.y + 5f, rect.width - 10f, 18f); Widgets.Label(rect2, keyCode.ToStringReadable()); GizmoGridDrawer.drawnHotKeys.Add(keyCode); if (hotKey.KeyDownEvent) { isUsed = true; Event.current.Use(); } } if (Widgets.ButtonInvisible(rect, false)) { isUsed = true; } var labelCap = LabelCap; if (!labelCap.NullOrEmpty()) { var num = Text.CalcHeight(labelCap, rect.width); num -= 2f; var rect3 = new Rect(rect.x, rect.yMax - num + 12f, rect.width, num); GUI.DrawTexture(rect3, TexUI.GrayTextBG); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(rect3, labelCap); Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; } GUI.color = Color.white; if (DoTooltip) { TipSignal tip = Desc; if (disabled && !disabledReason.NullOrEmpty()) { tip.text = tip.text + StringsToTranslate.AU_DISABLED + ": " + disabledReason + "\n" + ability.CooldownTicksLeft.ToStringSecondsFromTicks(); } TooltipHandler.TipRegion(rect, tip); } if (ability.CooldownTicksLeft != -1 && ability.CooldownTicksLeft < ability.MaxCastingTicks) { var math = ability.CooldownTicksLeft / (float)ability.MaxCastingTicks; FillableBar(rect, math, AbilityButtons.FullTex, AbilityButtons.EmptyTex, false); } if (!HighlightTag.NullOrEmpty() && (Find.WindowStack.FloatMenu == null || !Find.WindowStack.FloatMenu.windowRect.Overlaps(rect))) { UIHighlighter.HighlightOpportunity(rect, HighlightTag); } if (isUsed) { if (disabled) { if (!disabledReason.NullOrEmpty()) { Messages.Message(disabledReason, MessageTypeDefOf.RejectInput); } return(new GizmoResult(GizmoState.Mouseover, null)); } if (!TutorSystem.AllowAction(TutorTagSelect)) { return(new GizmoResult(GizmoState.Mouseover, null)); } var result = new GizmoResult(GizmoState.Interacted, Event.current); TutorSystem.Notify_Event(TutorTagSelect); return(result); } if (isMouseOver) { return(new GizmoResult(GizmoState.Mouseover, null)); } return(new GizmoResult(GizmoState.Clear, null)); }