コード例 #1
0
ファイル: MapLoader.cs プロジェクト: xnum/hasuite
        private static void LoadToolTips(WzImage mapImage, Board mapBoard)
        {
            WzSubProperty tooltipsParent      = (WzSubProperty)mapImage["ToolTip"];
            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 || tooltipsParent == null)
            {
                return;
            }
            //if (tooltipStrings == null ^ tooltipsParent == null) throw new Exception("at LoadToolTips, only one tooltip parent is null");
            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);
                HaCreator.MapEditor.ToolTip       tt         = new HaCreator.MapEditor.ToolTip(mapBoard, tooltipPos, title, desc);
                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);
                }
            }
        }
コード例 #2
0
ファイル: Mouse.cs プロジェクト: hanistory/hasuite
 private void CreateTooltip()
 {
     ToolTip tt = new ToolTip(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());
 }
コード例 #3
0
ファイル: MapleShape.cs プロジェクト: johnnyeven/hasuite
 public override void RemoveItem(ref List<UndoRedoAction> undoPipe)
 {
     if (boundTooltip == null) return; //already removed via the parent tooltip
     base.RemoveItem(ref undoPipe);
     undoPipe.Add(UndoRedoManager.ToolTipUnlinked(boundTooltip, this));
     boundTooltip.CharacterToolTip = null;
     boundTooltip = null;
 }
コード例 #4
0
ファイル: MapleShape.cs プロジェクト: johnnyeven/hasuite
 public ToolTipChar(Board board, Rectangle rect, ToolTip boundTooltip)
     : base(board, rect)
 {
     PointA = new ToolTipDot(this, board, rect.Left, rect.Top, false);
     PointB = new ToolTipDot(this, board, rect.Right, rect.Top, false);
     PointC = new ToolTipDot(this, board, rect.Right, rect.Bottom, false);
     PointD = new ToolTipDot(this, board, rect.Left, rect.Bottom, false);
     board.BoardItems.ToolTipDots.Add((ToolTipDot)PointA);
     board.BoardItems.ToolTipDots.Add((ToolTipDot)PointB);
     board.BoardItems.ToolTipDots.Add((ToolTipDot)PointC);
     board.BoardItems.ToolTipDots.Add((ToolTipDot)PointD);
     LineAB = new ToolTipLine(board, PointA, PointB);
     LineBC = new ToolTipLine(board, PointB, PointC);
     LineCD = new ToolTipLine(board, PointC, PointD);
     LineDA = new ToolTipLine(board, PointD, PointA);
     LineAB.yBind = true;
     LineBC.xBind = true;
     LineCD.yBind = true;
     LineDA.xBind = true;
     BoundTooltip = boundTooltip;
 }
コード例 #5
0
ファイル: UndoRedoManager.cs プロジェクト: johnnyeven/hasuite
 public static UndoRedoAction ToolTipUnlinked(ToolTip tt, ToolTipChar ttc)
 {
     return new UndoRedoAction(tt, UndoRedoType.ToolTipUnlinked, ttc, null);
 }
コード例 #6
0
ファイル: MapLoader.cs プロジェクト: ilvmoney/hasuite-new
 private static void LoadToolTips(WzImage mapImage, Board mapBoard)
 {
     WzSubProperty tooltipsParent = (WzSubProperty)mapImage["ToolTip"];
     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 || tooltipsParent == null) return;
     //if (tooltipStrings == null ^ tooltipsParent == null) throw new Exception("at LoadToolTips, only one tooltip parent is null");
     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);
         HaCreator.MapEditor.ToolTip tt = new HaCreator.MapEditor.ToolTip(mapBoard, tooltipPos, title, desc);
         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);
         }
     }
 }