mirror of
https://github.com/OMGeeky/ItemChecklist.git
synced 2025-12-27 06:29:25 +01:00
0.2.1 release.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user