public DrawEditorTool(LevelEntry le, bool draw, int width, int height) { mEntry = le; mDraw = draw; mAvoidOverlapping = true; mWidth = width; mHeight = height; }
public Teleport(Level level) : base(level) { mWidth = 20; mHeight = 20; mEntry = new Polygon(level); mEntry.X = 50; mEntry.Y = 50; }
private void WriteEntry(XmlWriter xmlWriter, LevelEntry entry) { xmlWriter.WriteStartElement("Entry"); xmlWriter.WriteAttributeString("type", entry.Type.ToString()); WriteLevelChild(xmlWriter, entry); //Write properties xmlWriter.WriteEndElement(); }
public override void ReadData(BinaryReader br, int version) { FlagGroup fA = new FlagGroup(br.ReadByte()); mWidth = br.ReadInt32(); mHeight = br.ReadInt32(); if (fA[1]) br.ReadInt16(); if (fA[3]) br.ReadInt32(); if (fA[5]) br.ReadInt32(); if (fA[4]) { mEntry = LevelEntryFactory.CreateLevelEntry(br, version); } if (fA[2]) { X = br.ReadSingle(); Y = br.ReadSingle(); } if (fA[6]) { br.ReadSingle(); br.ReadSingle(); } }
public PegInfo(LevelEntry parent, bool canBeOrange, bool quickDisappear) : this(parent) { mVariable = canBeOrange; mCrumble = quickDisappear; }
public PegInfo(LevelEntry parent) { mParent = parent; }
public DrawEditorTool(LevelEntry le, bool draw) { mEntry = le; mDraw = draw; }
public override void MouseDown(MouseButtons button, Point location, Keys modifierKeys) { Level level = Editor.Level; Point vl = Editor.Level.GetVirtualXY(location); //Get the pegs at this point LevelEntry[] les = level.GetObjectsIn(new RectangleF(vl.X, vl.Y, 1, 1)); //Get top most object LevelEntry top_le = null; if (les.Length > 0) { top_le = les[les.Length - 1]; } //Select the one thats already selected if possible LevelEntry le = null; foreach (LevelEntry entry in les) { if (Editor.SelectedEntries.Contains(entry)) { le = entry; break; } } if (top_le != le) le = null; //Select whatever one is there if (le == null && les.Length > 0) le = top_le; //Did we click on an object if (le != null) { if (Editor.SelectedEntries.Contains(le)) { } else { //Unless control is down, clear selection if ((modifierKeys & Keys.Control) == 0) Editor.SelectedEntries.Clear(); //Add the new peg to the selection Editor.SelectedEntries.Add(le); } if (button == MouseButtons.Left) { //Set the selection start to here mSelectionStart = location; //Store all the original poisitons of the objects mObjectPoints.Clear(); for (int i = 0; i < Editor.SelectedEntries.Count; i++) { LevelEntry objs = Editor.SelectedEntries[i]; mObjectPoints.Add(new PointF(objs.X, objs.Y)); } //We are moving the pegs mDragObject = le; mMovingObjects = true; mFirstObjectMovement = true; } } else { Editor.SelectedEntries.Clear(); //Start selection rectangle mSelectionStart = location; mSelecting = true; } Editor.UpdateRedraw(); Editor.CheckSelectionChanged(); }
protected void CloneTo(LevelEntry dest) { dest.mX = mX; dest.mY = mY; if (HasPegInfo) { dest.mPegInfo = (PegInfo)mPegInfo.Clone(); dest.mPegInfo.Parent = dest; } if (HasMovementInfo) dest.mMovement = (Movement)mMovement.Clone(); dest.mImageFilename = mImageFilename; dest.mID = mID; dest.mLogic = mLogic; dest.mCollision = mCollision; dest.mVisible = mVisible; dest.mCanMove = mCanMove; dest.mBackground = mBackground; dest.mBallStopReset = mBallStopReset; dest.mForeground = mForeground; dest.mDrawSort = mDrawSort; dest.mForeground2 = mForeground2; dest.mDrawFloat = mDrawFloat; dest.mBaseObject = mBaseObject; dest.mRolly = mRolly; dest.mBouncy = mBouncy; dest.mSolidColour = mSolidColour; dest.mOutlineColour = mOutlineColour; dest.mImageDX = mImageDX; dest.mImageDY = mImageDY; dest.mImageRotation = mImageRotation; dest.mSound = mSound; dest.mMaxBounceVelocity = mMaxBounceVelocity; dest.mSubID = mSubID; dest.mFlipperFlags = mFlipperFlags; dest.mShadow = mShadow; }
private void DrawEntrySelection(Graphics g, LevelEntry le) { //Set the pen Pen selectedEntryPen = new Pen(Brushes.White, 1.0f); selectedEntryPen.DashPattern = new float[] { 1, 1 }; Rectangle rect = new Rectangle(); Point p = mLevel.GetActualXY(le.Bounds.Location); rect = Rectangle.Round(le.Bounds); rect.Location = p; rect.Inflate(5, 5); g.DrawRectangle(selectedEntryPen, rect); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (mLevel == null) return; Point virtualLocation = Level.GetVirtualXY(e.Location); LevelEntry entry = Level.GetObjectAt(virtualLocation.X, virtualLocation.Y); if (entry == null) { if (lastOverObject != null) { lastOverObject.MouseOver = false; lastOverObject = null; UpdateRedraw(); } } else { entry.MouseOver = true; if (lastOverObject != entry) { if (lastOverObject != null) lastOverObject.MouseOver = false; lastOverObject = entry; UpdateRedraw(); } } if (mSelectedTool != null) mSelectedTool.MouseMove(e.Button, e.Location, Control.ModifierKeys); }
private int CompareObjectsByY(LevelEntry a, LevelEntry b) { if (a.Y < b.Y) return -1; else if (a.Y > b.Y) return 1; else return 0; }
private int CompareObjectsByX(LevelEntry a, LevelEntry b) { if (a.X < b.X) return -1; else if (a.X > b.X) return 1; else return 0; }
public void AddToSelection(LevelEntry entry) { mSelectedEntries.Add(entry); CheckSelectionChanged(); }
public void UpdatePropertyGrid(LevelEntry[] objects) { mPropertyGrid.SelectedObjects = objects; mPropertyGrid.ExpandAllGridItems(); }
public void UpdateProperties(LevelEntry[] objects) { if (mPropertiesToolWindowInfo == null) return; if (mPropertiesToolWindowInfo.IsDisposed) return; PropertiesToolWindow form = mPropertiesToolWindowInfo.DockableForm as PropertiesToolWindow; form.UpdatePropertyGrid(objects); }