Ejemplo n.º 1
0
        private void DrawNeed(Rect rect, Pawn ownerPawn)
        {
            if (ownerPawn.RaceProps.IsMechanoid)
            {
                return;
            }
            if (ownerPawn.needs == null)
            {
                return;
            }
            //TODO: rebuild using code in DrawOnGUI
            Need need = ownerPawn.needs.TryGetNeed((NeedDef)displayObject);

            if (need == null)
            {
                return;
            }

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }

            TooltipHandler.TipRegion(rect, new TipSignal(() => need.GetTipString(), rect.GetHashCode()));
            float num2 = 14f;
            float num3 = num2 + 15f;

            if (rect.height < 50f)
            {
                num2 *= Mathf.InverseLerp(0f, 50f, rect.height);
            }



            Text.Font   = ((rect.height <= 55f) ? GameFont.Tiny : GameFont.Small);
            Text.Anchor = TextAnchor.UpperLeft;
            Rect rect3 = new Rect(rect.x, rect.y + rect.height / 2f, rect.width, rect.height / 2f);

            rect3 = new Rect(rect3.x + num3, rect3.y, rect3.width - num3 * 2f, rect3.height - num2);
            Widgets.FillableBar(rect3, need.CurLevelPercentage);
            Widgets.FillableBarChangeArrows(rect3, need.GUIChangeArrow);
            List <float> threshPercents = (List <float>)needThreshPercent.GetValue(need);

            if (threshPercents != null)
            {
                for (int i = 0; i < threshPercents.Count; i++)
                {
                    needDrawBarThreshold(rect3, threshPercents[i], need.CurLevelPercentage);
                }
            }
            float curInstantLevel = need.CurInstantLevelPercentage;

            if (curInstantLevel >= 0f)
            {
                needDrawBarInstantMarkerAt(rect3, curInstantLevel);
            }
            Text.Font = GameFont.Small;
        }
Ejemplo n.º 2
0
        public void DrawNeed(Rect rect, Need need, List <float> threshPercents)
        {
            if (rect.height > 70f)
            {
                float num = (rect.height - 70f) / 2f;
                rect.height = 70f;
                rect.y     += num;
            }
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            TooltipHandler.TipRegion(rect, new TipSignal(() => need.GetTipString(), rect.GetHashCode()));
            float num2 = 14f;
            float num3 = num2 + 15f;

            if (rect.height < 50f)
            {
                num2 *= Mathf.InverseLerp(0f, 50f, rect.height);
            }
            Text.Font   = ((rect.height > 55f) ? GameFont.Small : GameFont.Tiny);
            Text.Anchor = TextAnchor.LowerCenter;
            Rect rect2 = new Rect(rect.x, rect.y, rect.width, rect.height / 2f);

            Widgets.Label(rect2, need.LabelCap);
            Text.Anchor = TextAnchor.UpperLeft;
            Rect rect3 = new Rect(rect.x, rect.y + rect.height / 2f, rect.width, rect.height / 2f);

            rect3 = new Rect(rect3.x + num3, rect3.y, rect3.width - num3 * 2f, rect3.height - num2);
            Widgets.FillableBar(rect3, need.CurLevel);
            Widgets.FillableBarChangeArrows(rect3, need.GUIChangeArrow);
            if (threshPercents != null)
            {
                for (int i = 0; i < threshPercents.Count; i++)
                {
                    this.DrawBarThreshold(rect3, threshPercents[i], need);
                }
            }
            float curInstantLevel = need.CurInstantLevel;

            if (curInstantLevel >= 0f)
            {
                this.DrawBarInstantMarkerAt(rect3, curInstantLevel, need);
            }
            Text.Font = GameFont.Small;
        }
Ejemplo n.º 3
0
        public static void DrawStatusLevel(Need status, Rect rect)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = new Rect(0f, 2f, rect.width, 25f);

            Widgets.Label(rect2, status.LabelCap);
            Rect rect3 = new Rect(100f, 3f, GenUI.PieceBarSize.x, GenUI.PieceBarSize.y);

            Widgets.FillableBar(rect3, status.CurLevelPercentage);
            Widgets.FillableBarChangeArrows(rect3, status.GUIChangeArrow);
            GUI.EndGroup();
            TooltipHandler.TipRegion(rect, status.GetTipString());
            if (Mouse.IsOver(rect))
            {
                GUI.DrawTexture(rect, TexUI.HighlightTex);
            }
        }