public virtual void OnLinkClick(IClickable c) { if (c.HasRadar) { c.OpenDocument(); } }
public void ProcessMouse(MouseData data) { ivec2 mouseLocation = data.Location; if (hoveredItem != null && !hoveredItem.Contains(mouseLocation)) { hoveredItem.OnUnhover(); hoveredItem = null; } foreach (IClickable item in Items) { if (item != hoveredItem && item.Contains(mouseLocation)) { // It's possible for the mouse to move between items in a single frame. hoveredItem?.OnUnhover(); hoveredItem = item; hoveredItem.OnHover(mouseLocation); break; } } // It's also possible for the mouse to move to a new item and click on the same frame (which is rare, but // considered a valid click). if (hoveredItem != null && data.Query(GLFW_MOUSE_BUTTON_LEFT, InputStates.PressedThisFrame)) { hoveredItem.OnClick(mouseLocation); } }
public override void Execute(float d) { if (!Input.GetMouseButton(0)) { if (GameManager.Instance.clicking) { PointerEventData pointerData = new PointerEventData(EventSystem.current); pointerData.position = Input.mousePosition; List <RaycastResult> results = new List <RaycastResult>(); //get all objects our pointer is overlapping with EventSystem.current.RaycastAll(pointerData, results); foreach (RaycastResult r in results) { IClickable c = r.gameObject.GetComponentInParent <IClickable>(); if (c != null) { c.OnRelease(); break; } } } GameManager.Instance.clicking = false; } }
public override void Execute(float d) { if (Input.GetMouseButton(0)) { PointerEventData pointerData = new PointerEventData(EventSystem.current) { position = Input.mousePosition }; List <RaycastResult> results = new List <RaycastResult>(); EventSystem.current.RaycastAll(pointerData, results); IClickable c = null; foreach (RaycastResult r in results) { c = r.gameObject.GetComponentInParent <IClickable>(); if (c != null) { c.OnHighlight(); break; } else { Debug.Log(r.gameObject.name); } } } }
public RouteActionController( Locator <AppOptions> appOptionsLocator, AirwayNetwork airwayNetwork, ISelectedProcedureProvider origController, ISelectedProcedureProvider destController, Locator <CountryCodeCollection> checkedCodesLocator, Func <AvgWindCalculator> windCalcGetter, Label routeDisLbl, DistanceDisplayStyle displayStyle, Func <string> routeTxtGetter, Action <string> routeTxtSetter, IClickable findRouteBtn, IClickable analyzeRouteBtn, IClickable exportBtn, IClickable showMapBtn, Form parentForm) { this.appOptionsLocator = appOptionsLocator; this.airwayNetwork = airwayNetwork; this.origController = origController; this.destController = destController; this.checkedCodesLocator = checkedCodesLocator; this.windCalcGetter = windCalcGetter; this.routeDisLbl = routeDisLbl; this.displayStyle = displayStyle; this.routeTxtGetter = routeTxtGetter; this.routeTxtSetter = routeTxtSetter; this.findRouteBtn = findRouteBtn; this.analyzeRouteBtn = analyzeRouteBtn; this.exportBtn = exportBtn; this.showMapBtn = showMapBtn; this.parentForm = parentForm; }
/// <summary> /// Mise à jour du nombre d'éléments de l'emplacement de l'item cliquable /// </summary> /// <param name="clickable"></param> public void UpdateStackSize(IClickable clickable) { // S'il y a plus d'un élément if (clickable.MyCount > 1) { // Actualise le texte du nombre d'éléments de l'item clickable.MyStackText.text = clickable.MyCount.ToString(); // Affiche le compteur sur l'image clickable.MyStackText.enabled = true; // Affiche l'image clickable.MyIcon.enabled = true; } else { // Réinitialise le texte du nombre d'éléments de l'item ClearStackCount(clickable); } // S'il n'y a plus d'élément if (clickable.MyCount == 0) { // Masque le compteur sur l'image clickable.MyStackText.enabled = false; // Masque l'image clickable.MyIcon.enabled = false; } }
void Update() { if (Input.GetMouseButtonDown(0)) // If clicking { ray = camera.ScreenPointToRay(Input.mousePosition); // Create a ray from the mouse position if (Physics.Raycast(ray, out hit)) // If something was hit { foreach (MonoBehaviour script in hit.collider.GetComponents <MonoBehaviour>()) { if (script is IClickable) { IClickable clickable = (IClickable)script; clickable.LeftClick(); } } } } else if (Input.GetMouseButtonDown(1)) { ray = camera.ScreenPointToRay(Input.mousePosition); // Create a ray from the mouse position if (Physics.Raycast(ray, out hit)) // If something was hit { foreach (MonoBehaviour script in hit.collider.GetComponents <MonoBehaviour>()) { if (script is IClickable) { IClickable clickable = (IClickable)script; clickable.RightClick(); } } } } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { // Cast a ray straight down. RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector3.forward); // If it hits something... if (hit.collider != null) { Debug.Log(hit.collider.gameObject.name); IClickable clickable = hit.collider.gameObject.GetComponent <IClickable>(); if (clickable != null) { clickable.Click(); } } else { if (OnClickMiss != null) { OnClickMiss(); } } } }
public override void UpdateClick(IClickable button) { Game1.self.FocusedElement = button; if (button is Dropdown) { Dropdown d = (Dropdown)button; if (d.ShowChildren) { button.OnClick(); d.Active = false; } else { d.ShowChildren = true; d.Update(); dropClicked = true; button.Active = false; d.Active = true; } } else if (button.Parent is Dropdown) { dropClicked = true; Dropdown d = (Dropdown)button.Parent; button.OnClick(); // d.Active = true; } else { button.OnClick(); } }
public void AddObject(IClickable clickableObject) { if (!ClickableObjects.Contains(clickableObject)) { ClickableObjects.Add(clickableObject); } }
public TeachFormBase() { InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; clickable = this as IClickable; this.ReadLanguageResources(); }
public override void EnsureVisible(IAdorner adorner, bool scrollNow) { IClickable clickable = adorner as IClickable; if (adorner == null || clickable == null || !(adorner.ElementSet.PrimaryElement is BaseFrameworkElement)) { return; } Matrix identity = Matrix.Identity; AdornerSet adornerSet = adorner.AdornerSet as AdornerSet; Matrix matrix; Visual visual; if (adornerSet != null) { matrix = adornerSet.Matrix; visual = (Visual)this.Artboard.AdornerLayer; } else { matrix = this.platformSurface.TransformToVisual(adorner.ElementSet.PrimaryElement.ViewObject, (IViewObject)this.HitTestRoot); visual = (Visual)this.ViewRootContainer; } Point clickablePoint = clickable.GetClickablePoint(matrix); Rect rect = new Rect(clickablePoint.X - 3.0, clickablePoint.Y - 3.0, 6.0, 6.0); this.EnsureVisibleInternal(visual, rect, scrollNow); }
static public void UnregisterToMouse(IClickable clickable) { IoManager.window.MouseMoved -= clickable.OnMouseMove; IoManager.window.MouseButtonPressed -= clickable.OnMousePressed; IoManager.window.MouseButtonReleased -= clickable.OnMouseReleased; mouseDelegates.Remove(clickable); }
private IEnumerator RemoveItems() { _isRemovingItems = true; WaitForSeconds waiting = new WaitForSeconds(_spawnRate); while (_itemsToRemove.Count > 0) { IClickable itemToFind = _itemsToRemove[0].GetComponent <IClickable>(); for (int i = 0; i < _instatiatedObjects.Count; i++) { if (_instatiatedObjects[i].GetComponent <IClickable>()._id == itemToFind._id) { Destroy(_instatiatedObjects[i]); _instatiatedObjects.RemoveAt(i); SpawnNewItem(itemToFind._collumn); } } _itemsToRemove.RemoveAt(0); yield return(waiting); } _isRemovingItems = false; }
private void OnClick(IClickable clickable) { if (clickable is GemElement gemElement) { AssignGem(gemElement); } }
public virtual IClickable[] Links(TestProperty[] properties) { GetMapObjects(TestObjectType.Link, properties); IClickable[] tmp = new IClickable[_lastObjects.Length]; _lastObjects.CopyTo(tmp, 0); return tmp; }
private void CheckClickables(MouseState mouseState) { if (Game1.self.IsActive) { int x = mouseState.X; int y = mouseState.Y; Point xy = new Point(x, y); IClickable button = GetClickable(xy); if (mouseState.LeftButton == ButtonState.Pressed && Game1.self.AbleToClick) { UpdateFields(); Game1.self.DeltaSeconds = 0; Game1.self.AbleToClick = false; if (button != null) { UpdateClick(button); UpdateButtonNotNull(); } else { Game1.self.FocusedElement = null; UpdateButtonNull(); } UpdateClickables(); } } }
public virtual IClickable[] Links(string name) { GetMapObjects(TestObjectType.Link, name); IClickable[] tmp = new IClickable[_lastObjects.Length]; _lastObjects.CopyTo(tmp, 0); return tmp; }
void Update() { if (camera == null) { return; } Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition), out RaycastHit hitInfo, maxDist); IClickable t = hitInfo.transform?.GetComponent <IClickable>(); //MouseOver if (t != current) { current?.OnMouseOverEnd(); t?.OnMouseOverBegin(); } current = t; //Clicks if (t != null && Input.GetMouseButtonDown(0)) { if (clickCo == null) { clickCo = StartCoroutine(Click(0, current)); } } }
private void CheckClickables(Vector2 position) { if (Game1.self.IsActive) { int x = (int)position.X; int y = (int)position.Y; Point xy = new Point(x, y); IClickable button = GetClickable(xy); if (Game1.self.AbleToClick) { UpdateFields(); Game1.self.DeltaSeconds = 0; Game1.self.AbleToClick = false; if (button != null) { UpdateClick(button); UpdateButtonNotNull(); } else { Game1.self.FocusedElement = null; UpdateButtonNull(); hideKeyboard(); } UpdateClickables(); } } }
public void UpdateStackSize(IClickable clickable) { if (clickable.MyCount == 0) { clickable.MyIcon.color = new Color(0, 0, 0, 0); } }
public void UpdateStackSize(IClickable _clickable) { if (_clickable.Count == 0) { _clickable.Icon.color = new Color(0, 0, 0, 0); } }
/// <summary> /// Mise à jour du nombre d'éléments de l'emplacement de l'item cliquable /// </summary> /// <param name="clickable"></param> public void UpdateStackSize(IClickable clickable) { // S'il y a plus d'un élément if (clickable.MyCount > 1) { // Actualise le texte du nombre d'éléments de l'item clickable.MyStackText.text = clickable.MyCount.ToString(); // Actualise la couleur du texte clickable.MyStackText.color = Color.white; // Actualise la couleur de l'image clickable.MyIcon.color = Color.white; } else { // Réinitialise le texte du nombre d'éléments de l'item ClearStackCount(clickable); } // S'il n'y a plus d'élément if (clickable.MyCount == 0) { // Réinitialisation de l'image de l'emplacement clickable.MyIcon.sprite = null; // Réinitialisation de la couleur de l'emplacement clickable.MyIcon.color = new Color(0, 0, 0, 0); } }
public void DisableControl() { Cursor.SetCursor(null, Vector2.zero, CursorMode.Auto); controllable = false; targetObject = null; mouseTarget = null; }
public override void Update(GameTime gameTime) { bool atBlankSpace = true; MouseState mouse = Mouse.GetState(); for (int i = 0; i < clickables.Count; i++) { IClickable clickable = clickables[i]; if (Toolbox.IsPointInsideSquare(new Point(mouse.X, mouse.Y), clickable.GetBoundary())) { atBlankSpace = false; clickable.MouseEnter(); if (mouse.LeftButton == ButtonState.Pressed) { clickable.Click(); } else { clickable.Release(); } } else { clickable.MouseLeave(); } } if (atBlankSpace && mouse.LeftButton == ButtonState.Pressed) { heroDetail?.Deactivate(); } base.Update(gameTime); }
public ClickSettings(bool left, int layer, bool layerHit, IClickable clickable) { this.left = left; this.layer = layer; this.layerHit = layerHit; this.clickable = clickable; }
static public void RegisterToMouse(IClickable clickable) { mouseDelegates.Add(clickable); IoManager.window.MouseMoved += clickable.OnMouseMove; IoManager.window.MouseButtonPressed += clickable.OnMousePressed; IoManager.window.MouseButtonReleased += clickable.OnMouseReleased; }
void Click(IClickable clickable) { if (OnClick != null) { OnClick(this); } }
private void ProcessClick(Vector2 pos) { Ray ray = Camera.main.ScreenPointToRay(pos); RaycastHit hit = new RaycastHit(); if (Physics.Raycast(ray, out hit)) { var curTouch = hit.collider.GetComponent(typeof(IClickable)) as IClickable; if (_touched != null) { int mapPos; mapPos = _touched.GetPos(); if (curTouch != null) { mapPos = curTouch.GetPos(); } _touched.OnReleased(mapPos); curTouch = null; } else if (_touched == null && curTouch != null) { curTouch.OnSelected(); } _touched = curTouch; } }
/*// Update is called once per frame * void Update() * { * * }*/ public void UpdateStackSize(IClickable clickable) { if (clickable.MyCount == 0) //no more items { clickable.MyIcon.color = new Color(0, 0, 0, 0); //hide icon } }
public bool RegisterClickable(IClickable c) { foreach (ObjContainer oc in _clickableObjects) if (oc.Obj == c) return false; _clickableObjects.Add(new ObjContainer(c)); return true; }
void LoadButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { string path = EditorUtility.OpenFilePanel( "Load Behavior Layout", Application.dataPath, "xml" ); if ( !string.IsNullOrEmpty( path ) ) { LoadXML( path ); } }
void SaveButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { BehaviorNodeControl root = m_editor.GetRootControl(); if ( root != null ) { string path = EditorUtility.SaveFilePanelInProject( "Save Behavior Layout", string.Format("Layout{0}",m_tools.TreeIdField.Value),"xml",""); if ( !string.IsNullOrEmpty( path ) ) { SaveXML( path, root ); } } }
private void CallIClickable(Transform go) { MonoBehaviour[] scripts = go.GetComponents<MonoBehaviour> (); foreach (MonoBehaviour m in scripts) { if (m is IClickable) { ((IClickable)m).NotifyClick (); if (go.tag == "decubePrefab"){ if (lastClicked != null){ ((IClickable)lastClicked).NotifyChange(); } lastClicked = (IClickable)m; } break; } } }
/// <summary> /// Checks the mouse against the clickable list, and executes the clickables if clicked /// </summary> public void MouseCheck() { _ms = Mouse.GetState(); if( _oldTop != null) _oldTop.SetMouseOver(false); int x = _ms.X; int y = _ms.Y; if (_hasClicked) { if (_ms.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed ) return; else { _hasClicked = false; return; } } _mouseOverText = ""; IClickable topClickable = null; if (!IsActive) return; _mouseOverCard = new KeyValuePair<Rectangle, Card>(new Rectangle(0, 0, 0, 0), null); foreach (KeyValuePair<Rectangle, IClickable> c in ClickableList.ToList()) { Rectangle r = c.Key; if (x > r.Left && x < r.Right && y > r.Top && y < r.Bottom) { _mouseOverText = "True"; Card cd = c.Value as Card; if (cd != null) { _mouseOverCard = new KeyValuePair<Rectangle, Card>(c.Key, cd); } topClickable = c.Value; } } if (topClickable == null) return; topClickable.SetMouseOver( true ); _oldTop = topClickable; if( _ms.LeftButton != Microsoft.Xna.Framework.Input.ButtonState.Pressed) return; topClickable.Click(this); _hasClicked = true; }
public SimpleBoxTemplate( ) { Fields = new Field[0]; Buttons = new IClickable[0]; }
public bool UnregisterClickable(IClickable c) { foreach (ObjContainer oc in _clickableObjects) if (oc.Obj == c) { _clickableObjects.Remove(oc); return true; } return false; }
public ObjContainer(IClickable cl, bool hovered = false, bool clicked = false) { Obj = cl; IsHoveredOn = hovered; HasBeenClicked = clicked; }
void OnOutputClicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { if ( sender is Button ) { Button b = sender as Button; int index = m_outputButtons.IndexOf( b ); if ( index >= 0 ) { if ( OutputClicked != null ) { OutputClicked( this, index, args.button ); } } } }
public Boolean HasClicked(IClickable clickable) { return _sm.Clicked && _sm.Inside(clickable.BoundingBox); }
void GenerateButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { BehaviorNodeControl root = m_editor.GetRootControl(); if ( root != null ) { SaveXML( Application.persistentDataPath + "/" + TEMP_FILENAME, root ); EditorPrefs.SetBool( TEMP_FILE_KEY, true ); string safeHandle = m_tools.TreeIdField.Value.Replace( " ", "" ); BehaviorTreeGenerator generator = new BehaviorTreeGenerator(); string output = generator.Generate( m_tools.TreeIdField.Value, safeHandle, root ); SaveSourceFile( safeHandle, output ); } }
void NewButton_Clicked( IClickable sender, ClickEventArgs args, Event nativeEvent ) { bool confirm = EditorUtility.DisplayDialog( "Confirm New Behavior", "Are you sure you would like to create a new behavior? Current layout will be discarded!", "Ok", "Cancel" ); if (confirm ) { m_editor.ClearAll(); } }
public void registerClickable(IClickable clickable) { clickables.Add(clickable); }