Skip to content

Commit

Permalink
0.2 release, Some code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Feb 21, 2018
1 parent ef689ec commit b372ab8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 17 deletions.
5 changes: 4 additions & 1 deletion HEROsMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ internal static string HeroText(string key)
// Clear EVERYthing, mod is unloaded.
public override void Unload()
{
translations = null;
UIKit.UIComponents.ItemBrowser.Filters = null;
UIKit.UIComponents.ItemBrowser.DefaultSorts = null;
UIKit.UIComponents.ItemBrowser.Categories = null;
UIKit.UIComponents.ItemBrowser.CategoriesLoaded = false;
UIKit.UIButton.buttonBackground = null;
UIKit.UIView.closeTexture = null;
UIKit.UITextbox.textboxBackground = null;
Expand Down Expand Up @@ -121,6 +122,8 @@ public override void Unload()
_hotbar = null;
ServiceController = null;
TimeWeatherControlHotbar.Unload();
ModUtils.previousInventoryItems = null;
translations = null;
instance = null;
}

Expand Down
2 changes: 1 addition & 1 deletion HEROsModServices/PrefixEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ private void label_onHover(object sender, EventArgs e)
UILabel label = (UILabel)sender;
Item item = (Item)label.Tag;
HoverText = item.Name;
HoverItem = item.Clone();
//HoverItem = item.Clone();
}

private void label_onLeftClick(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions Localization/en-US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ PauseTime=Pause Time
ForceEnchantedSundial=Force Enchanted Sundial
RainHasBeenTurnedOff=Rain has been turned off
RainHasBeenTurnedOn=Rain has been turned on
SandstormHasBeenTurnedOff=Rain has been turned off
SandstormHasBeenTurnedOn=Rain has been turned on
SandstormHasBeenTurnedOff=Sandstorm has been turned off
SandstormHasBeenTurnedOn=Sandstorm has been turned on
TimeHasBeenPaused=Time has been paused
TimeHasResumed=Time has resumed
RegionsVisible=Regions Visible
Expand Down
18 changes: 9 additions & 9 deletions ModUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal static class ModUtils
private static Texture2D _logoTexture2;
private static Texture2D _testTubeTexture;

private static Item[] previosInvenotryItems;
internal static Item[] previousInventoryItems;

public static event EventHandler InventoryChanged;

Expand Down Expand Up @@ -115,11 +115,11 @@ public static Texture2D HueTexture
}
}

public static Item HoverItem
{
get { return Main.HoverItem; }// (Item)_hoverItem.GetValue(null); }
set { Main.HoverItem = value; }// _hoverItem.SetValue(null, value); }
}
//public static Item HoverItem
//{
// get { return Main.HoverItem; }// (Item)_hoverItem.GetValue(null); }
// set { Main.HoverItem = value; }// _hoverItem.SetValue(null, value); }
//}

/// <summary>
/// Gets or Sets if the game camera is free to move from the players position
Expand Down Expand Up @@ -160,7 +160,7 @@ public static void Init()
//_testTubeTexture = HEROsMod.instance.GetTexture("Images/testTubeSpritesheet");
//ItemTooltip = new UIKit.UIComponents.ItemTooltip();
//UIKit.MasterView.gameScreen.AddChild(ItemTooltip);
previosInvenotryItems = new Item[Main.player[Main.myPlayer].inventory.Length];
previousInventoryItems = new Item[Main.player[Main.myPlayer].inventory.Length];
SetPreviousInventory();
Matrix projection = Matrix.CreateOrthographicOffCenter(0, Main.screenWidth, Main.screenHeight, 0, -10000, 10000);
//Effect effect = HEROsMod.Content.Load<Effect>("effects");
Expand Down Expand Up @@ -221,7 +221,7 @@ private static bool ItemChanged()
Player player = Main.player[Main.myPlayer];
for (int i = 0; i < player.inventory.Length - 1; i++)
{
if (player.inventory[i].IsNotTheSameAs(previosInvenotryItems[i]))
if (player.inventory[i].IsNotTheSameAs(previousInventoryItems[i]))
{
return true;
}
Expand All @@ -234,7 +234,7 @@ private static void SetPreviousInventory()
Player player = Main.player[Main.myPlayer];
for (int i = 0; i < player.inventory.Length; i++)
{
previosInvenotryItems[i] = player.inventory[i].Clone();
previousInventoryItems[i] = player.inventory[i].Clone();
}
}

Expand Down
2 changes: 1 addition & 1 deletion UIKit/MasterView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static void UpdateMaster()
UIView.ScrollAmount = PlayerInput.ScrollWheelDeltaForUI;
// UIView.ScrollAmount = (mouseState.ScrollWheelValue - previousMouseState.ScrollWheelValue) / 2;
previousMouseState = mouseState;
HoverItem = EmptyItem;
//HoverItem = EmptyItem;
HoverText = "";
GameMouseOverwritten = false;
masterView.Update();
Expand Down
2 changes: 1 addition & 1 deletion UIKit/UIComponents/ItemView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ItemView(Item item)
private void Slot2_onHover(object sender, EventArgs e)
{
HoverText = item.Name;
HoverItem = item.Clone();
//HoverItem = item.Clone();
}

public override void Draw(SpriteBatch spriteBatch)
Expand Down
2 changes: 1 addition & 1 deletion UIKit/UIComponents/Slot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected override float GetHeight()
private void Slot2_onHover(object sender, EventArgs e)
{
HoverText = item.Name;
HoverItem = item.Clone();
//HoverItem = item.Clone();
}

private void Slot2_onLeftClick(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion UIKit/UIView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class UIView
public static int ScrollAmount = 0;

public static string HoverText = "";
public static Item HoverItem = new Item();
//public static Item HoverItem = new Item();
protected static readonly Item EmptyItem = new Item();
public static bool HoverOverridden = false;

Expand Down

0 comments on commit b372ab8

Please sign in to comment.