public void LoadToolTips(WzImage mapImage, Board mapBoard)
        {
            WzSubProperty tooltipsParent = (WzSubProperty)mapImage["ToolTip"];

            if (tooltipsParent == null)
            {
                return;
            }

            WzImage tooltipsStringImage = (WzImage)Program.WzManager.String["ToolTipHelp.img"];

            if (!tooltipsStringImage.Parsed)
            {
                tooltipsStringImage.ParseImage();
            }

            WzSubProperty tooltipStrings = (WzSubProperty)tooltipsStringImage["Mapobject"][mapBoard.MapInfo.id.ToString()];

            if (tooltipStrings == null)
            {
                return;
            }

            for (int i = 0; true; i++)
            {
                string        num           = i.ToString();
                WzSubProperty tooltipString = (WzSubProperty)tooltipStrings[num];
                WzSubProperty tooltipProp   = (WzSubProperty)tooltipsParent[num];
                WzSubProperty tooltipChar   = (WzSubProperty)tooltipsParent[num + "char"];
                if (tooltipString == null && tooltipProp == null)
                {
                    break;
                }
                if (tooltipString == null ^ tooltipProp == null)
                {
                    continue;
                }
                string title = InfoTool.GetOptionalString(tooltipString["Title"]);
                string desc  = InfoTool.GetOptionalString(tooltipString["Desc"]);
                int    x1    = InfoTool.GetInt(tooltipProp["x1"]);
                int    x2    = InfoTool.GetInt(tooltipProp["x2"]);
                int    y1    = InfoTool.GetInt(tooltipProp["y1"]);
                int    y2    = InfoTool.GetInt(tooltipProp["y2"]);
                Microsoft.Xna.Framework.Rectangle tooltipPos = new Microsoft.Xna.Framework.Rectangle(x1, y1, x2 - x1, y2 - y1);
                ToolTipInstance tt = new ToolTipInstance(mapBoard, tooltipPos, title, desc, i);
                mapBoard.BoardItems.ToolTips.Add(tt);
                if (tooltipChar != null)
                {
                    x1         = InfoTool.GetInt(tooltipChar["x1"]);
                    x2         = InfoTool.GetInt(tooltipChar["x2"]);
                    y1         = InfoTool.GetInt(tooltipChar["y1"]);
                    y2         = InfoTool.GetInt(tooltipChar["y2"]);
                    tooltipPos = new Microsoft.Xna.Framework.Rectangle(x1, y1, x2 - x1, y2 - y1);
                    ToolTipChar ttc = new ToolTipChar(mapBoard, tooltipPos, tt);
                    mapBoard.BoardItems.CharacterToolTips.Add(ttc);
                }
            }
        }
Esempio n. 2
0
 private void CreateTooltip()
 {
     lock (Board.ParentControl)
     {
         ToolTipInstance tt = new ToolTipInstance(Board, new Xna.Rectangle(X, Y, 0, 0), "Title", "Description");
         Board.BoardItems.ToolTips.Add(tt);
         BindItem(tt.PointA, new Xna.Point());
         BindItem(tt.PointC, new Xna.Point());
     }
 }
Esempio n. 3
0
        public TooltipInstanceEditor(ToolTipInstance item)
        {
            InitializeComponent();
            this.item      = item;
            xInput.Value   = item.X;
            yInput.Value   = item.Y;
            pathLabel.Text = HaCreatorStateManager.CreateItemDescription(item);

            if (item.Title != null)
            {
                useTitleBox.Checked = true;
                titleBox.Text       = item.Title;
            }
            if (item.Desc != null)
            {
                useDescBox.Checked = true;
                descBox.Text       = item.Desc;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Tooltip
        /// </summary>
        /// <param name="texturePool"></param>
        /// <param name="farmFrameParent"></param>
        /// <param name="tooltip"></param>
        /// <param name="device"></param>
        /// <returns></returns>
        public static TooltipItem CreateTooltipFromProperty(TexturePool texturePool, WzSubProperty farmFrameParent, ToolTipInstance tooltip, GraphicsDevice device)
        {
            // Wz frames
            System.Drawing.Bitmap c     = ((WzCanvasProperty)farmFrameParent?["c"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap cover = ((WzCanvasProperty)farmFrameParent?["cover"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap e     = ((WzCanvasProperty)farmFrameParent?["e"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap n     = ((WzCanvasProperty)farmFrameParent?["n"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap s     = ((WzCanvasProperty)farmFrameParent?["s"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap w     = ((WzCanvasProperty)farmFrameParent?["w"])?.GetLinkedWzCanvasBitmap();
            System.Drawing.Bitmap ne    = ((WzCanvasProperty)farmFrameParent?["ne"])?.GetLinkedWzCanvasBitmap(); // top right
            System.Drawing.Bitmap nw    = ((WzCanvasProperty)farmFrameParent?["nw"])?.GetLinkedWzCanvasBitmap(); // top left
            System.Drawing.Bitmap se    = ((WzCanvasProperty)farmFrameParent?["se"])?.GetLinkedWzCanvasBitmap(); // bottom right
            System.Drawing.Bitmap sw    = ((WzCanvasProperty)farmFrameParent?["sw"])?.GetLinkedWzCanvasBitmap(); // bottom left


            // tooltip property
            string title = tooltip.Title;
            string desc  = tooltip.Desc;

            string renderText = string.Format("{0}{1}{2}", title, Environment.NewLine, desc);

            // Constants
            const float TOOLTIP_FONTSIZE = 9.25f; // thankie willified, ya'll be remembered forever here <3

            //System.Drawing.Color color_bgFill = System.Drawing.Color.FromArgb(230, 17, 54, 82); // pre V patch (dark blue theme used post-bb), leave this here in case someone needs it
            System.Drawing.Color color_bgFill     = System.Drawing.Color.FromArgb(255, 17, 17, 17); // post V patch (dark black theme used), use color picker on paint via image extracted from WZ if you need to get it
            System.Drawing.Color color_foreGround = System.Drawing.Color.White;
            const int            WIDTH_PADDING    = 10;
            const int            HEIGHT_PADDING   = 6;

            // Create
            using (System.Drawing.Font font = new System.Drawing.Font(GLOBAL_FONT, TOOLTIP_FONTSIZE))
            {
                System.Drawing.Graphics graphics_dummy = System.Drawing.Graphics.FromImage(new System.Drawing.Bitmap(1, 1)); // dummy image just to get the Graphics object for measuring string
                System.Drawing.SizeF    tooltipSize    = graphics_dummy.MeasureString(renderText, font);

                int effective_width  = (int)tooltipSize.Width + WIDTH_PADDING;
                int effective_height = (int)tooltipSize.Height + HEIGHT_PADDING;

                System.Drawing.Bitmap bmp_tooltip = new System.Drawing.Bitmap(effective_width, effective_height);
                using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bmp_tooltip))
                {
                    // Frames and background
                    UIFrameHelper.DrawUIFrame(graphics, color_bgFill, ne, nw, se, sw, e, w, n, s, c, effective_width, effective_height);

                    // Text
                    graphics.DrawString(renderText, font, new System.Drawing.SolidBrush(color_foreGround), WIDTH_PADDING / 2, HEIGHT_PADDING / 2);
                    graphics.Flush();
                }
                IDXObject   dxObj = new DXObject(tooltip.X, tooltip.Y, bmp_tooltip.ToTexture2D(device), 0);
                TooltipItem item  = new TooltipItem(tooltip, dxObj);

                return(item);
            }
        }
Esempio n. 5
0
        void addChar_Click(object sender, EventArgs e)
        {
            ToolTipInstance tt = (ToolTipInstance)target;

            tt.CreateCharacterTooltip(new XNA.Rectangle(tt.Left - 50, tt.Top - 50, tt.Width + 100, tt.Height + 100));
        }
 public static UndoRedoAction ToolTipUnlinked(ToolTipInstance tt, ToolTipChar ttc)
 {
     return(new UndoRedoAction(tt, UndoRedoType.ToolTipUnlinked, ttc, null));
 }
 public TooltipItem(ToolTipInstance npcInstance, IDXObject frame0)
     : base(frame0, false)
 {
     this.tooltipInstance = npcInstance;
 }
 public TooltipItem(ToolTipInstance tooltipInstance, List <IDXObject> frames)
     : base(frames, false)
 {
     this.tooltipInstance = tooltipInstance;
 }