private void HandleYAxisChanged(object sender, ExpanDialStickEventArgs e) { Vector2 gaugePosition = gaugePositions[gaugeIndex]; if (e.i == (int)gaugePosition.x && e.j == (int)gaugePosition.y) { triggerChangeXYAxis(0, (sbyte)e.diff); } }
private void HandlePositionChanged(object sender, ExpanDialStickEventArgs e) { //Debug.Log("HandlePositionChanged -> (" + e.i + '|' + e.j + '|' + e.diff + ")"); if (e.diff > 0) { users.Enqueue(e.i + "|" + e.j + "|" + PULL); } else { users.Enqueue(e.i + "|" + e.j + "|" + PUSH); } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { //Debug.Log("HandleRotationChanged -> (" + e.i + '|' + e.j + '|' + e.diff + ")"); if (e.diff > 0) { users.Enqueue(e.i + "|" + e.j + "|" + LEFT_ROTATION); } else { users.Enqueue(e.i + "|" + e.j + "|" + RIGHT_ROTATION); } }
private void HandleYAxisChanged(object sender, ExpanDialStickEventArgs e) { //Debug.Log("HandleYAxisChanged -> (" + e.i + "|" + e.j + "|" + e.prev + "|" + e.next + "|" + e.diff + ")"); if (e.diff > 0 && e.next >= JOYSTICK_THRESHOLD) { users.Enqueue(e.i + "|" + e.j + "|" + LEFT_BENDING); } if (e.diff < 0 && e.next <= -JOYSTICK_THRESHOLD) { users.Enqueue(e.i + "|" + e.j + "|" + RIGHT_BENDING); } }
private void HandleXAxisChanged(object sender, ExpanDialStickEventArgs e) { //Debug.Log("HandleXAxisChanged -> (" + e.i + '|' + e.j + '|' + e.diff + ")"); if (e.diff > 0 && e.next >= JOYSTICK_THRESHOLD) { users.Enqueue(e.i + '|' + e.j + '|' + TOP_BENDING); } if (e.diff < 0 && e.next <= -JOYSTICK_THRESHOLD) { users.Enqueue(e.i + '|' + e.j + '|' + BOTTOM_BENDING); } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { currSelect = new Vector2Int(e.i, e.j); if (currSelect != prevSelect) { if (shapeChangeUp) { TriggerShapeChangeUp(); } else { TriggerShapeChangeDown(); } shapeChangeUp = !shapeChangeUp; prevSelect = currSelect; } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { Vector2 gaugePosition = gaugePositions[gaugeIndex]; if (e.i == (int)gaugePosition.x && e.j == (int)gaugePosition.y) { float prevRotation = aiguilleRotation; aiguilleRotation += e.diff * anglePerStep; string msg = ""; msg += "USER_ROTATION " + prevRotation + " " + aiguilleRotation; Debug.Log(msg); if (gaugeState == GAUGE_APPEARED) { startGameTime = Time.time; motionDuration = Random.Range(5f, initGameDuration - 5f); gaugeState = GAUGE_STARTED; } expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(msg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { Vector3Int currOrderedCandidate = new Vector3Int(e.i, e.j, 0); if (!overlayAppeared) { if (currOrderedCandidate.x == target.x && currOrderedCandidate.y == target.y) { Debug.Log("TargetRotated!"); string targetCandidateMsg = "USER_TARGET_ROTATION " + target; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(targetCandidateMsg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); TriggerOverlay(); target = new Vector2Int(-1, -1); } } else { if (currOrderedCandidate != prevOrderedCandidate) { Vector3Int foundCandidate = diffCandidates.Find(diffCandidate => diffCandidate.x == e.i && diffCandidate.y == e.j); if (foundCandidate != Vector3Int.zero) { Debug.Log("Right Candidate Rotated => " + currOrderedCandidate); string rightCandidateMsg = "USER_RIGHT_ROTATION " + foundCandidate; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(rightCandidateMsg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); diffCandidates.Remove(foundCandidate); UpdateOverlay(); if (diffCandidates.Count() == 0) { toNextTrial = true; } } else { Debug.Log("Wrong Candidate Rotated => " + currOrderedCandidate); string wrongCandidateMsg = "USER_WRONG_ROTATION " + currOrderedCandidate; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(wrongCandidateMsg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); } } } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { Vector2 gaugePosition = gaugePositions[gaugeIndex]; if (e.i == (int)gaugePosition.x && e.j == (int)gaugePosition.y) { float prevRotation = currentRotation; currentRotation -= e.diff * anglePerStep; string msg = ""; if (gaugeState == GAUGE_APPEARING) { msg += "USER_START_GAUGE" + prevRotation + " " + currentRotation; gaugeState = GAUGE_APPEARED; } else { msg += "USER_ROTATE_GAUGE " + prevRotation + " " + currentRotation; } expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(msg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, true); } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { if (toNextTrial == false) { //Debug.Log("target(" + e.i + ", " + e.j + ") == right(" + rightCandidate.x + ", " + rightCandidate.y + ")?"); if (e.i == rightCandidate.x && e.j == rightCandidate.y) // right candidate { string payload = "USER_RIGHT_PIN " + e.i + " " + e.j + " " + expanDialSticks.modelMatrix[e.i, e.j].CurrentPosition; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(payload), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); //DebugInSitu("target("+e.i+", "+e.j+") == right("+ rightCandidate.x + ", "+ rightCandidate.y + ")", Color.black, Color.green); toNextTrial = true; } else // wrong candidate { string payload = "USER_WRONG_PIN " + e.i + " " + e.j + " " + expanDialSticks.modelMatrix[e.i, e.j].CurrentPosition; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(payload), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); //DebugInSitu("target(" + e.i + ", " + e.j + ") != right(" + rightCandidate.x + ", " + rightCandidate.y + ")", Color.black, Color.red); } } }
private void HandleRotationChanged(object sender, ExpanDialStickEventArgs e) { Vector2 molePosition = molePositions[moleIndex]; if (e.i == (int)molePosition.x && e.j == (int)molePosition.y) { string msg = "USER_ROTATION " + e.i + " " + e.j; expanDialSticks.client.Publish(MQTT_SYSTEM_RECORDER, System.Text.Encoding.UTF8.GetBytes(msg), MqttMsgBase.QOS_LEVEL_AT_MOST_ONCE, false); if (moleState == MOLE_APPEARED && moleIndex < molePositions.Length) { moleState = LANDSCAPE_IS_CHANGING; if (training) { StartCoroutine(FakeNextMole()); } else { StartCoroutine(NextMole()); } } } }
private void HandleHoldingChanged(object sender, ExpanDialStickEventArgs e) { }
private void HandlePositionChanged(object sender, ExpanDialStickEventArgs e) { }
private void HandleYAxisChanged(object sender, ExpanDialStickEventArgs e) { }
private void HandleClickChanged(object sender, ExpanDialStickEventArgs e) { Debug.Log("HandleClickChanged -> (" + e.i + "|" + e.j + "|" + e.diff + ")"); users.Enqueue(e.i + "|" + e.j + "|" + CLICK); }