public override void DroppedOnInventory(Vector3 mousePosition) { SetHidden(false); Spellbook spellbook = (GameObject.Find("Spellbook").GetComponent <Spellbook>()); spellbook.show(GameObject.Find("Inventory")); }
void OnGUI() { string redButtonText = "Help"; Badgebook badgebook = GameObject.Find("Badgebook").GetComponent <Badgebook>(); // If quest check has been requested, display an orange border if (badgebook.showOrangeBorder) { int thick = 10; GUI.DrawTexture(new Rect(0, 0, Screen.width, thick), orangeBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(0, 0, thick, Screen.height), orangeBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(Screen.width - thick, 0, thick, Screen.height), orangeBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(0, Screen.height - thick, Screen.width, thick), orangeBorder, ScaleMode.StretchToFill, false); if (showYellowBorder) { redButtonText = "Ok"; GUI.DrawTexture(new Rect(thick, thick, Screen.width - 2 * thick, thick), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(thick, thick, thick, Screen.height - 2 * thick), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(Screen.width - 2 * thick, thick, thick, Screen.height - 2 * thick), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(thick, Screen.height - 2 * thick, Screen.width - 2 * thick, thick), yellowBorder, ScaleMode.StretchToFill, false); } } // If help has been requested, display a yellow border else if (showYellowBorder) { redButtonText = "Ok"; int thick = 10; GUI.DrawTexture(new Rect(0, 0, Screen.width, thick), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(0, 0, thick, Screen.height), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(Screen.width - thick, 0, thick, Screen.height), yellowBorder, ScaleMode.StretchToFill, false); GUI.DrawTexture(new Rect(0, Screen.height - thick, Screen.width, thick), yellowBorder, ScaleMode.StretchToFill, false); } bool oldhint = hintstart; // Toggle control for marking start/end of giving a hint hintstart = GUI.Toggle(new Rect(Screen.width - 30, Screen.height - 30, 30, 30), hintstart, "H"); if (oldhint != hintstart) { showYellowBorder = false; TraceLogger.LogKVtime("hint", "" + hintstart); ProgramLogger.LogKVtime("hint", "" + hintstart); } // Display a button that requests help or cancels a call for help if (GUI.Button(new Rect(0, Screen.height - 64, 64, 64), redButtonText + "!", helpButtonStyle)) { TraceLogger.LogKVtime("hint", redButtonText); ProgramLogger.LogKVtime("hint", redButtonText); showYellowBorder = !showYellowBorder; } if (Input.GetKey(KeyCode.B)) { Inventory inventory = GameObject.Find("Inventory").GetComponent <Inventory>(); Spellbook spellbook = GameObject.Find("Spellbook").GetComponent <Spellbook>(); spellbook.show(GameObject.Find("Inventory")); } }
void OnGUI() { GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), background_texture); // this must come before the TextEditor line below halfbook.draw(); GUI.SetNextControlName("EditableCode"); stateObj = GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl) as TextEditor; //GUI.FocusControl("EditableCode"); // Give the appropriate text area keyboard control -> this prevents us from moving the player while in the IDE // if (Event.current.rawType == EventType.MouseDown) { // Debug.Log("caught mousedown event"); // if (editorPanel.isWithin(Event.current.mousePosition)) // GUI.FocusControl("EditableCode"); // else // GUI.FocusControl("ReferenceCode"); // Debug.Log("focus control: "+GUI.GetNameOfFocusedControl()); // } if (shouldPopup) { // GUI.DrawTexture(editorPanel.getRect(),left_panel_background); // //GUI.DrawTexture(new Rect(0,0,Screen.width*3/4,Screen.height),left_panel_background); // GUILayout.BeginArea(new Rect(120,40,Screen.width*3/4,Screen.height)); // // scroll_position = GUILayout.BeginScrollView (scroll_position, GUILayout.Width(Screen.width*3/4-200), GUILayout.Height(Screen.height-60 )); // Should vary the size of the last rect by how much text we have?? // // GUILayout.EndScrollView (); // GUILayout.EndArea(); editorPanel.draw(false); int boxWidth = 300; int boxHeight = 75; GUIStyle style = GUI.skin.box; style.alignment = TextAnchor.UpperCenter; GUI.Box(new Rect(Screen.width / 2 - boxWidth / 2, Screen.height / 2 - boxHeight / 2, boxWidth, boxHeight), "Are you sure you want to delete your script?", style); if (GUI.Button(new Rect(Screen.width / 2 - 60, Screen.height / 2 + box_height / 2 - 20, 50, 30), "Yes")) { no_edit = false; shouldRemove = true; shouldPopup = false; } if (GUI.Button(new Rect(Screen.width / 2 + 30, Screen.height / 2 + box_height / 2 - 20, 50, 30), "No")) { no_edit = false; shouldPopup = false; } } else { //leftPanel(); editorPanel.draw(true); } if (shouldRemove) { removeScript(); } //rightPanel(); errorPanel.draw(); buttonPanel.draw(); if (GUI.GetNameOfFocusedControl() == "EditableCode") { adjustScroll(); catchTabs(); detectKeyboardActivity(); logKeyboardActivity(); } // check if the spellbook (outside of the code region) was clicked // if so, we want to make it full screen if (Event.current.type == EventType.MouseDown) { Vector2 pos = Event.current.mousePosition; if (halfbook.getBookRect().Contains(pos) && !halfbook.getTextRect().Contains(pos) && !errorPanel.getErrorRect().Contains(pos) && !editorPanel.getEditorRect().Contains(pos)) { spellbook.setNoCopyDisplay(true); spellbook.show(GameObject.Find("IDE")); } } // make it so that we can't click through to the game // NOTE: This must appear LAST in the OnGUI. Otherwise, other buttons won't work! GUI.Button(new Rect(0, 0, Screen.width, Screen.height), "", empty_style); }
public void setFocus() { spellbook.show(GameObject.Find("IDE")); }