public void HeartMouseDown(Heart heart) { this.currentState = ClickState.HeartDown; this.clickedHeart = heart; this.overTile = null; this.GetHeartAnimator(heart).SetBool("Clenched", true); }
//tutorial circle object void Start() { viewingWeek = 0; curWeek = 0; curTotalDay = 0; curDayOfWeek = 0; curTime = 0; // hasEventDone = true; // hasEventMissed = false; curState = ClickState.NoFocus; if(ApplicationModel.tutorialEvent == "Party") { Commitment.GenerateCommitment("Party", "", 1, 0, 0, 3, 3); } else { Commitment.GenerateCommitment("Dinner", "", 1, 0, 0, 3, 3); } //generate work events at begining. 5-15 work events. 1-3 per day. mon to friday. for(int generateCount = 1; generateCount < 6; generateCount += 1) { int event_numbs=Random.Range (1, 4); for (int i = 0; i < event_numbs; i++) { Commitment.Generate_Works (generateCount); } } }
/// <summary> /// Reaktionen auf einen Linksklick. /// </summary> public override void OnLeftClick(Vector2 position, ClickState state, GameTime time) { base.OnLeftClick (position, state, time); if (IsSelectable) { State = WidgetState.Selected; if (Container != null) { foreach (MenuItem item in Container) { Log.Debug ("State: ", item.State); if (item is MenuEntry && item !=this) { item.State = WidgetState.None; } } } } OnClick (time); }
public void SetSingleSelectState() { currentClickState = ClickState.SINGLE_SELECT_CLICK; }
public void Update(Camera cam, IMenu menu) { MouseState currentMouseState = Mouse.GetState(); if (menu == null) { if (currentMouseState.X >= GraphicsDeviceManager.DefaultBackBufferWidth) { Mouse.SetPosition(GraphicsDeviceManager.DefaultBackBufferWidth, currentMouseState.Y); } else if (currentMouseState.X <= 0) { Mouse.SetPosition(0, currentMouseState.Y); } else if (currentMouseState.Y >= GraphicsDeviceManager.DefaultBackBufferHeight) { Mouse.SetPosition(currentMouseState.X, GraphicsDeviceManager.DefaultBackBufferHeight); } else if (currentMouseState.Y <= 0) { Mouse.SetPosition(currentMouseState.X, 0); } fakePos = new Point((int)cam.position.X + currentMouseState.X, (int)cam.position.Y + currentMouseState.Y); } position = new Point(currentMouseState.X, currentMouseState.Y); if (currentMouseState.LeftButton == ButtonState.Pressed) { if (oldMouseState.LeftButton == ButtonState.Released) { LeftClickState = ClickState.Clicked; } else { LeftClickState = ClickState.Held; } } else { if (oldMouseState.LeftButton == ButtonState.Released) { LeftClickState = ClickState.Released; } else { LeftClickState = ClickState.Releasing; } } if (currentMouseState.RightButton == ButtonState.Pressed) { if (oldMouseState.RightButton == ButtonState.Released) { RightClickState = ClickState.Clicked; } else { RightClickState = ClickState.Held; } } else { if (oldMouseState.RightButton == ButtonState.Released) { RightClickState = ClickState.Released; } else { RightClickState = ClickState.Releasing; } } oldMouseState = currentMouseState; }
/// <summary> /// Reaktionen auf einen Linksklick. /// </summary> public void OnLeftClick(Vector2 position, ClickState state, GameTime time) { OnClick (time); }
public void TileMouseDown(Tile tile) { this.currentState = ClickState.TileDown; this.clickedTile = tile; }
/// <summary> /// Reaktionen auf einen Linksklick. /// </summary> public override void OnLeftClick(Vector2 position, ClickState state, GameTime time) { onClick (); }
public void OnClick(ClickState state, RaycastHit hit, Ray ray) { touch.StartScene(); }
/// <summary> /// Reaktionen auf einen Rechtsklick. /// </summary> public virtual void OnRightClick(Vector2 position, ClickState state, GameTime time) { }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { leftClick = ClickState.CLICKING; PartSystem.emissionRate = _defaultParticleEmissionRate; } else if (Input.GetMouseButtonUp(0)) { leftClick = ClickState.RELEASING; PartSystem.emissionRate = 0; } if (Input.GetMouseButtonDown(1)) { rightClick = ClickState.CLICKING; } else if (Input.GetMouseButtonUp(1)) { rightClick = ClickState.RELEASING; } if (hasWishes) { this.sendWishesToServer(false); this.hasWishes = false; } }
void FixedUpdate() { if (Network.isClient) return; if (leftClick == ClickState.CLICKING) { Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit hit; if (Physics.Raycast (ray, out hit, 100, FaeryMask)) { Sphere.transform.position = hit.point; this.pos = hit.point; hasWishes = true; } } else if (leftClick == ClickState.RELEASING) { hasWishes = true; leftClick = ClickState.IDLE; } if (rightClick == ClickState.CLICKING) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100, FaeryMask)) { this.pos = hit.point; AggroScript.transform.position = hit.point; AggroScript.StartAggro(); hasWishes = true; } } else if (rightClick == ClickState.RELEASING) { hasWishes = true; rightClick = ClickState.IDLE; } }
/// <summary> /// Tut nichts. /// </summary> public void OnLeftClick(Vector2 position, ClickState state, GameTime time) { }
// Update is called once per frame void Update() { // //Threshold updating // float newDT = Mathf.Min(Screen.width, Screen.height) / 20; if (dragThreshold != newDT) { dragThreshold = newDT; } // //Input scouting // if (Input.touchCount > 2) { touchCount = 0; } else if (Input.touchCount == 2) { touchCount = 2; if (Input.GetTouch(1).phase == TouchPhase.Began) { clickState = ClickState.Began; origMP2 = Input.GetTouch(1).position; origScalePoint = Managers.Camera.getScalePointIndex(); } else if (Input.GetTouch(1).phase == TouchPhase.Ended) { } else { clickState = ClickState.InProgress; curMP2 = Input.GetTouch(1).position; } } else if (Input.touchCount == 1) { touchCount = 1; if (Input.GetTouch(0).phase == TouchPhase.Began) { clickState = ClickState.Began; origMP = Input.GetTouch(0).position; } else if (Input.GetTouch(0).phase == TouchPhase.Ended) { clickState = ClickState.Ended; } else { clickState = ClickState.InProgress; curMP = Input.GetTouch(0).position; } } else if (Input.GetMouseButton(0)) { touchCount = 1; if (Input.GetMouseButtonDown(0)) { clickState = ClickState.Began; origMP = Input.mousePosition; isRightClick = false; } else { clickState = ClickState.InProgress; curMP = Input.mousePosition; } } else if (Input.GetMouseButtonUp(0)) { clickState = ClickState.Ended; } else if (Input.GetMouseButton(1)) { touchCount = 1; if (Input.GetMouseButtonDown(1)) { clickState = ClickState.Began; origMP = Input.mousePosition; isRightClick = true; } else { clickState = ClickState.InProgress; curMP = Input.mousePosition; } } else if (Input.GetMouseButtonUp(1)) { clickState = ClickState.Ended; } else if (Input.GetAxis("Mouse ScrollWheel") != 0) { clickState = ClickState.InProgress; } else if (Input.touchCount == 0 && !Input.GetMouseButton(0) && !Input.GetMouseButton(1)) { touchCount = 0; clickState = ClickState.None; } // //Preliminary Processing //Stats are processed here // switch (clickState) { case ClickState.Began: if (touchCount < 2) { curMP = origMP; maxMouseMovement = 0; origCP = Camera.main.transform.position; origTime = Time.time; curTime = origTime; } else if (touchCount == 2) { curMP2 = origMP2; } break; case ClickState.Ended: //do the same thing you would for "in progress" case ClickState.InProgress: float mm = Vector3.Distance(curMP, origMP); if (mm > maxMouseMovement) { maxMouseMovement = mm; } curTime = Time.time; holdTime = curTime - origTime; break; case ClickState.None: break; default: throw new System.Exception("Click State of wrong type, or type not processed! (Stat Processing) clickState: " + clickState); } curMPWorld = (Vector2)Camera.main.ScreenToWorldPoint(curMP);//cast to Vector2 to force z to 0 if (Input.touchCount == 0 && Input.mousePresent) { currentGP.processCursorMoveGesture((Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition), true); } else { currentGP.processCursorMoveGesture(Vector3.zero, false); } // //Input Processing // if (touchCount == 1) { if (clickState == ClickState.Began) { if (touchCount < 2) { //Set all flags = true cameraDragInProgress = false; isDrag = false; isTapGesture = true; isHoldGesture = false; } } else if (clickState == ClickState.InProgress) { if (maxMouseMovement > dragThreshold) { if (!isHoldGesture) { isTapGesture = false; isDrag = true; cameraDragInProgress = true; } } if (holdTime > holdThreshold || isRightClick) { if (!isDrag) { isTapGesture = false; isHoldGesture = true; Time.timeScale = holdTimeScale; } } if (isDrag) { //Check to make sure Merky doesn't get dragged off camera Vector3 delta = Camera.main.ScreenToWorldPoint(origMP) - Camera.main.ScreenToWorldPoint(curMP); Vector3 newPos = origCP + delta; //Move the camera Camera.main.transform.position = newPos; Managers.Camera.pinpoint(); } else if (isHoldGesture) { currentGP.processHoldGesture(curMPWorld, holdTime, false); } } else if (clickState == ClickState.Ended) { if (isDrag) { Managers.Camera.pinpoint(); } else if (isHoldGesture) { currentGP.processHoldGesture(curMPWorld, holdTime, true); } else if (isTapGesture) { tapCount++; currentGP.processTapGesture(curMPWorld); tapGesture?.Invoke(); } //Set all flags = false cameraDragInProgress = false; isDrag = false; isTapGesture = false; isHoldGesture = false; Time.timeScale = 1; } else { throw new System.Exception("Click State of wrong type, or type not processed! (Input Processing) clickState: " + clickState); } } else {//touchCount == 0 || touchCount >= 2 if (clickState == ClickState.Began) { } else if (clickState == ClickState.InProgress) { // //Zoom Processing // // //Mouse Scrolling Zoom // if (Input.GetAxis("Mouse ScrollWheel") < 0) { currentGP.processPinchGesture(1); } else if (Input.GetAxis("Mouse ScrollWheel") > 0) { currentGP.processPinchGesture(-1); } // //Pinch Touch Zoom //2015-12-31 (1:23am): copied from https://unity3d.com/learn/tutorials/modules/beginner/platform-specific/pinch-zoom // // If there are two touches on the device... if (touchCount == 2) { // Store both touches. Touch touchZero = Input.GetTouch(0); Touch touchOne = Input.GetTouch(1); // Find the position in the previous frame of each touch. Vector2 touchZeroPrevPos = origMP; Vector2 touchOnePrevPos = origMP2; // Find the magnitude of the vector (the distance) between the touches in each frame. float prevTouchDeltaMag = (touchZeroPrevPos - touchOnePrevPos).magnitude; float touchDeltaMag = (touchZero.position - touchOne.position).magnitude; // Find the difference in the distances between each frame. int deltaMagnitudeQuo = (int)System.Math.Truncate(Mathf.Max(prevTouchDeltaMag, touchDeltaMag) / Mathf.Min(prevTouchDeltaMag, touchDeltaMag)); deltaMagnitudeQuo *= (int)Mathf.Sign(prevTouchDeltaMag - touchDeltaMag); //Update the camera's scale point index currentGP.processPinchGesture(origScalePoint + deltaMagnitudeQuo - Managers.Camera.getScalePointIndex()); } } else if (clickState == ClickState.Ended) { origScalePoint = Managers.Camera.getScalePointIndex(); } } // //Application closing // if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }
public void RegisterAction(Keys key, Action action, ClickState clickState) { this.key = key; this.registeredAction = action; this.clickState = clickState; }
/// <summary> /// Bei einem Linksklick wird eine Farbe ausgewählt und im Attribut Color abgespeichert. /// </summary> public void OnLeftClick(Vector2 position, ClickState state, GameTime time) { Log.Debug ("ColorPicker.OnLeftClick: position=", position); int i = 0; foreach (ScreenPoint tile in tiles) { //Log.Debug ("ColorPicker: tile=", tile, " " // + (tile.X <= position.X) + " " + (tile.X + tileSize.X > position.X) + " " + ( // tile.Y <= position.Y) + " " + (tile.Y + tileSize.Y > position.Y) //); if (tile.Relative.X <= position.X && tile.Relative.X + tileSize.Relative.X > position.X && tile.Relative.Y <= position.Y && tile.Relative.Y + tileSize.Relative.Y > position.Y) { Log.Debug ("ColorPicker: color=", colors [i]); ColorSelected (colors [i], time); } ++i; } }
void GridClick(GridClick grid) { Debug.Log("Grid Click (" + grid.node.pos.x + "," + grid.node.pos.y + ")"); switch(state) { case ClickState.START: node_start = grid.node; UpdateMap(); break; case ClickState.END: node_end = grid.node; UpdateMap(); break; default : break; } state = ClickState.NULL; }
public void OnLeftClick(Vector2 position, ClickState click, GameTime time) { position = position.RelativeTo (screen.viewport); Console.WriteLine ("ColorPicker.OnLeftClick: positon=" + position); int i = 0; foreach (Vector2 tile in tiles) { Console.WriteLine ("ColorPicker: tile=" + tile + " " + (tile.X <= position.X) + " " + (tile.X + tileSize.X > position.X) + " " + ( tile.Y <= position.Y) + " " + (tile.Y + tileSize.Y > position.Y) ); if (tile.X <= position.X && tile.X + tileSize.X > position.X && tile.Y <= position.Y && tile.Y + tileSize.Y > position.Y) { Console.WriteLine ("ColorPicker: color=" + colors [i]); SelectColor (colors [i]); } ++i; } }
/// <summary> /// Reaktionen auf einen Linksklick. /// </summary> public override void OnLeftClick(Vector2 position, ClickState state, GameTime time) { if (IsInputEnabled) { ValidKeys.Clear (); IsInputEnabled = false; } else { ValidKeys.AddRange (typeof (Keys).ToEnumValues<Keys> ()); IsInputEnabled = true; InputText = String.Empty; } }
public Option <ICommand> HandleMouseInput(double x, double y, ClickState click) { return(Option.None <ICommand>()); }
public void TileMouseUp(Tile tile) { if (this.overTile != null) { if (this.clickedTile == this.overTile) { this.GetPlayer().inner = this.overTile.beast; } else { Debug.Log(this.clickedTile.link.origin); this.overTile.link.set(this.clickedTile.link.get()); } this.PulseBorder(); this.PulsePlayerLey(); this.RefreshScreen(); } if (this.overHeart != Heart.None) { this.GetHeartLink(this.overHeart).set(this.clickedTile.beast); this.PulseHeart(this.overHeart); this.PulsePlayerLey(); this.RefreshScreen(); } this.clickedTile = null; this.currentState = ClickState.Idle; }
public override void Update(GameTime time) { // update saved screen. PreviousKeyboardState = CurrentKeyboardState; PreviousMouseState = CurrentMouseState; CurrentKeyboardState = Keyboard.GetState (); CurrentMouseState = Mouse.GetState (); if (time != null) { bool mouseMoved; if (CurrentMouseState != PreviousMouseState) { // mouse movements Vector2 mouseMove = CurrentMouseState.ToVector2 () - PreviousClickMouseState.ToVector2 (); mouseMoved = mouseMove.Length () > 3; } else { mouseMoved = false; } LeftButtonClickTimer += time.ElapsedGameTime.TotalMilliseconds; if (CurrentMouseState.LeftButton == ButtonState.Pressed && PreviousMouseState.LeftButton != ButtonState.Pressed) { LeftMouseButton = LeftButtonClickTimer < 500 && !mouseMoved ? ClickState.DoubleClick : ClickState.SingleClick; LeftButtonClickTimer = 0; PreviousClickMouseState = PreviousMouseState; Console.WriteLine ("LeftButton=" + LeftMouseButton.ToString ()); } else { LeftMouseButton = ClickState.None; } RightButtonClickTimer += time.ElapsedGameTime.TotalMilliseconds; if (CurrentMouseState.RightButton == ButtonState.Pressed && PreviousMouseState.RightButton != ButtonState.Pressed) { RightMouseButton = RightButtonClickTimer < 500 && !mouseMoved ? ClickState.DoubleClick : ClickState.SingleClick; RightButtonClickTimer = 0; PreviousClickMouseState = PreviousMouseState; Console.WriteLine ("RightButton=" + RightMouseButton.ToString ()); } else { RightMouseButton = ClickState.None; } } // fullscreen if (Keys.G.IsDown () || Keys.F11.IsDown ()) { screen.game.IsFullscreen = !screen.game.IsFullscreen; FullscreenToggled = true; } }
public void HeartMouseUp(Heart heart) { if (this.overTile != null) { this.overTile.link.set(this.GetHeartLink(this.clickedHeart).get()); this.RefreshScreen(); this.GetHeartAnimator(heart).SetBool("Visible", false); this.PulseHeart(heart); } if (this.overHeart != Heart.None) { if (this.overHeart == this.clickedHeart) { this.GetPlayer().inner = this.GetHeartLink(this.clickedHeart).get(); this.RefreshScreen(); this.PulseHeart(this.clickedHeart); this.PulseBorder(); } else { this.GetHeartLink(this.overHeart).set(this.GetHeartLink(this.clickedHeart).get()); this.PulseHeart(this.clickedHeart); this.PulseHeart(this.overHeart); } } this.PulsePlayerLey(); this.currentState = ClickState.Idle; this.clickedHeart = Heart.None; this.GetHeartAnimator(heart).SetBool("Clenched", false); }
protected abstract TEvent EventFromRaycastHit(RaycastHit hit, ClickState state);
public void work() { foreach (MonthTimeStamp month in months) { for (int i = month.FromDate.Day; i <= month.ToDate.Day;) { AR_event.WaitOne(); switch (mClickState) { case ClickState.DATE_SELECT: case ClickState.TAG_CLICK: { String tagName = ElementIds.Tag_ + i; mBrowser.Invoke(new Action(() => { RefreshFrame(); HtmlElement StatusInfoMonths = mMainWindow.Document.GetElementById(ElementIds.StatusInfoMonths); if (null == StatusInfoMonths) { i--; return; } String selectedindex = StatusInfoMonths.GetAttribute(ElementIds.selectedindex); int index; int.TryParse(selectedindex, out index); HtmlElementCollection children = StatusInfoMonths.Children; if (month.SelectorValue != children[index].InnerText) { setMonth(months[months.IndexOf(month)].SelectorValue); Application.DoEvents(); i--; return; } HtmlElementCollection Tags = mMainWindow.Document.GetElementsByTagName(ElementIds.td); foreach (HtmlElement tag in Tags) { if (tag.Name == tagName) { tag.FirstChild.InvokeMember(ElementIds.click); Application.DoEvents(); if (ElementIds.disabled == tag.GetAttribute(ElementIds.bgcolor)) { break; } mClickState = ClickState.REGULAR_CLICK; } } })); i++; } break; case ClickState.REGULAR_CLICK: { AR_event.Set(); HtmlElement RegularHours = null; mBrowser.Invoke(new Action(() => { RegularHours = mMainWindow.Document.GetElementById(ElementIds.DefaultZeit); })); if (null == RegularHours) { mClickState = ClickState.TAG_CLICK; continue; } if (!RegularHours.Enabled) { mClickState = ClickState.TAG_CLICK; continue; } RegularHours.InvokeMember(ElementIds.click); mClickState = ClickState.SAVE_CLICK; } break; case ClickState.SAVE_CLICK: { HtmlElement Save = null; mBrowser.Invoke(new Action(() => { Save = mMainWindow.Document.GetElementById(ElementIds.SaveDel); })); mClickState = ClickState.TAG_CLICK; if (null == Save) { AR_event.Set(); continue; } if (!Save.Enabled) { AR_event.Set(); continue; } mBrowser.Invoke(new Action(() => { IHTMLInputElement stat1 = (IHTMLInputElement)mMainWindow.Document.GetElementById(ElementIds.SpeichernStatus1).DomElement; IHTMLInputElement stat2 = (IHTMLInputElement)mMainWindow.Document.GetElementById(ElementIds.SpeichernStatus2).DomElement; if ((stat1.value == ElementIds.saved && stat2.value == ElementIds.saved) || (stat1.value == ElementIds.gespeichert && stat2.value == ElementIds.gespeichert)) { AR_event.Set(); return; } })); Save.InvokeMember(ElementIds.click); Application.DoEvents(); } break; default: break; } } } }
public void OnLeftClick(Vector2 position, ClickState click, GameTime time) { Info.OnClick (); }
public void SetClickState(ClickState newClickState) { currentClickState = newClickState; }
public void CommitmentClicked() { switch(curState) { case ClickState.NoFocus: curState = ClickState.CommitmentFocus; if(OnCommitmentClicked != null) { OnCommitmentClicked(); } break; case ClickState.CommitmentFocus: if(OnCommitmentClicked != null) { OnCommitmentClicked(); } break; case ClickState.MessageBoxFocus: break; } }
/// <summary> /// Reaktionen auf einen Linksklick. /// </summary> public override void OnLeftClick(Vector2 position, ClickState state, GameTime time) { if (IsVisible) { IsInputEnabled = true; } }
public void NoFocus() { curState = ClickState.NoFocus; GameManager.UI.SetDragArea(-1, 0, -1, 0); }
/// <summary> /// Bei einem Linksklick geschieht nichts. /// </summary> public virtual void OnLeftClick(Vector2 position, ClickState state, GameTime time) { }
public void CommitmentFocus(Commitment com) { curState = ClickState.CommitmentFocus; int maxTotalDay, minTotalDay, maxTime, minTime; com.ReturnTimeRange(out maxTotalDay, out minTotalDay, out maxTime, out minTime); // Debug.Log (maxTotalDay); // Debug.Log ( minTotalDay); // Debug.Log (maxTime); // Debug.Log (minTime); GameManager.UI.SetDragArea(maxTotalDay, minTotalDay, maxTime, minTime); }
/// <summary> /// Bei einem Rechtsklick geschieht nichts. /// </summary> public void OnRightClick(Vector2 position, ClickState state, GameTime time) { }
void OnGUI() { if (GUILayout.Button("Start")) { state = ClickState.START; } if (GUILayout.Button("End")) { state = ClickState.END; } if (GUILayout.Button("Path")) { if (node_start == null) { Debug.Log("start node is null!"); return; } if (node_end == null) { Debug.Log("end node is null!"); return; } CleanPathData(); path.Find(map, node_start, node_end); } }