Example #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;
        }
Example #2
0
 protected void DecreasePassion(SkillContainer filter)
 {
     if (filter.passion == Passion.None)
     {
         filter.passion = Passion.Major;
     }
     else if (filter.passion == Passion.Minor)
     {
         filter.passion = Passion.None;
     }
     else if (filter.passion == Passion.Major)
     {
         filter.passion = Passion.Minor;
     }
 }