A game about forced loneliness, made by TACStudios
1using System;
2
3namespace Unity.VisualScripting
4{
5 /// <summary>
6 /// Branches flow by switching over a string.
7 /// </summary>
8 [UnitCategory("Control")]
9 [UnitTitle("Switch On String")]
10 [UnitShortTitle("Switch")]
11 [UnitSubtitle("On String")]
12 [UnitOrder(4)]
13 public class SwitchOnString : SwitchUnit<string>
14 {
15 [Serialize]
16 [Inspectable, UnitHeaderInspectable("Ignore Case")]
17 [InspectorToggleLeft]
18 public bool ignoreCase { get; set; }
19
20 protected override bool Matches(string a, string b)
21 {
22 if (string.IsNullOrEmpty(a) && string.IsNullOrEmpty(b))
23 {
24 return true;
25 }
26
27 return string.Equals(a, b, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
28 }
29 }
30}