public void AddObject(ISelectableObject selectableObject) { if (!Objects.Contains(selectableObject)) { Objects.Add(selectableObject); } }
public new void MouseUp(IViewportController viewportController, MouseEventArgs e) { if (Editor.SelectionBox.SelectedObject != null) { Editor.SelectionBox.MouseUp(viewportController, e); } else { Ray ray = viewportController.CreateViewportRay(e.X, e.Y); ISelectableObject selectedObject = null; float d = float.MaxValue; foreach (ISelectableObject selectable in Editor.SelectableObjects) { Pair <bool, float> pair = selectable.RayIntersects(ray, viewportController); if (pair.first && pair.second < d) { d = pair.second; selectedObject = selectable; } } Editor.SelectionBox.SelectedObject = selectedObject; } }
public override void OtherObjectSelected(ISelectableObject selectedObject) { if (selectedObject is IInventoryTourist) { Deselect(); } }
public GameObjectSizingAction(Point ptBegin, Point ptEnd, int sizingValue, ISelectableObject shape) { this.ptBegin = ptBegin; this.ptEnd = ptEnd; this.sizingValue = sizingValue; this.shape = shape; }
public void ObjectSelected(ISelectableObject newlySelectedObject) { for (int i = 0; i < SelectedObjects.Count; i++) { SelectedObjects[i].OtherObjectSelected(newlySelectedObject); } SelectedObjects.Add(newlySelectedObject); }
public void SizingGameObject(Point ptBegin, Point ptEnd, int sizingValue, ISelectableObject shape) { if (ptBegin == ptEnd) { return; } var action = new GameObjectSizingAction(ptBegin, ptEnd, sizingValue, shape); HandlePushAction(action, false); }
public void MovingGameObject(int moveX, int moveY, ISelectableObject shape) { if (moveX == moveY && moveX == 0) { return; } var action = new GameObjectMovingAction(moveX, moveY, shape); HandlePushAction(action, false); }
/// <summary> /// 取消对象选择 /// </summary> /// <param name="obj"></param> /// <returns></returns> public ISelectableObject Remove(ISelectableObject obj) { if (!this.SelectionObjects.Contains(obj)) { return(obj); } this.SelectionObjects.Remove(obj); obj.Selected(false); return(obj); }
/// <summary> /// 添加选择对象 /// </summary> /// <param name="obj"></param> /// <returns></returns> public ISelectableObject Add(ISelectableObject obj) { if (this.SelectionObjects.Contains(obj)) { return(obj); } this.SelectionObjects.Add(obj); obj.Selected(true); return(obj); }
public void SingleSelect(ISelectableObject selectableObject) { if (SingleSelectedObject != null && !SingleSelectedObject.Equals(null)) { SingleSelectedObject.OnSingleUnselected(); } SingleSelectedObject = selectableObject; SingleSelectedObject.OnSingleSelected(); }
public void OnPointToAnotherObject(ISelectableObject anotherObject) { if (anotherObject is Ship) { Debug.Log("Another ship."); } else if (anotherObject is Planet) { Debug.Log("Planet " + ((Planet)anotherObject).Name); } }
// Update is called once per frame void Update() { if (Input.touchCount > 0) { Touch touch = Input.GetTouch(0); Vector2 tPos = touch.position; if (touch.phase == TouchPhase.Began) { Ray ray = arcamera.ScreenPointToRay(tPos); if (Physics.Raycast(ray, out RaycastHit hit)) { //Destroy(hit.transform.gameObject); ISelectableObject selected = hit.transform.gameObject.GetComponent <ISelectableObject>(); if (selected != null) { if (selected.IsSelected == false) { selected.OnSelectEnter(); } else { selected.OnSelectExit(); } selected.IsSelected = !selected.IsSelected; } } } List <ARRaycastHit> hits = new List <ARRaycastHit>(); if (raycastManager.Raycast(tPos, hits, TrackableType.PlaneWithinPolygon)) { Pose pose = hits[0].pose; if (placed == null) { placed = Instantiate(player); placed = Instantiate(level, pose.position, Quaternion.identity); planeManager.planePrefab = null; foreach (var plane in planeManager.trackables) { plane.gameObject.SetActive(false); } } } } }
public void SetLocation(ISelectableObject thisImage, double x, double y) { View thisView; thisView = (View)thisImage; Rectangle thisRect; thisRect = new Rectangle(x, y, thisView.WidthRequest, thisView.HeightRequest); if (thisView.Width == 0) { throw new BasicBlankException("The width can't be 0"); } SetLayoutBounds((View)thisImage, thisRect); }
public void MultiSelect(ISelectableObject selectableObject) { if (MultiSelectedObjects.Contains(selectableObject)) { MultiSelectedObjects.Remove(selectableObject); if (!selectableObject.Equals(null)) { selectableObject.OnMultiUnselected(); } } else { if (selectableObject.Equals(null)) { return; } MultiSelectedObjects.Add(selectableObject); selectableObject.OnMultiSelected(); } }
public bool MouseDown(IViewportController viewportController, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.mouseDownPos = viewportController.MouseToGrid(e.X, e.Y); this.selectedGrip = this.GetSelectedGrip(viewportController, e.X, e.Y); // create a new box if (this.selectedGrip == ResizableBox.MG_NONE) { this.selectedObject = null; this.min = mouseDownPos; this.max = mouseDownPos; if (this.isCreated) { this.Destroy(); } } } return(this.selectedGrip != ResizableBox.MG_NONE); }
/// <summary> /// 预览鼠标下的对象 /// </summary> private void PreviewSelect() { var obj = MouseRayHitObj(); if (obj != null && !Contains(obj)) { if (this.previewObject == null) { this.previewObject = obj; obj.PreviewSelect(true); return; } else { return; } } if (this.previewObject != null) { this.previewObject.PreviewSelect(false); this.previewObject = null; } }
public async Task DoAnimateAsync(ISelectableObject thisImage) { thisImage.IsSelected = false; GameBoard !.Clear(); GameBoard.AddChild(thisImage); try { GameBoard.SetLocation(thisImage, LocationFrom.X, LocationFrom.Y); } catch (Exception ex) { UIPlatform.ShowError(ex.Message); return; } _startX = (int)LocationFrom.X; // myLocation.X _startY = (int)LocationFrom.Y; // myLocation.Y _destinationX = (int)LocationTo.X; _destinationY = (int)LocationTo.Y; var temps = LongestTravelTime / _interval; _totalSteps = (int)temps; _image = thisImage; await RunAnimations(); }
public void AddChild(ISelectableObject thisImage) { Children.Add((View)thisImage); }
public void ObjectDeselected(ISelectableObject deselectedObject) { SelectedObjects.Remove(deselectedObject); }
public override void OtherObjectSelected(ISelectableObject selectedObject) { }
public bool MouseDown(IViewportController viewportController, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.mouseDownPos = viewportController.MouseToGrid(e.X, e.Y); this.selectedGrip = this.GetSelectedGrip(viewportController, e.X, e.Y); // create a new box if (this.selectedGrip == ResizableBox.MG_NONE) { this.selectedObject = null; this.min = mouseDownPos; this.max = mouseDownPos; if (this.isCreated) this.Destroy(); } } return this.selectedGrip != ResizableBox.MG_NONE; }
public void RemoveObject(ISelectableObject selectableObject) { Objects.Remove(selectableObject); }
/// <interface>ISelectionManager</interface> /// <summary> /// Sets the selection. /// </summary> /// <param name="selectableObject">The array of ISelectableObject values to select.</param> public void SetSelection(ISelectableObject[] selectableObjects) { }
public bool ContainsObject(ISelectableObject selectableObject) { return(Objects.Contains(selectableObject)); }
/// <interface>ISelectionManager</interface> /// <summary> /// Sets the selection. /// </summary> /// <param name="selectableObject">The ISelectableObject value to select.</param> public void SetSelection(ISelectableObject selectableObject) { }
public override void OnSelectableEnter(ISelectableObject selectableObject) { throw new System.NotImplementedException(); }
public void OnMouseMove(PointF screenLocation) { if ([email protected]) { return; } if (_mouseManager.Active) { PointF oldFirstCorner = _mouseManager.FirstCorner; _mouseManager.FirstCorner = _mouseManager.SecondCorner; _mouseManager.SecondCorner = _convertWorldView.GetWorldPoint(screenLocation); switch (_modifiledObjectState) { case ModifiledObjectState.None: break; case ModifiledObjectState.Moving: if (@interface.CurrentObject != null) { @interface.CurrentObject.Move(_mouseManager.Delta); @interface.RefreshCanvas(); } break; case ModifiledObjectState.Sizing: if (@interface.CurrentObject != null) { @interface.CurrentObject.SetSizing(_prepareSizingValue, _mouseManager.FirstCorner.ToPoint(), _mouseManager.SecondCorner.ToPoint()); @interface.RefreshCanvas(); } @interface.RefreshCanvas(); break; case ModifiledObjectState.Selecting: _mouseManager.FirstCorner = oldFirstCorner; var r = @interface.SelectingRect = _mouseManager.BoudingRect; if (@interface.CurrentObject == null) { @interface.CurrentObject = new GroupSelectable(); @interface.AddLayerObject(@interface.CurrentObject); } try { if ([email protected]) { @interface.CurrentObject.Objects.RemoveAll(obj => ((GameObject)obj).Active == false || (!obj.BoudingRect.IntersectsWith(r)) ); } foreach (GameObject obj in @interface.Objects.Objects) { if (!obj.Active) { continue; } if ([email protected](obj) && obj.BoudingRect.IntersectsWith(r)) { @interface.CurrentObject.Objects.Add(obj); } } } catch { } @interface.RefreshCanvas(); break; } _mouseManager.FirstCorner = oldFirstCorner; } else { _prepareObject = null; var ptWorld = _convertWorldView.GetWorldPoint(screenLocation); var objCanSelectByPoint = @interface.Objects.ObjectCanSelectByPoint(ptWorld); if (objCanSelectByPoint != null) { @interface.SelectCursor = Cursors.SizeAll; _modifiledObjectState = ModifiledObjectState.Moving; if (@interface.CurrentObject == null) { _prepareObject = objCanSelectByPoint; } else { if (@interface.CurrentObject.ContainsObject(objCanSelectByPoint)) { _prepareSizingValue = @interface.CurrentObject.SizingPointValue(ptWorld); if (_prepareSizingValue != -1) { _modifiledObjectState = ModifiledObjectState.Sizing; @interface.SelectCursor = PointSizeValueHelper.GetCursor(_prepareSizingValue); } } else { _prepareObject = objCanSelectByPoint; } } } else { _modifiledObjectState = ModifiledObjectState.None; } } }
public static void SelectUnselectItem(this ISelectableObject thisItem) { thisItem.IsSelected = !thisItem.IsSelected; }
public bool Contains(ISelectableObject obj) => this.SelectionObjects.Contains(obj);
public override void OtherObjectSelected(ISelectableObject selectedObject) { throw new System.NotImplementedException(); }
public void OnPointToAnotherObject(ISelectableObject anotherObject) { }
public GameObjectMovingAction(int moveX, int moveY, ISelectableObject shape) { this.moveX = moveX; this.moveY = moveY; this.shape = shape; }
public void Initialize(ISelectableObject selectableObject) { isInitialized = true; SelectionManager.RegisterSelectableObject(this); currentSelectableObject = selectableObject; }