示例#1
0
        public static void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering, bool showSlaveSuppresion = false)
        {
            float alpha = TacticUtils.TacticalColonistBar.GetEntryRectAlpha(rect);

            TacticUtils.TacticalColonistBar.drawer.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color2 = GUI.color = new Color(1f, 1f, 1f, alpha);

            GUI.DrawTexture(rect, TacticalColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                if (TacticalGroupsSettings.DisplayColorBars)
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.GetMoodBarTexture(colonist));
                }
                else
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
                }
            }
            if (highlight)
            {
                int thickness = (rect.width <= 22f) ? 2 : 3;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color2;
            }
            Rect rect2 = rect.ContractedBy(-2f * TacticUtils.TacticalColonistBar.Scale);

            if ((colonist.Dead ? Find.Selector.SelectedObjects.Contains(colonist.Corpse) : Find.Selector.SelectedObjects.Contains(colonist)) && !WorldRendererUtility.WorldRenderedNow)
            {
                TacticUtils.TacticalColonistBar.drawer.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                TacticUtils.TacticalColonistBar.drawer.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, PawnTextureSize, Rot4.South, PawnTextureCameraOffset, PawnTextureCameraZoom));
            if (colonist.Drafted)
            {
                GUI.DrawTexture(rect, Textures.PawnDrafted);
            }
            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            TacticUtils.TacticalColonistBar.drawer.DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num2 = 4f * TacticUtils.TacticalColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + TacticUtils.TacticalColonistBar.SpaceBetweenColonistsHorizontal - 2f, TacticUtils.TacticalColonistBar.drawer.pawnLabelsCache);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            if (showSlaveSuppresion && colonist.needs.TryGetNeed <Need_Suppression>() is Need_Suppression need_Suppression)
            {
                Rect  suppressionBar = new Rect(rect.x + rect.width, rect.y, Textures.RestFood.width, rect.height);
                float num            = Mathf.Clamp(need_Suppression.CurLevelPercentage, 0f, 1f);
                Rect  rect3          = GenUI.ContractedBy(suppressionBar, 1f);
                float num5           = rect3.height * num;
                rect3.yMin   = rect3.yMax - num5;
                rect3.height = num5;
                GUI.DrawTexture(rect3, Textures.SlaveSuppressionBar, ScaleMode.ScaleAndCrop);
                GUI.DrawTexture(suppressionBar, Textures.RestFood, ScaleMode.StretchToFill);
            }
            else
            {
                ColonistBarColonistDrawer.DrawHealthBar(rect, colonist, Textures.HealthBar.width);
                ColonistBarColonistDrawer.DrawRestAndFoodBars(rect, colonist, Textures.RestFood.width);
            }
        }
示例#2
0
        public static void DrawColonist(Rect rect, Pawn colonist, Map pawnMap, bool highlight, bool reordering)
        {
            float alpha = TacticUtils.TacticalColonistBar.GetEntryRectAlpha(rect);

            TacticUtils.TacticalColonistBar.drawer.ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref alpha);
            if (reordering)
            {
                alpha *= 0.5f;
            }
            Color color2 = GUI.color = new Color(1f, 1f, 1f, alpha);

            GUI.DrawTexture(rect, TacticalColonistBar.BGTex);
            if (colonist.needs != null && colonist.needs.mood != null)
            {
                Rect  position = rect.ContractedBy(2f);
                float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                position.yMin   = position.yMax - num;
                position.height = num;
                if (TacticalGroupsSettings.DisplayColorBars)
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.GetMoodBarTexture(colonist));
                }
                else
                {
                    GUI.DrawTexture(position, ColonistBarColonistDrawer.MoodBGTex);
                }
            }

            if (highlight)
            {
                int thickness = (rect.width <= 22f) ? 2 : 3;
                GUI.color = Color.white;
                Widgets.DrawBox(rect, thickness);
                GUI.color = color2;
            }
            Rect rect2 = rect.ContractedBy(-2f * TacticUtils.TacticalColonistBar.Scale);

            if ((colonist.Dead ? Find.Selector.SelectedObjects.Contains(colonist.Corpse) : Find.Selector.SelectedObjects.Contains(colonist)) && !WorldRendererUtility.WorldRenderedNow)
            {
                TacticUtils.TacticalColonistBar.drawer.DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                TacticUtils.TacticalColonistBar.drawer.DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }
            GUI.DrawTexture(GetPawnTextureRect(rect.position), PortraitsCache.Get(colonist, ColonistBarColonistDrawer.DefaultPawnTextureSize, ColonistBarColonistDrawer.PawnTextureCameraOffset, 1.28205f));
            if (colonist.Drafted)
            {
                GUI.DrawTexture(rect, Textures.PawnDrafted);
            }
            GUI.color = new Color(1f, 1f, 1f, alpha * 0.8f);
            TacticUtils.TacticalColonistBar.drawer.DrawIcons(rect, colonist);
            GUI.color = color2;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarColonistDrawer.DeadColonistTex);
            }
            float   num2 = 4f * TacticUtils.TacticalColonistBar.Scale;
            Vector2 pos  = new Vector2(rect.center.x, rect.yMax - num2);

            GenMapUI.DrawPawnLabel(colonist, pos, alpha, rect.width + TacticUtils.TacticalColonistBar.SpaceBetweenColonistsHorizontal - 2f, TacticUtils.TacticalColonistBar.drawer.pawnLabelsCache);
            Text.Font = GameFont.Small;
            GUI.color = Color.white;

            ColonistBarColonistDrawer.DrawHealthBar(colonist, rect);
            ColonistBarColonistDrawer.DrawRestAndFoodBars(colonist, rect, Textures.RestFood.width);
            //ColonistBarColonistDrawer.ShowDrafteesWeapon(rect, colonist, 10);
        }