public GazeButton(Rect position, Texture2D content, GUIStyle myStyle, buttonCallbackListener3 callback) { this.position = position; this.contentImage = content; colliderPosition = new Rect(position.x, Camera.main.pixelHeight - position.y - position.height, position.width, position.height); if (myStyle != null) { initStyle(myStyle); } actionToDo3 = callback; }
void OnGUI() { if (isToggled) { GUI.DrawTexture(notebook, notebookTexture, ScaleMode.ScaleToFit, true); //GUI.Box(notebook, notebookTexture); foreach (GazeButton button in gazeUI) { button.OnGUI(); } if (isInfoBoxActive) { buttonCallbackListener3 buttonAction3 = DeactivateInfoBox; infoBox = new GazeButton(notebook, clueInfoBox, gazeStyle, buttonAction3); infoBox.OnGUI(); } } }
public bool Update() { //Use mouseInput, if no EyeTracker runs Vector2 positionGaze = Input.mousePosition; //Load the GazeData From the gazemodel if (gazeModel.isEyeTrackerRunning) { positionGaze = (gazeModel.posGazeLeft + gazeModel.posGazeRight) * 0.5f; positionGaze.y = Screen.height - positionGaze.y; } //Check Colision if (colliderPosition.Contains(positionGaze)) { setFocused(); if (Input.GetButtonDown("GUIAccuse")) { actionToDo(GameObject.Find(content)); } if (Input.GetButtonDown("GUISelect")) { if (actionToDo2 != null) { actionToDo2(content); } if (actionToDo3 != null) { actionToDo3(); actionToDo3 = null; } } } else { setActive(); } return(false); }
public bool Update() { //Use mouseInput, if no EyeTracker runs Vector2 positionGaze = Input.mousePosition; //Load the GazeData From the gazemodel if(gazeModel.isEyeTrackerRunning) { positionGaze = (gazeModel.posGazeLeft + gazeModel.posGazeRight) * 0.5f; positionGaze.y = Screen.height - positionGaze.y; } //Check Colision if (colliderPosition.Contains(positionGaze)) { setFocused(); if (Input.GetButtonDown("GUIAccuse")) { actionToDo(GameObject.Find(content)); } if (Input.GetButtonDown("GUISelect")) { if(actionToDo2 != null) { actionToDo2(content); } if(actionToDo3 != null) { actionToDo3(); actionToDo3 = null; } } } else { setActive(); } return false; }