Exemple #1
0
        private void DrawSkill(SkillContainer filter, Rect rect)
        {
            int level = filter.MinValue;

            float barSize = (level > 0 ? (float)level : 0) / 20f;

            FillableBar(rect, barSize, Textures.TextureSkillBarFill);

            //int baseLevel = customPawn.GetSkillModifier(skill.def);
            //float baseBarSize = (baseLevel > 0 ? (float)baseLevel : 0) / 20f;
            FillableBar(rect, 0, Textures.TextureSkillBarFill);

            GUI.color = new Color(0.25f, 0.25f, 0.25f);
            Widgets.DrawBox(rect, 1);
            GUI.color = Style.ColorText;

            if (Widgets.ButtonInvisible(rect, false))
            {
                Vector2 pos   = Event.current.mousePosition;
                float   x     = pos.x - rect.x;
                int     value = 0;
                if (Mathf.Floor(x / rect.width * 20f) == 0)
                {
                    if (x <= 1)
                    {
                        value = 0;
                    }
                    else
                    {
                        value = 1;
                    }
                }
                else
                {
                    value = Mathf.CeilToInt(x / rect.width * 20f);
                }
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                filter.MinValue = value;
                //SetSkillLevel(customPawn, skill, value);
            }


            string label;

            label = GenString.ToStringCached(level);

            Text.Anchor = TextAnchor.MiddleLeft;
            rect.x      = rect.x + 3;
            rect.y      = rect.y + 1;
            Widgets.Label(rect, label);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
        }
Exemple #2
0
        protected static void DrawGUIOverlay([NotNull] ThingStatus status, Vector3 drawPos)
        {
            if (Find.CameraMap.CurrentZoom != CameraZoomRange.Closest)
            {
                return;
            }
            drawPos.z -= 0.4f;

            var screenPos = Find.CameraMap.camera.WorldToScreenPoint(drawPos);

            screenPos.y = Screen.height - screenPos.y;

            GenWorldUI.DrawThingLabel(new Vector2(screenPos.x, screenPos.y), GenString.ToStringCached(status.Thing.stackCount),
                                      new Color(1f, 1f, 1f, 0.75f));
        }