private void DrawArticyVariables()
 {
     articyVariablesFoldout = EditorGUILayout.Foldout(articyVariablesFoldout, "Variables");
     if (articyVariablesFoldout)
     {
         StartIndentedSection();
         EditorGUILayout.BeginHorizontal();
         if (GUILayout.Button("All", EditorStyles.miniButton, GUILayout.Width(40)))
         {
             MassSelectVariables(true);
         }
         if (GUILayout.Button("None", EditorStyles.miniButton, GUILayout.Width(40)))
         {
             MassSelectVariables(false);
         }
         EditorGUILayout.EndHorizontal();
         foreach (ArticyData.VariableSet variableSet in articyData.variableSets.Values)
         {
             foreach (ArticyData.Variable variable in variableSet.variables)
             {
                 EditorGUILayout.BeginHorizontal();
                 string            id = ArticyData.FullVariableName(variableSet, variable);
                 ConversionSetting conversionSetting = prefs.ConversionSettings.GetConversionSetting(id);
                 conversionSetting.Include = EditorGUILayout.Toggle(conversionSetting.Include, GUILayout.Width(ToggleWidth));
                 EditorGUI.BeginDisabledGroup(true);
                 EditorGUILayout.TextField(id);
                 EditorGUILayout.TextField(variable.technicalName);
                 EditorGUI.EndDisabledGroup();
                 EditorGUILayout.EndHorizontal();
             }
         }
         EndIndentedSection();
     }
 }
 private void MassSelectVariables(bool value)
 {
     foreach (ArticyData.VariableSet variableSet in articyData.variableSets.Values)
     {
         foreach (ArticyData.Variable variable in variableSet.variables)
         {
             string            id = ArticyData.FullVariableName(variableSet, variable);
             ConversionSetting conversionSetting = prefs.ConversionSettings.GetConversionSetting(id);
             conversionSetting.Include = value;
         }
     }
 }
        private void BuildArticyVarNameList()
        {
            var list = new List <string>();

            foreach (ArticyData.VariableSet variableSet in articyData.variableSets.Values)
            {
                foreach (ArticyData.Variable variable in variableSet.variables)
                {
                    list.Add(ArticyData.FullVariableName(variableSet, variable));
                }
            }
            articyVarNameList = list.ToArray();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Converts articy variable sets and variables into Dialogue System variables.
        /// </summary>
        private void ConvertVariables()
        {
            int variableID = 0;

            foreach (ArticyData.VariableSet articyVariableSet in articyData.variableSets.Values)
            {
                foreach (ArticyData.Variable articyVariable in articyVariableSet.variables)
                {
                    string fullName = ArticyData.FullVariableName(articyVariableSet, articyVariable);
                    fullVariableNames.Add(fullName);
                    if (prefs.ConversionSettings.GetConversionSetting(fullName).Include)
                    {
                        variableID++;
                        Variable variable = template.CreateVariable(variableID, fullName, articyVariable.defaultValue);
                        variable.Type = (articyVariable.dataType == ArticyData.VariableDataType.Boolean)
                                                        ? FieldType.Boolean
                                                                : (articyVariable.dataType == ArticyData.VariableDataType.Integer)
                                                                ? FieldType.Number
                                                                : FieldType.Text;
                        database.variables.Add(variable);
                    }
                }
            }
        }