public void SetDragger(DraggerView draggerView) { RemoveDragger(); if (draggerView == null) { return; } this.draggerView = draggerView; this.dragger = draggerView.HitObject; SetParent(draggerView); // Override judgement end time so it doesn't go over any other nested object's start time // nor the dragger's end time. judgeEndTime = Mathf.Min(judgeEndTime, dragger.EndTime); foreach (var o in dragger.NestedObjects) { if (o != hitObject) { judgeEndTime = Mathf.Min(judgeEndTime, o.StartTime); } } // Reset to initial position Position = Vector3.zero; }
Vector3 mouse_offset; // distance between mouse and position of object void Start() { // find the local player's dragger component dragger = GetComponent <NetworkUtility>().GetLocalPlayer().GetComponent <Dragger>(); // find distance between camera and board camera_offset = new Vector3(0, 0, GameObject.Find("Main Camera").transform.position.z * -1); }
protected virtual void OnLevelLoaded () { if (Dragger.Instance != null && Dragger.Instance != this) { KiltUtils.Destroy (Dragger.Instance.gameObject); } Dragger.Instance = this; }
private void List_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var child = e.OriginalSource as DependencyObject; DependencyObject parent = null; do { parent = VisualTreeHelper.GetParent(child); if (parent == null || parent is ContentPresenter) { break; } child = parent; } while (true); if (parent == null) { return; } index = list.ItemContainerGenerator.IndexFromContainer(parent); Dragger.SetIsDragged(parent, true); var pos = Mouse.GetPosition(list); initPos = pos.X; }
public MinimapView() { capabilities = Capabilities.Movable; m_Dragger = new Dragger { clampToParentEdges = true }; this.AddManipulator(m_Dragger); //label = new Label("Minimap"); //Add(label); //label.RegisterCallback<MouseDownEvent>(EatMouseDown); m_Resizer = new ResizableElement(); m_Resizer.SetResizerWidth(4); Add(m_Resizer); RegisterCallback <MouseDownEvent>(OnMouseDown); this.AddManipulator(new ContextualMenuManipulator(BuildContextualMenu)); this.AddStyleSheet("uNodeStyles/Minimap"); minimapType = UIElementUtility.Theme.minimapType; var rect = UIElementUtility.Theme.minimapPosition; style.left = rect.x; style.top = rect.y; style.width = rect.width; style.height = rect.height; this.RegisterRepaintAction(DrawContent); }
private void List_PreviewMouseMove(object sender, MouseEventArgs e) { if (index > -1) { var item = list.ItemContainerGenerator.ContainerFromIndex(index) as FrameworkElement; var pos = Mouse.GetPosition(list); Dragger.SetDragPosition(item, pos.X - initPos); var data = DataContext as IList; if (index > 0) // Не пересёк ли середину левого элемента { var item2 = list.ItemContainerGenerator.ContainerFromIndex(index - 1) as FrameworkElement; if (pos.X - initPos < -item2.ActualWidth * 0.6) { // Меняем элементы местами if (data.IsFixedSize) { var dataItem = data[index - 1]; data[index - 1] = data[index]; data[index] = dataItem; } else { var dataItem = data[index - 1]; data.RemoveAt(index - 1); data.Insert(index, dataItem); } initPos -= item2.ActualWidth; index--; return; } } if (index < data.Count - 1) // Не пересёк ли середину правого элемента { var item2 = list.ItemContainerGenerator.ContainerFromIndex(index + 1) as FrameworkElement; if (pos.X - initPos > item2.ActualWidth * 0.6) { // Меняем элементы местами if (data.IsFixedSize) { var dataItem = data[index + 1]; data[index + 1] = data[index]; data[index] = dataItem; } else { var dataItem = data[index + 1]; data.RemoveAt(index + 1); data.Insert(index, dataItem); } initPos += item2.ActualWidth; index++; } } } }
public override void Update() { Dragger.Update(); if (Time.frameCount % (60 * 60) == 0) // 'bout every minute { DesignatorContextMenuController.CheckForMemoryLeak(); } }
void Start() { _dragger = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Dragger>(); if (_dragger == null) { Debug.LogError("The Dragger component needs to be on Main Camera to keep shit from breaking :/"); } }
protected override void Setup() { base.Setup(); ResourceCache.AddResourceDir("C:\\Users\\sebastian.quelcutti\\OneDrive - collinson365\\Documents\\Visual Studio 2019\\Temp_Projects\\WindowsFormsApp1\\Assets", 0); _dragger = new Dragger(); }
public Form1() { InitializeComponent(); _dragger = new Dragger(this); panel1.MouseMove += _dragger.MouseMoved; panel1.MouseDown += panel1_MouseDown; panel1.MouseUp += panel1_MouseUp; }
protected virtual void OnLevelLoaded() { if (Dragger.Instance != null && Dragger.Instance != this) { KiltUtils.Destroy(Dragger.Instance.gameObject); } Dragger.Instance = this; }
private void panelSelect_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { //Console.WriteLine("MouseDown,X:" + e.X + "Y:" + e.Y); dragger = new Dragger(this.panelSource, this.panelSelect, e.Location); } }
protected override void UseItemData() { icon.sprite = ResourceMgr.GetAsset <Sprite>( ItemData.spriteName ); dragger = transform.GetOrAddComponent <Dragger>(); selfRect = transform.GetComponent <RectTransform>(); }
protected override void Setup() { base.Setup(); ResourceCache.AddResourceDir("E:\\VSProjects\\Windows\\Pulsar\\Assets", 0); _dragger = new Dragger(); ActionManager = new ActionManager(); }
public void RemoveDragger() { if (draggerView == null) { return; } SetParent(draggerView.Parent); draggerView = null; dragger = null; }
private Dragger CreateDragger(ItemBase item) { Dragger d = (Dragger)Instantiate(res.dragger); d.sprite.color = colors[item.index]; d.tr.parent = item.transform; d.tr.localPosition = Vector3.up * 4; d.tr.localRotation = Quaternion.identity; d.m_transform = item.transform; return(d); }
private void dragger_MouseUp(object sender, MouseButtonEventArgs e) { if (e.OriginalSource.GetType() == typeof(Image)) { Dragger.Source = _imgCrosshair; Dragger.Cursor = Cursors.Cross; _isMove = false; Dragger.ReleaseMouseCapture(); CrosshairDragged?.Invoke(this, e); } }
private void EndDrag() { if (index > -1) { var item = list.ItemContainerGenerator.ContainerFromIndex(index); Dragger.SetIsDragged(item, false); Dragger.SetDragPosition(item, 0); index = -1; } }
void Start() { gameController = FindObjectOfType <GameController>(); gameController.zoomOutTriggered += playAnimation; gameController.zoomInTriggered += stopAnimation; gameController.swipeTriggered += firstSwipe; Dragger dragger = triggeringDragger.GetComponent <Dragger>(); dragger.dragTriggered += firstSwipe; gestureAnimator = GetComponent <Animator>(); }
private void dragger_MouseDown(object sender, MouseButtonEventArgs e) { if (e.OriginalSource.GetType() == typeof(Image)) { //Image image = e.OriginalSource as Image; _isMove = true; Dragger.Source = null; Dragger.Cursor = _myCursor; Dragger.CaptureMouse(); } }
private void Awake() { if (Instance == null) { Instance = this; } else if (Instance != this) { Debug.Log("instance already exists, destroying object!"); Destroy(this); } }
/// <summary> /// Initializes a new instance of the <see cref="ToolWindow"/> class. /// </summary> /// <param name="parent">Parent control.</param> public ToolWindow(ControlBase parent) : base(parent) { m_DragBar = new Dragger(this); m_DragBar.Target = this; m_DragBar.SendToBack(); Vertical = false; m_InnerPanel = new InnerContentControl(this); m_InnerPanel.SendToBack(); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } cam = Camera.main; }
private void panelSelect_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { //Console.WriteLine("MouseUp,X:" + e.X + "Y:" + e.Y); if (dragger != null) { dragger.End(e.Location); } dragger = null; } }
void BuildManipulators() { m_Dragger = new Dragger { clampToParentEdges = true }; RegisterCallback <MouseUpEvent>(OnMoved); this.AddManipulator(m_Dragger); var resizeElement = this.Q <ResizableElement>(); resizeElement.BindOnResizeCallback(OnWindowResize); hierarchy.Add(resizeElement); }
private void RenderScene_Resize(object sender, EventArgs e) { //update the main dragger IntVector2 surfaceDimensions = new IntVector2(_renderSurface.Width, _renderSurface.Height); if (MainApplication != null) { Dragger dragger = MainApplication.GetDragger(); if (dragger != null) { dragger.SurfaceDimensions = surfaceDimensions; } } }
private void dragger_MouseDown(object sender, MouseButtonEventArgs e) { if (e.OriginalSource.GetType() == typeof(Image)) { //Image image = e.OriginalSource as Image; _isMove = true; Dragger.Source = null; if (_myCursor == null) { // use file path to avoid System.IO.IOException caused by GetTempFileName in System.Windows.Input.Cursor.LoadFromStream _myCursor = new Cursor(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets\\crosshair.cur")); } Dragger.Cursor = _myCursor; Dragger.CaptureMouse(); } }
protected override void Initialize() { draggerUL = new Dragger(this); draggerUL.PositionChanged += OnDraggerPositionChanged; this.Components.Add(draggerUL); draggerUR = new Dragger(this); draggerUR.PositionChanged += OnDraggerPositionChanged; this.Components.Add(draggerUR); draggerLL = new Dragger(this); draggerLL.PositionChanged += OnDraggerPositionChanged; this.Components.Add(draggerLL); base.Initialize(); }
public SpeechBubble(Camera camera, float leftToRightSwitchOverPosition) { this.camera = camera; this.leftToRightSwitchOverPosition = leftToRightSwitchOverPosition; speechBubble = Sprite.create("SceneFour/bubble"); speechBubbleLeft = Sprite.create("SceneFour/bubble_1"); speechBubbleRight = Sprite.create("SceneFour/bubble_2"); speechBubbleRight.visible(false); speechBubble.setWorldPosition(-80f, 60f, -1f); speechBubbleLeft.setWorldPosition(-55f, 50f, -5f); speechBubbleRight.setWorldPosition(-55f, 50f, -5f); speechBubbleRight.transform.Rotate(Vector3.forward * 5); input = new UnityInput(); dragger = new Dragger(input, speechBubble); }
private void RenderScene_Resize(object sender, EventArgs e) { renderSurface.Top = renderSceneTools.Size.Height + 1; renderSurface.Width = Width; renderSurface.Height = Height - (renderSceneTools.Size.Height + renderSurface.Size.Height) - 1; //update the main dragger IntVector2 surfaceDimensions = new IntVector2(Width, Height); if (MainApplication != null) { Dragger dragger = MainApplication.GetDragger(); if (dragger != null) { dragger.SurfaceDimensions = surfaceDimensions; } } }
/// <summary> /// Initializes a new instance of the <see cref="WindowControl"/> class. /// </summary> /// <param name="parent">Parent control.</param> /// <param name="caption">Window caption.</param> /// <param name="modal">Determines whether the window should be modal.</param> public WindowControl(ControlBase parent, string title = "") : base(parent) { m_TitleBar = new Dragger(null) { Height = 24, Target = this, Dock = Dock.Top, Margin = new Margin(0, 0, 0, 6) }; PrivateChildren.Insert(0, m_TitleBar); m_Title = new TitleLabel(m_TitleBar, this) { Alignment = Pos.Left | Pos.Top, Text = title, Dock = Dock.Fill, TextPadding = new Padding(8, 4, 0, 0), TextColor = Skin.Colors.Text.AccentForeground, }; m_CloseButton = new CloseButton(m_TitleBar, this) { Width = 24, Height = 24, Dock = Dock.Right, IsTabable = false, Name = "closeButton" }; m_CloseButton.Clicked += CloseButtonPressed; //Create a blank content control, dock it to the top - Should this be a ScrollControl? // GetResizer(8).Hide(); _resizer_top.Hide(); IsTabable = false; MinimumSize = new Size(100, 50); ClampMovement = true; KeyboardInputEnabled = false; m_Panel.Dock = Dock.Fill; m_Panel.AutoSizeToContents = true; IsHidden = true; HideResizersOnDisable = false; }
public void Update() { if (win.WindowHit) return; var sets = settings.editor; var mpos = Input.mousePosition; mouseMove = new Vector3(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); mouseDrag = new Vector3(mouseMove.x, 0, mouseMove.y) * sets.factorMove * camera.orthographicSize; var move = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")) * sets.factorMove * camera.orthographicSize; var ray = camera.ScreenPointToRay(mpos); Physics.Raycast(ray, out hitpos, 99999, Layer.levelMask); hover = null; { RaycastHit h; if (Physics.Raycast(ray, out h, 99999, 1 << Layer.dragger) && isMaster) hover = h.transform.GetComponent<Dragger>(); } if (!isMaster) curTool = ToolType.Select; var mouse0 = Input.GetMouseButton(0); var mouse1 = Input.GetMouseButton(1); var mouse2 = Input.GetMouseButton(2); var mouseDown0 = Input.GetMouseButtonDown(0); var mouseDown1 = Input.GetMouseButtonDown(1); if (mouseDown0 && hover) dragging = hover; if (!mouse0) dragging = null; camera.orthographicSize -= (mouse1 ? (mouseMove.x - mouseMove.y) * .1f : Input.GetAxis("Mouse ScrollWheel")) * camera.orthographicSize * sets.factorScale; if (dragging) { var zeroY = ZeroY(hitpos.point - dragging.pos); if (zeroY.magnitude > 0) lastForward = dragging.tr.forward = zeroY; dragging.pos = Vector3.Lerp(dragging.pos, _Administration.hitpos.point + Vector3.up, Time.deltaTime * 10); } else { if (mouseDown0 && prefab) { var a = InstantiateSceneObject(prefab.fullName, hitpos.point, Quaternion.LookRotation(lastForward)).GetComponent<ItemBase>(); //var a = (MonoBehaviour)Instantiate(prefab, hitpos.point, Quaternion.LookRotation(ZeroY(bounds.center - hitpos.point))); dragging = CreateDragger(a); } else if (mouse0 || mouse2) cameraTr.position -= mouseDrag; } cameraTr.position += move; if (hover && (mouseDown0 && curTool == ToolType.Delete || mouseDown1)) PhotonNetwork.Destroy(hover.tr.gameObject); }