Removed commented out code.

This commit is contained in:
JavidPack
2016-12-19 07:54:28 -07:00
parent ec266cd00a
commit 156e7696e2
6 changed files with 1 additions and 201 deletions

View File

@@ -1,5 +1,4 @@
using System; using Terraria;
using Terraria;
using Terraria.ModLoader; using Terraria.ModLoader;
using System.Collections.Generic; using System.Collections.Generic;
using Terraria.UI; using Terraria.UI;
@@ -14,7 +13,6 @@ namespace ItemChecklist
static internal ItemChecklist instance; static internal ItemChecklist instance;
internal static ModHotKey ToggleChecklistHotKey; internal static ModHotKey ToggleChecklistHotKey;
internal static UserInterface ItemChecklistInterface; internal static UserInterface ItemChecklistInterface;
//internal bool UIInitialized;
internal ItemChecklistUI ItemChecklistUI; internal ItemChecklistUI ItemChecklistUI;
public ItemChecklist() public ItemChecklist()
@@ -29,27 +27,8 @@ namespace ItemChecklist
{ {
instance = this; instance = this;
ToggleChecklistHotKey = RegisterHotKey("Toggle Item Checklist", "I"); ToggleChecklistHotKey = RegisterHotKey("Toggle Item Checklist", "I");
//UIInitialized = false;
//if (!Main.dedServ)
//{
// ItemChecklistUI = new ItemChecklistUI();
// ItemChecklistUI.Activate();
// ItemChecklistInterface = new UserInterface();
// ItemChecklistInterface.SetState(ItemChecklistUI);
//}
} }
//public override void PostSetupContent()
//{
// if (!Main.dedServ)
// {
// ItemChecklistUI = new ItemChecklistUI();
// ItemChecklistUI.Activate();
// ItemChecklistInterface = new UserInterface();
// ItemChecklistInterface.SetState(ItemChecklistUI);
// }
//}
public override void AddRecipes() public override void AddRecipes()
{ {
if (!Main.dedServ) if (!Main.dedServ)
@@ -65,14 +44,6 @@ namespace ItemChecklist
int lastSeenScreenHeight; int lastSeenScreenHeight;
public override void ModifyInterfaceLayers(List<MethodSequenceListItem> layers) public override void ModifyInterfaceLayers(List<MethodSequenceListItem> layers)
{ {
//if (!UIInitialized)
//{
// ItemChecklistUI = new ItemChecklistUI();
// ItemChecklistUI.Activate();
// ItemChecklistInterface = new UserInterface();
// ItemChecklistInterface.SetState(ItemChecklistUI);
//}
int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text")); int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));
if (MouseTextIndex != -1) if (MouseTextIndex != -1)
{ {

View File

@@ -1,9 +1,6 @@
using ItemChecklist.UI; using ItemChecklist.UI;
using System.Linq;
using Terraria; using Terraria;
using Terraria.GameInput;
using Terraria.ModLoader; using Terraria.ModLoader;
using Terraria.ModLoader.IO;
namespace ItemChecklist namespace ItemChecklist
{ {
@@ -33,7 +30,6 @@ namespace ItemChecklist
itemChecklistPlayer.foundItems.Add(newItem); itemChecklistPlayer.foundItems.Add(newItem);
itemChecklistPlayer.totalItemsFound++; itemChecklistPlayer.totalItemsFound++;
itemChecklistPlayer.foundItem[item.type] = true; itemChecklistPlayer.foundItem[item.type] = true;
//ItemChecklist.instance.ItemChecklistUI.UpdateCheckboxes();
ItemChecklist.instance.ItemChecklistUI.UpdateNeeded(); ItemChecklist.instance.ItemChecklistUI.UpdateNeeded();
if (ItemChecklistUI.announce) if (ItemChecklistUI.announce)
{ {

View File

@@ -1,15 +1,9 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Terraria; using Terraria;
using Terraria.ModLoader;
using Terraria.GameContent.UI.Elements; using Terraria.GameContent.UI.Elements;
using Terraria.UI; using Terraria.UI;
using System;
using System.Collections.Generic;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader.UI;
using System.Reflection;
using Terraria.Graphics;
namespace ItemChecklist.UI namespace ItemChecklist.UI
{ {
@@ -18,9 +12,7 @@ namespace ItemChecklist.UI
public UIHoverImageButton toggleButton; public UIHoverImageButton toggleButton;
public UIToggleHoverImageButton muteButton; public UIToggleHoverImageButton muteButton;
public UIPanel checklistPanel; public UIPanel checklistPanel;
//public UIList checklistList;
public UIGrid checklistList; public UIGrid checklistList;
// private FieldInfo uilistinnerlist;
float spacing = 8f; float spacing = 8f;
public static bool visible = false; public static bool visible = false;
@@ -34,7 +26,6 @@ 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; // Is initialize called? (Yes it is called on reload) I want to reset nicely with new character or new loaded mods: visible = false;
// uilistinnerlist = typeof(UIList).GetField("_innerList", BindingFlags.Instance | BindingFlags.NonPublic);
announce = true; announce = true;
checklistPanel = new UIPanel(); checklistPanel = new UIPanel();
@@ -48,8 +39,6 @@ namespace ItemChecklist.UI
toggleButton = new UIHoverImageButton(Main.itemTexture[ItemID.Book], "Toggle Found"); toggleButton = new UIHoverImageButton(Main.itemTexture[ItemID.Book], "Toggle Found");
toggleButton.OnClick += ToggleButtonClicked; toggleButton.OnClick += ToggleButtonClicked;
//toggleButton.Left.Pixels = spacing;
//toggleButton.Top.Pixels = spacing;
checklistPanel.Append(toggleButton); checklistPanel.Append(toggleButton);
muteButton = new UIToggleHoverImageButton(Main.itemTexture[ItemID.Megaphone], ItemChecklist.instance.GetTexture("closeButton"), "Toggle Messages", announce); muteButton = new UIToggleHoverImageButton(Main.itemTexture[ItemID.Megaphone], ItemChecklist.instance.GetTexture("closeButton"), "Toggle Messages", announce);
@@ -84,8 +73,6 @@ namespace ItemChecklist.UI
itemSlots[i] = new ItemSlot(i); itemSlots[i] = new ItemSlot(i);
} }
updateneeded = true; updateneeded = true;
// TODO, game window resize issue --> UserInterface.ActiveInstance.Recalculate(); on resize? new hook?
// TODO, Scrollbar can't click
} }
private void ToggleButtonClicked(UIMouseEvent evt, UIElement listeningElement) private void ToggleButtonClicked(UIMouseEvent evt, UIElement listeningElement)
@@ -114,13 +101,10 @@ namespace ItemChecklist.UI
if (!updateneeded) { return; } if (!updateneeded) { return; }
updateneeded = false; updateneeded = false;
checklistList.Clear(); checklistList.Clear();
// var uilistinner = (UIElement)uilistinnerlist.GetValue(checklistList);
var itemChecklistPlayer = Main.LocalPlayer.GetModPlayer<ItemChecklistPlayer>(ItemChecklist.instance); var itemChecklistPlayer = Main.LocalPlayer.GetModPlayer<ItemChecklistPlayer>(ItemChecklist.instance);
//var itemChecklistPlayer = ItemChecklistPlayer.localInstance;
UIElement element = new UIElement(); UIElement element = new UIElement();
int count = 0;
for (int i = 0; i < itemChecklistPlayer.findableItems.Length; i++) for (int i = 0; i < itemChecklistPlayer.findableItems.Length; i++)
{ {
if (itemChecklistPlayer.findableItems[i]) if (itemChecklistPlayer.findableItems[i])
@@ -128,32 +112,15 @@ namespace ItemChecklist.UI
if (showCompleted || !itemChecklistPlayer.foundItem[i]) if (showCompleted || !itemChecklistPlayer.foundItem[i])
{ {
//ItemSlot box = new ItemSlot(i);
ItemSlot box = itemSlots[i]; ItemSlot box = itemSlots[i];
//keyImage.Left.Set(xOffset, 1f);
//element.Append(keyImage);
//count++;
//if(count == 4)
//{
// count = 0;
// element = new UIElement();
//}
//UIHoverImageButton box = new UIHoverImageButton(Main.itemTexture[i], Main.itemName[i]);
//UICheckbox box = new UICheckbox(i, Main.itemName[i], 1f, false);
//box.Selected = itemChecklistPlayer.foundItem[i];
//checklistList.Add(box); n squared
checklistList._items.Add(box); checklistList._items.Add(box);
checklistList._innerList.Append(box); checklistList._innerList.Append(box);
// uilistinner.Append(box);
} }
} }
} }
checklistList.UpdateOrder(); checklistList.UpdateOrder();
checklistList._innerList.Recalculate(); checklistList._innerList.Recalculate();
// uilistinner.Recalculate();
} }
protected override void DrawSelf(SpriteBatch spriteBatch) protected override void DrawSelf(SpriteBatch spriteBatch)
@@ -168,71 +135,8 @@ namespace ItemChecklist.UI
} }
} }
//public class FixedUIScrollbar : UIElement
public class FixedUIScrollbar : UIScrollbar public class FixedUIScrollbar : UIScrollbar
{ {
//private float _viewPosition;
//private float _viewSize = 1f;
//private float _maxViewSize = 20f;
//private bool _isDragging;
//private bool _isHoveringOverHandle;
//private float _dragYOffset;
//private Texture2D _texture;
//private Texture2D _innerTexture;
//public float ViewPosition
//{
// get
// {
// return this._viewPosition;
// }
// set
// {
// this._viewPosition = MathHelper.Clamp(value, 0f, this._maxViewSize - this._viewSize);
// }
//}
//public FixedUIScrollbar()
//{
// this.Width.Set(20f, 0f);
// this.MaxWidth.Set(20f, 0f);
// this._texture = TextureManager.Load("Images/UI/Scrollbar");
// this._innerTexture = TextureManager.Load("Images/UI/ScrollbarInner");
// this.PaddingTop = 5f;
// this.PaddingBottom = 5f;
//}
//public void SetView(float viewSize, float maxViewSize)
//{
// viewSize = MathHelper.Clamp(viewSize, 0f, maxViewSize);
// this._viewPosition = MathHelper.Clamp(this._viewPosition, 0f, maxViewSize - viewSize);
// this._viewSize = viewSize;
// this._maxViewSize = maxViewSize;
//}
//public float GetValue()
//{
// return this._viewPosition;
//}
//private Rectangle GetHandleRectangle()
//{
// CalculatedStyle innerDimensions = base.GetInnerDimensions();
// if (this._maxViewSize == 0f && this._viewSize == 0f)
// {
// this._viewSize = 1f;
// this._maxViewSize = 1f;
// }
// return new Rectangle((int)innerDimensions.X, (int)(innerDimensions.Y + innerDimensions.Height * (this._viewPosition / this._maxViewSize)) - 3, 20, (int)(innerDimensions.Height * (this._viewSize / this._maxViewSize)) + 7);
//}
//private void DrawBar(SpriteBatch spriteBatch, Texture2D texture, Rectangle dimensions, Color color)
//{
// spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y - 6, dimensions.Width, 6), new Rectangle?(new Rectangle(0, 0, texture.Width, 6)), color);
// spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y, dimensions.Width, dimensions.Height), new Rectangle?(new Rectangle(0, 9, texture.Width, 2)), color);
// spriteBatch.Draw(texture, new Rectangle(dimensions.X, dimensions.Y + dimensions.Height, dimensions.Width, 6), new Rectangle?(new Rectangle(0, texture.Height - 6, texture.Width, 6)), color);
//}
protected override void DrawSelf(SpriteBatch spriteBatch) protected override void DrawSelf(SpriteBatch spriteBatch)
{ {
UserInterface temp = UserInterface.ActiveInstance; UserInterface temp = UserInterface.ActiveInstance;
@@ -248,27 +152,5 @@ namespace ItemChecklist.UI
base.MouseDown(evt); base.MouseDown(evt);
UserInterface.ActiveInstance = temp; UserInterface.ActiveInstance = temp;
} }
//public override void MouseUp(UIMouseEvent evt)
//{
// base.MouseUp(evt);
// this._isDragging = false;
//}
} }
//public class BossInfo
//{
// internal Func<bool> available;
// internal Func<bool> downed;
// internal string name;
// internal float progression;
// public BossInfo(string name, float progression, Func<bool> available, Func<bool> downed)
// {
// this.name = name;
// this.progression = progression;
// this.available = available;
// this.downed = downed;
// }
//}
} }

View File

@@ -87,27 +87,6 @@ namespace ItemChecklist
{ {
ItemChecklistUI.hoverText = item.name + (item.modItem != null ? " [" + item.modItem.mod.Name + "]" : ""); ItemChecklistUI.hoverText = item.name + (item.modItem != null ? " [" + item.modItem.mod.Name + "]" : "");
} }
//if (IsMouseHovering)
//{
// string hoverText = item.name + " " + item.type;
// float x = Main.fontMouseText.MeasureString(hoverText).X;
// Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 0f);
// if (vector.Y > (float)(Main.screenHeight - 30))
// {
// vector.Y = (float)(Main.screenHeight - 30);
// }
// if (vector.X > (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16))
// {
// vector.X = (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16);
// }
// Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, hoverText, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f);
//}
} }
//public override void MouseOver(UIMouseEvent evt)
//{
// base.MouseOver(evt);
// Main.PlaySound(12, -1, -1, 1, 1f, 0f);
//}
} }
} }

View File

@@ -1,12 +1,5 @@
using ItemChecklist.UI; using ItemChecklist.UI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.GameContent.UI.Elements; using Terraria.GameContent.UI.Elements;
namespace ItemChecklist namespace ItemChecklist
@@ -26,17 +19,6 @@ namespace ItemChecklist
if (IsMouseHovering) if (IsMouseHovering)
{ {
ItemChecklistUI.hoverText = hoverText; ItemChecklistUI.hoverText = hoverText;
//float x = Main.fontMouseText.MeasureString(hoverText).X;
//Vector2 vector = new Vector2((float)Main.mouseX, (float)Main.mouseY) + new Vector2(16f, 0f);
//if (vector.Y > (float)(Main.screenHeight - 30))
//{
// vector.Y = (float)(Main.screenHeight - 30);
//}
//if (vector.X > (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16))
//{
// vector.X = (float)(Parent.GetDimensions().Width + Parent.GetDimensions().X - x - 16);
//}
//Utils.DrawBorderStringFourWay(spriteBatch, Main.fontMouseText, hoverText, vector.X, vector.Y, new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), Color.Black, Vector2.Zero, 1f);
} }
} }
} }

View File

@@ -1,17 +1,7 @@
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using System;
using Terraria.UI; using Terraria.UI;
using ItemChecklist.UI; using ItemChecklist.UI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terraria;
using Terraria.GameContent.UI.Elements;
namespace Terraria.GameContent.UI.Elements namespace Terraria.GameContent.UI.Elements
{ {