public MapUserControl(HomeUserControl home) { InitializeComponent(); LoginTools.CheckConnection(); HomeUserControl = home; _db = new DataBase(); _cursorAction = CursorAction.Default; _moving = false; _offsetMoving = new Point(); FillListsControlsDromDb(); LoadLocationsFromDb(); if (!_db.App.Any(m => m.Fond_Image != null)) { _mode = MapMode.LoadImage; } else { MemoryStream ms = new MemoryStream(_db.App.FirstOrDefault().Fond_Image); var imageJpeg = Image.FromStream(ms); _image = new Bitmap(imageJpeg); ms.Close(); pictureBox.Image = _image; _mode = MapMode.Normal; } ChangeMode(_mode); }
public static string ToRichTextString(this CursorAction action) { string res; switch (action) { case CursorAction.Activate: res = "<color=orange>Activate</color>"; break; case CursorAction.Move: res = "<color=white>Move</color>"; break; case CursorAction.Use: res = "<color=orange>Use</color>"; break; case CursorAction.Pick: res = "<color=orange>Pick</color>"; break; case CursorAction.PlaceItem: res = "<color=cyan>Place item</color>"; break; default: res = ""; break; } return(res); }
private void chart_MouseUp(object sender, MouseEventArgs e) { if (FileType == 8) { return; } chart.Invalidate(); //chart.Cursor = System.Windows.Forms.Cursors.Cross; cursorAction = CursorAction.Unknown; }
public void SetAction(CursorAction type, bool repeat, int?animation = null) { if (type == this.type) { return; } this.type = type; this.tick = Core.Tick; this.repeat = repeat; this.currentAction = animation ?? (int)type; this.currentFrame = 0; var action = act.actions[currentAction]; this.currentFrameTime = action.delay / 1000f; }
private void PullAction() { // Check to see if the agent has queued any // additional actions. if (actions.Count > 0) { pathIndex = 1; actionState = ActionState.MovingTowardsStart; // Load and begin new action. currentAction = actions[0]; actions.RemoveAt(0); UpdateContext.Update += OnUpdateToStart; } else { ActionsExhausted?.Invoke(); actionState = ActionState.AwaitingAction; } }
private void chart_MouseDown(object sender, MouseEventArgs e) { if (FileType == 8) { return; } if (e.Button == System.Windows.Forms.MouseButtons.Left) { if ((e.X >= m_X) && (e.Y >= m_Y) && (e.X <= (m_X + m_Width)) && (e.Y <= (m_Y + m_Height)) && e.X > (m_X + m_CursorPointY1.X - 5) && e.X < (m_X + m_CursorPointY1.X + 5) && e.Y > (m_Y + m_CursorPointY1.Y - 5) && e.Y < (m_Y + m_CursorPointY1.Y + 5)) { m_CursorPointY1.X = e.X - m_X; m_CursorPointY1.Y = e.Y - m_Y; cursorAction = CursorAction.Y1; } else if (e.Y > (m_Y - 10) && e.Y < m_Y && e.X < (m_X + m_CursorPointY1.X + 5) && e.X > (m_X + m_CursorPointY1.X - 5)) { m_CursorPointY1.X = e.X - m_X; cursorAction = CursorAction.Y1; } else if ((e.X >= m_X) && (e.Y >= m_Y) && (e.X <= (m_X + m_Width)) && (e.Y <= (m_Y + m_Height)) && e.X > (m_X + m_CursorPointY2.X - 5) && e.X < (m_X + m_CursorPointY2.X + 5) && e.Y > (m_Y + m_CursorPointY2.Y - 5) && e.Y < (m_Y + m_CursorPointY2.Y + 5)) { m_CursorPointY2.X = e.X - m_X; m_CursorPointY2.Y = e.Y - m_Y; cursorAction = CursorAction.Y2; } else if (e.Y > (m_Y - 10) && e.Y < m_Y && e.X < (m_X + m_CursorPointY2.X + 5) && e.X > (m_X + m_CursorPointY2.X - 5)) { m_CursorPointY2.X = e.X - m_X; cursorAction = CursorAction.Y2; } else { cursorAction = CursorAction.Unknown; } } }
/// <summary> /// Adds a new action to the agent cursor controller. /// </summary> /// <param name="action">The cursor action to perform.</param> /// <param name="priority">When should this action be performed.</param> public void AddAction(CursorAction action, OrderPriority priority) { // Check for invalid action. if (action.path == null) { throw new ArgumentNullException("action.path", "Path must have at least two points."); } else if (action.path.Length < 2) { throw new ArgumentException("Path must have at least two points.", "action.path"); } if (isEnabled) { // Add the action based on the action // priority. switch (priority) { case OrderPriority.Queued: actions.Add(action); break; case OrderPriority.Immediate: actions.Insert(0, action); break; default: // Throw if order priority enum is updated, // but the appropriate behavior has not been // added for this switch block. throw new NotImplementedException(); } // If the controller is not performing an // action, start its Update routine. if (actionState == ActionState.AwaitingAction) { PullAction(); } } }
public static string ToString(this CursorAction action) { string res; switch (action) { case CursorAction.Activate: res = "Activate"; break; case CursorAction.Move: res = "Move"; break; case CursorAction.Use: res = "Use"; break; case CursorAction.Pick: res = "Pick"; break; case CursorAction.PlaceItem: res = "Place item"; break; case CursorAction.Custom: res = ""; break; default: res = ""; break; } return(res); }
internal AboutToLeftDoubleClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
internal AboutToRightClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
internal InitialMiniClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
protected override QModelIndex MoveCursor(CursorAction cursorAction, uint modifiers) { return(new QModelIndex()); }
internal InitialLeftDoubleClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
private void CategoriesCheckedListBox_MouseUp(object sender, MouseEventArgs e) { _cursorAction = CursorAction.Default; Refresh(); }
private void PictureBox_MouseMove(object sender, MouseEventArgs e) { if (SelectedLocation != null) { RectangleF position = SelectedLocation.Position; if (_mode == MapMode.Edit) { if (!_moving) { if (new RectangleF(position.X - 2, position.Y, 4, position.Height).Contains(e.Location)) { Cursor = Cursors.SizeWE; _cursorAction = CursorAction.ResizeW; } else if (new RectangleF(position.X + position.Width, position.Y, 4, position.Height).Contains(e.Location)) { Cursor = Cursors.SizeWE; _cursorAction = CursorAction.ResizeE; } else if (new RectangleF(position.X, position.Y - 2, position.Width, 4).Contains(e.Location)) { Cursor = Cursors.SizeNS; _cursorAction = CursorAction.ResizeN; } else if (new RectangleF(position.X, position.Y + position.Height, position.Width, 4).Contains(e.Location)) { Cursor = Cursors.SizeNS; _cursorAction = CursorAction.ResizeS; } else if (position.Contains(e.Location)) { Cursor = Cursors.SizeAll; _cursorAction = CursorAction.Move; } else { Cursor = Cursors.Default; } } } else { Cursor = Cursors.Default; } } else { Cursor = Cursors.Default; } if (_moving && SelectedLocation != null) { PointF newPosition = new Point(); bool move = false; switch (_cursorAction) { case CursorAction.Move: { PointF movePoint = new PointF { X = e.Location.X - _offsetMoving.X, Y = e.Location.Y - _offsetMoving.Y }; if (movePoint.X < 0) { movePoint.X = 0; } if (movePoint.Y < 0) { movePoint.Y = 0; } if (movePoint.X > (pictureBox.Width - SelectedLocation.Position.Width)) { movePoint.X = pictureBox.Width - SelectedLocation.Position.Width; } if (movePoint.Y > (pictureBox.Height - SelectedLocation.Position.Height)) { movePoint.Y = pictureBox.Height - SelectedLocation.Position.Height; } SelectedLocation.Move(movePoint, pictureBox); } break; case CursorAction.ResizeE: { SizeF newSize = new SizeF { Height = _oldSize.Height, Width = _oldSize.Width + (e.Location.X - _startClick.X) }; SelectedLocation.Resize(newSize, pictureBox); } break; case CursorAction.ResizeN: { newPosition.Y = e.Location.Y; newPosition.X = _oldPosition.X; SizeF newSize = new SizeF { Height = _oldSize.Height - (e.Location.Y - _startClick.Y), Width = _oldSize.Width }; SelectedLocation.Resize(newSize, pictureBox); move = true; } break; case CursorAction.ResizeS: { SizeF newSize = new SizeF { Height = _oldSize.Height + (e.Location.Y - _startClick.Y), Width = _oldSize.Width }; SelectedLocation.Resize(newSize, pictureBox); } break; case CursorAction.ResizeW: { newPosition.Y = _oldPosition.Y; newPosition.X = e.Location.X; SizeF newSize = new SizeF { Height = _oldSize.Height, Width = _oldSize.Width - (e.Location.X - _startClick.X) }; SelectedLocation.Resize(newSize, pictureBox); move = true; } break; case CursorAction.Default: break; default: throw new ArgumentOutOfRangeException(); } if (SelectedLocation.Location.Taille_X < 1) { SelectedLocation.Location.Taille_X = 1; move = false; } if (SelectedLocation.Location.Taille_Y < 1) { SelectedLocation.Location.Taille_Y = 1; move = false; } if (move) { SelectedLocation.Move(newPosition, pictureBox); } pictureBox.Refresh(); } }
internal NotAboutToMiniClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
internal ShouldLeftDoubleClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
/// <summary> /// Called whenever the gvr reticle pointer enter an object /// </summary> /// <param name="cursorAction">Cursor action.</param> /// <param name="gameObject">Game object.</param> void OnReticlePointerEnter(CursorAction cursorAction, GameObject gameObject) { this.GetComponent <Text>().text = cursorAction.ToRichTextString(); }
/// <summary> /// Called whenever the gvr reticle pointer exits an object /// </summary> /// <param name="cursorAction">Cursor action.</param> /// <param name="gameObject">Game object.</param> void OnReticlePointerExit(CursorAction cursorAction, GameObject gameObject) { this.GetComponent <Text> ().text = ""; }
protected override QModelIndex MoveCursor(CursorAction cursorAction, uint modifiers) { return new QModelIndex(); }
internal ShouldRightClickState(CursorAction<FaceState> cursorAction) : base(cursorAction) { }
public static void DispatchMouseEvent(CursorAction cursorAction) { mouse_event(cursorAction.ActionFlags, cursorAction.DX, cursorAction.DY, cursorAction.ActionData, cursorAction.ExtraInfo); }