public Storyteller(StorytellerDef def, DifficultyDef difficulty, Difficulty difficultyValues)
 {
     this.def              = def;
     this.difficulty       = difficulty;
     this.difficultyValues = difficultyValues;
     InitializeStorytellerComps();
 }
 public virtual IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
 {
     if (this.compClass == null)
     {
         yield return("a StorytellerCompProperties has null compClass.");
     }
 }
Exemple #3
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
 {
     this.def                = def;
     this.difficulty         = difficulty;
     this.intenderPopulation = new StoryIntender_Population(this);
     this.InitializeStorytellerComps();
 }
        public override IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
        {
            if (incident != null && category != null)
            {
                yield return("incident and category should not both be defined");

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (onDays <= 0f)
            {
                yield return("onDays must be above zero");

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (numIncidentsRange.TrueMax <= 0f)
            {
                yield return("numIncidentRange not configured");

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (minSpacingDays * numIncidentsRange.TrueMax > onDays * 0.9f)
            {
                yield return("minSpacingDays too high compared to max number of incidents.");

                /*Error: Unable to find new state assignment for yield return*/;
            }
        }
 public override void PreOpen()
 {
     base.PreOpen();
     storyteller = (from d in DefDatabase <StorytellerDef> .AllDefs
                    where d.listVisible
                    orderby d.listOrder
                    select d).First();
 }
 public virtual IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
 {
     if (this.compClass == null)
     {
         yield return(parentDef.defName + " has StorytellerCompProperties with null compClass.");
     }
     yield break;
 }
Exemple #7
0
        public virtual IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
        {
            if (compClass == null)
            {
                yield return("a StorytellerCompProperties has null compClass.");

                /*Error: Unable to find new state assignment for yield return*/;
            }
        }
        private static float CalculatePopulationIntent(StorytellerDef def, float curPop, float popAdaptation)
        {
            float num = def.populationIntentFactorFromPopCurve.Evaluate(curPop);

            if (num > 0f)
            {
                num *= def.populationIntentFactorFromPopAdaptDaysCurve.Evaluate(popAdaptation);
            }
            return(num);
        }
Exemple #9
0
        public virtual IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
        {
            if (this.compClass != null)
            {
                yield break;
            }
            yield return(parentDef.defName + " has StorytellerCompProperties with null compClass.");

            /*Error: Unable to find new state assignment for yield return*/;
        }
Exemple #10
0
        private static float CalculatePopulationIntent(StorytellerDef def, float curPop, int ticksSinceGain)
        {
            float num = def.populationIntentFromPopCurve.Evaluate(curPop);

            if (num > 0f)
            {
                float x = (float)ticksSinceGain / 60000f;
                num *= def.populationIntentFromTimeCurve.Evaluate(x);
            }
            return(num);
        }
 public virtual IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
 {
     if (compClass == null)
     {
         yield return("a StorytellerCompProperties has null compClass.");
     }
     if (!enableIfAnyModActive.NullOrEmpty() && !disableIfAnyModActive.NullOrEmpty())
     {
         yield return("enableIfAnyModActive and disableIfAnyModActive can't be used simultaneously");
     }
 }
 public override void ResolveReferences(StorytellerDef parentDef)
 {
     base.ResolveReferences(parentDef);
     if (this.threatSmallCategory == null)
     {
         this.threatSmallCategory = IncidentCategoryDefOf.ThreatSmall;
     }
     if (this.threatBigCategory == null)
     {
         this.threatBigCategory = IncidentCategoryDefOf.ThreatBig;
     }
 }
Exemple #13
0
 public override void PreOpen()
 {
     base.PreOpen();
     if (storyteller == null)
     {
         storyteller = (from d in DefDatabase <StorytellerDef> .AllDefs
                        where d.listVisible
                        orderby d.listOrder
                        select d).First();
     }
     StorytellerUI.ResetStorytellerSelectionInterface();
 }
Exemple #14
0
        public override void DoWindowContents(Rect rect)
        {
            DrawPageTitle(rect);
            Rect           mainRect    = GetMainRect(rect);
            Storyteller    storyteller = Current.Game.storyteller;
            StorytellerDef def         = Current.Game.storyteller.def;

            StorytellerUI.DrawStorytellerSelectionInterface_NewTemp(mainRect, ref storyteller.def, ref storyteller.difficulty, ref storyteller.difficultyValues, selectedStorytellerInfoListing);
            if (storyteller.def != def)
            {
                storyteller.Notify_DefChanged();
            }
        }
Exemple #15
0
        public override void DoWindowContents(Rect rect)
        {
            base.DrawPageTitle(rect);
            Rect           mainRect    = base.GetMainRect(rect, 0f, false);
            Storyteller    storyteller = Current.Game.storyteller;
            StorytellerDef def         = Current.Game.storyteller.def;

            StorytellerUI.DrawStorytellerSelectionInterface(mainRect, ref storyteller.def, ref storyteller.difficulty, this.selectedStorytellerInfoListing);
            if (storyteller.def != def)
            {
                storyteller.Notify_DefChanged();
            }
        }
 public override IEnumerable <string> ConfigErrors(StorytellerDef parentDef)
 {
     if (this.incident != null && this.category != null)
     {
         yield return("incident and category should not both be defined");
     }
     if (this.onDays <= 0f)
     {
         yield return("onDays must be above zero");
     }
     if (this.numIncidentsRange.TrueMax <= 0f)
     {
         yield return("numIncidentRange not configured");
     }
     if (this.minSpacingDays * this.numIncidentsRange.TrueMax > this.onDays * 0.9f)
     {
         yield return("minSpacingDays too high compared to max number of incidents.");
     }
 }
Exemple #17
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();
        }
Exemple #18
0
        public static IncidentParms DefaultParmsNow(StorytellerDef tellerDef, IncidentCategory incCat, IIncidentTarget target)
        {
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target = target;
            if (incCat == IncidentCategory.ThreatSmall || incCat == IncidentCategory.ThreatBig || incCat == IncidentCategory.RaidBeacon)
            {
                float playerWealthForStoryteller = target.PlayerWealthForStoryteller;
                playerWealthForStoryteller = (float)(playerWealthForStoryteller - 2000.0);
                playerWealthForStoryteller = Mathf.Max(playerWealthForStoryteller, 0f);
                float num  = (float)(playerWealthForStoryteller / 1000.0 * 10.0);
                float num2 = 0f;
                foreach (Pawn item in target.FreeColonistsForStoryteller)
                {
                    float num3 = 1f;
                    if (item.ParentHolder != null && item.ParentHolder is Building_CryptosleepCasket)
                    {
                        num3 = (float)(num3 * 0.30000001192092896);
                    }
                    num3 = Mathf.Lerp(num3, num3 * item.health.summaryHealth.SummaryHealthPercent, 0.5f);
                    num2 = (float)(num2 + 42.0 * num3);
                }
                incidentParms.points  = num + num2;
                incidentParms.points *= Find.StoryWatcher.watcherRampUp.TotalThreatPointsFactor;
                incidentParms.points *= Find.Storyteller.difficulty.threatScale;
                incidentParms.points *= target.IncidentPointsRandomFactorRange.RandomInRange;
                switch (Find.StoryWatcher.statsRecord.numThreatBigs)
                {
                case 0:
                    incidentParms.points                  = 35f;
                    incidentParms.raidForceOneIncap       = true;
                    incidentParms.raidNeverFleeIndividual = true;
                    break;

                case 1:
                    incidentParms.points *= 0.5f;
                    break;

                case 2:
                    incidentParms.points *= 0.7f;
                    break;

                case 3:
                    incidentParms.points *= 0.8f;
                    break;

                case 4:
                    incidentParms.points *= 0.9f;
                    break;

                default:
                    incidentParms.points *= 1f;
                    break;
                }
                if (incidentParms.points < 0.0)
                {
                    incidentParms.points = 0f;
                }
                if (incidentParms.points > 1000.0)
                {
                    if (incidentParms.points > 2000.0)
                    {
                        incidentParms.points = (float)(2000.0 + (incidentParms.points - 2000.0) * 0.5);
                    }
                    incidentParms.points = (float)(1000.0 + (incidentParms.points - 1000.0) * 0.5);
                }
            }
            return(incidentParms);
        }
        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();
        }
        public static IncidentParms DefaultParmsNow(StorytellerDef tellerDef, IncidentCategory incCat, IIncidentTarget target)
        {
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.target = target;
            if (incCat == IncidentCategory.ThreatSmall || incCat == IncidentCategory.ThreatBig || incCat == IncidentCategory.RaidBeacon)
            {
                float num = target.PlayerWealthForStoryteller;
                num -= 2000f;
                num  = Mathf.Max(num, 0f);
                float num2 = num / 1000f * 10f;
                float num3 = 0f;
                foreach (Pawn current in target.FreeColonistsForStoryteller)
                {
                    float num4 = 1f;
                    if (current.ParentHolder != null && current.ParentHolder is Building_CryptosleepCasket)
                    {
                        num4 *= 0.3f;
                    }
                    num4  = Mathf.Lerp(num4, num4 * current.health.summaryHealth.SummaryHealthPercent, 0.5f);
                    num3 += 42f * num4;
                }
                incidentParms.points  = num2 + num3;
                incidentParms.points *= Find.StoryWatcher.watcherRampUp.TotalThreatPointsFactor;
                incidentParms.points *= Find.Storyteller.difficulty.threatScale;
                incidentParms.points *= target.IncidentPointsRandomFactorRange.RandomInRange;
                switch (Find.StoryWatcher.statsRecord.numThreatBigs)
                {
                case 0:
                    incidentParms.points                  = 35f;
                    incidentParms.raidForceOneIncap       = true;
                    incidentParms.raidNeverFleeIndividual = true;
                    break;

                case 1:
                    incidentParms.points *= 0.5f;
                    break;

                case 2:
                    incidentParms.points *= 0.7f;
                    break;

                case 3:
                    incidentParms.points *= 0.8f;
                    break;

                case 4:
                    incidentParms.points *= 0.9f;
                    break;

                default:
                    incidentParms.points *= 1f;
                    break;
                }
                if (incidentParms.points < 0f)
                {
                    incidentParms.points = 0f;
                }
                if (incidentParms.points > 1000f)
                {
                    if (incidentParms.points > 2000f)
                    {
                        incidentParms.points = 2000f + (incidentParms.points - 2000f) * 0.5f;
                    }
                    incidentParms.points = 1000f + (incidentParms.points - 1000f) * 0.5f;
                }
            }
            return(incidentParms);
        }
Exemple #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)
            {
                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();
        }
Exemple #22
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();
        }
Exemple #23
0
 private static int <PreOpen> m__1(StorytellerDef d)
 {
     return(d.listOrder);
 }
Exemple #24
0
 private static bool <PreOpen> m__0(StorytellerDef d)
 {
     return(d.listVisible);
 }
Exemple #25
0
 public virtual void ResolveReferences(StorytellerDef parentDef)
 {
 }
        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);
        }
Exemple #27
0
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
 {
     this.def        = def;
     this.difficulty = difficulty;
     this.InitializeStorytellerComps();
 }
        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();
        }
Exemple #29
0
 private static int <DrawStorytellerSelectionInterface> m__0(StorytellerDef tel)
 {
     return(tel.listOrder);
 }
 public Storyteller(StorytellerDef def, DifficultyDef difficulty)
     : this(def, difficulty, new Difficulty(difficulty))
 {
 }