public override void Click(UIMouseEvent evt) { Codex codex = Parent as Codex; codex.ActiveRecipe = Recipe; codex.Dust.Clear(); }
private void UpdateParent(Item item) { Codex codex = (Parent as Codex); codex.ShownRecipes.Clear(); foreach (RecipeButton recipe in codex.Recipes) { if (recipe.Recipe.Ingredients.Any(i => i.type == item.type)) { codex.ShownRecipes.Add(recipe); } } }
public override void Update(GameTime gameTime) { if (IsMouseHovering) { Main.LocalPlayer.mouseInterface = true; Main.isMouseLeftConsumedByUI = true; } if (!Codex.Crafting) { Codex codex = (Parent as Codex); item = null; codex.ShownRecipes.Clear(); codex.RefreshRecipes(); } }
public override void Unload() { if (!Main.dedServ) { RiftRecipes = null; StaminaUserInterface = null; CollectionUserInterface = null; OverlayUserInterface = null; InfusionUserInterface = null; CookingUserInterface = null; TextCardUserInterface = null; CodexUserInterface = null; CodexPopupUserInterface = null; LootUserInterface = null; ChatboxUserInterface = null; ExtraNPCInterface = null; stamina = null; collection = null; overlay = null; infusion = null; cooking = null; textcard = null; codex = null; codexpopup = null; lootUI = null; Chatbox = null; ExtraNPCState = null; Instance = null; Dash = null; Superdash = null; Wisp = null; Smash = null; Purify = null; } UnhookIL(); Main.OnPreDraw -= TestLighting; }
internal void ChangeCategory(CodexEntry.Categories category) //swaps out all of the entry buttons based on the category { if (!(Parent is Codex)) { return; } Codex parent = Parent as Codex; ActiveCategory = category; CodexHandler player = Main.LocalPlayer.GetModPlayer <CodexHandler>(); parent.ClickableEntries.Clear(); int offY = 0; foreach (CodexEntry entry in player.Entries.Where(n => n.Category == category && (!n.RequiresUpgradedBook || player.CodexState == 2))) { EntryButton button = new EntryButton(entry); parent.AddEntryButton(button, offY); } }
public override void Click(UIMouseEvent evt) { if (item == null && Main.mouseItem.IsAir) { return; } //if the player isnt holding anything but something is equipped, unequip it Codex codex = (Parent as Codex); if (item != null && Main.mouseItem.IsAir) { item = null; Main.PlaySound(SoundID.Grab); codex.ShownRecipes.Clear(); codex.RefreshRecipes(); return; } //if nothing is equipped, equip the held item if (item == null) { item = Main.mouseItem.Clone(); Main.PlaySound(SoundID.Grab); UpdateParent(item); } //if something is equipped, swap that for the held item else { item = Main.mouseItem.Clone(); Main.PlaySound(SoundID.Grab); UpdateParent(item); } codex.RefreshRecipes(); }
public override void Load() { //Shaders if (!Main.dedServ) { GameShaders.Misc["StarlightRiver:Distort"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Distort")), "Distort"); Ref <Effect> screenRef4 = new Ref <Effect>(GetEffect("Effects/Shockwave")); Filters.Scene["ShockwaveFilter"] = new Filter(new ScreenShaderData(screenRef4, "ShockwavePass"), EffectPriority.VeryHigh); Filters.Scene["ShockwaveFilter"].Load(); Ref <Effect> screenRef3 = new Ref <Effect>(GetEffect("Effects/WaterEffect")); Filters.Scene["WaterFilter"] = new Filter(new ScreenShaderData(screenRef3, "WaterPass"), EffectPriority.VeryHigh); Filters.Scene["WaterFilter"].Load(); Ref <Effect> screenRef2 = new Ref <Effect>(GetEffect("Effects/AuraEffect")); Filters.Scene["AuraFilter"] = new Filter(new ScreenShaderData(screenRef2, "AuraPass"), EffectPriority.VeryHigh); Filters.Scene["AuraFilter"].Load(); Ref <Effect> screenRef = new Ref <Effect>(GetEffect("Effects/BlurEffect")); Filters.Scene["BlurFilter"] = new Filter(new ScreenShaderData(screenRef, "BlurPass"), EffectPriority.High); Filters.Scene["BlurFilter"].Load(); Ref <Effect> screenRef5 = new Ref <Effect>(GetEffect("Effects/Purity")); Filters.Scene["PurityFilter"] = new Filter(new ScreenShaderData(screenRef5, "PurityPass"), EffectPriority.High); Filters.Scene["PurityFilter"].Load(); Ref <Effect> screenRef6 = new Ref <Effect>(GetEffect("Effects/LightShader")); Filters.Scene["Lighting"] = new Filter(new ScreenShaderData(screenRef6, "LightingPass"), EffectPriority.High); Filters.Scene["Lighting"].Load(); Ref <Effect> screenRef7 = new Ref <Effect>(GetEffect("Effects/LightApply")); Filters.Scene["LightingApply"] = new Filter(new ScreenShaderData(screenRef7, "LightingApplyPass"), EffectPriority.High); Filters.Scene["LightingApply"].Load(); Ref <Effect> screenRef8 = new Ref <Effect>(GetEffect("Effects/pixelationFull")); Filters.Scene["Pixelation"] = new Filter(new ScreenShaderData(screenRef8, "PixelationPass"), EffectPriority.Medium); Filters.Scene["Pixelation"].Load(); Ref <Effect> screenRefCrystal = new Ref <Effect>(GetEffect("Effects/CrystalRefraction")); Filters.Scene["Crystal"] = new Filter(new ScreenShaderData(screenRefCrystal, "CrystalPass"), EffectPriority.High); Filters.Scene["Crystal"].Load(); Ref <Effect> screenRefIceCrystal = new Ref <Effect>(GetEffect("Effects/IceCrystal")); Filters.Scene["IceCrystal"] = new Filter(new ScreenShaderData(screenRefIceCrystal, "IcePass"), EffectPriority.High); Filters.Scene["IceCrystal"].Load(); Ref <Effect> screenRefWaves = new Ref <Effect>(GetEffect("Effects/Waves")); Filters.Scene["Waves"] = new Filter(new ScreenShaderData(screenRefWaves, "WavesPass"), EffectPriority.High); Filters.Scene["Waves"].Load(); Ref <Effect> screenRefWaterShine = new Ref <Effect>(GetEffect("Effects/WaterShine")); Filters.Scene["WaterShine"] = new Filter(new ScreenShaderData(screenRefWaterShine, "WaterShinePass"), EffectPriority.High); Filters.Scene["WaterShine"].Load(); lightingTest = new RenderTest(); } //Autoload Rift Recipes RiftRecipes = new List <RiftRecipe>(); AutoloadRiftRecipes(RiftRecipes); //Furniture AutoloadFurniture(); //UI if (!Main.dedServ) { //Hotkeys AbilityKeys = new AbilityHotkeys(this); AbilityKeys.LoadDefaults(); StaminaUserInterface = new UserInterface(); CollectionUserInterface = new UserInterface(); OverlayUserInterface = new UserInterface(); InfusionUserInterface = new UserInterface(); CookingUserInterface = new UserInterface(); KeyInventoryUserInterface = new UserInterface(); TextCardUserInterface = new UserInterface(); CodexUserInterface = new UserInterface(); CodexPopupUserInterface = new UserInterface(); LootUserInterface = new UserInterface(); ChatboxUserInterface = new UserInterface(); ExtraNPCInterface = new UserInterface(); RichTextInterface = new UserInterface(); stamina = new Stamina(); collection = new Collection(); overlay = new ParticleOverlay(); infusion = new Infusion(); cooking = new CookingUI(); keyinventory = new KeyInventory(); textcard = new TextCard(); codex = new GUI.Codex(); codexpopup = new CodexPopup(); lootUI = new LootUI(); Chatbox = new ChatboxOverUI(); RichText = new RichTextBox(); StaminaUserInterface.SetState(stamina); CollectionUserInterface.SetState(collection); OverlayUserInterface.SetState(overlay); InfusionUserInterface.SetState(infusion); CookingUserInterface.SetState(cooking); KeyInventoryUserInterface.SetState(keyinventory); TextCardUserInterface.SetState(textcard); CodexUserInterface.SetState(codex); CodexPopupUserInterface.SetState(codexpopup); LootUserInterface.SetState(lootUI); ChatboxUserInterface.SetState(Chatbox); RichTextInterface.SetState(RichText); } //particle systems if (!Main.dedServ) { LoadVitricBGSystems(); } //Hooking HookOn(); HookIL(); }
public override void Load() { //Shaders if (!Main.dedServ) { GameShaders.Misc["StarlightRiver:Distort"] = new MiscShaderData(new Ref <Effect>(GetEffect("Effects/Distort")), "Distort"); Ref <Effect> screenRef4 = new Ref <Effect>(GetEffect("Effects/Shockwave")); Terraria.Graphics.Effects.Filters.Scene["ShockwaveFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef4, "ShockwavePass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh); Terraria.Graphics.Effects.Filters.Scene["ShockwaveFilter"].Load(); Ref <Effect> screenRef3 = new Ref <Effect>(GetEffect("Effects/WaterEffect")); Terraria.Graphics.Effects.Filters.Scene["WaterFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef3, "WaterPass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh); Terraria.Graphics.Effects.Filters.Scene["WaterFilter"].Load(); Ref <Effect> screenRef2 = new Ref <Effect>(GetEffect("Effects/AuraEffect")); Terraria.Graphics.Effects.Filters.Scene["AuraFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef2, "AuraPass"), Terraria.Graphics.Effects.EffectPriority.VeryHigh); Terraria.Graphics.Effects.Filters.Scene["AuraFilter"].Load(); Ref <Effect> screenRef = new Ref <Effect>(GetEffect("Effects/BlurEffect")); Terraria.Graphics.Effects.Filters.Scene["BlurFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef, "BlurPass"), Terraria.Graphics.Effects.EffectPriority.High); Terraria.Graphics.Effects.Filters.Scene["BlurFilter"].Load(); Ref <Effect> screenRef5 = new Ref <Effect>(GetEffect("Effects/Purity")); Terraria.Graphics.Effects.Filters.Scene["PurityFilter"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef5, "PurityPass"), Terraria.Graphics.Effects.EffectPriority.High); Terraria.Graphics.Effects.Filters.Scene["PurityFilter"].Load(); Ref <Effect> screenRef6 = new Ref <Effect>(GetEffect("Effects/LightShader")); Terraria.Graphics.Effects.Filters.Scene["Lighting"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef6, "LightingPass"), Terraria.Graphics.Effects.EffectPriority.High); Terraria.Graphics.Effects.Filters.Scene["Lighting"].Load(); Ref <Effect> screenRef7 = new Ref <Effect>(GetEffect("Effects/LightApplicator")); Terraria.Graphics.Effects.Filters.Scene["LightingApply"] = new Terraria.Graphics.Effects.Filter(new ScreenShaderData(screenRef7, "LightingApplyPass"), Terraria.Graphics.Effects.EffectPriority.High); Terraria.Graphics.Effects.Filters.Scene["LightingApply"].Load(); } //Autoload Rift Recipes RiftRecipes = new List <RiftRecipe>(); AutoloadRiftRecipes(RiftRecipes); //Hotkeys Dash = RegisterHotKey("Forbidden Winds", "LeftShift"); Wisp = RegisterHotKey("Faeflame", "F"); Purify = RegisterHotKey("[PH]Purify Crown", "N"); Smash = RegisterHotKey("Gaia's Fist", "Z"); Superdash = RegisterHotKey("Zzelera's Cloak", "Q"); //UI if (!Main.dedServ) { StaminaUserInterface = new UserInterface(); CollectionUserInterface = new UserInterface(); OverlayUserInterface = new UserInterface(); InfusionUserInterface = new UserInterface(); CookingUserInterface = new UserInterface(); KeyInventoryUserInterface = new UserInterface(); TextCardUserInterface = new UserInterface(); CodexUserInterface = new UserInterface(); CodexPopupUserInterface = new UserInterface(); LootUserInterface = new UserInterface(); ChatboxUserInterface = new UserInterface(); ExtraNPCInterface = new UserInterface(); stamina = new Stamina(); collection = new Collection(); overlay = new Overlay(); infusion = new Infusion(); cooking = new Cooking(); keyinventory = new KeyInventory(); textcard = new TextCard(); codex = new GUI.Codex(); codexpopup = new CodexPopup(); lootUI = new LootUI(); Chatbox = new ChatboxOverUI(); StaminaUserInterface.SetState(stamina); CollectionUserInterface.SetState(collection); OverlayUserInterface.SetState(overlay); InfusionUserInterface.SetState(infusion); CookingUserInterface.SetState(cooking); KeyInventoryUserInterface.SetState(keyinventory); TextCardUserInterface.SetState(textcard); CodexUserInterface.SetState(codex); CodexPopupUserInterface.SetState(codexpopup); LootUserInterface.SetState(lootUI); ChatboxUserInterface.SetState(Chatbox); } //particle systems if (!Main.dedServ) { LoadVitricBGSystems(); } //Hooking HookOn(); HookIL(); }