public static LogKVtime ( string key, string message ) : void | ||
key | string | |
message | string | |
return | void |
// void rightPanel() // { // //GUI.BeginGroup(errorPanel.getRect()); // GUI.BeginGroup(new Rect(Screen.width*3/4+5,0,Screen.width*1/4-5,Screen.height)); // if (GUI.Button (new Rect (10,15,130,65), "Back", button_style)) // { // if (!shouldPopup) { // //back button will change the SpellBook page name // input.SetCode(current_code); // // enabled = false; // previous_state.active = true; // paused = true; // Time.timeScale = 1; // // ProgramLogger.LogKV("close", getSpellName()+", "+Time.time); // ProgramLogger.LogCode(getSpellName(), current_code); // // if(IDEClosed != null) // IDEClosed(file_name, current_code); // } // } // // // if (GUI.Button (new Rect (180,15,65,65), "X", remove_style)) // { // no_edit = true; // shouldPopup = true; // } // // // GUIStyle style = GUI.skin.box; // // // // style.alignment = TextAnchor.UpperLeft; // // style.wordWrap = true; // // // // string pattern = @"^(.+) class (.+) is public, should be declared in a file named (.+)"; // // if (!Regex.IsMatch(current_error, pattern)) // // GUI.Box(new Rect (10,100,230,500), current_error, style); // // else { // // GUI.Box(new Rect (10,100,230,500), "------------", style); // // } // // GUI.EndGroup(); // } public void checkBackButton(Rect r) { if (GUI.Button(r, "Back", button_style)) { if (!shouldPopup) { //back button will change the SpellBook page name input.SetCode(current_code); enabled = false; previous_state.active = true; paused = true; Time.timeScale = 1; ProgramLogger.LogKVtime("close", getSpellName()); //+", "+Time.time); ProgramLogger.LogCode(getSpellName(), current_code); SpellLogger.LogCode(getSpellName(), current_code); if (IDEClosed != null) { IDEClosed(file_name, current_code); } } } }
public void castSpell(GameObject target) { if (target.GetComponent("Enchantable") == null) { TraceLogger.LogKVtime("attempt", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position); TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position); (GameObject.Find("Popup").GetComponent("Popup") as Popup).popup("Target (" + target.name + ") immune to magic."); SetHidden(false); return; } TraceLogger.LogKVtime("spell", getSpellName()); ProgramLogger.LogKVtime("spell", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position); TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position); June june = new June(target, file_name); SetHidden(false); item_name = "Blank"; file_name = ""; animate = false; inventoryTexture = Resources.Load("Textures/Scroll") as Texture2D; (target.GetComponent("Enchantable") as Enchantable).enchant(june, delegate(GameObject t){ absorbSpell(t); }); }
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 OnApplicationQuit() { if (enabled) { input.SetCode(current_code); ProgramLogger.LogKVtime("close", getSpellName()); //+", "+Time.time); ProgramLogger.LogCode(getSpellName(), current_code); SpellLogger.LogCode(getSpellName(), current_code); } }
public void show(GameObject previous_state) { this.previous_state = previous_state; previous_state.active = false; enabled = true; paused = false; //Time.timeScale = 0; ProgramLogger.LogKVtime("open", getSpellName()); //+", "+Time.time); spellbook = GameObject.Find("Spellbook").GetComponent <Spellbook>(); halfbook = new HalfBook(); if (IDEOpened != null) { IDEOpened(file_name, current_code); } }
public void checkNewSpellButton(Rect r) { if (GUI.Button(r, left_panel_background, empty_style)) { input.SetCode(current_code); ProgramLogger.LogKVtime("close", getSpellName()); //+", "+Time.time); ProgramLogger.LogCode(getSpellName(), current_code); SpellLogger.LogCode(getSpellName(), current_code); if (IDEClosed != null) { IDEClosed(file_name, current_code); } string fname = spellbook.copyBlankSpell(); SetInput(new EclipseInput("CodeSpellsJava", JuneConfig.java_files_path + "/" + fname)); ProgramLogger.LogKVtime("open", getSpellName()); //+", "+Time.time); if (IDEOpened != null) { IDEOpened(file_name, current_code); } } }
void removeScript() { shouldRemove = false; current_code = ""; input.SetCode(current_code); enabled = false; previous_state.active = true; paused = true; Time.timeScale = 1; ProgramLogger.LogKVtime("delete", "all"); ProgramLogger.LogKVtime("close", getSpellName()); //+", "+Time.time); ProgramLogger.LogCode(getSpellName(), current_code); SpellLogger.Log("delete: " + getSpellName()); if (IDEClosed != null) { IDEClosed(file_name, current_code); } }
void setupSpecialEvents() { //Remove a spell from the inventory if the user blanks out the file contents. // This is how we'll delete spells (for now). IDE.IDEClosed += (file_name, contents) => { string newName = getSpellName(contents); string[] segs = file_name.Split('/'); string prevName = segs[segs.Length - 1].Replace(".java", ""); Inventory i = GameObject.Find("Inventory").GetComponent <Inventory>(); //previous name List <GameObject> matching_items = i.getMatching(prevName); if (Regex.Match(contents.Replace("\n", ""), "^\\s*$").Success&& matching_items.Count > 0) { Debug.Log("About to remove item"); i.removeItem(matching_items[0]); return; } if (!prevName.Equals(newName)) { // this spell already exists in the inventory so we need to automatically rename it Spellbook spellbook = GameObject.Find("Spellbook").GetComponent <Spellbook>(); string newNameAdjusted = spellbook.getIncName(newName); contents = contents.Replace(newName, newNameAdjusted); newName = newNameAdjusted; //matching_items[0].GetComponent<Item>().item_name = newName; matching_items[0].GetComponent <CodeScrollItem>().setCurrentFile(newName + ".java"); matching_items[0].GetComponent <CodeScrollItem>().getIDEInput().SetCode(contents); ProgramLogger.LogKVtime("rename", prevName + ", " + newName); SpellLogger.Log("rename: " + prevName + ", " + newName); } matching_items[0].GetComponent <CodeScrollItem>().SetCompilable(); ProgramLogger.LogKV("compilable", newName + ", " + matching_items[0].GetComponent <CodeScrollItem>().IsCompilable()); }; AudioClip monster_clip = Resources.Load("Growls") as AudioClip; //Setup sounds Monster.AttackStarted += (monster) => { monster.audio.PlayOneShot(monster_clip); Popup.mainPopup.popup("Monster awoken! Hide in the swamp!"); }; Monster.AttackEnded += (monster) => { monster.audio.PlayOneShot(monster_clip); Popup.mainPopup.popup("You lost him!"); }; AudioSource main_audio = GameObject.Find("Voice").audio; AudioClip spellbook_clip = Resources.Load("PageTurn") as AudioClip; Spellbook.PageTurnedForward += (page) => { main_audio.audio.PlayOneShot(spellbook_clip); }; Spellbook.PageTurnedBackward += (page) => { main_audio.audio.PlayOneShot(spellbook_clip); }; Spellbook.SpellCopied += (page) => { main_audio.audio.PlayOneShot(spellbook_clip); }; AudioClip drop_item_clip = Resources.Load("DropItem") as AudioClip; Inventory.DroppedOff += (target) => { main_audio.audio.PlayOneShot(drop_item_clip); }; AudioClip badge_clip = Resources.Load("BadgeUnlocked") as AudioClip; Badgebook.BadgeUnlocked += (target) => { main_audio.audio.PlayOneShot(badge_clip); }; ConversationDisplayer.ConversationStarted += (target) => { int i = Random.Range(1, 7); AudioClip hi_clip = Resources.Load("GnomeHi" + i) as AudioClip; main_audio.audio.PlayOneShot(hi_clip); }; ConversationDisplayer.ConversationStopped += (target) => { int i = Random.Range(1, 3); AudioClip bye_clip = Resources.Load("GnomeBye" + i) as AudioClip; main_audio.audio.PlayOneShot(bye_clip); }; }
public void logCurrentPage() { ProgramLogger.LogKVtime("page", currentPage().getName()); }