private void UIItem_MouseRightButtonUp(object sender, MouseButtonEventArgs e) { try { Point currentPosition = e.GetPosition(this.Map as UIElement); MovingUI.ReleaseMouseCapture(); isDragging = false; //RoomMoving = false; if (MovingUI != RoomUI) { EnterpriseManagementRelationshipObject <EnterpriseManagementObject> relloc = _Rel.GetSingleRelationship(emg, relConfigItemRefLocation, MovingUI.ModuleId, true); relloc[relConfigItemRefLocation, "X"].Value = (int)currentPosition.X - (int)currentUIPosition.X; relloc[relConfigItemRefLocation, "Y"].Value = (int)currentPosition.Y - (int)currentUIPosition.Y; relloc.Commit(); } else { TreeViewItem SelectedItem = (TreeViewItem)ModulesTreeView.SelectedItem; Guid RoomId = (Guid)SelectedItem.Tag; EnterpriseManagementRelationshipObject <EnterpriseManagementObject> relloc = _Rel.GetSingleRelationship(emg, relLoctoLoc, RoomId, false); relloc[relLoctoLoc, "X"].Value = (int)currentPosition.X - (int)currentUIPosition.X; relloc[relLoctoLoc, "Y"].Value = (int)currentPosition.Y - (int)currentUIPosition.Y; relloc.Commit(); } Canvas.SetLeft(MovingUI, (int)currentPosition.X - (int)currentUIPosition.X); Canvas.SetTop(MovingUI, (int)currentPosition.Y - (int)currentUIPosition.Y); MovingUI.RenderTransform = null; } catch (Exception ex) { System.Windows.MessageBox.Show("UIItem_MouseRightButtonUp procedure error : " + ex.Message, "Service Manager", MessageBoxButton.OK, MessageBoxImage.Error); //this.Close(); } }
public void Init() { gameManager = GameManager.Instance; cameraControl = gameManager.CameraControl; if (!cameraControl) { Debug.Log("No CameraControl"); } reticle = cameraControl.GetReticle(); controllerRenderer = reticle.parent.parent.Find("ControllerVisual").GetComponent <Renderer>(); laserRenderer = reticle.parent.GetComponent <Renderer>(); GameObject firingUIPrefab = GameManager.Instance.GetPrefab("FiringUI"); firingUI = (Instantiate(firingUIPrefab) as GameObject).GetComponent <FiringUI>(); GameObject movingUIPrefab = GameManager.Instance.GetPrefab("MovingUI"); movingUI = (Instantiate(movingUIPrefab) as GameObject).GetComponent <MovingUI>(); }
private void UIItem_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { try { //if (RoomMoving == false) //{ MovingUI = sender as MapUIElement; MovingUI.AllowDrop = true; MovingUI.CaptureMouse(); isDragging = true; clickPosition = e.GetPosition(this.Map as UIElement); currentUIPosition = e.GetPosition(MovingUI as UIElement); // } } catch (Exception ex) { System.Windows.MessageBox.Show("UIItem_MouseRightButtonDown procedure error : " + ex.Message, "Service Manager", MessageBoxButton.OK, MessageBoxImage.Error); this.Close(); } }