Exemplo n.º 1
0
        private void DrawWatchVariableNamePopup(Watch watch)
        {
            if (watchableVariableNames == null || watchableVariableNames.Length == 0)
            {
                List <string> variableNames = new List <string>();
                if (database != null)
                {
                    foreach (var variable in database.variables)
                    {
                        variableNames.Add(variable.Name);
                    }
                }
                watchableVariableNames = variableNames.ToArray();
            }
            int newIndex = EditorGUILayout.Popup(watch.variableIndex, watchableVariableNames);

            if (newIndex != watch.variableIndex)
            {
                watch.variableIndex = newIndex;
                if (0 <= watch.variableIndex && watch.variableIndex < watchableVariableNames.Length)
                {
                    watch.expression = string.Format("Variable[\"{0}\"]", DialogueLua.StringToTableIndex(watchableVariableNames[watch.variableIndex]));
                }
                else
                {
                    watch.expression = string.Empty;
                }
                watch.Evaluate();
            }
        }
 private void DrawWatchVariableNamePopup(Watch watch)
 {
     if (watchableVariableNames == null || watchableVariableNames.Length == 0) {
         List<string> variableNames = new List<string>();
         if (database != null) {
             foreach (var variable in database.variables) {
                 variableNames.Add(variable.Name);
             }
         }
         watchableVariableNames = variableNames.ToArray();
     }
     int newIndex = EditorGUILayout.Popup(watch.variableIndex, watchableVariableNames);
     if (newIndex != watch.variableIndex) {
         watch.variableIndex = newIndex;
         if (0 <= watch.variableIndex && watch.variableIndex < watchableVariableNames.Length) {
             watch.expression = string.Format("Variable[\"{0}\"]", DialogueLua.StringToTableIndex(watchableVariableNames[watch.variableIndex]));
         } else {
             watch.expression = string.Empty;
         }
         watch.Evaluate();
     }
 }