Пример #1
0
        public bool CheckboxLabeled(string label, ref bool checkOn, bool dev, ref float modifier, string tooltip = null, bool disabled = false, bool highlight = false, Texture2D texChecked = null, Texture2D texUnchecked = null, bool placeCheckboxNearText = false, bool extend = false)
        {
            float lineHeight = Text.LineHeight;
            Rect  rect       = this.GetRect(lineHeight, null, extend);

            if (dev)
            {
                Rect r = rect.RightPart(0.25f);
                rect = rect.LeftPart(0.75f);
                if (Widgets.ButtonText(r.LeftHalf(), "-"))
                {
                    modifier--;
                }
                if (Widgets.ButtonText(r.RightHalf(), "+"))
                {
                    modifier++;
                }
            }
            if (!tooltip.NullOrEmpty() || highlight)
            {
                if (Mouse.IsOver(rect))
                {
                    Widgets.DrawHighlight(rect);
                }
                if (!tooltip.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect, tooltip);
                }
            }
            AdeptusWidgets.CheckboxLabeled(rect, label, ref checkOn, disabled, texChecked, texUnchecked, placeCheckboxNearText);
            this.Gap(this.verticalSpacing);
            return(checkOn);
        }
Пример #2
0
        /*
         * public void CheckboxLabeled(string label, ref bool checkOn, string tooltip = null, bool disabled = false, bool highlight = false, Texture2D texChecked = null, Texture2D texUnchecked = null, bool placeCheckboxNearText = false)
         * {
         *      float lineHeight = Text.LineHeight;
         *      Rect rect = this.GetRect(lineHeight);
         *      if (!tooltip.NullOrEmpty() || highlight)
         *      {
         *              if (Mouse.IsOver(rect))
         *              {
         *                      Widgets.DrawHighlight(rect);
         *              }
         *              if (!tooltip.NullOrEmpty()) TooltipHandler.TipRegion(rect, tooltip);
         *      }
         *      AdeptusWidgets.CheckboxLabeled(rect, label, ref checkOn, disabled, texChecked, texUnchecked, placeCheckboxNearText);
         *      this.Gap(this.verticalSpacing);
         * }
         */
        public bool CheckboxLabeled(string label, ref bool checkOn, string tooltip = null, bool disabled = false, bool highlight = false, Texture2D texChecked = null, Texture2D texUnchecked = null, bool placeCheckboxNearText = false, bool extend = false)
        {
            float lineHeight = Text.LineHeight;
            Rect  rect       = this.GetRect(lineHeight, null, extend);

            if (!tooltip.NullOrEmpty() || highlight)
            {
                if (Mouse.IsOver(rect))
                {
                    Widgets.DrawHighlight(rect);
                }
                if (!tooltip.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect, tooltip);
                }
            }
            AdeptusWidgets.CheckboxLabeled(rect, label, ref checkOn, disabled, texChecked, texUnchecked, placeCheckboxNearText);
            this.Gap(this.verticalSpacing);
            return(checkOn);
        }
        // Token: 0x060043EB RID: 17387 RVA: 0x0016B798 File Offset: 0x00169998
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth, GizmoRenderParms parms)
        {
            Rect        rect   = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f);
            GizmoResult result = base.GizmoOnGUI(topLeft, maxWidth, parms);

            if (this.comp.CooldownTicksRemaining > 0)
            {
                //	float num = Mathf.InverseLerp((float)this.comp.CooldownTicksTotal, 0f, (float)this.comp.CooldownTicksRemaining);
                float num  = Mathf.InverseLerp(0f, (float)this.comp.CooldownTicksTotal, (float)this.comp.CooldownTicksRemaining);
                var   math = (float)this.comp.CooldownTicksRemaining / (float)this.comp.CooldownTicksTotal;
                //	Widgets.FillableBar(rect, Mathf.Clamp01(num), Command_ApparelWargear.cooldownBarTex, null, false);
                AdeptusWidgets.VertFillableBar(rect, Mathf.Clamp01(num), AbilityButtons.FullTex, AbilityButtons.EmptyTex, false);

                /*
                 * if (this.comp.CooldownTicksRemaining > 0)
                 * {
                 *      Text.Font = GameFont.Tiny;
                 *      Text.Anchor = TextAnchor.UpperCenter;
                 * //	Widgets.Label(rect, num.ToStringPercent("F0"));
                 *      Widgets.Label(rect, this.comp.CooldownTicksRemaining.TicksToSeconds().ToString("F2"));
                 *      Text.Anchor = TextAnchor.UpperLeft;
                 * }
                 */
            }
            if (DoTooltip)
            {
                TipSignal tip = Desc;
                if (disabled && !disabledReason.NullOrEmpty())
                {
                    tip.text = tip.text + "AU_DISABLED".Translate() + ": " + disabledReason + "\n" + comp.CooldownTicksRemaining.ToStringSecondsFromTicks();
                }
                TooltipHandler.TipRegion(rect, tip);
            }
            if (result.State == GizmoState.Interacted && this.comp.CanBeUsed)
            {
                return(result);
            }
            return(new GizmoResult(result.State));
        }
Пример #4
0
 // Token: 0x06001B7B RID: 7035 RVA: 0x000A80E6 File Offset: 0x000A62E6
 public void TextFieldNumericLabeled <T>(string label, ref T val, ref string buffer, float min = 0f, float max = 1E+09f, string tooltip = null, float textpart = 0.75f, float boxpart = 0.25f) where T : struct
 {
     AdeptusWidgets.TextFieldNumericLabeled <T>(this.GetRect(Text.LineHeight), label, ref val, ref buffer, min, max, tooltip, textpart, boxpart);
     this.Gap(this.verticalSpacing);
 }