Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item saying how much damage they do and Text fixes #10256

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
75 changes: 74 additions & 1 deletion UnityProject/Assets/Scripts/Items/ItemAttributesV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using AddressableReferences;
using Core;
using Systems.Clothing;
using UI.Systems.Tooltips.HoverTooltips;
using Util.Independent.FluentRichText;

namespace Items
{
Expand All @@ -16,7 +18,7 @@ namespace Items
/// </summary>
[RequireComponent(typeof(Pickupable))] //Inventory interaction
[RequireComponent(typeof(RegisterItem))] //Registry with subsistence
public class ItemAttributesV2 : Attributes
public class ItemAttributesV2 : Attributes, IHoverTooltip
{
[Header("Item Info")]

Expand Down Expand Up @@ -316,6 +318,77 @@ public void PropagatePaletteChanges()
if (clothing != null) clothing.AssignPaletteToSprites(this.ItemSprites.Palette);
}

private string GetInfo()
{
string returnS = "";
switch (hitDamage)
{
case < 1:
returnS = "no hit damage";
break;
case < 4:
returnS = "measly hit damage";
break;
case < 7:
returnS = "ok hit damage";
break;
case < 11:
returnS = "decent hit damage";
break;
case < 13:
returnS = "robust hit damage";
break;
case < 21:
returnS = "strong hit damage";
break;
case < 31:
returnS = "powerful hit damage";
break;
case < 41:
returnS = "crazy hit damage";
break;
case < 51:
returnS = "insane hit damage";
break;
case < 101:
returnS = "One shot bs hit damage";
break;
case < 201:
returnS = "ok they are dead now you don't need any more damage!!!";
break;
default:
returnS = "what type of damages this!?!?! AAAAAA";
break;
}

return returnS.Color("#D4D4D4").FontSize("85%");
}

public string HoverTip()
{
return GetInfo();
}

public string CustomTitle()
{
return null;
}

public Sprite CustomIcon()
{
return null;
}

public List<Sprite> IconIndicators()
{
return null;
}

public List<TextColor> InteractionsStrings()
{
return null;
}


}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class StringExtensions
public static string Color(this string text, RichTextColor namedRichTextColor) => new ColorStrategy(namedRichTextColor).ApplyStyle(text);
public static string Color(this string text, string hexColor) => new ColorStrategy(hexColor).ApplyStyle(text);

public static string Color(this string text, Color unityColour) => new ColorStrategy(ColorUtility.ToHtmlStringRGBA(unityColour)).ApplyStyle(text);
public static string Color(this string text, Color unityColour) => new ColorStrategy("#" + ColorUtility.ToHtmlStringRGBA(unityColour)).ApplyStyle(text);
public static string Font(this string text, string fontName) => new FontStrategy(fontName).ApplyStyle(text);
public static string Indent(this string text, string amount) => new IndentStrategy(amount).ApplyStyle(text);
public static string LineHeight(this string text, string amount) => new LineHeightStrategy(amount).ApplyStyle(text);
Expand All @@ -25,7 +25,7 @@ public static class StringExtensions
public static string NoParse(this string text) => new NoParseStrategy().ApplyStyle(text);
public static string NonBreakingSpaces(this string text) => new NonBreakingSpacesStrategy().ApplyStyle(text);
public static string HorizontalPosition(this string text, string position) => new HorizontalPositionStrategy(position).ApplyStyle(text);
public static string FontSize(this string text, string size) => new FontStrategy(size).ApplyStyle(text);
public static string FontSize(this string text, string size) => new FontSizeStrategy(size).ApplyStyle(text);
public static string Space(this string text, string amount) => new SpaceStrategy(amount).ApplyStyle(text);
public static string Sprite(this string text, int index) => new SpriteStrategy(index).ApplyStyle(text);
public static string Sprite(this string text, string name) => new SpriteStrategy(name).ApplyStyle(text);
Expand Down