protected void FillCard(Rect cardRect) { if (tab == InfoCardTab.Stats) { if (enchantmentTask != null) { Thing enchantableThing = enchantmentTask.enchantableThing; Thing soulGem = enchantmentTask.soulGem; if (enchantableThing != null) { StatsReportUtility.DrawStatsReport(cardRect, enchantableThing); } if (soulGem != null) { StatsReportUtility.DrawStatsReport(cardRect, soulGem); // needs its own. } } if (!products.NullOrEmpty()) { // Draw the products instead! Thing enchantableThing = enchantmentTask.enchantableThing; if (enchantableThing != null) { StatsReportUtility.DrawStatsReport(cardRect, enchantableThing); } } } }
public Dialog_NewBlueprint(Blueprint blueprint) { this.blueprint = blueprint; resizeable = true; draggable = true; bpHandler = new BlueprintWindowHandler(blueprint, BlueprintHandlerState.New); bpHandler.EventCancel += () => { Close(); }; bpHandler.EventAccept += () => { if (blueprint.IsValid()) { DroidManager.Instance.Blueprints.Add(blueprint); Close(); } else { Messages.Message(new Message("InvalidBlueprint".Translate(), MessageTypeDefOf.RejectInput)); } }; absorbInputAroundWindow = true; forcePause = true; StatsReportUtility.Reset(); }
public static bool FUUUCK(Rect rect, Thing thing) { if (!Active) { return(true); } Profiler prof = null; if (StatsReportUtility.cachedDrawEntries.NullOrEmpty <StatDrawEntry>()) { prof = ProfileController.Start("SpecialDisplayStats"); StatsReportUtility.cachedDrawEntries.AddRange(thing.def.SpecialDisplayStats(StatRequest.For(thing))); prof.Stop(); prof = ProfileController.Start("StatsToDraw"); StatsReportUtility.cachedDrawEntries.AddRange(StatsReportUtility.StatsToDraw(thing).Where(s => s.ShouldDisplay)); prof.Stop(); prof = ProfileController.Start("RemoveAll"); StatsReportUtility.cachedDrawEntries.RemoveAll((StatDrawEntry de) => de.stat != null && !de.stat.showNonAbstract); prof.Stop(); prof = ProfileController.Start("FinalizeCachedDrawEntries"); StatsReportUtility.FinalizeCachedDrawEntries(StatsReportUtility.cachedDrawEntries); prof.Stop(); } prof = ProfileController.Start("DrawStatsWorker"); StatsReportUtility.DrawStatsWorker(rect, thing, null); prof.Stop(); return(false); }
//draws the harddrive's info tabs private void FillInfoTabs(Rect cardRect) { if (this.tab == Neurolink_Dialog_Mainframe.InfoCardTab.Character) { CharacterCardUtility.DrawCharacterCard(cardRect, this.selectedHarddrive.pawn, null, default(Rect)); } else if (this.tab == Neurolink_Dialog_Mainframe.InfoCardTab.Stats) { if (this.selectedHarddrive != null) { Thing innerPawn = this.selectedHarddrive.pawn; MinifiedThing minifiedThing = (Thing)this.selectedHarddrive as MinifiedThing; if (minifiedThing != null) { innerPawn = minifiedThing.InnerThing; } StatsReportUtility.DrawStatsReport(cardRect, innerPawn); } // else if (this.titleDef != null) { //%TODO% // StatsReportUtility.DrawStatsReport(cardRect, this.titleDef, this.faction); // } } else if (this.tab == Neurolink_Dialog_Mainframe.InfoCardTab.Social) { SocialCardUtility.DrawSocialCard(cardRect, this.selectedHarddrive.pawn); } else if (this.tab == Neurolink_Dialog_Mainframe.InfoCardTab.Needs) { Vector2 scrollPos = default(Vector2); NeedsCardUtility.DoNeedsMoodAndThoughts(cardRect, this.selectedHarddrive.pawn, ref scrollPos); } }
public BlueprintWindowHandler(Blueprint blueprint, BlueprintHandlerState state) { Blueprint = blueprint; this.state = state; StatsReportUtility.Reset(); }
protected void FillCard(Rect cardRect) { if (tab == InfoCardTab.Stats) { if (thing != null) { Thing innerThing = thing; MinifiedThing minifiedThing = thing as MinifiedThing; if (minifiedThing != null) { innerThing = minifiedThing.InnerThing; } StatsReportUtility.DrawStatsReport(cardRect, innerThing); } else if (titleDef != null) { StatsReportUtility.DrawStatsReport(cardRect, titleDef, faction); } else if (faction != null) { StatsReportUtility.DrawStatsReport(cardRect, faction); } else if (worldObject != null) { StatsReportUtility.DrawStatsReport(cardRect, worldObject); } else if (def is AbilityDef) { StatsReportUtility.DrawStatsReport(cardRect, (AbilityDef)def); } else { StatsReportUtility.DrawStatsReport(cardRect, def, stuff); } } else if (tab == InfoCardTab.Character) { CharacterCardUtility.DrawCharacterCard(cardRect, (Pawn)thing); } else if (tab == InfoCardTab.Health) { cardRect.yMin += 8f; HealthCardUtility.DrawPawnHealthCard(cardRect, (Pawn)thing, allowOperations: false, showBloodLoss: false, null); } else if (tab == InfoCardTab.Records) { RecordsCardUtility.DrawRecordsCard(cardRect, (Pawn)thing); } else if (tab == InfoCardTab.Permits) { PermitsCardUtility.DrawRecordsCard(cardRect, (Pawn)thing); } if (executeAfterFillCardOnce != null) { executeAfterFillCardOnce(); executeAfterFillCardOnce = null; } }
private void Setup() { this.forcePause = true; this.doCloseButton = true; this.doCloseX = true; this.absorbInputAroundWindow = true; this.soundAppear = SoundDefOf.InfoCard_Open; this.soundClose = SoundDefOf.InfoCard_Close; StatsReportUtility.Reset(); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.InfoCard, KnowledgeAmount.Total); }
public static Droid StatDummy(Blueprint bp) { if (statDummy == null || statDummy.kindDef != bp.KindDef || statDummy.blueprint != bp) { statDummy = (Droid)PawnGenerator.GeneratePawn(bp.KindDef); statDummy.blueprint = bp; statDummy.InitialiseFromBlueprint(); StatsReportUtility.Reset(); } return(statDummy); }
public void Setup() { forcePause = true; closeOnEscapeKey = true; doCloseButton = true; doCloseX = true; absorbInputAroundWindow = true; soundAppear = SoundDef.Named("InfoCard_Open"); soundClose = SoundDef.Named("InfoCard_Close"); StatsReportUtility.Reset(); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.InfoCard, KnowledgeAmount.Total); }
public void OpenDialog() { Dialog_InfoCard dialog_InfoCard = null; if (def == null && thing == null && worldObject == null && titleDef == null) { dialog_InfoCard = Find.WindowStack.WindowOfType <Dialog_InfoCard>(); } else { PushCurrentToHistoryAndClose(); if (worldObject != null) { dialog_InfoCard = new Dialog_InfoCard(worldObject); } else if (def != null && def is ThingDef && (stuff != null || GenStuff.DefaultStuffFor((ThingDef)def) != null)) { dialog_InfoCard = new Dialog_InfoCard(def as ThingDef, stuff ?? GenStuff.DefaultStuffFor((ThingDef)def)); } else if (def != null) { dialog_InfoCard = new Dialog_InfoCard(def); } else if (thing != null) { dialog_InfoCard = new Dialog_InfoCard(thing); } else if (titleDef != null) { dialog_InfoCard = new Dialog_InfoCard(titleDef, faction); } } if (dialog_InfoCard == null) { return; } int localSelectedStatIndex = selectedStatIndex; if (selectedStatIndex >= 0) { dialog_InfoCard.executeAfterFillCardOnce = delegate { StatsReportUtility.SelectEntry(localSelectedStatIndex); }; } Find.WindowStack.Add(dialog_InfoCard); }
private static void DrawSkillsEntry(Rect entryRect, SkillLevel skill, Blueprint bp, bool alternate, BlueprintHandlerState state) { try { if (Mouse.IsOver(entryRect)) { Widgets.DrawHighlight(entryRect); } else if (alternate) { Widgets.DrawAltRect(entryRect); } GUI.BeginGroup(entryRect); if (state == BlueprintHandlerState.New || state == BlueprintHandlerState.Edit) { Rect sliderRect = new Rect(0f, 0f, entryRect.width, entryRect.height); int prevLevel = skill.Level; skill.Level = Mathf.RoundToInt(Widgets.HorizontalSlider(sliderRect, skill.Level, 0, 20, true, $"{skill.Skill.LabelCap} ({skill.Level})", "0", "20")); if (skill.Level != prevLevel) { bp.Recache(); bp.AddSkillsToDroid(StatDummy(bp)); StatsReportUtility.Reset(); } } else { Rect skillLabelRect = new Rect(0f, 0f, (entryRect.width / 2), entryRect.height); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(skillLabelRect, skill.Skill.LabelCap); Rect skillLevelRect = new Rect(skillLabelRect.xMax, 0f, entryRect.width / 2 - 5f, entryRect.height); Text.Anchor = TextAnchor.MiddleRight; Widgets.Label(skillLevelRect, skill.Level.ToString()); Text.Anchor = TextAnchor.UpperLeft; } } finally { GUI.EndGroup(); } }
protected void FillCard(Rect cardRect) { if (this.tab == Dialog_InfoCard.InfoCardTab.Stats) { if (this.thing != null) { Thing innerThing = this.thing; MinifiedThing minifiedThing = this.thing as MinifiedThing; if (minifiedThing != null) { innerThing = minifiedThing.InnerThing; } StatsReportUtility.DrawStatsReport(cardRect, innerThing); } else if (this.worldObject != null) { StatsReportUtility.DrawStatsReport(cardRect, this.worldObject); } else { StatsReportUtility.DrawStatsReport(cardRect, this.def, this.stuff); } } else if (this.tab == Dialog_InfoCard.InfoCardTab.Character) { CharacterCardUtility.DrawCharacterCard(cardRect, (Pawn)this.thing, null, default(Rect)); } else if (this.tab == Dialog_InfoCard.InfoCardTab.Health) { cardRect.yMin += 8f; HealthCardUtility.DrawPawnHealthCard(cardRect, (Pawn)this.thing, false, false, null); } else if (this.tab == Dialog_InfoCard.InfoCardTab.Records) { RecordsCardUtility.DrawRecordsCard(cardRect, (Pawn)this.thing); } }
protected void FillCard(Rect cardRect) { if (tab == InfoCardTab.Stats) { if (thing != null) { Thing innerThing = thing; MinifiedThing minifiedThing = thing as MinifiedThing; if (minifiedThing != null) { innerThing = minifiedThing.InnerThing; } StatsReportUtility.DrawStatsReport(cardRect, innerThing); } else if (worldObject != null) { StatsReportUtility.DrawStatsReport(cardRect, worldObject); } else { StatsReportUtility.DrawStatsReport(cardRect, def, stuff); } } else if (tab == InfoCardTab.Character) { CharacterCardUtility.DrawCharacterCard(cardRect, (Pawn)thing); } else if (tab == InfoCardTab.Health) { cardRect.yMin += 8f; HealthCardUtility.DrawPawnHealthCard(cardRect, (Pawn)thing, allowOperations: false, showBloodLoss: false, null); } else if (tab == InfoCardTab.Records) { RecordsCardUtility.DrawRecordsCard(cardRect, (Pawn)thing); } }
public void DrawWindow(Rect inRect) { try { GUI.BeginGroup(inRect); #region Header //Header Rect headerRect = new Rect(0f, 0f, inRect.width, HeaderRectHeight); try { GUI.BeginGroup(headerRect); //Draw the label string nameLabelString; float nameLabelXPos; float nameLabelWidth; if (state == BlueprintHandlerState.Edit || state == BlueprintHandlerState.New) { nameLabelString = "BlueprintName".Translate(); nameLabelWidth = Text.CalcSize(nameLabelString).x; nameLabelXPos = headerRect.width / 2 - (nameLabelWidth + 5f + TextBoxWidth) / 2; } else { nameLabelString = "BlueprintName".Translate() + Blueprint.Label; nameLabelWidth = Text.CalcSize(nameLabelString).x; nameLabelXPos = headerRect.width / 2 - nameLabelWidth / 2; } Rect nameLabelRect = new Rect(nameLabelXPos, 0f, nameLabelWidth, HeaderRectHeight); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(nameLabelRect, nameLabelString); Text.Anchor = TextAnchor.UpperLeft; //if the state is New or Edit, draw the textbox. if (state == BlueprintHandlerState.Edit || state == BlueprintHandlerState.New) { Rect nameRect = new Rect(nameLabelRect.xMax + 5f, HeaderRectHeight / 2 - TextBoxHeight / 2, 200f, TextBoxHeight); Blueprint.Label = Widgets.TextField(nameRect, Blueprint.Label); } } finally { GUI.EndGroup(); Text.Anchor = TextAnchor.UpperLeft; } #endregion #region Main Rect //MainRect Rect mainRect = new Rect(0f, headerRect.yMax + SectionMargin, inRect.width, inRect.height - HeaderRectHeight - FooterRectHeight - SectionMargin * 2); try { GUI.BeginGroup(mainRect); PartSelectorAreaWidth = (float)Math.Floor(mainRect.width * 0.45); StatsAreaWidth = (float)Math.Floor(mainRect.width * 0.30); DisplayAreaWidth = (float)Math.Floor(mainRect.width * 0.25); //Parts list float leftRectsHeight = mainRect.height / 3 - (SectionMargin * 2) / 3; Rect partsRect = new Rect(0f, 0f, DisplayAreaWidth, leftRectsHeight); BlueprintUIUtil.DrawPartsList(partsRect, ref partsScrollPos, Blueprint); //AI list Rect aiRect = new Rect(0f, partsRect.yMax + SectionMargin, partsRect.width, leftRectsHeight); BlueprintUIUtil.DrawAIList(aiRect, ref aiScrollPos, Blueprint, state); //Skills Rect skillsRect = new Rect(0f, aiRect.yMax + SectionMargin, partsRect.width, leftRectsHeight); BlueprintUIUtil.DrawSkillsList(skillsRect, ref skillsScrollPos, Blueprint, state); //Droid part selector Rect droidDisplayRect = new Rect(partsRect.xMax + SectionMargin, 0f, PartSelectorAreaWidth, mainRect.height); BlueprintUIUtil.DrawPartSelector(droidDisplayRect, Blueprint, state); //Stats Rect statsRect = new Rect(droidDisplayRect.xMax + SectionMargin, 0f, StatsAreaWidth, leftRectsHeight * 2 + SectionMargin); Widgets.DrawBoxSolid(statsRect, BoxColor); StatsReportUtility.DrawStatsReport(statsRect, BlueprintUIUtil.StatDummy(Blueprint)); //Costs Rect costsRect = new Rect(statsRect.x, statsRect.yMax + SectionMargin, statsRect.width, leftRectsHeight); Widgets.DrawBoxSolid(costsRect, BoxColor); } finally { GUI.EndGroup(); Text.Anchor = TextAnchor.UpperLeft; } #endregion //Footer area Rect footerRect = new Rect(0f, inRect.height - FooterRectHeight, mainRect.width, FooterRectHeight); DrawFooter(footerRect); } finally { GUI.EndGroup(); Text.Anchor = TextAnchor.UpperLeft; } }