Ejemplo n.º 1
0
        // ------------------------------------------------------------------
        // Public
        // ------------------------------------------------------------------

        public override void DrawContents()
        {
            Sprite icon = Action == null ? null : Action.Icon;

            if (icon != null)
            {
                var drawParameters = DrawParameters.Default;
                if (!Enabled)
                {
                    drawParameters.Transform             = ColorTransform.BlackAndWhite;
                    drawParameters.Transform.ColorOffset = new Color(0.2f, 0.2f, 0.2f, 0f);
                }
                drawParameters.Scale = new Vector2(SIZE / icon.rect.width, SIZE / icon.rect.height);
                SmartUI.Draw(0, 0, icon, drawParameters);
            }

            if (Action != null)
            {
                if (Action.Type == ActionType.Spell)
                {
                    var style = CoM.SubtextStyle;
                    style.alignment = TextAnchor.LowerCenter;
                    string costString = Action.Spell.CostFor(CoM.Party.Selected).ToString();
                    Rect   rect       = ContentsFrame;
                    rect.height -= 4;
                    SmartUI.TextWithShadow(rect, costString, style, 1);
                }
            }
        }
Ejemplo n.º 2
0
        /**
         * Draws this item's representation
         */
        public override void Draw()
        {
            Engine.PerformanceStatsInProgress.GuiUpdates++;

            if (ItemInstance != null)
            {
                var            item = ItemInstance.Item;
                Sprite         icon = CoM.Instance.ItemIconSprites[item.IconID];
                DrawParameters dp   = DrawParameters.Default;

                int offsetX = (int)((Width) - icon.rect.width) / 2;
                int offsetY = (int)((Height) - icon.rect.height) / 2;

                SmartUI.Color = Color;
                dp.Transform  = ColorTransform;

                if (BeingDragged || !Enabled)
                {
                    SmartUI.Color = Color.gray;
                    dp            = DrawParameters.BlackAndWhite;
                }

                SmartUI.Draw(X + offsetX, Y + offsetY, icon, dp);
                SmartUI.Color = Color.white;

                if (ItemInstance.Item.Usable)
                {
                    GUIStyle myStyle = CoM.SubtextStyle;
                    myStyle.alignment = TextAnchor.LowerLeft;
                    SmartUI.TextWithShadow(new Rect(X + offsetX + 2, Y + offsetY, 40, 35), ItemInstance.RemainingCharges.ToString(), myStyle, 1);
                }
            }
        }