Beispiel #1
0
        private void AddLine_Click(object sender, EventArgs e)
        {
            Point pos = new Point((int)(ShiftX / Zoom), (int)(ShiftY / Zoom));
            pos.X += Math.Min(splitContainer1.SplitterDistance, GraphicPanel.Width)/2 - Map.Instance.CenterX;
            pos.Y += Math.Min(splitContainer1.Height, GraphicPanel.Height) / 2 - Map.Instance.CenterY;
            if (EditFH.Checked)
            {
                IMGEntry gentry = new IMGEntry();
                gentry.Name = Map.Instance.GenerateFootholdsGroupID().ToString();
                IMGEntry entry = new IMGEntry();
                entry.Name = Map.Instance.GenerateFootholdID().ToString();
                entry.SetInt("x1", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("x2", pos.X + 20);
                entry.SetInt("y2", pos.Y);
                entry.SetInt("prev", 0);
                entry.SetInt("next", 0);
                gentry.Add(entry);
                IMGEntry layer = Map.Instance.map.GetChild("foothold/" + (int)Layer.Value);
                if(layer == null)
                {
                    layer = new IMGEntry();
                    layer.Name = ((int)Layer.Value).ToString();
                    Map.Instance.map.GetChild("foothold").Add(layer);
                }
                layer.Add(gentry);
                MapFootholds group = new MapFootholds(int.Parse(gentry.Name));
                group.Object = gentry;
                MapFoothold fh = new MapFoothold(int.Parse(entry.Name));
                fh.Object = entry;
                fh.s1 = new MapFootholdSide();
                fh.s2 = new MapFootholdSide();
                fh.s1.ID = 1;
                fh.s2.ID = 2;
                fh.s1.Object = entry;
                fh.s2.Object = entry;
                fh.s1.Foothold = fh;
                fh.s2.Foothold = fh;
                fh.Group = group;
                group.footholds.Add(fh.ID, fh);
                group.ToFix = true;
                Map.Instance.layers[(int)Layer.Value].footholdGroups.Add(group.ID, group);
            }
            if (EditLR.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetInt("l", 1);
                entry.SetInt("uf", 1);
                entry.SetInt("x", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("y2", pos.Y + 20);
                entry.SetInt("page", (int)Layer.Value);
                MapLR lr = new MapLR();
                lr.Object = entry;
                lr.s1 = new MapLRSide();
                lr.s2 = new MapLRSide();
                lr.s1.ID = 1;
                lr.s2.ID = 2;
                lr.s1.Object = entry;
                lr.s2.Object = entry;
                lr.s1.LR = lr;
                lr.s2.LR = lr;
                Map.Instance.Add(lr);
            }
            else if (EditSeat.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetVector(new WZVector(pos.X, pos.Y));

                MapSeat seat = new MapSeat();
                seat.Object = entry;

                Map.Instance.Add(seat);
                undo.Push(new ActionAdd(seat));
                redo.Clear();
            }
            else if (EditPortal.Checked)
            {
                IMGEntry entry = new IMGEntry();

                entry.SetString("pn", "sp");
                entry.SetInt("pt", 0);
                entry.SetInt("x", pos.X);
                entry.SetInt("y", pos.Y);
                entry.SetInt("tm", 999999999);
                entry.SetString("tn", "");

                MapPortal portal = new MapPortal();
                portal.Object = entry;

                Map.Instance.Add(portal);
                undo.Push(new ActionAdd(portal));
                redo.Clear();
            }
            else if (EditToolTip.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetInt("x1", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("x2", pos.X + 40);
                entry.SetInt("y2", pos.Y + 20);
                MapToolTip tt = new MapToolTip();

                tt.Object = entry;
                tt.c1 = new MapToolTipCorner();
                tt.c1.Object = entry;
                tt.c1.type = MapToolTipCornerType.TopLeft;
                tt.c1.ToolTip = tt;
                tt.c2 = new MapToolTipCorner();
                tt.c2.Object = entry;
                tt.c2.type = MapToolTipCornerType.TopRight;
                tt.c2.ToolTip = tt;
                tt.c3 = new MapToolTipCorner();
                tt.c3.Object = entry;
                tt.c3.type = MapToolTipCornerType.BottomLeft;
                tt.c3.ToolTip = tt;
                tt.c4 = new MapToolTipCorner();
                tt.c4.Object = entry;
                tt.c4.type = MapToolTipCornerType.BottomRight;
                tt.c4.ToolTip = tt;
                Map.Instance.Add(tt);
                lock (StringLock)
                {
                    IMGEntry ToolTipsStrings = stringf.Directory.GetIMG("ToolTipHelp.img").GetChild("Mapobject").GetChild(int.Parse(MapEditor.Instance.MapID).ToString());
                    if (ToolTipsStrings == null)
                    {
                        ToolTipsStrings = new IMGEntry();
                        ToolTipsStrings.Name = int.Parse(MapID).ToString();
                        stringf.Directory.GetIMG("ToolTipHelp.img").GetChild("Mapobject").Add(ToolTipsStrings);
                    }
                    IMGEntry strings = new IMGEntry(tt.Object.Name);
                    strings.SetString("Title", "Title");
                    strings.SetString("Desc", "Desc");
                    ToolTipsStrings.Add(strings);
                    stringf.Directory.GetIMG("ToolTipHelp.img").ToSave = true;
                    tt.Image = strings;
                }
            }
            else if (EditClock.Checked)
            {
                if (Map.Instance.clock == null)
                {
                    IMGEntry entry = new IMGEntry();

                    entry.SetInt("x", pos.X - 100);
                    entry.SetInt("y", pos.Y - 100);
                    entry.SetInt("width", 200);
                    entry.SetInt("height", 200);

                    MapClock clock = new MapClock();
                    clock.Object = entry;

                    lock(MapLock)
                        Map.Instance.Add(clock);
                    undo.Push(new ActionAdd(clock));
                    redo.Clear();
                }
            }
        }
Beispiel #2
0
        private void CreateSeat(MapSeatDesign seatd)
        {
            IMGEntry entry = new IMGEntry();
            entry.SetVector(new WZVector(seatd.GetX() - Map.Instance.CenterX, seatd.GetY() - Map.Instance.CenterY));

            MapSeat seat = new MapSeat();
            seat.Object = entry;

            Map.Instance.Add(seat);
        }