Browse Source

Help box and readability improvements for Localisation editor

master
chrisgregan 10 years ago
parent
commit
ec1d98b333
  1. 8
      Assets/Fungus/Narrative/Editor/LocalizationEditor.cs
  2. 6
      Assets/Fungus/Narrative/Scripts/Localization.cs
  3. 38
      Assets/FungusExamples/Localization/Localization.unity

8
Assets/Fungus/Narrative/Editor/LocalizationEditor.cs

@ -29,11 +29,19 @@ namespace Fungus
EditorGUILayout.PropertyField(activeLanguageProp); EditorGUILayout.PropertyField(activeLanguageProp);
EditorGUILayout.PropertyField(localizationFileProp); EditorGUILayout.PropertyField(localizationFileProp);
GUILayout.Space(10);
EditorGUILayout.HelpBox("Exports a localization csv file to disk. You should save this file in your project assets and then set the Localization File property above to use it.", MessageType.Info);
if (GUILayout.Button(new GUIContent("Export Localization File"))) if (GUILayout.Button(new GUIContent("Export Localization File")))
{ {
ExportLocalizationFile(localization); ExportLocalizationFile(localization);
} }
GUILayout.Space(10);
EditorGUILayout.HelpBox("Exports all standard text in the scene to a text file for easy editing in a text editor. Use the Import option to read the standard text back into the scene.", MessageType.Info);
if (GUILayout.Button(new GUIContent("Export Standard Text"))) if (GUILayout.Button(new GUIContent("Export Standard Text")))
{ {
ExportStandardText(localization); ExportStandardText(localization);

6
Assets/Fungus/Narrative/Scripts/Localization.cs

@ -23,8 +23,9 @@ namespace Fungus
public class Localization : MonoBehaviour public class Localization : MonoBehaviour
{ {
/** /**
* Currently active language, usually defined by a two letter language code (e.g DE = German) * Language to use at startup, usually defined by a two letter language code (e.g DE = German)
*/ */
[Tooltip("Language to use at startup, usually defined by a two letter language code (e.g DE = German)")]
public string activeLanguage = ""; public string activeLanguage = "";
protected static Dictionary<string, string> localizedStrings = new Dictionary<string, string>(); protected static Dictionary<string, string> localizedStrings = new Dictionary<string, string>();
@ -40,8 +41,9 @@ namespace Fungus
} }
/** /**
* CSV file containing localization data * CSV file containing localization data which can be easily edited in a spreadsheet tool.
*/ */
[Tooltip("CSV file containing localization data which can be easily edited in a spreadsheet tool")]
public TextAsset localizationFile; public TextAsset localizationFile;
/** /**

38
Assets/FungusExamples/Localization/Localization.unity

@ -237,6 +237,7 @@ GameObject:
- 114: {fileID: 1369216154} - 114: {fileID: 1369216154}
- 114: {fileID: 1369216153} - 114: {fileID: 1369216153}
- 114: {fileID: 1369216152} - 114: {fileID: 1369216152}
- 114: {fileID: 1369216165}
m_Layer: 0 m_Layer: 0
m_Name: Flowchart m_Name: Flowchart
m_TagString: Untagged m_TagString: Untagged
@ -304,7 +305,6 @@ MonoBehaviour:
itemId: 0 itemId: 0
blockName: Select Language blockName: Select Language
description: description:
runSlowInEditor: 0
eventHandler: {fileID: 1369216147} eventHandler: {fileID: 1369216147}
commandList: commandList:
- {fileID: 1369216146} - {fileID: 1369216146}
@ -347,18 +347,19 @@ MonoBehaviour:
y: -385 y: -385
width: 1297 width: 1297
height: 1047 height: 1047
selectedBlock: {fileID: 0} selectedBlock: {fileID: 1369216156}
selectedCommands: [] selectedCommands:
- {fileID: 1369216165}
variables: [] variables: []
description: "This scene shows how to use the Fungus localization system.\nThe key description: "This scene shows how to use the Fungus localization system.\nThe key
elements are the Localization game object, the \nlocalization.csv file and the elements are the Localization game object, the \nlocalization.csv file and the
Set Language command." Set Language command."
runSlowDuration: .25 pauseAfterCommand: 0
colorCommands: 1 colorCommands: 1
hideComponents: 1 hideComponents: 1
saveSelection: 1 saveSelection: 1
localizationId: LocalizationDemo localizationId: LocalizationDemo
nextItemId: 16 nextItemId: 17
--- !u!4 &1369216151 --- !u!4 &1369216151
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -404,8 +405,9 @@ MonoBehaviour:
itemId: 14 itemId: 14
errorMessage: errorMessage:
indentLevel: 0 indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 1369216156} targetBlock: {fileID: 1369216156}
stopParentBlock: 1 callMode: 0
--- !u!114 &1369216154 --- !u!114 &1369216154
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 2 m_ObjectHideFlags: 2
@ -420,8 +422,9 @@ MonoBehaviour:
itemId: 13 itemId: 13
errorMessage: errorMessage:
indentLevel: 0 indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 1369216156} targetBlock: {fileID: 1369216156}
stopParentBlock: 1 callMode: 0
--- !u!114 &1369216155 --- !u!114 &1369216155
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 2 m_ObjectHideFlags: 2
@ -468,10 +471,10 @@ MonoBehaviour:
itemId: 11 itemId: 11
blockName: Story blockName: Story
description: description:
runSlowInEditor: 1
eventHandler: {fileID: 0} eventHandler: {fileID: 0}
commandList: commandList:
- {fileID: 1369216155} - {fileID: 1369216155}
- {fileID: 1369216165}
--- !u!114 &1369216157 --- !u!114 &1369216157
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 2 m_ObjectHideFlags: 2
@ -523,7 +526,6 @@ MonoBehaviour:
itemId: 8 itemId: 8
blockName: Spanish blockName: Spanish
description: Set language to Spanish description: Set language to Spanish
runSlowInEditor: 1
eventHandler: {fileID: 0} eventHandler: {fileID: 0}
commandList: commandList:
- {fileID: 1369216158} - {fileID: 1369216158}
@ -580,7 +582,6 @@ MonoBehaviour:
itemId: 4 itemId: 4
blockName: French blockName: French
description: Set language to French description: Set language to French
runSlowInEditor: 1
eventHandler: {fileID: 0} eventHandler: {fileID: 0}
commandList: commandList:
- {fileID: 1369216160} - {fileID: 1369216160}
@ -624,6 +625,23 @@ MonoBehaviour:
targetBlock: {fileID: 1369216156} targetBlock: {fileID: 1369216156}
hideIfVisited: 0 hideIfVisited: 0
setMenuDialog: {fileID: 0} setMenuDialog: {fileID: 0}
--- !u!114 &1369216165
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1369216145}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 050fb9e6e72f442b3b883da8a965bdeb, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 16
errorMessage:
indentLevel: 0
targetFlowchart: {fileID: 0}
targetBlock: {fileID: 1369216148}
callMode: 0
--- !u!1001 &1843071213 --- !u!1001 &1843071213
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

Loading…
Cancel
Save