0.2.1 release.

This commit is contained in:
JavidPack
2017-06-02 00:30:51 -06:00
parent 5b77e8eeee
commit bc23141a91
4 changed files with 42 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ using Terraria.UI;
using Terraria.DataStructures;
using ItemChecklist.UI;
using Microsoft.Xna.Framework;
using System;
namespace ItemChecklist
{
@@ -14,6 +15,7 @@ namespace ItemChecklist
internal static ModHotKey ToggleChecklistHotKey;
internal static UserInterface ItemChecklistInterface;
internal ItemChecklistUI ItemChecklistUI;
internal event Action<int> OnNewItem;
public ItemChecklist()
{
@@ -40,6 +42,42 @@ namespace ItemChecklist
}
}
public override object Call(params object[] args)
{
try
{
string message = args[0] as string;
if (message == "RequestFoundItems")
{
if (Main.gameMenu)
{
return "NotInGame";
}
return Main.LocalPlayer.GetModPlayer<ItemChecklistPlayer>(this).foundItem;
}
else if (message == "RegisterForNewItem")
{
Action<int> callback = args[1] as Action<int>;
OnNewItem += callback;
return "RegisterSuccess";
}
else
{
ErrorLogger.Log("ItemChecklist Call Error: Unknown Message: " + message);
}
}
catch (Exception e)
{
ErrorLogger.Log("ItemChecklist Call Error: " + e.StackTrace + e.Message);
}
return "Failure";
}
internal void NewItem(int type)
{
OnNewItem?.Invoke(type);
}
int lastSeenScreenWidth;
int lastSeenScreenHeight;
public override void ModifyInterfaceLayers(List<MethodSequenceListItem> layers)

View File

@@ -33,8 +33,9 @@ namespace ItemChecklist
ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(item.type);
if (ItemChecklistUI.announce)
{
Main.NewText($"You obtained your first {item.name}. {itemChecklistPlayer.totalItemsFound}/{itemChecklistPlayer.totalItemsToFind} {(100f*itemChecklistPlayer.totalItemsFound/itemChecklistPlayer.totalItemsToFind).ToString("0.00")}%");
Main.NewText($"You found your first {item.name}. {itemChecklistPlayer.totalItemsFound}/{itemChecklistPlayer.totalItemsToFind} {(100f*itemChecklistPlayer.totalItemsFound/itemChecklistPlayer.totalItemsToFind).ToString("0.00")}%");
}
ItemChecklist.instance.NewItem(item.type);
}
}
}

View File

@@ -40,7 +40,7 @@ namespace ItemChecklist.UI
{
// Is initialize called? (Yes it is called on reload) I want to reset nicely with new character or new loaded mods: visible = false;
announce = true; // overwritten by modplayer
announce = false; // overwritten by modplayer
checklistPanel = new UIPanel();
checklistPanel.SetPadding(10);

View File

@@ -1,5 +1,5 @@
author = jopojelly
version = 0.2.0.2
version = 0.2.1
displayName = Item Checklist
homepage = https://forums.terraria.org/index.php?threads/item-checklist-in-game-100-item-collection-checklist.52786/
hideCode = false