示例#1
0
            /// <summary>
            /// Gets the text for the <see cref="Tooltip"/>.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="args">The args.</param>
            /// <returns>The text for the <see cref="Tooltip"/>.</returns>
            static StyledText[] TooltipCallback(Control sender, TooltipArgs args)
            {
                var src      = (ShopItemPB)sender;
                var itemInfo = src.ItemInfo;

                return(ItemInfoHelper.GetStyledText(itemInfo));
            }
示例#2
0
 static StyledText[] Tooltip_Button(Control sender, TooltipArgs args)
 {
     return(new StyledText[]
     {
         new StyledText(
             "hello-hello-hello-hello-hello-hello-hello-hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello")
         , new StyledText("button", new Color(50, 50, 190))
     });
 }
示例#3
0
        static StyledText[] Tooltip_Label(Control sender, TooltipArgs args)
        {
            args.FontColor   = new Color(50, 190, 50);
            args.RefreshRate = 100;

            var r = (byte)rnd.Next(100, 255);
            var g = (byte)rnd.Next(100, 255);
            var b = (byte)rnd.Next(100, 255);

            var c = new Color(r, g, b, 255);

            return(new StyledText[] { new StyledText("Text for a "), new StyledText("label", c) });
        }
示例#4
0
            static StyledText[] TooltipCallback(Control sender, TooltipArgs args)
            {
                var        src  = (EquippedItemPB)sender;
                var        slot = src.Slot;
                IItemTable itemInfo;

                if (!src.EquippedForm._infoRequester.TryGetInfo(slot, out itemInfo))
                {
                    // The data has not been received yet - returning null will make the tooltip retry later
                    return(null);
                }

                // Data was received, so format it and return it
                return(ItemInfoHelper.GetStyledText(itemInfo));
            }
示例#5
0
        /// <summary>
        /// Handles the <see cref="TooltipHandler"/> callback for an item slot in the trade form.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="TooltipArgs"/>.</param>
        /// <returns>The text to display for the tooltip.</returns>
        StyledText[] SlotTooltipCallback(Control sender, TooltipArgs args)
        {
            // Cast the sender to the needed type
            var asItemSlot = sender as PeerTradeSidePanel.PeerTradeItemsCollectionSlot;

            if (asItemSlot == null)
            {
                return(null);
            }

            // Ensure a valid trade state
            var ptih = PeerTradeInfoHandler;

            if (ptih == null || !ptih.IsTradeOpen)
            {
                return(null);
            }

            // Get the item info for the slot
            IItemTable itemInfo;

            if (asItemSlot.ItemsCollection.IsSourceSide)
            {
                itemInfo = ptih.GetSourceItemInfo(asItemSlot.Slot);
            }
            else
            {
                itemInfo = ptih.GetTargetItemInfo(asItemSlot.Slot);
            }

            if (itemInfo == null)
            {
                return(null);
            }

            // Get and return the tooltip text
            return(ItemInfoHelper.GetStyledText(itemInfo));
        }
示例#6
0
 /// <summary>
 /// Gets the default tooltip handler for a <see cref="ToolbarItem"/>.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The args.</param>
 /// <returns>The tooltip text.</returns>
 StyledText[] TooltipHandler(Control sender, TooltipArgs args)
 {
     return(new StyledText[] { new StyledText(ToolbarItemType.ToString()) });
 }