Browse Source

Added Show Line Numbers option to Flowchart

master
chrisgregan 9 years ago
parent
commit
62a1b8d40b
  1. 14
      Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs
  2. 3
      Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs
  3. 6
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs

14
Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs

@ -393,7 +393,17 @@ namespace Fungus
}
else
{
GUI.Label(commandLabelRect, commandName, commandLabelStyle);
string commandNameLabel;
if (flowchart.showLineNumbers)
{
commandNameLabel = command.commandIndex.ToString() + ": " + commandName;
}
else
{
commandNameLabel = commandName;
}
GUI.Label(commandLabelRect, commandNameLabel, commandLabelStyle);
}
if (command.executingIconTimer > Time.realtimeSinceStartup)
@ -433,7 +443,7 @@ namespace Fungus
summaryStyle.wordWrap = false;
summaryStyle.clipping = TextClipping.Clip;
commandLabelStyle.alignment = TextAnchor.MiddleLeft;
GUI.Label(summaryRect, command.commandIndex + ": " + summary, summaryStyle);
GUI.Label(summaryRect, summary, summaryStyle);
if (error)
{

3
Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs

@ -25,6 +25,7 @@ namespace Fungus
protected SerializedProperty saveSelectionProp;
protected SerializedProperty localizationIdProp;
protected SerializedProperty variablesProp;
protected SerializedProperty showLineNumbersProp;
protected SerializedProperty hideCommandsProp;
protected Texture2D addTexture;
@ -41,6 +42,7 @@ namespace Fungus
saveSelectionProp = serializedObject.FindProperty("saveSelection");
localizationIdProp = serializedObject.FindProperty("localizationId");
variablesProp = serializedObject.FindProperty("variables");
showLineNumbersProp = serializedObject.FindProperty("showLineNumbers");
hideCommandsProp = serializedObject.FindProperty("hideCommands");
addTexture = Resources.Load("Icons/add_small") as Texture2D;
@ -60,6 +62,7 @@ namespace Fungus
EditorGUILayout.PropertyField(stepPauseProp);
EditorGUILayout.PropertyField(saveSelectionProp);
EditorGUILayout.PropertyField(localizationIdProp);
EditorGUILayout.PropertyField(showLineNumbersProp);
// Show list of commands to hide in Add Command menu
ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip));

6
Assets/Fungus/Flowchart/Scripts/Flowchart.cs

@ -134,6 +134,12 @@ namespace Fungus
[Tooltip("Unique identifier for this flowchart in localized string keys. If no id is specified then the name of the Flowchart object will be used.")]
public string localizationId = "";
/**
* Display line numbers in the command list in the Block inspector.
*/
[Tooltip("Display line numbers in the command list in the Block inspector.")]
public bool showLineNumbers = false;
/**
* List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart.
*/

Loading…
Cancel
Save