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);
        }
Exemple #2
0
        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);
        }
 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);
     }
 }
Exemple #4
0
 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 override void PostGameStart()
 {
     if (Find.GameInitData.startedFromEntry)
     {
         Find.MusicManagerPlay.disabled = true;
         Find.WindowStack.Notify_GameStartDialogOpened();
         DiaNode   diaNode   = new DiaNode(text.NullOrEmpty() ? textKey.TranslateSimple() : text);
         DiaOption diaOption = new DiaOption();
         diaOption.resolveTree = true;
         diaOption.clickSound  = null;
         diaNode.options.Add(diaOption);
         Dialog_NodeTree dialog_NodeTree = new Dialog_NodeTree(diaNode);
         dialog_NodeTree.soundClose  = ((closeSound != null) ? closeSound : SoundDefOf.GameStartSting);
         dialog_NodeTree.closeAction = delegate
         {
             Find.MusicManagerPlay.ForceSilenceFor(7f);
             Find.MusicManagerPlay.disabled = false;
             Find.WindowStack.Notify_GameStartDialogClosed();
             Find.TickManager.CurTimeSpeed = TimeSpeed.Normal;
             TutorSystem.Notify_Event("GameStartDialogClosed");
         };
         Find.WindowStack.Add(dialog_NodeTree);
         Find.Archive.Add(new ArchivedDialog(diaNode.text));
     }
 }
 public override void PostOpen()
 {
     base.PostOpen();
     Find.GameInitData.ChooseRandomStartingTile();
     LessonAutoActivator.TeachOpportunity(ConceptDefOf.WorldCameraMovement, OpportunityType.Important);
     TutorSystem.Notify_Event("PageStart-SelectLandingSite");
 }
 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);
     }
 }
Exemple #8
0
 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);
 }
Exemple #9
0
        private List <FloatMenuOption> < FillTab > m__0()
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            for (int i = 0; i < this.SelTable.def.AllRecipes.Count; i++)
            {
                if (this.SelTable.def.AllRecipes[i].AvailableNow)
                {
                    RecipeDef recipe = this.SelTable.def.AllRecipes[i];
                    list.Add(new FloatMenuOption(recipe.LabelCap, delegate()
                    {
                        if (!this.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col)))
                        {
                            Bill.CreateNoPawnsWithSkillDialog(recipe);
                        }
                        Bill bill = recipe.MakeNewBill();
                        this.SelTable.billStack.AddBill(bill);
                        if (recipe.conceptLearned != null)
                        {
                            PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total);
                        }
                        if (TutorSystem.TutorialMode)
                        {
                            TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap);
                        }
                    }, MenuOptionPriority.Default, null, null, 29f, (Rect rect) => Widgets.InfoCardButton(rect.x + 5f, rect.y + (rect.height - 24f) / 2f, recipe), null));
                }
            }
            if (!list.Any <FloatMenuOption>())
            {
                list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            return(list);
        }
Exemple #10
0
 protected virtual bool CanDoNext()
 {
     if (TutorSystem.TutorialMode)
     {
         return(TutorSystem.AllowAction("GotoNextPage"));
     }
     return(true);
 }
 private static void NewlyLearned(ConceptDef conc)
 {
     TutorSystem.Notify_Event("ConceptLearned-" + conc.defName);
     if (Find.Tutor != null)
     {
         Find.Tutor.learningReadout.Notify_ConceptNewlyLearned(conc);
     }
 }
Exemple #12
0
 private static void <PostGameStart> m__0()
 {
     Find.MusicManagerPlay.ForceSilenceFor(7f);
     Find.MusicManagerPlay.disabled = false;
     Find.WindowStack.Notify_GameStartDialogClosed();
     Find.TickManager.CurTimeSpeed = TimeSpeed.Normal;
     TutorSystem.Notify_Event("GameStartDialogClosed");
 }
Exemple #13
0
 private void RandomizeCurPawn()
 {
     if (TutorSystem.AllowAction("RandomizePawn"))
     {
         this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn);
         TutorSystem.Notify_Event("RandomizePawn");
     }
 }
Exemple #14
0
 protected virtual void DoBack()
 {
     TutorSystem.Notify_Event("PageClosed");
     TutorSystem.Notify_Event("GoToPrevPage");
     if (prev != null)
     {
         Find.WindowStack.Add(prev);
     }
     Close();
 }
Exemple #15
0
 protected virtual void DoBack()
 {
     if (this.prev != null)
     {
         Find.WindowStack.Add(this.prev);
     }
     TutorSystem.Notify_Event("PageClosed");
     TutorSystem.Notify_Event("GoToPrevPage");
     this.Close(true);
 }
Exemple #16
0
 public override void PostDeactivated()
 {
     SoundDefOf.CommsWindow_Close.PlayOneShotOnCamera(null);
     TutorSystem.Notify_Event("InstructionDeactivated-" + this.def.defName);
     if (this.def.endTutorial)
     {
         Find.ActiveLesson.Deactivate();
         Find.TutorialState.Notify_TutorialEnding();
         LessonAutoActivator.Notify_TutorialEnding();
     }
 }
 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");
     }
 }
Exemple #18
0
 protected virtual void DoNext()
 {
     if (this.next != null)
     {
         Find.WindowStack.Add(this.next);
     }
     if (this.nextAct != null)
     {
         this.nextAct();
     }
     TutorSystem.Notify_Event("PageClosed");
     TutorSystem.Notify_Event("GoToNextPage");
     this.Close(true);
 }
Exemple #19
0
            internal void <> m__0()
            {
                if (!this.$this.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => this.recipe.PawnSatisfiesSkillRequirements(col)))
                {
                    Bill.CreateNoPawnsWithSkillDialog(this.recipe);
                }
                Bill bill = this.recipe.MakeNewBill();

                this.$this.SelTable.billStack.AddBill(bill);
                if (this.recipe.conceptLearned != null)
                {
                    PlayerKnowledgeDatabase.KnowledgeDemonstrated(this.recipe.conceptLearned, KnowledgeAmount.Total);
                }
                if (TutorSystem.TutorialMode)
                {
                    TutorSystem.Notify_Event("AddBill-" + this.recipe.LabelCap);
                }
            }
Exemple #20
0
        protected override void FillTab()
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BillsTab, KnowledgeAmount.FrameDisplayed);
            Vector2 winSize  = ITab_Bills.WinSize;
            float   x        = winSize.x;
            Vector2 winSize2 = ITab_Bills.WinSize;
            Rect    rect2    = new Rect(0f, 0f, x, winSize2.y).ContractedBy(10f);
            Func <List <FloatMenuOption> > recipeOptionsMaker = delegate
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                for (int i = 0; i < this.SelTable.def.AllRecipes.Count; i++)
                {
                    ITab_Bills tab_Bills = this;
                    if (this.SelTable.def.AllRecipes[i].AvailableNow)
                    {
                        RecipeDef recipe = this.SelTable.def.AllRecipes[i];
                        list.Add(new FloatMenuOption(recipe.LabelCap, delegate
                        {
                            if (!tab_Bills.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col)))
                            {
                                Bill.CreateNoPawnsWithSkillDialog(recipe);
                            }
                            Bill bill = recipe.MakeNewBill();
                            tab_Bills.SelTable.billStack.AddBill(bill);
                            if (recipe.conceptLearned != null)
                            {
                                PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total);
                            }
                            if (TutorSystem.TutorialMode)
                            {
                                TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap);
                            }
                        }, MenuOptionPriority.Default, null, null, 29f, (Rect rect) => Widgets.InfoCardButton((float)(rect.x + 5.0), (float)(rect.y + (rect.height - 24.0) / 2.0), recipe), null));
                    }
                }
                if (!list.Any())
                {
                    list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                return(list);
            };

            this.mouseoverBill = this.SelTable.billStack.DoListing(rect2, recipeOptionsMaker, ref this.scrollPosition, ref this.viewHeight);
        }
        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");
        }
Exemple #22
0
        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);
                }
            }
        }
 public void ToggleTab(MainButtonDef newTab, bool playSound = true)
 {
     if (this.OpenTab == null && newTab == null)
     {
         return;
     }
     if (this.OpenTab == newTab)
     {
         Find.WindowStack.TryRemove(this.OpenTab.TabWindow, true);
         if (playSound)
         {
             SoundDefOf.TabClose.PlayOneShotOnCamera(null);
         }
     }
     else
     {
         if (this.OpenTab != null)
         {
             Find.WindowStack.TryRemove(this.OpenTab.TabWindow, true);
         }
         if (newTab != null)
         {
             Find.WindowStack.Add(newTab.TabWindow);
         }
         if (playSound)
         {
             if (newTab == null)
             {
                 SoundDefOf.TabClose.PlayOneShotOnCamera(null);
             }
             else
             {
                 SoundDefOf.TabOpen.PlayOneShotOnCamera(null);
             }
         }
         if (TutorSystem.TutorialMode && newTab != null)
         {
             TutorSystem.Notify_Event("Open-MainTab-" + newTab.defName);
         }
     }
 }
        internal static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard selectedStorytellerInfoListing)
        {
            GUI.BeginGroup(rect);
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                float   height            = rect.height;
                Vector2 portraitSizeLarge = Storyteller.PortraitSizeLarge;
                double  y = height - portraitSizeLarge.y - 1.0;
                Vector2 portraitSizeLarge2 = Storyteller.PortraitSizeLarge;
                float   x = portraitSizeLarge2.x;
                Vector2 portraitSizeLarge3 = Storyteller.PortraitSizeLarge;
                Rect    position           = new Rect(390f, (float)y, x, portraitSizeLarge3.y);
                GUI.DrawTexture(position, chosenStoryteller.portraitLargeTex);
                Widgets.DrawLineHorizontal(0f, rect.height, rect.width);
            }
            Vector2 portraitSizeTiny  = Storyteller.PortraitSizeTiny;
            Rect    outRect           = new Rect(0f, 0f, (float)(portraitSizeTiny.x + 16.0), rect.height);
            Vector2 portraitSizeTiny2 = Storyteller.PortraitSizeTiny;
            float   x2  = portraitSizeTiny2.x;
            float   num = (float)DefDatabase <StorytellerDef> .AllDefs.Count();

            Vector2 portraitSizeTiny3 = Storyteller.PortraitSizeTiny;
            Rect    viewRect          = new Rect(0f, 0f, x2, (float)(num * (portraitSizeTiny3.y + 10.0)));

            Widgets.BeginScrollView(outRect, ref StorytellerUI.scrollPosition, viewRect, true);
            Vector2 portraitSizeTiny4 = Storyteller.PortraitSizeTiny;
            float   x3 = portraitSizeTiny4.x;
            Vector2 portraitSizeTiny5 = Storyteller.PortraitSizeTiny;
            Rect    rect2             = new Rect(0f, 0f, x3, portraitSizeTiny5.y);

            foreach (StorytellerDef item in from tel in DefDatabase <StorytellerDef> .AllDefs
                     orderby tel.listOrder
                     select tel)
            {
                if (item.listVisible)
                {
                    if (Widgets.ButtonImage(rect2, item.portraitTinyTex))
                    {
                        TutorSystem.Notify_Event("ChooseStoryteller");
                        chosenStoryteller = item;
                    }
                    if (chosenStoryteller == item)
                    {
                        GUI.DrawTexture(rect2, StorytellerUI.StorytellerHighlightTex);
                    }
                    rect2.y += (float)(rect2.height + 8.0);
                }
            }
            Widgets.EndScrollView();
            Text.Font = GameFont.Small;
            Rect rect3 = new Rect((float)(outRect.xMax + 8.0), 0f, 240f, 999f);

            Widgets.Label(rect3, "HowStorytellersWork".Translate());
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect rect4 = new Rect((float)(outRect.xMax + 8.0), (float)(outRect.yMin + 200.0), 290f, 0f);
                rect4.height = rect.height - rect4.y;
                Text.Font    = GameFont.Medium;
                Rect rect5 = new Rect((float)(rect4.x + 15.0), (float)(rect4.y - 40.0), 9999f, 40f);
                Widgets.Label(rect5, chosenStoryteller.label);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
                selectedStorytellerInfoListing.Begin(rect4);
                selectedStorytellerInfoListing.Label(chosenStoryteller.description, 120f);
                selectedStorytellerInfoListing.Gap(6f);
                foreach (DifficultyDef allDef in DefDatabase <DifficultyDef> .AllDefs)
                {
                    Rect rect6 = selectedStorytellerInfoListing.GetRect(30f);
                    if (Mouse.IsOver(rect6))
                    {
                        Widgets.DrawHighlight(rect6);
                    }
                    TooltipHandler.TipRegion(rect6, allDef.description);
                    if (Widgets.RadioButtonLabeled(rect6, allDef.LabelCap, difficulty == allDef))
                    {
                        difficulty = allDef;
                    }
                }
                selectedStorytellerInfoListing.Gap(30f);
                if (Current.ProgramState == ProgramState.Entry)
                {
                    selectedStorytellerInfoListing.CheckboxLabeled("PermadeathMode".Translate(), ref Find.GameInitData.permadeath, "PermadeathModeInfo".Translate());
                }
                selectedStorytellerInfoListing.End();
            }
            GUI.EndGroup();
        }
Exemple #25
0
        protected override void FillTab()
        {
            PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BillsTab, KnowledgeAmount.FrameDisplayed);
            Rect rect2 = new Rect(WinSize.x - PasteX, PasteY, PasteSize, PasteSize);

            if (BillUtility.Clipboard == null)
            {
                GUI.color = Color.gray;
                Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f);
                GUI.color = Color.white;
                TooltipHandler.TipRegionByKey(rect2, "PasteBillTip");
            }
            else if (!SelTable.def.AllRecipes.Contains(BillUtility.Clipboard.recipe) || !BillUtility.Clipboard.recipe.AvailableNow || !BillUtility.Clipboard.recipe.AvailableOnNow(SelTable))
            {
                GUI.color = Color.gray;
                Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f);
                GUI.color = Color.white;
                TooltipHandler.TipRegionByKey(rect2, "ClipboardBillNotAvailableHere");
            }
            else if (SelTable.billStack.Count >= 15)
            {
                GUI.color = Color.gray;
                Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f);
                GUI.color = Color.white;
                if (Mouse.IsOver(rect2))
                {
                    TooltipHandler.TipRegion(rect2, "PasteBillTip".Translate() + " (" + "PasteBillTip_LimitReached".Translate() + ")");
                }
            }
            else
            {
                if (Widgets.ButtonImageFitted(rect2, TexButton.Paste, Color.white))
                {
                    Bill bill = BillUtility.Clipboard.Clone();
                    bill.InitializeAfterClone();
                    SelTable.billStack.AddBill(bill);
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera();
                }
                TooltipHandler.TipRegionByKey(rect2, "PasteBillTip");
            }
            Rect rect3 = new Rect(0f, 0f, WinSize.x, WinSize.y).ContractedBy(10f);
            Func <List <FloatMenuOption> > recipeOptionsMaker = delegate
            {
                List <FloatMenuOption> list      = new List <FloatMenuOption>();
                ITab_Bills             tab_Bills = default(ITab_Bills);
                RecipeDef recipe = default(RecipeDef);
                for (int i = 0; i < SelTable.def.AllRecipes.Count; i++)
                {
                    tab_Bills = this;
                    if (SelTable.def.AllRecipes[i].AvailableNow && SelTable.def.AllRecipes[i].AvailableOnNow(SelTable))
                    {
                        recipe = SelTable.def.AllRecipes[i];
                        list.Add(new FloatMenuOption(recipe.LabelCap, delegate
                        {
                            if (!tab_Bills.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col)))
                            {
                                Bill.CreateNoPawnsWithSkillDialog(recipe);
                            }
                            Bill bill2 = recipe.MakeNewBill();
                            tab_Bills.SelTable.billStack.AddBill(bill2);
                            if (recipe.conceptLearned != null)
                            {
                                PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total);
                            }
                            if (TutorSystem.TutorialMode)
                            {
                                TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap.Resolve());
                            }
                        }, recipe.ProducedThingDef, MenuOptionPriority.Default, null, null, 29f, (Rect rect) => Widgets.InfoCardButton(rect.x + 5f, rect.y + (rect.height - 24f) / 2f, recipe)));
                    }
                }
                if (!list.Any())
                {
                    list.Add(new FloatMenuOption("NoneBrackets".Translate(), null));
                }
                return(list);
            };

            mouseoverBill = SelTable.billStack.DoListing(rect3, recipeOptionsMaker, ref scrollPosition, ref viewHeight);
        }
Exemple #26
0
        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();
        }
Exemple #27
0
 public static void Notify_Event(string eventTag, IntVec3 cell)
 {
     TutorSystem.Notify_Event(new EventPack(eventTag, cell));
 }
        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));
        }
Exemple #29
0
        protected override void DoConfigInterface(Rect baseRect, Color baseColor)
        {
            Rect rect = new Rect(28f, 32f, 100f, 30f);

            GUI.color = new Color(1f, 1f, 1f, 0.65f);
            Widgets.Label(rect, RepeatInfoText);
            GUI.color = baseColor;
            WidgetRow widgetRow = new WidgetRow(baseRect.xMax, baseRect.y + 29f, UIDirection.LeftThenUp);

            if (widgetRow.ButtonText("Details".Translate() + "..."))
            {
                Find.WindowStack.Add(new Dialog_BillConfig(this, ((Thing)billStack.billGiver).Position));
            }
            if (widgetRow.ButtonText(repeatMode.LabelCap.PadRight(20)))
            {
                BillRepeatModeUtility.MakeConfigFloatMenu(this);
            }
            if (widgetRow.ButtonIcon(TexButton.Plus))
            {
                if (repeatMode == BillRepeatModeDefOf.Forever)
                {
                    repeatMode  = BillRepeatModeDefOf.RepeatCount;
                    repeatCount = 1;
                }
                else if (repeatMode == BillRepeatModeDefOf.TargetCount)
                {
                    int num = recipe.targetCountAdjustment * GenUI.CurrentAdjustmentMultiplier();
                    targetCount        += num;
                    unpauseWhenYouHave += num;
                }
                else if (repeatMode == BillRepeatModeDefOf.RepeatCount)
                {
                    repeatCount += GenUI.CurrentAdjustmentMultiplier();
                }
                SoundDefOf.AmountIncrement.PlayOneShotOnCamera();
                if (TutorSystem.TutorialMode && repeatMode == BillRepeatModeDefOf.RepeatCount)
                {
                    TutorSystem.Notify_Event(recipe.defName + "-RepeatCountSetTo-" + repeatCount);
                }
            }
            if (widgetRow.ButtonIcon(TexButton.Minus))
            {
                if (repeatMode == BillRepeatModeDefOf.Forever)
                {
                    repeatMode  = BillRepeatModeDefOf.RepeatCount;
                    repeatCount = 1;
                }
                else if (repeatMode == BillRepeatModeDefOf.TargetCount)
                {
                    int num2 = recipe.targetCountAdjustment * GenUI.CurrentAdjustmentMultiplier();
                    targetCount        = Mathf.Max(0, targetCount - num2);
                    unpauseWhenYouHave = Mathf.Max(0, unpauseWhenYouHave - num2);
                }
                else if (repeatMode == BillRepeatModeDefOf.RepeatCount)
                {
                    repeatCount = Mathf.Max(0, repeatCount - GenUI.CurrentAdjustmentMultiplier());
                }
                SoundDefOf.AmountDecrement.PlayOneShotOnCamera();
                if (TutorSystem.TutorialMode && repeatMode == BillRepeatModeDefOf.RepeatCount)
                {
                    TutorSystem.Notify_Event(recipe.defName + "-RepeatCountSetTo-" + repeatCount);
                }
            }
        }
Exemple #30
0
 public virtual void InterfaceTryActivate()
 {
     if (!TutorSystem.TutorialMode || !this.def.canBeTutorDenied || Find.MainTabsRoot.OpenTab == this.def || TutorSystem.AllowAction("MainTab-" + this.def.defName + "-Open"))
     {
         this.Activate();
     }
 }