コード例 #1
0
        protected virtual void DoConfigInterface(Rect rect, Color baseColor)
        {
            rect.yMin += 29f;
            float y   = rect.center.y;
            float num = rect.xMax - (rect.yMax - y);

            Widgets_Extensions.InfoCardButton(num - 12f, y - 12f, enchantmentTask);
        }
コード例 #2
0
        private static Ability DoActiveAbilityInterface(Rect abilityRect, Ability ability, Pawn pawn)
        {
            CompAbilityHolder abilityHolderComp = pawn.GetComp <CompAbilityHolder>();

            GUI.BeginGroup(abilityRect);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = Color.white;

            Rect iconRect = new Rect(0f, 0f, iconSize, iconSize);

            Widgets_Extensions.AbilityIcon(iconRect, ability);

            Rect labelRect = new Rect(iconRect.width + 2f, 0f, 120f, 32f);

            Widgets.Label(labelRect, ability.def.LabelCap);

            Rect upRect = new Rect(abilityRect.xMax - 24f - 24f - 34f, 0f, 24f, 24f);

            if (ability.gizmoOrder > 0)
            {
                if (Widgets.ButtonImage(upRect, Widgets_Extensions.reorderUpTex, Color.white))
                {
                    abilityHolderComp.ReorderClickable(ability, -1);
                }
            }

            Rect downRect = new Rect(abilityRect.xMax - 24f - 34f, 0f, 24f, 24f);

            if (ability.gizmoOrder != abilityHolderComp.LastGizmoNumber)
            {
                if (Widgets.ButtonImage(downRect, Widgets_Extensions.reorderDownTex, Color.white))
                {
                    abilityHolderComp.ReorderClickable(ability, 1);
                }
            }

            Rect deleteRect = new Rect(abilityRect.xMax - 34f, 0f, 24f, 24f); // 24f + 10f (scrollbar) = 34f

            if (Widgets.ButtonImage(deleteRect, Widgets_Extensions.deleteXTex, Color.white))
            {
                abilityHolderComp.ToggleClickable(ability);
            }

            float effectsWidth = abilityRect.width - iconRect.width - labelRect.width - upRect.width - downRect.width - deleteRect.width;
            Rect  effectsRect  = new Rect(labelRect.x + labelRect.width + 2f, 0f, effectsWidth, 32f);

            Widgets.Label(effectsRect, ability.def.description);

            GUI.EndGroup();

            if (Mouse.IsOver(abilityRect))
            {
                return(ability);
            }

            return(null);
        }
コード例 #3
0
        private static Ability DoForgettingAbilityInterface(Rect abilityRect, Ability forgettingAbility, Pawn pawn)
        {
            CompAbilityHolder abilityHolderComp = pawn.GetComp <CompAbilityHolder>();

            GUI.BeginGroup(abilityRect);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = Color.white;

            Rect iconRect = new Rect(0f, 0f, iconSize, iconSize);

            Widgets_Extensions.AbilityIcon(iconRect, forgettingAbility);

            Rect labelRect = new Rect(iconRect.width + 2f, 0f, 120f, 32f);

            Widgets.Label(labelRect, forgettingAbility.def.LabelCap);

            Rect timerRect = new Rect(abilityRect.xMax - 180f - 34f, 0f, 180f, 24f);

            GUI.color   = forgettingAbility.remainingTicksToForget > forgettingAbility.remainingTicksToForget * 0.5 ? Color.white : forgettingAbility.remainingTicksToForget > forgettingAbility.remainingTicksToForget * 0.2 ? Color.yellow : Color.red;
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Tiny;
            Widgets.Label(timerRect, GenDate.ToStringTicksToPeriod(forgettingAbility.remainingTicksToForget, true, true));
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.MiddleLeft;
            Text.Font   = GameFont.Small;

            Rect deleteRect = new Rect(abilityRect.xMax - 34f, 0f, 24f, 24f); // 24f + 10f (scrollbar) = 34f

            if (Widgets.ButtonImage(deleteRect, Widgets_Extensions.deleteXTex, Color.white))
            {
                abilityHolderComp.ToggleForgettable(forgettingAbility);
            }

            float effectsWidth = abilityRect.width - iconRect.width - labelRect.width - timerRect.width - deleteRect.width;
            Rect  effectsRect  = new Rect(labelRect.x + labelRect.width + 2f, 0f, effectsWidth, 32f);

            //Widgets.Label(effectsRect, forgettingAbility.def.description);

            GUI.EndGroup();

            if (Mouse.IsOver(abilityRect))
            {
                return(forgettingAbility);
            }

            return(null);
        }
コード例 #4
0
        public override void DoWindowContents(Rect inRect)
        {
            Text.Font = GameFont.Medium;
            Rect rect = new Rect(0f, 0f, 400f, 50f);

            Widgets.Label(rect, bill.LabelCap);

            Rect rect2 = new Rect(0f, 80f, 200f, inRect.height - 80f);
            Rect rect3 = new Rect(rect2.xMax + 17f, 50f, 180f, inRect.height - 50f - CloseButSize.y);
            Rect rect4 = new Rect(rect3.xMax + 17f, 50f, inRect.width - (rect3.xMax + 17f), inRect.height - 50f - CloseButSize.y);

            Text.Font = GameFont.Small;
            Listing_Standard listing_Standard = new Listing_Standard();

            listing_Standard.Begin(rect3);
            if (bill.suspended)
            {
                if (listing_Standard.ButtonText("Suspended".Translate(), null))
                {
                    bill.suspended = false;
                }
            }
            else if (listing_Standard.ButtonText("NotSuspended".Translate(), null))
            {
                bill.suspended = true;
            }

            string labelCap = bill.storeMode.LabelCap;

            if (listing_Standard.ButtonText(labelCap, null))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (BillStoreModeDef current in from bsm in DefDatabase <BillStoreModeDef> .AllDefs orderby bsm.listOrder select bsm)
                {
                    BillStoreModeDef smLocal = current;
                    list.Add(new FloatMenuOption(smLocal.LabelCap, delegate
                    {
                        bill.storeMode = smLocal;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
            listing_Standard.Gap(12f);

            if (bill.workSkill != null)
            {
                listing_Standard.Label("AllowedSkillRange".Translate(new object[]
                {
                    bill.workSkill.label
                }), -1f);
                listing_Standard.IntRange(ref bill.allowedSkillRange, 0, 20);
            }

            listing_Standard.End();
            StringBuilder stringBuilder = new StringBuilder();

            if (bill.enchantmentTask.description != null)
            {
                stringBuilder.AppendLine(bill.enchantmentTask.description);
                stringBuilder.AppendLine();
            }
            stringBuilder.AppendLine("WorkAmount".Translate() + ": " + bill.enchantmentTask.WorkAmountTotal().ToStringWorkAmount());
            stringBuilder.AppendLine();

            // Display the item and the soul gem.

            if (!bill.enchantmentTask.skillRequirements.NullOrEmpty())
            {
                stringBuilder.AppendLine("MinimumSkills".Translate());
                stringBuilder.AppendLine(bill.enchantmentTask.MinSkillString);
            }

            Text.Font = GameFont.Small;
            string text5 = stringBuilder.ToString();

            if (Text.CalcHeight(text5, rect2.width) > rect2.height)
            {
                Text.Font = GameFont.Tiny;
            }

            Widgets.Label(rect2, text5);
            Text.Font = GameFont.Small;

            if (bill.enchantmentTask.products.Count > 0)
            {
                Widgets_Extensions.InfoCardButton(rect2.x, rect4.y, bill.enchantmentTask.products);
            }
        }
コード例 #5
0
        private static Ability DoAbilityInterface(Rect abilityRect, Ability ability, Pawn pawn)
        {
            CompAbilityHolder abilityHolderComp = pawn.GetComp <CompAbilityHolder>();

            GUI.BeginGroup(abilityRect);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = Color.white;

            Rect iconRect = new Rect(0f, 0f, iconSize, iconSize);

            Widgets_Extensions.AbilityIcon(iconRect, ability);

            GUI.color = abilityHolderComp.ClickableAbilities.Contains(ability) ? Color.green : Color.white;
            Rect labelRect = new Rect(iconRect.width + 4f, 0f, 120f, 32f);

            Widgets.Label(labelRect, ability.def.LabelCap);
            GUI.color = Color.white;

            float deleteRectWidth = ability.lastAttemptedForget <= 0 ? 34f : 154f;

            Rect infoRect = new Rect(abilityRect.xMax - 24f - 24f - deleteRectWidth, 0f, 24f, 24f);

            if (Widgets.ButtonImage(infoRect, Widgets_Extensions.infoTex, Color.white))
            {
                Log.Warning("clicked info");
            }

            Rect addRect = new Rect(abilityRect.xMax - 24f - deleteRectWidth, 0f, 24f, 24f);

            if (Widgets.ButtonImage(addRect, Widgets_Extensions.plusTex, Color.white))
            {
                abilityHolderComp.ToggleClickable(ability);
            }

            Rect deleteRect = new Rect(abilityRect.xMax - deleteRectWidth, 0f, deleteRectWidth - 10f, 24f); // 24f + 10f (scrollbar) = 34f

            if (ability.lastAttemptedForget <= 0)
            {
                if (Widgets.ButtonImage(deleteRect, Widgets_Extensions.deleteXTex, ability.forgetting ? new Color(0.2f, 0.2f, 0.2f) : Color.white))
                {
                    abilityHolderComp.ToggleForgettable(ability);
                }
            }
            else
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                Text.Font   = GameFont.Tiny;
                Widgets.Label(deleteRect, GenDate.ToStringTicksToPeriod(ability.lastAttemptedForget, true, true));
                Text.Font   = GameFont.Small;
                Text.Anchor = TextAnchor.UpperLeft;
            }

            GUI.color = abilityHolderComp.ClickableAbilities.Contains(ability) ? Color.green : Color.white;
            float effectsWidth = abilityRect.width - iconRect.width - labelRect.width - infoRect.width - addRect.width - deleteRect.width - 8f; // 8f sum of gaps.
            Rect  effectsRect  = new Rect(labelRect.x + labelRect.width + 4f, 0f, effectsWidth, 32f);

            Widgets.Label(effectsRect, ability.def.description);
            GUI.color = Color.white;
            GUI.EndGroup();

            if (ability.forgetting)
            {
                Text.Font   = GameFont.Medium;
                Text.Anchor = TextAnchor.MiddleCenter;
                Rect forgettingRect = new Rect(abilityRect.x, abilityRect.y, abilityRect.width, abilityRect.height);
                GUI.DrawTexture(forgettingRect, TexUI.TextBGBlack);
                Widgets.Label(forgettingRect, "ForgettingAbility".Translate());
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            }

            if (Mouse.IsOver(abilityRect))
            {
                return(ability);
            }

            return(null);
        }