Skip to content

Commit

Permalink
Localized strings for Target and Filter #377
Browse files Browse the repository at this point in the history
  • Loading branch information
vanjac committed Jan 14, 2024
1 parent f7e00da commit d89139c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
13 changes: 7 additions & 6 deletions Assets/Base/ActivatedSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override string ToString()
{
Entity e = entityRef.entity;
if (e == null)
return "None";
return GUIPanel.StringSet.EntityRefNone;
return e.ToString();
}
}
Expand Down Expand Up @@ -127,7 +127,8 @@ public bool EntityMatches(EntityComponent entityComponent)
return entityComponent.entity.tag == tag;
}

public override string ToString() => "With tag " + Entity.TagToString(tag);
public override string ToString() =>
GUIPanel.StringSet.FilterWithTag(Entity.TagToString(tag));
}

public class MultipleTagFilter : Filter
Expand All @@ -151,9 +152,9 @@ public bool EntityMatches(EntityComponent entityComponent)
public override string ToString()
{
if (tagBits == 0)
return "Nothing";
return GUIPanel.StringSet.FilterNothing;
else if (tagBits == 255)
return "Anything";
return GUIPanel.StringSet.FilterAnything;
string str = "";
int count = 0;
for (byte i = 0; i < 8; i++)
Expand All @@ -165,9 +166,9 @@ public override string ToString()
}
}
if (count == 1)
return "With tag " + str;
return GUIPanel.StringSet.FilterWithTag(str);
else
return "Tags " + str;
return GUIPanel.StringSet.FilterMultipleTags(str);
}
}

Expand Down
18 changes: 9 additions & 9 deletions Assets/Base/EntityReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,33 +198,33 @@ public override string ToString()
return entityRef.entity.ToString();
else
{
string dirStr = "None";
string dirStr = GUIPanel.StringSet.EntityRefNone;
switch (direction & ~LOCAL_BIT)
{
case WEST:
dirStr = "West";
dirStr = GUIPanel.StringSet.West;
break;
case EAST:
dirStr = "East";
dirStr = GUIPanel.StringSet.East;
break;
case DOWN:
dirStr = "Down";
dirStr = GUIPanel.StringSet.Down;
break;
case UP:
dirStr = "Up";
dirStr = GUIPanel.StringSet.Up;
break;
case SOUTH:
dirStr = "South";
dirStr = GUIPanel.StringSet.South;
break;
case NORTH:
dirStr = "North";
dirStr = GUIPanel.StringSet.North;
break;
case RANDOM:
dirStr = "Random";
dirStr = GUIPanel.StringSet.TargetRandom;
break;
}
if ((direction & LOCAL_BIT) != 0 && direction != NO_DIRECTION)
return "Local " + dirStr;
return GUIPanel.StringSet.TargetLocalDirection(dirStr);
else
return dirStr;
}
Expand Down
8 changes: 8 additions & 0 deletions Assets/VoxelEditor/GUI/localization/GUIStringSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ public virtual string NoDataInWorld(string type) =>
"Filter by active behavior";
public virtual string FilterAnything =>
"Anything";
public virtual string FilterNothing =>
"Nothing";
public virtual string FilterWithTag(string tag) =>
$"With tag {tag}";
public virtual string FilterMultipleTags(string tags) =>
$"Tags {tags}";

// Target
public virtual string TargetAny =>
Expand All @@ -158,6 +164,8 @@ public virtual string NoDataInWorld(string type) =>
"World";
public virtual string TargetLocal =>
"Local";
public virtual string TargetLocalDirection(string dir) =>
$"Local {dir}";
public virtual string TargetPickObject =>
"Pick object...";
public virtual string TargetRandom =>
Expand Down

0 comments on commit d89139c

Please sign in to comment.