Skip to content

Commit

Permalink
Localized strings for sensor/behavior tabs #377
Browse files Browse the repository at this point in the history
  • Loading branch information
vanjac committed Jan 14, 2024
1 parent 4d8a5f2 commit 7b35ffc
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 10 deletions.
16 changes: 11 additions & 5 deletions Assets/GameScripts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,9 @@ public static PropertiesObjectType FindTypeWithName(PropertiesObjectType[] types
DelaySensor.objectType
};

public static string[] sensorTabNames = new string[] { "Detect", "Logic" };

public static PropertiesObjectType[][] sensorTabs = new PropertiesObjectType[][]
{
new PropertiesObjectType[]
new PropertiesObjectType[] // Detect
{
PropertiesObjectType.NONE,
TouchSensor.objectType,
Expand All @@ -87,7 +85,7 @@ public static PropertiesObjectType FindTypeWithName(PropertiesObjectType[] types
InCameraSensor.objectType,
CheckScoreSensor.objectType,
},
new PropertiesObjectType[]
new PropertiesObjectType[] // Logic
{
InputThresholdSensor.objectType,
ToggleSensor.objectType,
Expand Down Expand Up @@ -127,7 +125,15 @@ public static PropertiesObjectType FindTypeWithName(PropertiesObjectType[] types
Sound3DBehavior.objectType
};

public static string[] behaviorTabNames = new string[] { "Motion", "Graphics", "Life", "Physics", "Sound" };
public static string[] BehaviorTabNames(GUIStringSet s) =>
new string[]
{
s.BehaviorsMotion,
s.BehaviorsGraphics,
s.BehaviorsLife,
s.BehaviorsPhysics,
s.BehaviorsSound,
};

public static BehaviorType[][] behaviorTabs = new BehaviorType[][]
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/VoxelEditor/GUI/FilterGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override void WindowGUI()
{
TypePickerGUI picker = gameObject.AddComponent<TypePickerGUI>();
picker.title = StringSet.FilterActiveBehaviorTitle;
picker.categoryNames = GameScripts.behaviorTabNames;
picker.categoryNames = GameScripts.BehaviorTabNames(StringSet);
picker.categories = GameScripts.behaviorTabs;
picker.handler = (PropertiesObjectType type) =>
{
Expand Down
5 changes: 3 additions & 2 deletions Assets/VoxelEditor/GUI/PropertiesGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ private void EntityPropertiesGUI()
{
TypePickerGUI sensorMenu = gameObject.AddComponent<TypePickerGUI>();
sensorMenu.title = StringSet.ChangeSensor;
sensorMenu.categoryNames = GameScripts.sensorTabNames;
sensorMenu.categoryNames =
new string[] { StringSet.SensorsDetect, StringSet.SensorsLogic };
sensorMenu.categories = GameScripts.sensorTabs;
sensorMenu.handler = (PropertiesObjectType type) =>
{
Expand Down Expand Up @@ -552,7 +553,7 @@ public override Rect GetRect(Rect safeRect, Rect screenRect)
void Start()
{
typePicker = gameObject.AddComponent<TypePickerGUI>();
typePicker.categoryNames = GameScripts.behaviorTabNames;
typePicker.categoryNames = GameScripts.BehaviorTabNames(StringSet);
UpdateBehaviorList();
typePicker.handler = (PropertiesObjectType type) =>
{
Expand Down
18 changes: 16 additions & 2 deletions Assets/VoxelEditor/GUI/localization/GUIStringSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,26 @@ public class GUIStringSet
public virtual string PickObjectCount(int count) =>
$"{count} objects selected";

// Type names
// Categories
public virtual string Substance =>
"Substance";
public virtual string Object =>
"Object";

public virtual string SensorsDetect =>
"Detect";
public virtual string SensorsLogic =>
"Logic";
public virtual string BehaviorsMotion =>
"Motion";
public virtual string BehaviorsGraphics =>
"Graphics";
public virtual string BehaviorsLife =>
"Life";
public virtual string BehaviorsPhysics =>
"Physics";
public virtual string BehaviorsSound =>
"Sound";

// Bevel
public virtual string BevelSelectEdgesInstruction =>
"Select edges to bevel...";
Expand Down

0 comments on commit 7b35ffc

Please sign in to comment.