Ejemplo n.º 1
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
 {
     this.def                = def;
     this.difficulty         = difficulty;
     this.intenderPopulation = new StoryIntender_Population(this);
     this.InitializeStorytellerComps();
 }
Ejemplo n.º 2
0
        protected override bool CanDoNext()
        {
            bool result;

            if (!base.CanDoNext())
            {
                result = false;
            }
            else
            {
                if (this.difficulty == null)
                {
                    if (!Prefs.DevMode)
                    {
                        Messages.Message("MustChooseDifficulty".Translate(), MessageTypeDefOf.RejectInput, false);
                        return(false);
                    }
                    Messages.Message("Difficulty has been automatically selected (debug mode only)", MessageTypeDefOf.SilentInput, false);
                    this.difficulty = DifficultyDefOf.ExtraHard;
                }
                Current.Game.storyteller = new Storyteller(this.storyteller, this.difficulty);
                result = true;
            }
            return(result);
        }
Ejemplo n.º 3
0
 protected override bool CanDoNext()
 {
     if (!base.CanDoNext())
     {
         return(false);
     }
     if (difficulty == null)
     {
         if (!Prefs.DevMode)
         {
             Messages.Message("MustChooseDifficulty".Translate(), MessageTypeDefOf.RejectInput, historical: false);
             return(false);
         }
         Messages.Message("Difficulty has been automatically selected (debug mode only)", MessageTypeDefOf.SilentInput, historical: false);
         difficulty = DifficultyDefOf.Rough;
     }
     if (!Find.GameInitData.permadeathChosen)
     {
         if (!Prefs.DevMode)
         {
             Messages.Message("MustChoosePermadeath".Translate(), MessageTypeDefOf.RejectInput, historical: false);
             return(false);
         }
         Messages.Message("Reload anytime mode has been automatically selected (debug mode only)", MessageTypeDefOf.SilentInput, historical: false);
         Find.GameInitData.permadeathChosen = true;
         Find.GameInitData.permadeath       = false;
     }
     Current.Game.storyteller = new Storyteller(storyteller, difficulty);
     return(true);
 }
Ejemplo n.º 4
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty, Difficulty difficultyValues)
 {
     this.def              = def;
     this.difficulty       = difficulty;
     this.difficultyValues = difficultyValues;
     InitializeStorytellerComps();
 }
        private float Multiplier(DifficultyDef d)
        {
            int num = d.difficulty;

            if (num < 0 || num > this.factorsPerDifficulty.Count - 1)
            {
                Log.ErrorOnce("Not enough difficulty offsets defined for StatPart_Difficulty", 3598689, false);
                num = Mathf.Clamp(num, 0, this.factorsPerDifficulty.Count - 1);
            }
            return(this.factorsPerDifficulty[num]);
        }
        private void DoStatisticsPage(Rect rect)
        {
            rect.yMin += 17f;
            GUI.BeginGroup(rect);
            StringBuilder stringBuilder = new StringBuilder();
            TimeSpan      timeSpan      = new TimeSpan(0, 0, (int)Find.GameInfo.RealPlayTimeInteracting);

            stringBuilder.AppendLine(string.Concat(new object[]
            {
                "Playtime".Translate(),
                ": ",
                timeSpan.Days,
                "LetterDay".Translate(),
                " ",
                timeSpan.Hours,
                "LetterHour".Translate(),
                " ",
                timeSpan.Minutes,
                "LetterMinute".Translate(),
                " ",
                timeSpan.Seconds,
                "LetterSecond".Translate()
            }));
            stringBuilder.AppendLine("Storyteller".Translate() + ": " + Find.Storyteller.def.LabelCap);
            DifficultyDef difficulty = Find.Storyteller.difficulty;

            stringBuilder.AppendLine("Difficulty".Translate() + ": " + difficulty.LabelCap);
            if (Find.CurrentMap != null)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("ThisMapColonyWealthTotal".Translate() + ": " + Find.CurrentMap.wealthWatcher.WealthTotal.ToString("F0"));
                stringBuilder.AppendLine("ThisMapColonyWealthItems".Translate() + ": " + Find.CurrentMap.wealthWatcher.WealthItems.ToString("F0"));
                stringBuilder.AppendLine("ThisMapColonyWealthBuildings".Translate() + ": " + Find.CurrentMap.wealthWatcher.WealthBuildings.ToString("F0"));
                stringBuilder.AppendLine("ThisMapColonyWealthColonistsAndTameAnimals".Translate() + ": " + Find.CurrentMap.wealthWatcher.WealthPawns.ToString("F0"));
            }
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("NumThreatBigs".Translate() + ": " + Find.StoryWatcher.statsRecord.numThreatBigs);
            stringBuilder.AppendLine("NumEnemyRaids".Translate() + ": " + Find.StoryWatcher.statsRecord.numRaidsEnemy);
            stringBuilder.AppendLine();
            if (Find.CurrentMap != null)
            {
                stringBuilder.AppendLine("ThisMapDamageTaken".Translate() + ": " + Find.CurrentMap.damageWatcher.DamageTakenEver);
            }
            stringBuilder.AppendLine("ColonistsKilled".Translate() + ": " + Find.StoryWatcher.statsRecord.colonistsKilled);
            stringBuilder.AppendLine();
            stringBuilder.AppendLine("ColonistsLaunched".Translate() + ": " + Find.StoryWatcher.statsRecord.colonistsLaunched);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            Rect rect2 = new Rect(0f, 0f, 400f, 400f);

            Widgets.Label(rect2, stringBuilder.ToString());
            GUI.EndGroup();
        }
Ejemplo n.º 7
0
 public void ExposeData()
 {
     Scribe_Defs.Look(ref def, "def");
     Scribe_Defs.Look(ref difficulty, "difficulty");
     Scribe_Deep.Look(ref incidentQueue, "incidentQueue");
     if (difficulty == null)
     {
         Log.Error("Loaded storyteller without difficulty");
         difficulty = DefDatabase <DifficultyDef> .AllDefsListForReading[3];
     }
     if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         InitializeStorytellerComps();
     }
 }
Ejemplo n.º 8
0
 public void ExposeData()
 {
     Scribe_Defs.Look <StorytellerDef>(ref this.def, "def");
     Scribe_Defs.Look <DifficultyDef>(ref this.difficulty, "difficulty");
     Scribe_Deep.Look <IncidentQueue>(ref this.incidentQueue, "incidentQueue", new object[0]);
     if (this.difficulty == null)
     {
         Log.Error("Loaded storyteller without difficulty", false);
         this.difficulty = DefDatabase <DifficultyDef> .AllDefsListForReading[3];
     }
     if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         this.InitializeStorytellerComps();
     }
 }
Ejemplo n.º 9
0
        private float Multiplier(DifficultyDef d)
        {
            switch (d.index)
            {
            case 0:
                return(this.factorRelax);

            case 1:
                return(this.factorBasebuilder);

            case 2:
                return(this.factorRough);

            case 3:
                return(this.factorChallenge);

            case 4:
                return(this.factorExtreme);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 10
0
 public void ExposeData()
 {
     Scribe_Defs.Look(ref def, "def");
     Scribe_Defs.Look(ref difficulty, "difficulty");
     Scribe_Deep.Look(ref incidentQueue, "incidentQueue");
     if (difficulty == null)
     {
         Log.Error("Loaded storyteller without difficulty");
         difficulty = DifficultyDefOf.Rough;
     }
     if (difficulty.isCustom)
     {
         Scribe_Deep.Look(ref difficultyValues, "customDifficulty", difficulty);
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         difficultyValues = new Difficulty(difficulty);
     }
     if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         InitializeStorytellerComps();
     }
 }
Ejemplo n.º 11
0
 public void CopyFrom(DifficultyDef src)
 {
     threatScale                        = src.threatScale;
     allowBigThreats                    = src.allowBigThreats;
     allowIntroThreats                  = src.allowIntroThreats;
     allowCaveHives                     = src.allowCaveHives;
     peacefulTemples                    = src.peacefulTemples;
     allowViolentQuests                 = src.allowViolentQuests;
     predatorsHuntHumanlikes            = src.predatorsHuntHumanlikes;
     scariaRotChance                    = src.scariaRotChance;
     colonistMoodOffset                 = src.colonistMoodOffset;
     tradePriceFactorLoss               = src.tradePriceFactorLoss;
     cropYieldFactor                    = src.cropYieldFactor;
     mineYieldFactor                    = src.mineYieldFactor;
     butcherYieldFactor                 = src.butcherYieldFactor;
     researchSpeedFactor                = src.researchSpeedFactor;
     diseaseIntervalFactor              = src.diseaseIntervalFactor;
     enemyReproductionRateFactor        = src.enemyReproductionRateFactor;
     playerPawnInfectionChanceFactor    = src.playerPawnInfectionChanceFactor;
     manhunterChanceOnDamageFactor      = src.manhunterChanceOnDamageFactor;
     deepDrillInfestationChanceFactor   = src.deepDrillInfestationChanceFactor;
     foodPoisonChanceFactor             = src.foodPoisonChanceFactor;
     maintenanceCostFactor              = src.maintenanceCostFactor;
     enemyDeathOnDownedChanceFactor     = src.enemyDeathOnDownedChanceFactor;
     adaptationGrowthRateFactorOverZero = src.adaptationGrowthRateFactorOverZero;
     adaptationEffectFactor             = src.adaptationEffectFactor;
     questRewardValueFactor             = src.questRewardValueFactor;
     raidLootPointsFactor               = src.raidLootPointsFactor;
     allowTraps   = src.allowTraps;
     allowTurrets = src.allowTurrets;
     allowMortars = src.allowMortars;
     allowExtremeWeatherIncidents = src.allowExtremeWeatherIncidents;
     fixedWealthMode          = src.fixedWealthMode;
     fixedWealthTimeFactor    = 1f;
     friendlyFireChanceFactor = 0.4f;
     allowInstantKillChance   = 1f;
 }
Ejemplo n.º 12
0
        public static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard infoListing)
        {
            GUI.BeginGroup(rect);
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                GUI.DrawTexture(new Rect(390f, rect.height - Storyteller.PortraitSizeLarge.y - 1f, Storyteller.PortraitSizeLarge.x, Storyteller.PortraitSizeLarge.y), chosenStoryteller.portraitLargeTex);
                Widgets.DrawLineHorizontal(0f, rect.height, rect.width);
            }
            Rect outRect = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x + 16f, rect.height);

            Widgets.BeginScrollView(viewRect: new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, (float)DefDatabase <StorytellerDef> .AllDefs.Count() * (Storyteller.PortraitSizeTiny.y + 10f)), outRect: outRect, scrollPosition: ref scrollPosition);
            Rect rect2 = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, Storyteller.PortraitSizeTiny.y);

            foreach (StorytellerDef item in DefDatabase <StorytellerDef> .AllDefs.OrderBy((StorytellerDef tel) => tel.listOrder))
            {
                if (item.listVisible)
                {
                    if (Widgets.ButtonImage(rect2, item.portraitTinyTex))
                    {
                        TutorSystem.Notify_Event("ChooseStoryteller");
                        chosenStoryteller = item;
                    }
                    if (chosenStoryteller == item)
                    {
                        GUI.DrawTexture(rect2, StorytellerHighlightTex);
                    }
                    rect2.y += rect2.height + 8f;
                }
            }
            Widgets.EndScrollView();
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(outRect.xMax + 8f, 0f, 300f, 999f), "HowStorytellersWork".Translate());
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect rect3 = new Rect(outRect.xMax + 8f, outRect.yMin + 160f, 290f, 0f);
                rect3.height = rect.height - rect3.y;
                Text.Font    = GameFont.Medium;
                Widgets.Label(new Rect(rect3.x + 15f, rect3.y - 40f, 9999f, 40f), chosenStoryteller.label);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
                infoListing.Begin(rect3);
                infoListing.Label(chosenStoryteller.description, 160f);
                infoListing.Gap(6f);
                foreach (DifficultyDef allDef in DefDatabase <DifficultyDef> .AllDefs)
                {
                    if (!allDef.isExtreme || Prefs.ExtremeDifficultyUnlocked)
                    {
                        GUI.color = allDef.drawColor;
                        if (infoListing.RadioButton_NewTemp(allDef.LabelCap, difficulty == allDef, 0f, allDef.description, 0f))
                        {
                            difficulty = allDef;
                        }
                        infoListing.Gap(3f);
                    }
                }
                GUI.color = Color.white;
                if (Current.ProgramState == ProgramState.Entry)
                {
                    infoListing.Gap(25f);
                    bool active  = Find.GameInitData.permadeathChosen && Find.GameInitData.permadeath;
                    bool active2 = Find.GameInitData.permadeathChosen && !Find.GameInitData.permadeath;
                    if (infoListing.RadioButton("ReloadAnytimeMode".Translate(), active2, 0f, "ReloadAnytimeModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = false;
                    }
                    infoListing.Gap(3f);
                    if (infoListing.RadioButton("CommitmentMode".TranslateWithBackup("PermadeathMode"), active, 0f, "PermadeathModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = true;
                    }
                }
                infoListing.End();
            }
            GUI.EndGroup();
        }
Ejemplo n.º 13
0
        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();
        }
Ejemplo n.º 14
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
 {
     this.def        = def;
     this.difficulty = difficulty;
     this.InitializeStorytellerComps();
 }
Ejemplo n.º 15
0
 public Difficulty(DifficultyDef src)
 {
     CopyFrom(src);
 }
Ejemplo n.º 16
0
        internal static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard selectedStorytellerInfoListing)
        {
            GUI.BeginGroup(rect);
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect position = new Rect(390f, rect.height - Storyteller.PortraitSizeLarge.y - 1f, Storyteller.PortraitSizeLarge.x, Storyteller.PortraitSizeLarge.y);
                GUI.DrawTexture(position, chosenStoryteller.portraitLargeTex);
                Widgets.DrawLineHorizontal(0f, rect.height, rect.width);
            }
            Rect outRect  = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x + 16f, rect.height);
            Rect viewRect = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, (float)DefDatabase <StorytellerDef> .AllDefs.Count <StorytellerDef>() * (Storyteller.PortraitSizeTiny.y + 10f));

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

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

            Widgets.Label(rect3, "HowStorytellersWork".Translate());
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect rect4 = new Rect(outRect.xMax + 8f, outRect.yMin + 200f, 290f, 0f);
                rect4.height = rect.height - rect4.y;
                Text.Font    = GameFont.Medium;
                Rect rect5 = new Rect(rect4.x + 15f, rect4.y - 40f, 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 current2 in DefDatabase <DifficultyDef> .AllDefs)
                {
                    Rect rect6 = selectedStorytellerInfoListing.GetRect(30f);
                    if (Mouse.IsOver(rect6))
                    {
                        Widgets.DrawHighlight(rect6);
                    }
                    TooltipHandler.TipRegion(rect6, current2.description);
                    if (Widgets.RadioButtonLabeled(rect6, current2.LabelCap, difficulty == current2))
                    {
                        difficulty = current2;
                    }
                }
                selectedStorytellerInfoListing.Gap(30f);
                if (Current.ProgramState == ProgramState.Entry)
                {
                    selectedStorytellerInfoListing.CheckboxLabeled("PermadeathMode".Translate(), ref Find.GameInitData.permadeath, "PermadeathModeInfo".Translate());
                }
                selectedStorytellerInfoListing.End();
            }
            GUI.EndGroup();
        }
 private float Multiplier(DifficultyDef d)
 {
     return(1f);
 }
Ejemplo n.º 18
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
     : this(def, difficulty, new Difficulty(difficulty))
 {
 }
Ejemplo n.º 19
0
        public static void DrawStorytellerSelectionInterface_NewTemp(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, ref Difficulty difficultyValues, Listing_Standard infoListing)
        {
            GUI.BeginGroup(rect);
            Rect outRect = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x + 16f, rect.height);

            Widgets.BeginScrollView(viewRect: new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, (float)DefDatabase <StorytellerDef> .AllDefs.Count() * (Storyteller.PortraitSizeTiny.y + 10f)), outRect: outRect, scrollPosition: ref scrollPosition);
            Rect rect2 = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, Storyteller.PortraitSizeTiny.y);

            foreach (StorytellerDef item in DefDatabase <StorytellerDef> .AllDefs.OrderBy((StorytellerDef tel) => tel.listOrder))
            {
                if (item.listVisible)
                {
                    if (Widgets.ButtonImage(rect2, item.portraitTinyTex))
                    {
                        TutorSystem.Notify_Event("ChooseStoryteller");
                        chosenStoryteller = item;
                    }
                    if (chosenStoryteller == item)
                    {
                        GUI.DrawTexture(rect2, StorytellerHighlightTex);
                    }
                    rect2.y += rect2.height + 8f;
                }
            }
            Widgets.EndScrollView();
            Rect outRect2 = new Rect(outRect.xMax + 8f, 0f, rect.width - outRect.width - 8f, rect.height);

            explanationInnerRect.width = outRect2.width - 16f;
            Widgets.BeginScrollView(outRect2, ref explanationScrollPosition, explanationInnerRect);
            Text.Font = GameFont.Small;
            Widgets.Label(new Rect(0f, 0f, 300f, 999f), "HowStorytellersWork".Translate());
            Rect  rect3 = new Rect(0f, 120f, 290f, 9999f);
            float num   = 300f;

            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect position = new Rect(390f - outRect2.x, rect.height - Storyteller.PortraitSizeLarge.y - 1f, Storyteller.PortraitSizeLarge.x, Storyteller.PortraitSizeLarge.y);
                GUI.DrawTexture(position, chosenStoryteller.portraitLargeTex);
                Text.Anchor = TextAnchor.UpperLeft;
                infoListing.Begin(rect3);
                Text.Font = GameFont.Medium;
                infoListing.Indent(15f);
                infoListing.Label(chosenStoryteller.label);
                infoListing.Outdent(15f);
                Text.Font = GameFont.Small;
                infoListing.Gap(8f);
                infoListing.Label(chosenStoryteller.description, 160f);
                infoListing.Gap(6f);
                foreach (DifficultyDef allDef in DefDatabase <DifficultyDef> .AllDefs)
                {
                    TaggedString labelCap = allDef.LabelCap;
                    if (allDef.isCustom)
                    {
                        labelCap += "...";
                    }
                    if (infoListing.RadioButton_NewTemp(labelCap, difficulty == allDef, 0f, allDef.description, 0f))
                    {
                        if (!allDef.isCustom)
                        {
                            difficultyValues.CopyFrom(allDef);
                        }
                        else if (allDef != difficulty)
                        {
                            difficultyValues.CopyFrom(DifficultyDefOf.Rough);
                            float time = Time.time;
                            float num2 = 0.6f;
                            explanationScrollPositionAnimated = AnimationCurve.EaseInOut(time, explanationScrollPosition.y, time + num2, explanationInnerRect.height);
                        }
                        difficulty = allDef;
                    }
                    infoListing.Gap(3f);
                }
                if (Current.ProgramState == ProgramState.Entry)
                {
                    infoListing.Gap(25f);
                    bool active  = Find.GameInitData.permadeathChosen && Find.GameInitData.permadeath;
                    bool active2 = Find.GameInitData.permadeathChosen && !Find.GameInitData.permadeath;
                    if (infoListing.RadioButton("ReloadAnytimeMode".Translate(), active2, 0f, "ReloadAnytimeModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = false;
                    }
                    infoListing.Gap(3f);
                    if (infoListing.RadioButton("CommitmentMode".TranslateWithBackup("PermadeathMode"), active, 0f, "PermadeathModeInfo".Translate()))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = true;
                    }
                }
                num = rect3.y + infoListing.CurHeight;
                infoListing.End();
                if (difficulty != null && difficulty.isCustom)
                {
                    if (explanationScrollPositionAnimated != null)
                    {
                        float time2 = Time.time;
                        if (time2 < explanationScrollPositionAnimated.keys.Last().time)
                        {
                            explanationScrollPosition.y = explanationScrollPositionAnimated.Evaluate(time2);
                        }
                        else
                        {
                            explanationScrollPositionAnimated = null;
                        }
                    }
                    Listing_Standard listing_Standard = new Listing_Standard();
                    float            num3             = position.xMax - explanationInnerRect.x;
                    listing_Standard.ColumnWidth = num3 / 2f - 17f;
                    Rect rect4 = new Rect(0f, Math.Max(position.yMax, num) - 45f, num3, 9999f);
                    listing_Standard.Begin(rect4);
                    Text.Font = GameFont.Medium;
                    listing_Standard.Indent(15f);
                    listing_Standard.Label("DifficultyCustomSectionLabel".Translate());
                    listing_Standard.Outdent(15f);
                    Text.Font = GameFont.Small;
                    listing_Standard.Gap();
                    if (listing_Standard.ButtonText("DifficultyReset".Translate()))
                    {
                        MakeResetDifficultyFloatMenu(difficultyValues);
                    }
                    float curHeight = listing_Standard.CurHeight;
                    float gapHeight = outRect2.height / 2f;
                    DrawCustomLeft(listing_Standard, difficultyValues);
                    listing_Standard.Gap(gapHeight);
                    listing_Standard.NewColumn();
                    listing_Standard.Gap(curHeight);
                    DrawCustomRight(listing_Standard, difficultyValues);
                    listing_Standard.Gap(gapHeight);
                    num = rect4.y + listing_Standard.MaxColumnHeightSeen;
                    listing_Standard.End();
                }
            }
            explanationInnerRect.height = num;
            Widgets.EndScrollView();
            GUI.EndGroup();
        }
Ejemplo n.º 20
0
        public static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard infoListing)
        {
            Difficulty difficultyValues = new Difficulty();

            DrawStorytellerSelectionInterface_NewTemp(rect, ref chosenStoryteller, ref difficulty, ref difficultyValues, infoListing);
        }
Ejemplo n.º 21
0
        public static void DrawStorytellerSelectionInterface(Rect rect, ref StorytellerDef chosenStoryteller, ref DifficultyDef difficulty, Listing_Standard infoListing)
        {
            GUI.BeginGroup(rect);
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect position = new Rect(390f, rect.height - Storyteller.PortraitSizeLarge.y - 1f, Storyteller.PortraitSizeLarge.x, Storyteller.PortraitSizeLarge.y);
                GUI.DrawTexture(position, chosenStoryteller.portraitLargeTex);
                Widgets.DrawLineHorizontal(0f, rect.height, rect.width);
            }
            Rect outRect  = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x + 16f, rect.height);
            Rect viewRect = new Rect(0f, 0f, Storyteller.PortraitSizeTiny.x, (float)DefDatabase <StorytellerDef> .AllDefs.Count <StorytellerDef>() * (Storyteller.PortraitSizeTiny.y + 10f));

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

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

            Widgets.Label(rect3, "HowStorytellersWork".Translate());
            if (chosenStoryteller != null && chosenStoryteller.listVisible)
            {
                Rect rect4 = new Rect(outRect.xMax + 8f, outRect.yMin + 160f, 290f, 0f);
                rect4.height = rect.height - rect4.y;
                Text.Font    = GameFont.Medium;
                Rect rect5 = new Rect(rect4.x + 15f, rect4.y - 40f, 9999f, 40f);
                Widgets.Label(rect5, chosenStoryteller.label);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
                infoListing.Begin(rect4);
                infoListing.Label(chosenStoryteller.description, 160f, null);
                infoListing.Gap(6f);
                foreach (DifficultyDef difficultyDef in DefDatabase <DifficultyDef> .AllDefs)
                {
                    if (!difficultyDef.isExtreme || Prefs.ExtremeDifficultyUnlocked)
                    {
                        GUI.color = difficultyDef.drawColor;
                        string text   = difficultyDef.LabelCap;
                        bool   active = difficulty == difficultyDef;
                        string text2  = difficultyDef.description;
                        if (infoListing.RadioButton(text, active, 0f, text2))
                        {
                            difficulty = difficultyDef;
                        }
                        infoListing.Gap(3f);
                    }
                }
                GUI.color = Color.white;
                if (Current.ProgramState == ProgramState.Entry)
                {
                    infoListing.Gap(25f);
                    bool   flag   = Find.GameInitData.permadeathChosen && Find.GameInitData.permadeath;
                    bool   flag2  = Find.GameInitData.permadeathChosen && !Find.GameInitData.permadeath;
                    string text2  = "ReloadAnytimeMode".Translate();
                    bool   active = flag2;
                    string text   = "ReloadAnytimeModeInfo".Translate();
                    if (infoListing.RadioButton(text2, active, 0f, text))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = false;
                    }
                    infoListing.Gap(3f);
                    text   = "CommitmentMode".TranslateWithBackup("PermadeathMode");
                    active = flag;
                    text2  = "PermadeathModeInfo".Translate();
                    if (infoListing.RadioButton(text, active, 0f, text2))
                    {
                        Find.GameInitData.permadeathChosen = true;
                        Find.GameInitData.permadeath       = true;
                    }
                }
                infoListing.End();
            }
            GUI.EndGroup();
        }