Skip to content

Commit

Permalink
0.7, Help Panel, Sorts and Filters everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Aug 22, 2018
1 parent dc2af81 commit d3345c4
Show file tree
Hide file tree
Showing 35 changed files with 1,736 additions and 703 deletions.
1 change: 1 addition & 0 deletions BestiaryUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ internal UIElement CreateBestiaryPanel()
queryItem = new UIBestiaryQueryItemSlot(new Item());
queryItem.Top.Set(2, 0f);
queryItem.Left.Set(2, 0f);
queryItem.emptyHintText = RBText("EmptyQuerySlotHint");
mainPanel.Append(queryItem);

npcNameFilter = new NewUITextBox(RBText("FilterByName", "Common"));
Expand Down
471 changes: 471 additions & 0 deletions HelpUI.cs

Large diffs are not rendered by default.

Binary file added Images/Help/Inventory_Back8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/Item_2430.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/Item_531.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/Item_54.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/mpFavorited.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/sortsExplanation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Help/uniqueTile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
670 changes: 7 additions & 663 deletions ItemCatalogueUI.cs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Localization/TranslationsNeeded.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
zh-Hans 2
ru-RU 2
pt-BR 2
pl-PL 2
it-IT 2
fr-FR 2
es-ES 2
de-DE 2
4 changes: 2 additions & 2 deletions Localization/UpdateLocalizationFiles.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os.path

# tModLoader .lang file updater by jopojelly. (v1.0)
# tModLoader .lang file updater by jopojelly. (v1.1)
# Run this script after updating en-US.lang with new keys. python 3.
# Also make sure the file encodings are UTF-8 not UTF-8-BOM.
# You can use this script for your own mod if you credit me.
Expand Down Expand Up @@ -45,7 +45,7 @@

# For lines with key values pairs, copy translation or add commented translation placeholder.
if englishLine.find("=") != -1:
if otherLines[otherIndex].startswith(englishLine[:englishLine.find("=")]):
if len(otherLines) > otherIndex and otherLines[otherIndex].startswith(englishLine[:englishLine.find("=")]):
otherLanguage += otherLines[otherIndex]
otherIndex += 1
else:
Expand Down
2 changes: 2 additions & 0 deletions Localization/de-DE.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RecipeCatalogueUI.NearbyChests=Nahe Truhen
RecipeCatalogueUI.ClickToRefresh=Klicken zum Aktualisieren
RecipeCatalogueUI.ItemChecklistOnly=Nur Item Checklist
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Nur neue Gegenstände hergestellt aus gesehenen Gegenständen
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Hergestellt
ItemCatalogueUI.OnlyShowCraftedItems=Zeige nur Hergestellte Gegenstände
Expand All @@ -30,3 +31,4 @@ BestiaryUI.HasLoot=Hat Beute
BestiaryUI.ShowOnlyNPCWithLoot=Zeige nur NPC mit Beute
BestiaryUI.NewLoot=Neue Beute
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Zeige nur NPC mit niemals zuvor gesehener Beute
# BestiaryUI.EmptyQuerySlotHint=Place item here
2 changes: 2 additions & 0 deletions Localization/en-US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RecipeCatalogueUI.NearbyChests=Nearby Chests
RecipeCatalogueUI.ClickToRefresh=Click to Refresh
RecipeCatalogueUI.ItemChecklistOnly=Item Checklist Only
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Only new Items made from Seen Items
RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Crafted
ItemCatalogueUI.OnlyShowCraftedItems=Only show crafted items
Expand All @@ -30,3 +31,4 @@ BestiaryUI.HasLoot=Has Loot
BestiaryUI.ShowOnlyNPCWithLoot=Show only NPC with Loot
BestiaryUI.NewLoot=New Loot
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Show only NPC with never before seen Loot
BestiaryUI.EmptyQuerySlotHint=Place item here
2 changes: 2 additions & 0 deletions Localization/es-ES.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RecipeCatalogueUI.NearbyChests=Cofres cercanos
RecipeCatalogueUI.ClickToRefresh=Clic para recargar
RecipeCatalogueUI.ItemChecklistOnly=Item Checklist solamente
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Solo Items nuevos disponibles por Items ya vistos
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Elaborado
ItemCatalogueUI.OnlyShowCraftedItems=Solo items ya elaborados
Expand All @@ -30,3 +31,4 @@ BestiaryUI.HasLoot=Botín?
BestiaryUI.ShowOnlyNPCWithLoot=Solo NPC con botín
BestiaryUI.NewLoot=Nuevo botín
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Solo NPCs que nunca han sido vistos
# BestiaryUI.EmptyQuerySlotHint=Place item here
2 changes: 2 additions & 0 deletions Localization/fr-FR.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RecipeCatalogueUI.NearbyChests=Coffres à Proximité
RecipeCatalogueUI.ClickToRefresh=Cliquer pour Rafraîchir
RecipeCatalogueUI.ItemChecklistOnly=Item Checklist Uniquement
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Voir Uniquement les Nouveaux Objets Provenant d'Objets Déjà Vus
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Assemblé
ItemCatalogueUI.OnlyShowCraftedItems=Voir Uniquement les Objets Déjà Assemblés
Expand All @@ -30,3 +31,4 @@ BestiaryUI.HasLoot=Possède du Butin
BestiaryUI.ShowOnlyNPCWithLoot=Voir Uniquement les Ennemis à Butin
BestiaryUI.NewLoot=Nouveau Butin
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Voir Uniquement les Ennemis avec du Butin Jamais Obtenu
# BestiaryUI.EmptyQuerySlotHint=Place item here
2 changes: 2 additions & 0 deletions Localization/it-IT.lang
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RecipeCatalogueUI.NearbyChests=Ceste Vicine
RecipeCatalogueUI.ClickToRefresh=Clicca per Ricaricare
RecipeCatalogueUI.ItemChecklistOnly=Solo per Item Checklist
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Solo nuovi Oggetti fatti con Oggetti già Visti
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Costruito
ItemCatalogueUI.OnlyShowCraftedItems=Mostra solo oggetti costruiti
Expand All @@ -30,3 +31,4 @@ BestiaryUI.HasLoot=Ha bottino
BestiaryUI.ShowOnlyNPCWithLoot=Mostra solo PNG con bottino
BestiaryUI.NewLoot=Bottino nuovo
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Mostra solo PNG con bottino mai visto prima
# BestiaryUI.EmptyQuerySlotHint=Place item here
6 changes: 3 additions & 3 deletions Localization/pl-PL.lang
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Translation by ArcheRion720 & Cr4X

# Translation by ArcheRion720 & Cr4X
RecipeBrowserUI.Recipes=Przepisy
RecipeBrowserUI.Items=Przedmioty
RecipeBrowserUI.Bestiary=Bestiariusz
Expand All @@ -17,6 +16,7 @@ RecipeCatalogueUI.NearbyChests=Pobliskie skrzynie
RecipeCatalogueUI.ClickToRefresh=Kliknij aby odświeżyć
RecipeCatalogueUI.ItemChecklistOnly=Tylko przedmioty z 'Item Checklist'
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Tylko nowe przedmioty, zrobione z napotkanych przedmiotów
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Stworzone
ItemCatalogueUI.OnlyShowCraftedItems=Pokazuj tylko stworzone przedmioty
Expand All @@ -32,4 +32,4 @@ BestiaryUI.HasLoot=Ma łup
BestiaryUI.ShowOnlyNPCWithLoot=Pokaż tylko NPC z Łupem
BestiaryUI.NewLoot=Nowy Łup
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Pokaż NPC z wcześniej nie widzianym łupem

# BestiaryUI.EmptyQuerySlotHint=Place item here
5 changes: 3 additions & 2 deletions Localization/pt-BR.lang
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Translations partially by Aleck ?#4397 and partially by ??Bluezinho??#1242

# Translations partially by Aleck ?#4397 and partially by ??Bluezinho??#1242
RecipeBrowserUI.Recipes=Receitas
RecipeBrowserUI.Items=Items
RecipeBrowserUI.Bestiary=Bestiário
Expand All @@ -17,6 +16,7 @@ RecipeCatalogueUI.NearbyChests=Baús Pertos
RecipeCatalogueUI.ClickToRefresh=Clique para Atualizar
RecipeCatalogueUI.ItemChecklistOnly=Somente pela Item Checklist
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Somente Itens novos feito com Itens Vistos
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Craftado
ItemCatalogueUI.OnlyShowCraftedItems=Mostrar apenas itens craftados
Expand All @@ -32,3 +32,4 @@ BestiaryUI.HasLoot=Tem Saque
BestiaryUI.ShowOnlyNPCWithLoot=Mostrar apenas NPCs com Saque
BestiaryUI.NewLoot=Saque Novo
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Mostrar apenas NPCs com Saque nunca visto antes
# BestiaryUI.EmptyQuerySlotHint=Place item here
11 changes: 6 additions & 5 deletions Localization/ru-RU.lang
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//Russian Translation made by Terraria Phone&PC Team

# Russian Translation made by Terraria Phone&PC Team
RecipeBrowserUI.Recipes=Рецепты
RecipeBrowserUI.Items=Предметы
RecipeBrowserUI.Bestiary=Мобы
Expand All @@ -17,13 +16,14 @@ RecipeCatalogueUI.NearbyChests=Ближайшие сундуки
RecipeCatalogueUI.ClickToRefresh=Нажмите чтобы обновить
RecipeCatalogueUI.ItemChecklistOnly=Только Item Checklist
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=Только новые предметы из полученных предметов
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=Создано
ItemCatalogueUI.=Показывать только созданные предметы
ItemCatalogueUI.OnlyShowCraftedItems=Показывать только созданные предметы
ItemCatalogueUI.Loot=Лут
ItemCatalogueUI.=Показывать только лут
ItemCatalogueUI.ShowOnlyLootItems=Показывать только лут
ItemCatalogueUI.Unobtained=Неполученное
ItemCatalogueUI.=Только неполученные предметы
ItemCatalogueUI.OnlyUnobtainedItems=Только неполученные предметы
ItemCatalogueUI.BottomInstructions=2x ЛКМ: Рецепт; 2x ПКМ: С кого выпадает

BestiaryUI.Encountered=Встречено
Expand All @@ -32,3 +32,4 @@ BestiaryUI.HasLoot=Лут
BestiaryUI.ShowOnlyNPCWithLoot=Показывать только мобов с лутом
BestiaryUI.NewLoot=Новый лут
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=Показывать только мобов, с которых ни разу не получен лут
# BestiaryUI.EmptyQuerySlotHint=Place item here
4 changes: 3 additions & 1 deletion Localization/zh-Hans.lang
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Chinese Translations made by 抗药又坚硬汉化组(SBMW GROUP).
# Chinese Translations made by 抗药又坚硬汉化组(SBMW GROUP).
RecipeBrowserUI.Recipes=合成配方
RecipeBrowserUI.Items=物品图鉴
RecipeBrowserUI.Bestiary=生物图鉴
Expand All @@ -16,6 +16,7 @@ RecipeCatalogueUI.NearbyChests=附近箱子
RecipeCatalogueUI.ClickToRefresh=点击刷新
RecipeCatalogueUI.ItemChecklistOnly=只显示曾有制作
RecipeCatalogueUI.OnlyNewItemsMadeFromSeenItems=只显示使用见过的物品合成的新物品
# RecipeCatalogueUI.EmptyQuerySlotHint=Place item here

ItemCatalogueUI.Crafted=可合成
ItemCatalogueUI.OnlyShowCraftedItems=只显示可合成的物品
Expand All @@ -31,3 +32,4 @@ BestiaryUI.HasLoot=有掉落物
BestiaryUI.ShowOnlyNPCWithLoot=只显示有掉落物的NPC
BestiaryUI.NewLoot=新掉落物
BestiaryUI.ShowOnlyNPCWithNeverBeforeSeenLoot=只显示有未见过的掉落物的NPC
# BestiaryUI.EmptyQuerySlotHint=Place item here
23 changes: 23 additions & 0 deletions RecipeBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Terraria.Localization;
using Terraria.ModLoader;
using Terraria.UI;
using Terraria.UI.Chat;

namespace RecipeBrowser
{
Expand All @@ -21,6 +22,10 @@ namespace RecipeBrowser
// TODO: Hide Items, items not interested in crafting. Only show if query item is that item (so you can still know how to craft if needed in craft chain.)
// TODO: Star Loot
// TODO: some sort of banner menu?
// TODO: Craft in UI for Multiple chests/banks/Magic Storage

// Multistep craft?
// Craft in GUI?
internal class RecipeBrowser : Mod
{
internal static RecipeBrowser instance;
Expand All @@ -47,6 +52,11 @@ public override void Load()

instance = this;

// Remember, this mod is NOT open source, don't steal these TagHandlers.
ChatManager.Register<TagHandlers.LinkTagHandler>("l", "link");
ChatManager.Register<TagHandlers.ImageTagHandler>("image");
//ChatManager.Register<TagHandlers.URLTagHandler>("u", "url");

FieldInfo translationsField = typeof(Mod).GetField("translations", BindingFlags.Instance | BindingFlags.NonPublic);
translations = (Dictionary<string, ModTranslation>)translationsField.GetValue(this);

Expand Down Expand Up @@ -203,6 +213,7 @@ public override void HandlePacket(BinaryReader reader, int whoAmI)
int completedChestindex = reader.ReadInt32();
chestContentsAvailable[completedChestindex] = true;
RecipeCatalogueUI.instance.updateNeeded = true;
ItemCatalogueUI.instance.updateNeeded = true;
//Main.NewText($"Complete on {completedChestindex}");
break;

Expand Down Expand Up @@ -284,6 +295,18 @@ public override object Call(params object[] args)
}
return "Failure";
}

public override void AddRecipes()
{
// Test crafting station display
//var recipe = new ModRecipe(this);
//recipe.AddIngredient(Terraria.ID.ItemID.BlueBerries, 20);
//recipe.AddTile(Terraria.ID.TileID.WorkBenches);
//recipe.AddTile(Terraria.ID.TileID.Chairs);
//recipe.needWater = true;
//recipe.SetResult(Terraria.ID.ItemID.PumpkinPie, 2);
//recipe.AddRecipe();
}
}

//static class Extensions
Expand Down
4 changes: 2 additions & 2 deletions RecipeBrowser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="tModLoaderDebug">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Terraria\tModLoaderDebug.exe</HintPath>
<Reference Include="Terraria">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Terraria\Terraria.exe</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
46 changes: 46 additions & 0 deletions RecipeBrowserUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ internal class RecipeBrowserUI : UIModState
internal const int RecipeCatalogue = 0;
internal const int ItemCatalogue = 1;
internal const int Bestiary = 2;
internal const int Help = 3;

internal TabController tabController;
internal UIDragableElement mainPanel;
internal UIDragablePanel favoritePanel;
internal UIHoverImageButton closeButton;

internal SharedUI sharedUI;
internal RecipeCatalogueUI recipeCatalogueUI;
internal ItemCatalogueUI itemCatalogueUI;
internal BestiaryUI bestiaryUI;
internal HelpUI helpUI;

internal List<int> localPlayerFavoritedRecipes => Main.LocalPlayer.GetModPlayer<RecipeBrowserPlayer>().favoritedRecipes;
internal bool[] foundItems;
Expand Down Expand Up @@ -119,9 +122,13 @@ public override void OnInitialize()
mainPanel.MaxHeight.Set(1000, 0f);
//mainPanel.BackgroundColor = Color.LightBlue;

sharedUI = new SharedUI();
recipeCatalogueUI = new RecipeCatalogueUI();
itemCatalogueUI = new ItemCatalogueUI();
bestiaryUI = new BestiaryUI();
helpUI = new HelpUI();

sharedUI.Initialize();

var recipePanel = recipeCatalogueUI.CreateRecipeCataloguePanel();
mainPanel.Append(recipePanel);
Expand All @@ -132,17 +139,23 @@ public override void OnInitialize()
var bestiaryPanel = bestiaryUI.CreateBestiaryPanel();
mainPanel.Append(bestiaryPanel);

var helpPanel = helpUI.CreateHelpPanel();
//mainPanel.Append(helpPanel); // does this do anything?

tabController = new TabController(mainPanel);
tabController.AddPanel(recipePanel);
tabController.AddPanel(cataloguePanel);
tabController.AddPanel(bestiaryPanel);
tabController.AddPanel(helpPanel);

mainPanel.AddDragTarget(recipePanel);
mainPanel.AddDragTarget(recipeCatalogueUI.recipeInfo);
mainPanel.AddDragTarget(recipeCatalogueUI.RadioButtonGroup);
mainPanel.AddDragTarget(cataloguePanel);
itemCatalogueUI.additionalDragTargets.ForEach(x => mainPanel.AddDragTarget(x));
mainPanel.AddDragTarget(bestiaryPanel);
mainPanel.AddDragTarget(helpPanel);
mainPanel.AddDragTarget(helpUI.message);

UIPanel button = new UIBottomlessPanel();
button.SetPadding(0);
Expand Down Expand Up @@ -189,6 +202,21 @@ public override void OnInitialize()
mainPanel.Append(button);
tabController.AddButton(button);

button = new UIBottomlessPanel();
button.SetPadding(0);
button.Left.Set(-155, 1);
button.Width.Set(80, 0);
button.Height.Set(22, 0);
button.OnClick += (a, b) => tabController.SetPanel(Help);
button.BackgroundColor = HelpUI.color;

text = new UIText("Help", 0.85f);
text.HAlign = 0.5f;
text.VAlign = 0.5f;
button.Append(text);
mainPanel.Append(button);
tabController.AddButton(button);

// TODO: Help panel with expandable help topics.

button = new UIBottomlessPanel();
Expand Down Expand Up @@ -409,6 +437,7 @@ public override void Update(GameTime gameTime)
mainPanel.Recalculate();
}

sharedUI.Update();
recipeCatalogueUI.Update();
itemCatalogueUI.Update();
bestiaryUI.Update();
Expand Down Expand Up @@ -486,6 +515,23 @@ public void SetPanel(int panelIndex)

parent.Append(panels[panelIndex]);
parent.Append(buttons[panelIndex]);

if(panelIndex == RecipeBrowserUI.ItemCatalogue)
{
SharedUI.instance.sortsAndFiltersPanel.Top.Set(0, 0f);
SharedUI.instance.sortsAndFiltersPanel.Width.Set(-275, 1);
SharedUI.instance.sortsAndFiltersPanel.Height.Set(60, 0f);

ItemCatalogueUI.instance.mainPanel.Append(SharedUI.instance.sortsAndFiltersPanel);
}
else if (panelIndex == RecipeBrowserUI.RecipeCatalogue)
{
SharedUI.instance.sortsAndFiltersPanel.Top.Set(60, 0f);
SharedUI.instance.sortsAndFiltersPanel.Width.Set(-56, 1);
SharedUI.instance.sortsAndFiltersPanel.Height.Set(60, 0f);

RecipeCatalogueUI.instance.mainPanel.Append(SharedUI.instance.sortsAndFiltersPanel);
}
}
}
}
Expand Down
Loading

0 comments on commit d3345c4

Please sign in to comment.