示例#1
0
        // RimWorld.CharacterCardUtility
        public static void DrawVampCard(Rect rect, Pawn pawn)
        {
            AdjustForLanguage();

            GUI.BeginGroup(rect);


            CompVampire compVampire = pawn.GetComp <CompVampire>();

            if (compVampire != null && (compVampire.IsVampire || compVampire.IsGhoul))
            {
                Rect rect7 = new Rect(CharacterCardUtility.BasePawnCardSize.x - 105f, 0f, 30f, 30f);
                TooltipHandler.TipRegion(rect7, new TipSignal("ROMV_CharacterSheet".Translate()));
                if (Widgets.ButtonImage(rect7, TexButton.ROMV_HumanIcon))
                {
                    HarmonyPatches.isSwitched = false;
                }

                if (compVampire.IsVampire)
                {
                    Rect rectVampOptions = new Rect(CharacterCardUtility.BasePawnCardSize.x - 105f, 150f, 30f, 30f);
                    switch (compVampire.CurrentSunlightPolicy)
                    {
                    case SunlightPolicy.Relaxed:
                        TooltipHandler.TipRegion(rectVampOptions, new TipSignal("ROMV_SP_Relaxed".Translate()));
                        if (Widgets.ButtonImage(rectVampOptions, TexButton.ROMV_SunlightPolicyRelaxed))
                        {
                            compVampire.CurrentSunlightPolicy = SunlightPolicy.Restricted;
                        }
                        break;

                    case SunlightPolicy.Restricted:
                        TooltipHandler.TipRegion(rectVampOptions, new TipSignal("ROMV_SP_Restricted".Translate()));
                        if (Widgets.ButtonImage(rectVampOptions, TexButton.ROMV_SunlightPolicyRestricted))
                        {
                            compVampire.CurrentSunlightPolicy = SunlightPolicy.NoAI;
                        }
                        break;

                    case SunlightPolicy.NoAI:
                        TooltipHandler.TipRegion(rectVampOptions, new TipSignal("ROMV_SP_NoAI".Translate()));
                        if (Widgets.ButtonImage(rectVampOptions, TexButton.ROMV_SunlightPolicyNoAI))
                        {
                            compVampire.CurrentSunlightPolicy = SunlightPolicy.Relaxed;
                        }
                        break;
                    }
                }

                NameTriple nameTriple      = pawn.Name as NameTriple;
                Rect       rectSkillsLabel = new Rect(rect.xMin, rect.yMin - 15, rect.width, HeaderSize);

                Text.Font = GameFont.Medium;
                Widgets.Label(rectSkillsLabel, pawn.Name.ToStringFull);
                Text.Font = GameFont.Small;
                string label    = (compVampire.IsGhoul) ? GhoulUtility.MainDesc(pawn)  : VampireUtility.MainDesc(pawn);
                Rect   rectDesc = new Rect(0f, 45f, rect.width, 60f);
                Widgets.Label(rectDesc, label);

                //                               Skills

                //Widgets.DrawLineHorizontal(rect.x - 10, rectSkillsLabel.yMax + Padding, rect.width - 15f);
                //---------------------------------------------------------------------

                Rect rectSkills   = new Rect(rect.x, rectDesc.yMax - 42 + Padding, rectSkillsLabel.width, SkillsColumnHeight);
                Rect rectInfoPane = new Rect(rectSkills.x, rectSkills.y + Padding, rect.width * 0.9f, SkillsColumnHeight);

                //Rect rectSkillsPane = new Rect(rectSkills.x + SkillsColumnDivider, rectSkills.y + Padding, rectSkills.width - SkillsColumnDivider, SkillsColumnHeight);

                LevelPane(rectInfoPane, compVampire);
                //InfoPane(rectSkillsPane, compVampire);

                // LEVEL ________________             |
                // ||||||||||||||||||||||             |
                // Points Available 1                 |
                //

                float powersTextSize  = Text.CalcSize("ROMV_Disciplines".Translate()).x;
                Rect  rectPowersLabel = new Rect((rect.width / 2 - powersTextSize / 2) - 15f, rectSkills.yMax + SectionOffset - 5, rect.width, HeaderSize);
                Text.Font = GameFont.Medium;
                Widgets.Label(rectPowersLabel, "ROMV_Disciplines".Translate().CapitalizeFirst());
                //                                   Disciplines
                Text.Font = GameFont.Small;

                //Powers

                Widgets.DrawLineHorizontal(rect.x - 10, rectPowersLabel.yMax, rect.width - 15f);
                //---------------------------------------------------------------------
                float curY    = rectPowersLabel.yMax;
                var   outRect = new Rect(rect.x, curY + 3f, rect.width, (rectSkills.height * 4f) + 16f);
                //rectSkills.width -= 10f;
                var   viewRect    = new Rect(rect.x, curY + 3f, rect.width, scrollViewHeight);//rectSkills.height * 4f);
                float scrollViewY = 0f;
                Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect, true);
                if (compVampire.Sheet.Pawn == null)
                {
                    compVampire.Sheet.Pawn = pawn;
                }
                if (compVampire.Sheet.Disciplines.NullOrEmpty())
                {
                    compVampire.Sheet.InitializeDisciplines();
                }
                for (int i = 0; i < compVampire.Sheet.Disciplines.Count; i++)
                {
                    Rect rectDisciplines = new Rect(rect.x, curY, rectPowersLabel.width, ButtonSize + Padding);
                    PowersGUIHandler(rectDisciplines, compVampire, compVampire.Sheet.Disciplines[i]);
                    var y = ButtonSize + Padding * 2 + TextSize * 2;
                    curY        += y;
                    scrollViewY += y;
                }
                if (Event.current.type == EventType.Layout)
                {
                    scrollViewHeight = scrollViewY + (ButtonSize + Padding * 2 + TextSize * 2) + 30f;
                }
                Widgets.EndScrollView();
            }
            GUI.EndGroup();
        }
        // RimWorld.CharacterCardUtility
        public static void DrawVampCard(Rect rect, Pawn pawn)
        {
            AdjustForLanguage();

            GUI.BeginGroup(rect);

            CompVampire compVampire = pawn.GetComp <CompVampire>();

            if (compVampire != null && compVampire.IsVampire)
            {
                Rect rect7 = new Rect(CharacterCardUtility.PawnCardSize.x - 105f, 0f, 30f, 30f);
                TooltipHandler.TipRegion(rect7, new TipSignal("ROMV_CharacterSheet".Translate()));
                if (Widgets.ButtonImage(rect7, TexButton.ROMV_HumanIcon))
                {
                    HarmonyPatches.isSwitched = false;
                }

                NameTriple nameTriple      = pawn.Name as NameTriple;
                Rect       rectSkillsLabel = new Rect(rect.xMin, rect.yMin - 15, rect.width, HeaderSize);

                Text.Font = GameFont.Medium;
                Widgets.Label(rectSkillsLabel, pawn.Name.ToStringFull);
                Text.Font = GameFont.Small;
                string label    = VampireUtility.MainDesc(pawn);
                Rect   rectDesc = new Rect(0f, 45f, rect.width, 60f);
                Widgets.Label(rectDesc, label);

                //                               Skills

                //Widgets.DrawLineHorizontal(rect.x - 10, rectSkillsLabel.yMax + Padding, rect.width - 15f);
                //---------------------------------------------------------------------

                Rect rectSkills     = new Rect(rect.x, rectDesc.yMax - 30 + Padding, rectSkillsLabel.width, SkillsColumnHeight);
                Rect rectInfoPane   = new Rect(rectSkills.x, rectSkills.y + Padding, SkillsColumnDivider, SkillsColumnHeight);
                Rect rectSkillsPane = new Rect(rectSkills.x + SkillsColumnDivider, rectSkills.y + Padding, rectSkills.width - SkillsColumnDivider, SkillsColumnHeight);

                LevelPane(rectInfoPane, compVampire);
                InfoPane(rectSkillsPane, compVampire);

                // LEVEL ________________             |
                // ||||||||||||||||||||||             |
                // Points Available 1                 |
                //

                float powersTextSize  = Text.CalcSize("ROMV_Disciplines".Translate()).x;
                Rect  rectPowersLabel = new Rect((rect.width / 2) - (powersTextSize / 2), rectSkills.yMax + SectionOffset - 5, rect.width, HeaderSize);
                Text.Font = GameFont.Medium;
                Widgets.Label(rectPowersLabel, "ROMV_Disciplines".Translate().CapitalizeFirst());
                Text.Font = GameFont.Small;

                //Powers

                Widgets.DrawLineHorizontal(rect.x - 10, rectPowersLabel.yMax, rect.width - 15f);
                //---------------------------------------------------------------------


                float curY = rectPowersLabel.yMax;
                for (int i = 0; i < compVampire.Sheet.Disciplines.Count; i++)
                {
                    Rect rectDisciplines = new Rect(rect.x + ButtonSize, curY, rectPowersLabel.width, ButtonSize + Padding);
                    PowersGUIHandler(rectDisciplines, compVampire, compVampire.Sheet.Disciplines[i]);
                    curY += ButtonSize + (Padding * 2) + (TextSize * 2);
                }
            }
            GUI.EndGroup();
        }