private void UpdateCanDrag(GraphArea area, bool canDrag) { foreach (var item in area.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, canDrag); } }
public void OnPointerUp(PointerEventData ped) { if (dragging == null || dragging.Equals(null)) { Debug.Log("How did this get hit?(In DragBehaviour)"); } else if (DragCatcher.hovering != null) { if (DragCatcher.hovering.onDragTo != null) { Debug.Log("Hit"); DragCatcher.hovering.onDragTo(dragging); } dragging.image.raycastTarget = true; dragging = null; } else { if (dragging.onRelease != null) { dragging.onRelease(); } dragging.image.raycastTarget = true; dragging = null; } }
/// <summary> /// /// </summary> /// <param name="control"></param> /// <param name="toggle"></param> public virtual void SelectVertex(VertexControl control, bool toggle) { if (control == null) { return; } VertexBase vertex = (VertexBase)control.Vertex; if (selected_vertices_.Contains(vertex)) { if (toggle) { control.SetValue(Selector.IsSelectedProperty, false); DragBehaviour.SetIsTagged(control, false); selected_vertices_.Remove(vertex); vertex_controls_.Remove(vertex); } } else { control.SetValue(Selector.IsSelectedProperty, true); DragBehaviour.SetIsTagged(control, true); selected_vertices_.Add(vertex); vertex_controls_.Add(vertex, control); } }
void tg_dragMoveEdges_Checked(object sender, RoutedEventArgs e) { foreach (var item in tg_Area.VertexList) { DragBehaviour.SetUpdateEdgesOnMove(item.Value, tg_dragMoveEdges.IsChecked != null && tg_dragMoveEdges.IsChecked.Value); } }
public void OnDrop(PointerEventData eventData) { if (!item) { Debug.Log ("Ingresa a item diferente de NULL"); DragBehaviour.itemBeingDragged.transform.SetParent (transform); drag_controller = item.GetComponent<DragBehaviour> (); if (drag_controller != null) { phase_from_button_being_dragged = drag_controller.phase_number; id_of_phase_in_slot = drag_controller.phase_number; Debug.Log ("Fase del boton seleccionado: " + phase_from_button_being_dragged + " en slot: " + phase_for_slot); if (phase_from_button_being_dragged == phase_for_slot) { slot_con_objeto_correcto = true; Debug.Log ("El item se ha colocado en el lugar correcto y se va a NOTIFICAR AL SCRIPT"); } else { slot_con_objeto_correcto = false; Debug.Log ("El item NO se ha colocado correctamente - NO SE NOTIFICA AL SCRIPT"); } //invocando al metodo HasChanged del script CanvasProcessPhasesManagerEval para notificar que un objeto se ha ubicado en el slot: ExecuteEvents.ExecuteHierarchy<IHasChanged> (gameObject, null, (x,y) => x.HasChanged ()); } else Debug.Log ("SlotsBehaviour: NO se ha podido obtener el componente DragBehaviour"); } else { slot_con_objeto_correcto = false; Debug.Log ("En slot: " + this.gameObject.name + " tiene slot_con_objeto_correcto= " + slot_con_objeto_correcto); } }
void erg_recalculate_Checked(object sender, RoutedEventArgs e) { foreach (var item in erg_Area.GetAllVertexControls()) { DragBehaviour.SetUpdateEdgesOnMove(item, erg_recalculate.IsChecked != null && erg_recalculate.IsChecked.Value); } }
public void OnDrop(PointerEventData eventData) { GameObject droppedObject = eventData.pointerDrag; if (droppableObjects.Contains(droppedObject)) { DragBehaviour dragBehaviour = droppedObject.GetComponent <DragBehaviour>(); if (dragBehaviour.GetCanDrag()) { dragBehaviour.ObjectIsSet((positionSnapList[droppableObjects.IndexOf(droppedObject)].position)); dragBehaviour.PlayRightAudio(); if (isSortedAudio) { droppedObject.GetComponent <Image>().sprite = droppedObject.GetComponent <DragBehaviour>().SettedSprite; droppedObject.GetComponent <Image>().raycastTarget = false; dragBehaviour.PlaySortedAudio(); } if (scale) { if (ScaleTo != Vector3.zero) { droppedObject.GetComponent <RectTransform>().localScale = ScaleTo; } else { droppedObject.GetComponent <RectTransform>().localScale = new Vector3(0.3f, 0.3f, 0.3f); } } OnComplete.Invoke(); // particleManager.StartParticles(); if (activityAnalytics != null) { activityAnalytics.AddRight(); } game.AddVictory(true); } } else { if (activityAnalytics != null) { activityAnalytics.AddWrong(); } if (randomFail) { droppedObject.GetComponent <DragBehaviour>().PlayRandomWrongAudio(); } else { droppedObject.GetComponent <DragBehaviour>().PlayWrongAudio(); } } }
private double ExaggeratedSnappingYModifier(GraphAreaBase area, DependencyObject obj, double val) { if (dg_snapExaggerate.IsChecked ?? false) { return(System.Math.Round(val * 0.01) * 100.0); } return(DragBehaviour.GlobalYSnapModifier(area, obj, val)); }
private void EnableDrag() { foreach (var item in gg_Area.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, true); item.Value.EventOptions.PositionChangeNotification = true; item.Value.PositionChanged += Value_PositionChanged; } }
void MoveCard(DragBehaviour behaviour) { PhysicalCard attachedCard = behaviour.GetComponent <PhysicalCard>(); if (attachedCard != null) { attachedCard.card.MoveTo(this); } }
void Start() { dragBehaviour = GetComponent<DragBehaviour>(); if (dragBehaviour == null) throw new Exception("DADItem object has no any DragBehaviour"); dragBehaviour.onPickOverride = OnPick; dragBehaviour.onDragOverride = OnDrag; }
void tst_but_gen_Click(object sender, RoutedEventArgs e) { var _graph = new GraphExample(); /*var v1 = new DataVertex("Start"); * _graph.AddVertex(v1); * var v2 = new DataVertex("End"); * _graph.AddVertex(v2); * var e1 = new DataEdge(v1, v2); * _graph.AddEdge(e1); * * _graph.AddVertex(new DataVertex("Block 1")); * _graph.AddVertex(new DataVertex("Block 2")); */ for (int i = 0; i < 10; i++) { _graph.AddVertex(new DataVertex(i.ToString() + "bldsddd\ndssdsds")); } _graph.AddEdge(new DataEdge(_graph.Vertices.First(), _graph.Vertices.Last())); _graph.AddEdge(new DataEdge(_graph.Vertices.Last(), _graph.Vertices.First())); _graph.AddEdge(new DataEdge(_graph.Vertices.First(), _graph.Vertices.Last())); // Resets external algorithms to null to start new fresh graph given that starting algo is a default algo tst_Area.DefaultEdgeRoutingAlgorithm = EdgeRoutingAlgorithmTypeEnum.None; //tst_Area.DefaultEdgeRoutingAlgorithmParams = tst_Area.AlgorithmFactory.CreateEdgeRoutingParameters(EdgeRoutingAlgorithmTypeEnum.SimpleER); //((SimpleERParameters)tst_Area.DefaultEdgeRoutingAlgorithmParams).BackStep = 10; tst_Area.DefaultOverlapRemovalAlgorithm = OverlapRemovalAlgorithmTypeEnum.FSA; tst_Area.GenerateGraph(_graph, true); /*var vlist = tst_Area.VertexList.Values.ToList(); * vlist[0].SetPosition(new Point(100, 100)); vlist[0].MathShape = VertexShape.Circle; * vlist[1].SetPosition(new Point(600, 100)); * * vlist[2].SetPosition(new Point(400, 100)); * vlist[3].SetPosition(new Point(440, 150)); */ foreach (var item in tst_Area.VertexList) { item.Value.MathShape = VertexShape.Rectangle; DragBehaviour.SetIsDragEnabled(item.Value, true); DragBehaviour.SetUpdateEdgesOnMove(item.Value, true); HighlightBehaviour.SetIsHighlightEnabled(item.Value, true); HighlightBehaviour.SetHighlightControl(item.Value, GraphControlType.VertexAndEdge); HighlightBehaviour.SetHighlightEdges(item.Value, EdgesType.All); } foreach (var item in tst_Area.EdgesList.Values) { HighlightBehaviour.SetHighlightControl(item, GraphControlType.VertexAndEdge); HighlightBehaviour.SetHighlightEdges(item, EdgesType.All); HighlightBehaviour.SetHighlightControl(item, GraphControlType.VertexAndEdge); } }
void Awake() { attachedDrag = GetComponent <DragBehaviour>(); attachedClick = GetComponent <ClickBehaviour>(); image = transform.GetChild(1).GetComponent <Image>(); highlight = GetComponent <Image>(); text = transform.GetChild(2).GetComponentInChildren <Text>(); costBanner = image.transform.GetChild(0).gameObject; typeBanner = transform.GetChild(3).GetComponent <Image>(); grayout = transform.GetChild(4).gameObject; }
protected override void CreateVertexControl(DisplayNode vertex) { base.CreateVertexControl(vertex); var newControl = VertexControls[vertex]; var isDrag = DragBehaviour.GetIsDragEnabled(newControl); DragBehaviour.SetIsDragEnabled(newControl, false); // newControl.MouseLeftButtonUp += OnVertexControlMouseLeftButtonUp; DragBehaviour.SetIsDragEnabled(newControl, isDrag); }
private void Awake() { m_Rigidbody = GetComponent <Rigidbody>(); m_Transform = GetComponent <Transform>(); m_DragBehaviour = GetComponent <DragBehaviour>(); m_DragBehaviour.OnDragStart += OnDragStart; m_DragBehaviour.OnDragStop += OnDragStop; selectionMaterial = selectableRender.material; }
void GraphArea_RelayoutFinished(object sender, EventArgs e) { ZoomBox.ZoomToFill(); ZoomBox.Mode = GraphX.Controls.ZoomControlModes.Custom; foreach (var item in GraphArea.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, true); item.Value.EventOptions.PositionChangeNotification = true; } GraphArea.ShowAllEdgesLabels(); GraphArea.InvalidateVisual(); }
private static void SelectVertex(DependencyObject vc) { if (DragBehaviour.GetIsTagged(vc)) { HighlightBehaviour.SetHighlighted(vc, false); DragBehaviour.SetIsTagged(vc, false); } else { HighlightBehaviour.SetHighlighted(vc, true); DragBehaviour.SetIsTagged(vc, true); } }
public void OnPointerExit(PointerEventData eventData) { if (eventData.pointerDrag == null) { return; } DragBehaviour dB = eventData.pointerDrag.GetComponent <DragBehaviour>(); if (dB != null && dB.placeholderParent == this.transform) { dB.placeholderParent = dB.ogParent; } }
/// <summary> /// /// </summary> public virtual void ClearVertexSelection() { if (selected_vertices_.Count > 0) { foreach (KeyValuePair <VertexBase, VertexControl> entry in vertex_controls_) { entry.Value.SetValue(Selector.IsSelectedProperty, false); DragBehaviour.SetIsTagged(entry.Value, false); } selected_vertices_.Clear(); vertex_controls_.Clear(); } }
private void tg_dragEnabled_Checked(object sender, RoutedEventArgs e) { if (tg_dragEnabled.IsChecked == null) { return; } tg_dragMoveEdges.IsEnabled = (bool)tg_dragEnabled.IsChecked; foreach (var item in tg_Area.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, tg_dragEnabled.IsChecked != null && tg_dragEnabled.IsChecked.Value); DragBehaviour.SetUpdateEdgesOnMove(item.Value, true); } }
private void UpdateCanDrag(bool value) { if (View == null) { return; } var area = View.Area; foreach (var item in area.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, value); } //throw new NotImplementedException(); }
private void SelectVertex(VertexControl vc) { if (_selectedVertices.Contains(vc)) { _selectedVertices.Remove(vc); HighlightBehaviour.SetHighlighted(vc, false); DragBehaviour.SetIsTagged(vc, false); } else { _selectedVertices.Add(vc); HighlightBehaviour.SetHighlighted(vc, true); DragBehaviour.SetIsTagged(vc, true); } }
/// <summary> /// /// </summary> /// <param name="control"></param> public virtual void UnselectVertex(VertexControl control) { if (control == null) { return; } VertexBase vertex = (VertexBase)control.Vertex; control.SetValue(Selector.IsSelectedProperty, false); DragBehaviour.SetIsTagged(control, false); selected_vertices_.Remove(vertex); vertex_controls_.Remove(vertex); }
// Update is called once per frame void LateUpdate() { if (dragging != null && Input.GetMouseButtonUp(0)) { if (dragging.onRelease != null) { dragging.onRelease(); } dragging = null; } if (dragging == this) { transform.position = Input.mousePosition; } }
public void OnDrop(PointerEventData eventData) { DragBehaviour dB = eventData.pointerDrag.GetComponent <DragBehaviour>(); if (dB != null) { if (dB.ogParent != this.transform) { Card c = eventData.pointerDrag.GetComponent <Card>(); if (c.PlayCard()) { dB.ogParent = this.transform; } } } }
/// <summary> /// Очищает режим выделения. /// </summary> /// <param name="soft"></param> private void ClearSelectMode(bool soft = false) { graphArea.VertexList.Values .Where(DragBehaviour.GetIsTagged) .ToList() .ForEach(a => { HighlightBehaviour.SetHighlighted(a, false); DragBehaviour.SetIsTagged(a, false); }); if (!soft) { graphArea.SetVerticesDrag(false); } }
private void ClearSelectMode(bool soft = false) { if (_selectedVertices != null && _selectedVertices.Any()) { _selectedVertices.ForEach(a => { HighlightBehaviour.SetHighlighted(a, false); DragBehaviour.SetIsTagged(a, false); }); _selectedVertices.Clear(); } if (!soft) { graphArea.SetVerticesDrag(false); } }
private void tg_dragEnabled_Checked(object sender, RoutedEventArgs e) { if (tg_dragEnabled.IsChecked == true) { tg_dragMoveEdges.Visibility = System.Windows.Visibility.Visible; } else { tg_dragMoveEdges.Visibility = System.Windows.Visibility.Collapsed; } foreach (var item in tg_Area.VertexList) { DragBehaviour.SetIsDragEnabled(item.Value, (bool)tg_dragEnabled.IsChecked); DragBehaviour.SetUpdateEdgesOnMove(item.Value, true); } }
/// <summary> /// Select vertex by setting its tag and highlight value /// </summary> /// <param name="vc">VertexControl object</param> private void SelectVertex(DependencyObject vc) { if (DragBehaviour.GetIsTagged(vc)) { HighlightBehaviour.SetHighlighted(vc, false); DragBehaviour.SetIsTagged(vc, false); vc.ClearValue(DragBehaviour.XSnapModifierProperty); vc.ClearValue(DragBehaviour.YSnapModifierProperty); } else { HighlightBehaviour.SetHighlighted(vc, true); DragBehaviour.SetIsTagged(vc, true); DragBehaviour.SetXSnapModifier(vc, ExaggeratedSnappingXModifier); DragBehaviour.SetYSnapModifier(vc, ExaggeratedSnappingYModifier); } }
/** * Constructor */ public DescriptorData() { contents = new List <ChapterSummary>(); cursors = new List <CustomCursor>(); buttons = new List <CustomButton>(); arrows = new List <CustomArrow>(); title = null; description = null; guiType = -1; defaultClickAction = DefaultClickAction.SHOW_DETAILS; perspective = Perspective.REGULAR; dragBehaviour = DragBehaviour.CONSIDER_NON_TARGETS; playerMode = MODE_PLAYER_1STPERSON; graphicConfig = GRAPHICS_WINDOWED; projectName = ENGINE_EXECUTION; versionNumber = "0"; keyboardNavigationEnabled = false; }
public void OnDrop(PointerEventData eventData) { DragBehaviour d = eventData.pointerDrag.GetComponent <DragBehaviour>(); if (d != null & this.transform.childCount < maxHandSize) { d.originalParent = this.transform; if (this.GetComponent <CardPlayBehaviour> () != null) { this.GetComponent <CardPlayBehaviour> ().StartPlayingCards(); } } if (d != null & this.transform.childCount == maxHandSize & this.transform != d.originalParent) { this.transform.GetChild(this.maxHandSize - 1).SetParent(d.originalParent); d.originalParent = this.transform; } }
// Use this for initialization void Start() { //inicializando variable que controla si todos los items estan en los slots: items_ubicados_correctamente = false; //desactivando el tick de orden correcto hasta que se obtenga el orden correcto: if (tickCorrectOrder != null) tickCorrectOrder.enabled = false; //cargando la imagen del warning que se muestra en cambio del tick cuando el orden no es correcto: img_warning = Resources.Load<Sprite> ("Sprites/buttons/warning_order"); //cargando la imagen del tick: img_tick = Resources.Load<Sprite> ("Sprites/buttons/tick"); //lamado al metodo que verifica si los items estan ubicados correctamente o no: //obteniendo el componente text que se llama titulo en el prefab: titulo_object = GameObject.Find ("title_process_phases_interface"); if (titulo_object != null) { Debug.LogError("Se va a cambiar el titulo de la interfaz!!"); titulo_object.GetComponent<Text>().text = titulo; } introduction_object = GameObject.Find ("introduction_process_phases_interface"); if (introduction_object != null) { Debug.LogError("Se va a cambiar el texto central!!"); introduction_asset = Resources.Load(introduction_text_path) as TextAsset; introduction_object.GetComponent<Text>().text = introduction_asset.text; } if (limpiezaButton != null) { image_button_sprite_uno = Resources.Load<Sprite> (image_uno_limpieza); limpiezaButton.GetComponent<Image>().sprite = image_button_sprite_uno; //Agregando la accion del boton: esta accion apunta al Action definido desde AppManager limpiezaButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase1();}); drag_controller = limpiezaButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_one; Debug.Log("CanvasProcessManagerEval: Se asigna el numero de fase: " + phase_number_button_one + " al btn LIMPIEZA"); } if (matizadoButton != null) { image_button_sprite_dos = Resources.Load<Sprite> (image_dos_matizado); matizadoButton.GetComponent<Image>().sprite = image_button_sprite_dos; matizadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase2();}); drag_controller = matizadoButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_two; } if (masilladoButton != null) { image_button_sprite_tres = Resources.Load<Sprite> (image_tres_masillado); masilladoButton.GetComponent<Image>().sprite = image_button_sprite_tres; masilladoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase3();}); drag_controller = masilladoButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_three; } if (aparejadoButton != null) { image_button_sprite_cuatro = Resources.Load<Sprite> (image_cuatro_aparejado); aparejadoButton.GetComponent<Image>().sprite = image_button_sprite_cuatro; aparejadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase4();}); drag_controller = aparejadoButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_four; } if (pintadoButton != null) { image_button_sprite_cinco = Resources.Load<Sprite> (image_cinco_pintado); pintadoButton.GetComponent<Image>().sprite = image_button_sprite_cinco; pintadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase5();}); drag_controller = pintadoButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_five; } if (barnizadoButton != null) { image_button_sprite_seis = Resources.Load<Sprite> (image_seis_barnizado); barnizadoButton.GetComponent<Image>().sprite = image_button_sprite_seis; barnizadoButton.onClick.AddListener(()=>{ActionButton_goToMenuStepsOfPhase6();}); drag_controller = barnizadoButton.GetComponent<DragBehaviour>(); if(drag_controller != null) drag_controller.phase_number = phase_number_button_six; } if (regresar != null) { regresar.onClick.AddListener(()=>{ActionButton_goToSelectionMode();}); } //colocando los textos en los botones: if(textUnoLimpieza != null){ textUnoLimpieza.text = this.button_uno_text_limpieza; } if(textDosMatizado != null){ textDosMatizado.text = this.button_dos_text_matizado; } if(textTresMasillado != null){ textTresMasillado.text = this.button_tres_text_masillado; } if(textCuatroAparejado != null){ textCuatroAparejado.text = this.button_cuatro_text_aparejado; } if(textCincoPintado != null){ textCincoPintado.text = this.button_cinco_text_pintado; } if(textSeisBarnizado != null){ textSeisBarnizado.text = this.button_seis_text_barnizado; } /* //Agrrgando los textos que van dentro de los slots donde se organizan: if (slot1_Ordenado != null) this.slot1_Ordenado.text = texto_slot1_ordenar; if (slot2_Ordenado != null) this.slot2_Ordenado.text = texto_slot2_ordenar; if (slot3_Ordenado != null) this.slot3_Ordenado.text = texto_slot3_ordenar; if (slot4_Ordenado != null) this.slot4_Ordenado.text = texto_slot4_ordenar; if (slot5_Ordenado != null) this.slot5_Ordenado.text = texto_slot5_ordenar; if (slot6_Ordenado != null) this.slot6_Ordenado.text = texto_slot6_ordenar; */ HasChanged (); }
/** * Constructor */ public DescriptorData() { contents = new List<ChapterSummary>(); cursors = new List<CustomCursor>(); buttons = new List<CustomButton>(); arrows = new List<CustomArrow>(); title = null; description = null; guiType = -1; defaultClickAction = DefaultClickAction.SHOW_DETAILS; perspective = Perspective.REGULAR; dragBehaviour = DragBehaviour.CONSIDER_NON_TARGETS; playerMode = MODE_PLAYER_1STPERSON; graphicConfig = GRAPHICS_WINDOWED; projectName = ENGINE_EXECUTION; versionNumber = "0"; keyboardNavigationEnabled = false; }
public void setDragBehaviour(DragBehaviour dragBehaviour) { this.dragBehaviour = dragBehaviour; }