Even More Modifiers  1.0.0.0
A mod for rolling various bonus stats on items
ModifierTooltipLine.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using Microsoft.Xna.Framework;
3 
4 namespace Loot.Api.Core
5 {
10  public class ModifierTooltipLine
11  {
12  public string Text;
13  public Color? Color;
14 
15  internal static ModifierTooltipBuilder Builder => new ModifierTooltipBuilder();
16 
17  public class ModifierTooltipBuilder : Builder.PropertyBuilder<List<ModifierTooltipLine>>
18  {
19  protected override List<ModifierTooltipLine> DefaultProperty
20  {
21  set
22  {
23  Property.Clear();
24  Property.AddRange(value);
25  }
26  }
27 
28  public ModifierTooltipBuilder WithLines(IEnumerable<ModifierTooltipLine> lines)
29  {
30  Property.AddRange(lines);
31  return this;
32  }
33 
35  {
36  Property.Add(line);
37  return this;
38  }
39 
40  public ModifierTooltipBuilder WithLine(string text, Color? color = null)
41  {
42  Property.Add(new ModifierTooltipLine
43  {
44  Text = text,
45  Color = color
46  });
47  return this;
48  }
49 
51  {
52  Property.Add(new PositiveTooltipLine(
53  text
54  ));
55  return this;
56  }
57 
59  {
60  Property.Add(new NegativeTooltipLine(
61  text
62  ));
63  return this;
64  }
65 
66  public ModifierTooltipBuilder WithPositives(params string[] texts)
67  {
68  foreach (string text in texts)
69  {
70  WithPositive(text);
71  }
72 
73  return this;
74  }
75 
76  public ModifierTooltipBuilder WithNegatives(params string[] texts)
77  {
78  foreach (string text in texts)
79  {
80  WithNegative(text);
81  }
82 
83  return this;
84  }
85  }
86  }
87 
92  {
93  public PositiveTooltipLine(string text = null)
94  {
95  if (text != null) Text = text;
96  Color = Microsoft.Xna.Framework.Color.Lime;
97  }
98  }
99 
104  {
105  public NegativeTooltipLine(string text = null)
106  {
107  if (text != null) Text = text;
108  Color = Microsoft.Xna.Framework.Color.Red;
109  }
110  }
111 }
A ModifierTooltipLine with a Red text color.
ModifierTooltipBuilder WithNegatives(params string[] texts)
A ModifierTooltipLine with a Lime text color.
ModifierTooltipBuilder WithPositives(params string[] texts)
ModifierTooltipBuilder WithLine(string text, Color?color=null)
ModifierTooltipBuilder WithLine(ModifierTooltipLine line)
Defines a tooltip line of a modifier A modifier can have multiple lines
ModifierTooltipBuilder WithLines(IEnumerable< ModifierTooltipLine > lines)