Пример #1
0
        public static void GenerateDefaultZms(Board mapBoard)
        {
            // generate default zM's
            HashSet<int> allExistingZMs = new HashSet<int>();
            foreach (Layer l in mapBoard.Layers)
            {
                l.RecheckTileSet();
                l.RecheckZM();
                l.zMList.ToList().ForEach(y => allExistingZMs.Add(y));
            }

            for (int i = 0; i < mapBoard.Layers.Count; i++)
            {
                for (int zm_cand = 0; mapBoard.Layers[i].zMList.Count == 0; zm_cand++)
                {
                    // Choose a zM that is free
                    if (!allExistingZMs.Contains(zm_cand))
                    {
                        mapBoard.Layers[i].zMList.Add(zm_cand);
                        allExistingZMs.Add(zm_cand);
                        break;
                    }
                }
            }
        }
Пример #2
0
 public BoardItemsManager(Board board)
 {
     AllItemLists = new IMapleList[] { BackBackgrounds, TileObjs, Mobs, NPCs, Reactors, Portals, FrontBackgrounds, FootholdLines, RopeLines, FHAnchors, RopeAnchors, Chairs, CharacterToolTips, ToolTips, ToolTipDots, MiscItems, SpecialDots };
     this.board = board;
     Items = new BoardItemsCollection(this, true);
     Lines = new MapleLinesCollection(this, false);
 }
Пример #3
0
 public static void ClearBoundItems(Board board)
 {
     object[] keys = new object[board.Mouse.BoundItems.Count];
     //int i = 0;
     board.Mouse.BoundItems.Keys.CopyTo(keys, 0);
     /*foreach (DictionaryEntry entry in board.Mouse.BoundItems)
     {
         keys[i] = entry.Key;
         i++;
     }*/
     List<UndoRedoAction> undoActions = new List<UndoRedoAction>();
     bool addUndo;
     foreach (object key in keys)
     {
         BoardItem item = (BoardItem)key;
         addUndo = item.tempParent == null || !(item.tempParent.Parent is Mouse);
         board.Mouse.ReleaseItem(item);
         if (addUndo)
         {
             if ((item is BackgroundInstance) && (((BackgroundInstance)item).BaseX != item.moveStartPos.X || ((BackgroundInstance)item).BaseY != item.moveStartPos.Y))
                 undoActions.Add(UndoRedoManager.BackgroundMoved((BackgroundInstance)item, new Point(item.moveStartPos.X, item.moveStartPos.Y), new Point(((BackgroundInstance)item).BaseX, ((BackgroundInstance)item).BaseY)));
             else if (!(item is BackgroundInstance) && (item.X != item.moveStartPos.X || item.Y != item.moveStartPos.Y))
                 undoActions.Add(UndoRedoManager.ItemMoved(item, new Point(item.moveStartPos.X, item.moveStartPos.Y), new Point(item.X, item.Y)));
         }
     }
     if (undoActions.Count > 0)
         board.UndoRedoMan.AddUndoBatch(undoActions);
 }
Пример #4
0
 public static void ClearSelectedItems(Board board)
 {
     while (board.SelectedItems.Count > 0)
     {
         board.SelectedItems[0].Selected = false;
     }
 }
Пример #5
0
 public BoardItemContextMenu(MultiBoard multiboard, Board board, BoardItem target)
 {
     this.multiboard = multiboard;
     this.board = board;
     this.target = target;
     this.cms = null;
 }
Пример #6
0
 public MassZmEditor(IContainsLayerInfo[] items, Board board, int zm)
 {
     InitializeComponent();
     this.items = items;
     this.board = board;
     zmInput.Value = zm;
 }
Пример #7
0
 public Layer(Board board)
 {
     this.board = board;
     if (board.Layers.Count == 10) throw new NotSupportedException("Cannot add more than 10 layers (why would you need that much anyway?)");
     num = board.Layers.Count;
     board.Layers.Add(this);
 }
Пример #8
0
        public TnSelector(Board board)
        {
            InitializeComponent();

            foreach (PortalInstance pi in board.BoardItems.Portals)
            {
                if (pi.pn != null && pi.pn != "" && pi.pn != "sp" && pi.pn != "pt")
                    pnList.Items.Add(pi.pn);
            }
        }
Пример #9
0
        public TnSelector(Board board)
        {
            InitializeComponent();

            styleManager.ManagerStyle = UserSettings.applicationStyle;

            foreach (PortalInstance pi in board.BoardItems.Portals)
            {
                if (pi.pn != null && pi.pn != "" && pi.pn != "sp" && pi.pn != "pt")
                    pnList.Items.Add(pi.pn);
            }
        }
Пример #10
0
        public static void checkConnected(Board mapBoard)
        {
            /*\
             * This is not used yet, I was making it for putting the FHs in separate groups
             * but lost my train of thought -DeathRight
            \*/
            foreach (FootholdLine fhline in mapBoard.BoardItems.FootholdLines)
            {
                foreach (FootholdLine connectedLine in fhline.FirstDot.connectedLines)
                {

                }
            }
        }
Пример #11
0
        public VREditor(Board mapBoardd)
        {
            InitializeComponent();
            styleManager.ManagerStyle = UserSettings.applicationStyle;
            mapBoard = mapBoardd;
            VROld = (Rectangle)mapBoard.MapInfo.VR;
            miniMap.Image = mapBoardd.MiniMap;
            miniMap.Update();
            miniMap.Refresh();


            //Rectangle VR = new Rectangle(miniMap.Location.X - (mapBoard.MapInfo.VR.Value.X / 4), miniMap.Location.Y - (mapBoard.MapInfo.VR.Value.Y / 4), miniMap.Width - (mapBoard.MapInfo.VR.Value.Width / 4), miniMap.Height - (mapBoard.MapInfo.VR.Value.Height / 4));
            
            //VR.Location = miniMap.Location;
        }
Пример #12
0
 public Save(Board board)
 {
     this.board = board;
     InitializeComponent();
     switch (board.MapInfo.mapType)
     {
         case MapType.CashShopPreview:
         case MapType.MapLogin:
             idBox.Text = board.MapInfo.strMapName;
             break;
         case MapType.RegularMap:
             idBox.Text = board.MapInfo.id == -1 ? "" : board.MapInfo.id.ToString();
             break;
         default:
             throw new NotSupportedException("Unknown map type at Save::.ctor()");
     }
     idBox_TextChanged(null, null);
 }
Пример #13
0
        //private int zM;

        public ObjectInstance(ObjectInfo baseInfo, Layer layer, Board board, int x, int y, int z, MapleBool r, MapleBool hide, MapleBool reactor, MapleBool flow, int? rx, int? ry, int? cx, int? cy, string name, string tags, List<ObjectInstanceQuest> questInfo, bool flip, bool beforeAdding)
            : base(board, layer, x, y, z, beforeAdding)
        {
            this.baseInfo = baseInfo;
            this.flip = flip;
            this._r = r;
            this.name = name;
            this._hide = hide;
            this._reactor = reactor;
            this._flow = flow;
            this._rx = rx;
            this._ry = ry;
            this._cx = cx;
            this._cy = cy;
            this._tags = tags;
            this.questInfo = questInfo;
            //this.zM = zM;
            if (flip)
                X -= Width - 2 * Origin.X;
        }
Пример #14
0
 public MiscRectangle(Board board, Rectangle rect)
     : base(board, rect)
 {
     PointA = new MiscDot(this, board, rect.Left, rect.Top, false);
     PointB = new MiscDot(this, board, rect.Right, rect.Top, false);
     PointC = new MiscDot(this, board, rect.Right, rect.Bottom, false);
     PointD = new MiscDot(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 MiscLine(board, PointA, PointB);
     LineBC = new MiscLine(board, PointB, PointC);
     LineCD = new MiscLine(board, PointC, PointD);
     LineDA = new MiscLine(board, PointD, PointA);
     LineAB.yBind = true;
     LineBC.xBind = true;
     LineCD.yBind = true;
     LineDA.xBind = true;
 }
Пример #15
0
        public LayerChange(List<BoardItem> items, Board board)
        {
            this.items = items;
            this.board = board;
            InitializeComponent();

            board.Layers.ForEach(x => layerBox.Items.Add(x.ToString()));
            if (board.SelectedLayerIndex == -1)
            {
                layerBox.SelectedIndex = 0;
                zmBox.SelectedIndex = 0;
            }
            else
            {
                layerBox.SelectedIndex = board.SelectedLayerIndex;
                if (board.SelectedPlatform != -1)
                {
                    zmBox.SelectedItem = board.SelectedPlatform;
                }
            }
        }
Пример #16
0
        public MapSimulator(Board mapBoard)
        {
            if (Program.InfoManager.BGMs.ContainsKey(mapBoard.MapInfo.bgm))
                audio = new WzMp3Streamer(Program.InfoManager.BGMs[mapBoard.MapInfo.bgm], true);
            mapCenter = mapBoard.CenterPoint;
            minimapPos = new Point((int)Math.Round((mapBoard.MinimapPosition.X + mapCenter.X) / (double)mapBoard.mag), (int)Math.Round((mapBoard.MinimapPosition.Y + mapCenter.Y) / (double)mapBoard.mag));
            if (mapBoard.VRRectangle == null) vr = new Rectangle(0, 0, mapBoard.MapSize.X, mapBoard.MapSize.Y);
            else vr = new Rectangle(mapBoard.VRRectangle.X + mapCenter.X, mapBoard.VRRectangle.Y + mapCenter.Y, mapBoard.VRRectangle.Width, mapBoard.VRRectangle.Height);
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);
            InitializeComponent();
            width = UserSettings.XGAResolution ? 1024 : 800;
            height = UserSettings.XGAResolution ? 768 : 600;
            this.Width = width;
            this.Height = height;
            #if FULLSCREEN
            pParams.BackBufferWidth = Math.Max(Width, 1);
            pParams.BackBufferHeight = Math.Max(Height, 1);
            pParams.BackBufferFormat = SurfaceFormat.Color;
            pParams.IsFullScreen = false;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
            #else
            pParams.BackBufferWidth = Math.Max(width, 1);
            pParams.BackBufferHeight = Math.Max(height, 1);
            pParams.BackBufferFormat = SurfaceFormat.Color;
            pParams.DepthStencilFormat = DepthFormat.Depth24;
            pParams.DeviceWindowHandle = Handle;
            pParams.IsFullScreen = false;
            #endif
            DxDevice = MultiBoard.CreateGraphicsDevice(pParams);
            this.minimap = BoardItem.TextureFromBitmap(DxDevice, mapBoard.MiniMap);
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1, 1);
            bmp.SetPixel(0, 0, System.Drawing.Color.White);
            pixel = BoardItem.TextureFromBitmap(DxDevice, bmp);

            sprite = new SpriteBatch(DxDevice);
        }
Пример #17
0
 public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding)
 {
     if (Image == null) ParseImage();
     return new ReactorInstance(this, board, x, y, UserSettings.defaultReactorTime, "", flip, beforeAdding);
 }
Пример #18
0
 public PortalInstance CreateInstance(Board board, int x, int y, bool beforeAdding, string pn, string tn, int tm, string script, int? delay, MapleBool hideTooltip, MapleBool onlyOnce, int? horizontalImpact, int? verticalImpact, string image, int? hRange, int? vRange)
 {
     return new PortalInstance(this, board, x, y, beforeAdding, pn, type, tn, tm, script, delay, hideTooltip, onlyOnce, horizontalImpact, verticalImpact, image, hRange, vRange);
 }
Пример #19
0
 public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding)
 {
     switch (type)
     {
         case PortalType.PORTALTYPE_STARTPOINT:
             return new PortalInstance(this, board, x, y, beforeAdding, "sp", type, "", 999999999, null, null, null, null, null, null, null, null, null);
         case PortalType.PORTALTYPE_INVISIBLE:
         case PortalType.PORTALTYPE_VISIBLE:
         case PortalType.PORTALTYPE_COLLISION:
         case PortalType.PORTALTYPE_CHANGABLE:
         case PortalType.PORTALTYPE_CHANGABLE_INVISIBLE:
             return new PortalInstance(this, board, x, y, beforeAdding, "portal", type, "", 999999999, null, null, null, null, null, null, null, null, null);
         case PortalType.PORTALTYPE_TOWNPORTAL_POINT:
             return new PortalInstance(this, board, x, y, beforeAdding, "tp", type, "", 999999999, null, null, null, null, null, null, null, null, null);
         case PortalType.PORTALTYPE_SCRIPT:
         case PortalType.PORTALTYPE_SCRIPT_INVISIBLE:
         case PortalType.PORTALTYPE_COLLISION_SCRIPT:
             return new PortalInstance(this, board, x, y, beforeAdding, "portal", type, "", 999999999, "script", null, null, null, null, null, null, null, null);
         case PortalType.PORTALTYPE_HIDDEN:
             return new PortalInstance(this, board, x, y, beforeAdding, "portal", type, "", 999999999, null, null, null, null, null, null, "", null, null);
         case PortalType.PORTALTYPE_SCRIPT_HIDDEN:
             return new PortalInstance(this, board, x, y, beforeAdding, "portal", type, "", 999999999, "script", null, null, null, null, null, "", null, null);
         case PortalType.PORTALTYPE_COLLISION_VERTICAL_JUMP:
         case PortalType.PORTALTYPE_COLLISION_CUSTOM_IMPACT:
         case PortalType.PORTALTYPE_COLLISION_UNKNOWN_PCIG:
             return new PortalInstance(this, board, x, y, beforeAdding, "portal", type, "", 999999999, "script", null, null, null, null, null, "", null, null);
         default:
             throw new Exception("unknown pt @ CreateInstance");
     }
 }
Пример #20
0
 public BoardItem CreateInstance(Board board, int x, int y, int rx0, int rx1, string limitedname, int? mobTime, MapleBool flip, MapleBool hide, int? info, int? team, bool beforeAdding)
 {
     if (Image == null) ParseImage();
     return new LifeInstance(this, "n", board, x, y, x - UserSettings.Mobrx0Offset, x + UserSettings.Mobrx1Offset, limitedname, mobTime, flip, hide, info, team, beforeAdding);
 }
Пример #21
0
 public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding)
 {
     if (Image == null) ParseImage();
     return new LifeInstance(this, "n", board, x, y, x - UserSettings.Npcrx0Offset, x + UserSettings.Npcrx1Offset, null, 0, flip, false, null, null, beforeAdding);
 }
Пример #22
0
 public abstract BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding);
Пример #23
0
 public void ParseOffsets(TileInstance instance, Board board, Layer layer, int x, int y)
 {
     List<FootholdAnchor> anchors = new List<FootholdAnchor>();
     foreach (XNA.Point foothold in footholdOffsets)
     {
         FootholdAnchor anchor = new FootholdAnchor(board, x + foothold.X, y + foothold.Y, layer.LayerNumber, false);
         anchors.Add(anchor);
         board.BoardItems.FHAnchors.Add(anchor);
         instance.BindItem(anchor, foothold);
     }
     for (int i = 0; i < anchors.Count - 1; i++)
     {
         FootholdLine fh = new FootholdLine(board, anchors[i], anchors[i + 1]);
         board.BoardItems.FootholdLines.Add(fh);
     }
 }
Пример #24
0
 public BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, MapleBool r, MapleBool hide, MapleBool reactor, MapleBool flow, int? rx, int? ry, int? cx, int? cy, string name, string tags, List<ObjectInstanceQuest> questInfo, bool flip, bool beforeAdding, bool parseOffsets)
 {
     ObjectInstance instance = new ObjectInstance(this, layer, board, x, y, z, r, hide, reactor, flow, rx, ry, cx, cy, name, tags, questInfo, flip, beforeAdding);
     if (parseOffsets) ParseOffsets(instance, layer, board, x, y);
     return instance;
 }
Пример #25
0
 public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding)
 {
     ObjectInstance instance = new ObjectInstance(this, layer, board, x, y, z, false, false, false, false, null, null, null, null, null, null, null, flip, beforeAdding);
     ParseOffsets(instance, layer, board, x, y);
     return instance;
 }
Пример #26
0
 public BoardItem(Board board, SerializationForm json)
 {
     this.board = board;
     position = new XNA.Vector3(json.x, json.y, json.z);
 }
Пример #27
0
 public BoardItem CreateInstance(Board board, int x, int y, int z, int rx, int ry, int cx, int cy, BackgroundType type, int a, bool front, bool flip, bool beforeAdding)
 {
     return new BackgroundInstance(this, board, x, y, z, rx, ry, cx, cy, type, a, front, flip, beforeAdding);
 }
Пример #28
0
 public BoardItem CreateInstance(Board board, int x, int y, int reactorTime, string name, bool flip, bool beforeAdding)
 {
     if (Image == null) ParseImage();
     return new ReactorInstance(this, board, x, y, reactorTime, name, flip, beforeAdding);
 }
Пример #29
0
 public override BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding)
 {
     return new BackgroundInstance(this, board, x, y, z, -100, -100, 0, 0, 0, 255, false, flip, beforeAdding);
 }
Пример #30
0
 public BoardItem CreateInstance(Layer layer, Board board, int x, int y, int z, bool flip, bool beforeAdding, bool parseOffsets)
 {
     TileInstance instance = new TileInstance(this, layer, board, x, y, z, beforeAdding);
     if (parseOffsets) ParseOffsets(instance, board, layer, x, y);
     return instance;
 }
Пример #31
0
 public Mouse(Board board)
     : base(board, 0, 0, false)
 {
     IsDown = false;
 }
Пример #32
0
        public XNA.Point moveStartPos = new XNA.Point(); //for undo of drag-drop

        public BoardItem(Board board, int x, int y, int z)
        {
            position = new XNA.Vector3(x, y, z);
            this.board = board;
        }