Skip to content

Commit

Permalink
Unload fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JavidPack committed Aug 26, 2017
1 parent 54e6d0d commit d8cc975
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 9 deletions.
10 changes: 10 additions & 0 deletions CheatSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@ public override void Load()
AddTranslation(text);
}

public override void Unload()
{
itemBrowser = null;
npcBrowser = null;
instance = null;
ToggleCheatSheetHotbarHotKey = null;
RecipeBrowserWindow.recipeView = null;
RecipeBrowserWindow.lookupItemSlot = null;
}

//public override void PreSaveAndQuit()
//{
// SpawnRateMultiplier.HasPermission = true;
Expand Down
2 changes: 1 addition & 1 deletion Menus/ItemView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ public void ReorderSlots()
base.ContentHeight = base.GetLastChild().Y + base.GetLastChild().Height + this.spacing;
}
}
}
}
7 changes: 5 additions & 2 deletions UI/UICheckbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace CheatSheet.UI
{
internal class UICheckbox : UIView
{
private static Texture2D checkboxTexture = ((CheatSheet)CheatSheet.instance).GetTexture("UI/checkBox");//UIView.GetEmbeddedTexture("Images/UIKit/checkBox");
private static Texture2D checkmarkTexture = ((CheatSheet)CheatSheet.instance).GetTexture("UI/checkMark");//UIView.GetEmbeddedTexture("Images/UIKit/checkMark");
private static Texture2D checkboxTexture;
private static Texture2D checkmarkTexture;

private bool selected = false;

Expand Down Expand Up @@ -39,6 +39,9 @@ public string Text

public UICheckbox(string text)
{
checkboxTexture = CheatSheet.instance.GetTexture("UI/checkBox");
checkmarkTexture = CheatSheet.instance.GetTexture("UI/checkMark");

label = new UILabel(text);
label.Scale = .5f;
label.Position = new Vector2(checkboxTexture.Width + spacing, 0);
Expand Down
7 changes: 6 additions & 1 deletion UI/UIScrollBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace CheatSheet.UI
{
internal class UIScrollBar : UIView
{
private static Texture2D ScrollbarTexture = Terraria.ModLoader.ModLoader.GetTexture("CheatSheet/UI/Images.UIKit.scrollbarEdge");//UIView.GetEmbeddedTexture("Images.UIKit.scrollbarEdge.png");
private static Texture2D ScrollbarTexture;

private static Texture2D scrollbarFill;

Expand All @@ -31,6 +31,11 @@ private static Texture2D ScrollbarFill
}
}

public UIScrollBar()
{
ScrollbarTexture = CheatSheet.instance.GetTexture("UI/Images.UIKit.scrollbarEdge");
}

protected override float GetHeight()
{
return this.height;
Expand Down
5 changes: 3 additions & 2 deletions UI/UIScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class UIScrollView : UIView
ScissorTestEnable = true
};

private static Texture2D ScrollbgTexture = Terraria.ModLoader.ModLoader.GetTexture("CheatSheet/UI/Images.UIKit.scrollbgEdge");// UIView.GetEmbeddedTexture("Images.UIKit.scrollbgEdge.png");
private static Texture2D ScrollbgTexture;

private static Texture2D scrollbgFill;

Expand Down Expand Up @@ -96,6 +96,7 @@ public float ScrollPosition

public UIScrollView()
{
ScrollbgTexture = CheatSheet.instance.GetTexture("UI/Images.UIKit.scrollbgEdge");
this.scrollBar.onMouseDown += new UIView.ClickEventHandler(this.scrollBar_onMouseDown);
this.AddChild(this.scrollBar);
}
Expand Down Expand Up @@ -209,7 +210,7 @@ public override void Update()
}
}
}
IL_1EC:
IL_1EC:
float y = this.ScrollPosition / this.ContentHeight * num2;
this.scrollBar.Height = num;
this.scrollBar.Position = new Vector2(base.Width - this.scrollBar.Width, y);
Expand Down
3 changes: 2 additions & 1 deletion UI/UITextbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace CheatSheet.UI
internal class UITextbox : UIView
{
private RasterizerState _rasterizerState = new RasterizerState() { ScissorTestEnable = true };
private static Texture2D textboxBackground = Terraria.ModLoader.ModLoader.GetTexture("CheatSheet/UI/Images.UIKit.textboxEdge");
private static Texture2D textboxBackground;
private static Texture2D textboxFill;

private static Texture2D TextboxFill
Expand Down Expand Up @@ -90,6 +90,7 @@ private string passwordString

public UITextbox()
{
textboxBackground = CheatSheet.instance.GetTexture("UI/Images.UIKit.textboxEdge");
this.onLeftClick += new EventHandler(UITextbox_onLeftClick);
label.ForegroundColor = Color.Black;
label.Scale = Height / label.Height;
Expand Down
7 changes: 6 additions & 1 deletion UI/UIView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal class UIView
{
public delegate void ClickEventHandler(object sender, byte button);

protected static Texture2D closeTexture = Terraria.ModLoader.ModLoader.GetTexture("CheatSheet/UI/closeButton");// UIView.GetEmbeddedTexture("Images.closeButton.png");
protected static Texture2D closeTexture;

public static UIView exclusiveControl = null;

Expand Down Expand Up @@ -664,6 +664,11 @@ public void RemoveChild(UIView view)
this.childrenToRemove.Add(view);
}

public UIView()
{
closeTexture = CheatSheet.instance.GetTexture("UI/closeButton");
}

//public static Texture2D GetEmbeddedTexture(string name)
//{
// Assembly executingAssembly = Assembly.GetExecutingAssembly();
Expand Down
2 changes: 1 addition & 1 deletion build.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
author = jopojelly, jofairden
version = 0.2.7.2
version = 0.2.7.3
displayName = Cheat Sheet
homepage = http://forums.terraria.org/index.php?threads/cheat-sheet.41407/
buildIgnore = .vs\*, Properties\*, *.csproj, *.user, obj\*, bin\*, *.config, .git\*
Expand Down

0 comments on commit d8cc975

Please sign in to comment.