private bool _uf; //deciding if you can climb over the end of the rope (usually true) //according to koolk it stands for "Upper Foothold" public Rope(Board board, int x, int y1, int y2, bool ladder, int page, bool uf) { this.board = board; this._page = page; this._ladder = ladder; this._uf = uf; this.firstAnchor = new RopeAnchor(board, x, y1, this, false); this.secondAnchor = new RopeAnchor(board, x, y2, this, false); this.line = new RopeLine(board, firstAnchor, secondAnchor); Create(); }
public RopeInstanceEditor(RopeAnchor item) { InitializeComponent(); this.item = item; styleManager.ManagerStyle = UserSettings.applicationStyle; xInput.Value = item.X; yInput.Value = item.Y; ufBox.Checked = item.ParentRope.uf; if (item.ParentRope.ladder) { ropeBox.Checked = false; ladderBox.Checked = true; } else { ropeBox.Checked = true; ladderBox.Checked = false; } pathLabel.Text = Editor.CreateItemDescription(item, "\r\n"); }
/// <summary> /// Creates the description of the selected item to be displayed on the top right corner of HaRibbon /// </summary> /// <param name="item"></param> /// <returns></returns> public static string CreateItemDescription(BoardItem item) { string lineBreak = Environment.NewLine; const string firstLineSpacer = " "; StringBuilder sb = new StringBuilder(); if (item is TileInstance) { sb.Append("[Tile]").Append(lineBreak); sb.Append(firstLineSpacer).Append(((TileInfo)item.BaseInfo).tS).Append(@"\").Append(((TileInfo)item.BaseInfo).u).Append(@"\").Append(((TileInfo)item.BaseInfo).no); } else if (item is ObjectInstance) { sb.Append("[Object]").Append(lineBreak); sb.Append(firstLineSpacer).Append(((ObjectInfo)item.BaseInfo).oS).Append(@"\").Append(((ObjectInfo)item.BaseInfo).l0).Append(@"\") .Append(((ObjectInfo)item.BaseInfo).l1).Append(@"\").Append(((ObjectInfo)item.BaseInfo).l2); } else if (item is BackgroundInstance) { sb.Append("[Background]").Append(lineBreak); sb.Append(firstLineSpacer).Append(((BackgroundInfo)item.BaseInfo).bS).Append(@"\").Append((((BackgroundInfo)item.BaseInfo).Type.ToString())).Append(@"\") .Append(((BackgroundInfo)item.BaseInfo).no); } else if (item is PortalInstance) { sb.Append("[Portal]").Append(lineBreak); sb.Append(firstLineSpacer).Append("Name: ").Append(((PortalInstance)item).pn).Append(lineBreak); sb.Append(firstLineSpacer).Append("Type: ").Append(Tables.PortalTypeNames[((PortalInstance)item).pt]); } else if (item is MobInstance) { sb.Append("[Mob]").Append(lineBreak); sb.Append(firstLineSpacer).Append("Name: ").Append(((MobInfo)item.BaseInfo).Name).Append(lineBreak); sb.Append(firstLineSpacer).Append("ID: ").Append(((MobInfo)item.BaseInfo).ID); } else if (item is NpcInstance) { sb.Append("[Npc]").Append(lineBreak); sb.Append(firstLineSpacer).Append("Name: ").Append(((NpcInfo)item.BaseInfo).Name).Append(lineBreak); sb.Append(firstLineSpacer).Append("ID: ").Append(((NpcInfo)item.BaseInfo).ID); } else if (item is ReactorInstance) { sb.Append("[Reactor]").Append(lineBreak); sb.Append(firstLineSpacer).Append("ID: ").Append(((ReactorInfo)item.BaseInfo).ID); } else if (item is FootholdAnchor) { sb.Append("[Foothold]"); } else if (item is RopeAnchor) { RopeAnchor rope = (RopeAnchor)item; sb.Append(rope.ParentRope.ladder ? "[Ladder]" : "[Rope]"); } else if (item is Chair) { sb.Append("[Chair]"); } else if (item is ToolTipChar || item is ToolTipDot || item is ToolTipInstance) { sb.Append("[Tooltip]"); } else if (item is INamedMisc) { sb.Append(((INamedMisc)item).Name); } sb.Append(lineBreak); sb.Append("W: ").Append(item.Width).Append(", H: ").Append(item.Height); return(sb.ToString()); }
private bool _uf; //deciding if you can climb over the end of the rope (usually true) #endregion Fields #region Constructors //according to koolk it stands for "Upper Foothold" public Rope(Board board, int x, int y1, int y2, bool ladder, int page, bool uf) { this.board = board; this._page = page; this._ladder = ladder; this._uf = uf; this.firstAnchor = new RopeAnchor(board, x, y1, this, false); this.secondAnchor = new RopeAnchor(board, x, y2, this, false); this.line = new RopeLine(board, firstAnchor, secondAnchor); Create(); }
public void PlaceObject() { if (state == MouseState.StaticObjectAdding || state == MouseState.RandomTiles) { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction>() { UndoRedoManager.ItemAdded(currAddedObj) }); //Board.BoardItems.Add(currAddedObj.CreateInstance(Board.Layers[Board.SelectedLayerIndex], Board, x, y, 50, false, false)); currAddedObj.BeforeAdding = false; ReleaseItem(currAddedObj); if (currAddedObj is LayeredItem) { int highestZ = 0; foreach (LayeredItem item in Board.BoardItems.TileObjs) { if (item.Z > highestZ) { highestZ = item.Z; } } currAddedObj.Z = highestZ; Board.BoardItems.Sort(); } if (state == MouseState.StaticObjectAdding) { currAddedObj = currAddedInfo.CreateInstance(Board.SelectedLayer, Board, X + currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, Y + currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2, 50, false, true); } else { currAddedObj = tileRandomList[NextInt32(tileRandomList.Length)].CreateInstance(Board.SelectedLayer, Board, X + currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, Y + currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2, 50, false, true); } Board.BoardItems.Add(currAddedObj, false); BindItem(currAddedObj, new Microsoft.Xna.Framework.Point(currAddedInfo.Origin.X - currAddedInfo.Image.Width / 2, currAddedInfo.Origin.Y - currAddedInfo.Image.Height / 2)); } else if (state == MouseState.Chairs) { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> { UndoRedoManager.ItemAdded(currAddedObj) }); ReleaseItem(currAddedObj); currAddedObj = new Chair(Board, X, Y, true); Board.BoardItems.Add(currAddedObj, false); BindItem(currAddedObj, new Microsoft.Xna.Framework.Point()); } else if (state == MouseState.Ropes) { int count = BoundItems.Count; object[] keys = new object[count]; BoundItems.Keys.CopyTo(keys, 0); RopeAnchor anchor = (RopeAnchor)keys[0]; ReleaseItem(anchor); if (count == 1) { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> { UndoRedoManager.RopeAdded(anchor.ParentRope) }); CreateRope(); } } else if (state == MouseState.Tooltip) { int count = BoundItems.Count; object[] keys = new object[count]; BoundItems.Keys.CopyTo(keys, 0); ToolTipDot dot = (ToolTipDot)keys[0]; ReleaseItem(dot); if (count == 1) { Board.UndoRedoMan.AddUndoBatch(new List <UndoRedoAction> { UndoRedoManager.ItemAdded(dot.ParentTooltip) }); CreateTooltip(); } } }