void Start() { //Set the Actions of the Buttons buttonCallbackListener writeIntroConsoleButton = button1_Action; buttonCallbackListener quitApplicationButton = button2_Action; //Create new Buttonelements and add them to the gazeUI gazeUI.Add(new GazeButton(new Rect(Screen.width * 0.35f, Screen.height * 0.05f, 512, 256), "Rotate Cube", myStyle, writeIntroConsoleButton)); gazeUI.Add(new GazeButton(new Rect(Screen.width * 0.35f, Screen.height * 0.65f, 512, 256), "Quit Application", myStyle, quitApplicationButton)); }
public void UpdateNoteButtonList() { gazeUI.Clear(); notes = clueManager.GetFoundClues(); for (int i = 0; i < notes.Count; i++) { buttonCallbackListener buttonAction = NoteAccusation; buttonCallbackListener2 buttonAction2 = NoteSelection; gazeUI.Add(new GazeButton(new Rect(notebookX + noteWidth / 2 + offset * 2, notebookY + notebookHeight / 6 + (noteHeight * i), noteWidth, noteHeight), notes[i], gazeStyle, buttonAction, buttonAction2)); } }
public GazeButton(Rect position, Texture2D content, GUIStyle myStyle, buttonCallbackListener 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); } actionToDo = callback; }
public GazeButton(Rect position,string content,GUIStyle myStyle,buttonCallbackListener callback) { this.position = position; this.content = content; colliderPosition = new Rect(position.x, Camera.main.pixelHeight-position.y-position.height,position.width,position.height); if(myStyle!= null) { this.myStyle = myStyle; actualStyleOfTheElement = this.myStyle; } actionToDo = callback; }