Ejemplo n.º 1
0
        private static void ConvertItem(object item, List <Field> fields)
        {
            System.Type type = item.GetType();
            if (type == typeof(BooleanPropertyType))
            {
                BooleanPropertyType booleanProperty = (BooleanPropertyType)item;
                fields.Add(new Field(booleanProperty.Name, string.Equals(booleanProperty.Value, "1").ToString(), FieldType.Boolean));
            }
            else if (type == typeof(EnumPropertyType))
            {
                EnumPropertyType enumProperty = (EnumPropertyType)item;
                if (PixelCrushers.DialogueSystem.Articy.ArticyTools.IsQuestStateArticyPropertyName(enumProperty.Name))
                {
                    fields.Add(new Field(enumProperty.Name, PixelCrushers.DialogueSystem.Articy.ArticyTools.EnumValueToQuestState(Tools.StringToInt(enumProperty.Value), GetEnumStringValue(enumProperty.Name, Tools.StringToInt(enumProperty.Value))), FieldType.Text));
                }
                else
                {
                    var asString = _convertDropdownAsString;
                    if (_prefs != null)
                    {
                        switch (_prefs.ConversionSettings.GetDropdownOverrideSetting(enumProperty.Name).mode)
                        {
                        case ConversionSettings.DropdownOverrideMode.Int:
                            asString = false;
                            break;

                        case ConversionSettings.DropdownOverrideMode.String:
                            asString = true;
                            break;
                        }
                    }
                    if (asString)
                    {
                        fields.Add(new Field(enumProperty.Name, GetEnumStringValue(enumProperty.Name, Tools.StringToInt(enumProperty.Value)), FieldType.Text));
                    }
                    else
                    {
                        fields.Add(new Field(enumProperty.Name, enumProperty.Value, FieldType.Number));
                    }
                }
            }
            else if (type == typeof(LocalizableTextPropertyType))
            {
                LocalizableTextPropertyType localizableTextProperty = (LocalizableTextPropertyType)item;
                string baseFieldTitle = localizableTextProperty.Name;
                if (!string.IsNullOrEmpty(baseFieldTitle) && localizableTextProperty.LocalizedString != null)
                {
                    foreach (var localizedStringItem in localizableTextProperty.LocalizedString)
                    {
                        if (string.IsNullOrEmpty(localizedStringItem.Lang))
                        {
                            fields.Add(new Field(baseFieldTitle, localizedStringItem.Value, FieldType.Text));
                        }
                        else
                        {
                            string localizedTitle = string.Format("{0} {1}", baseFieldTitle, localizedStringItem.Lang);
                            fields.Add(new Field(localizedTitle, localizedStringItem.Value, FieldType.Localization));
                        }
                    }
                }
            }
            else if (type == typeof(ReferenceSlotPropertyType))
            {
                ReferenceSlotPropertyType slotProperty = (ReferenceSlotPropertyType)item;
                if (_convertSlotsAs == ConverterPrefs.ConvertSlotsModes.DisplayName)
                {
                    fields.Add(new Field(slotProperty.Name, GetDisplayName(slotProperty.IdRef), FieldType.Text));
                }
                else
                {
                    fields.Add(new Field(slotProperty.Name, slotProperty.IdRef, FieldType.Text));
                }
            }
            else if (type == typeof(NumberPropertyType))
            {
                NumberPropertyType numberPropertyType = (NumberPropertyType)item;
                fields.Add(new Field(numberPropertyType.Name, numberPropertyType.Value, FieldType.Number));
            }
            else if (type == typeof(ReferenceStripPropertyType))
            {
                ReferenceStripPropertyType stripPropertyType = (ReferenceStripPropertyType)item;
                fields.Add(new Field(ArticyTools.SubtableFieldPrefix + stripPropertyType.Name, GetStripStringValue(stripPropertyType), FieldType.Text));
            }
            else if (type == typeof(StringPropertyType))
            {
                StringPropertyType stringPropertyType = (StringPropertyType)item;
                fields.Add(new Field(stringPropertyType.Name, stringPropertyType.Value, FieldType.Text));
            }
        }
Ejemplo n.º 2
0
        public virtual void AddProperty(EnumPropertyType propertyType, object content)
        {
            PropertyItem pro = new PropertyItem((int)propertyType, content);

            AddProperty(pro);
        }
Ejemplo n.º 3
0
 public virtual void RemoveProperty(EnumPropertyType propertyType)
 {
     RemoveProperty((int)propertyType);
 }
Ejemplo n.º 4
0
 public virtual void AddProperty(EnumPropertyType propertyType, object content)
 {
     AddProperty((int)propertyType, content);
 }
Ejemplo n.º 5
0
 public virtual PropertyItem GetProperty(EnumPropertyType propertyType)
 {
     return(GetProperty((int)propertyType));
 }
Ejemplo n.º 6
0
 private static void ConvertItem(object item, List <Field> fields)
 {
     System.Type type = item.GetType();
     if (type == typeof(BooleanPropertyType))
     {
         BooleanPropertyType booleanProperty = (BooleanPropertyType)item;
         fields.Add(new Field(booleanProperty.Name, string.Equals(booleanProperty.Value, "1").ToString(), FieldType.Boolean));
     }
     else if (type == typeof(EnumPropertyType))
     {
         EnumPropertyType enumProperty = (EnumPropertyType)item;
         if (PixelCrushers.DialogueSystem.Articy.ArticyTools.IsQuestStateArticyPropertyName(enumProperty.Name))
         {
             fields.Add(new Field(enumProperty.Name, PixelCrushers.DialogueSystem.Articy.ArticyTools.EnumValueToQuestState(Tools.StringToInt(enumProperty.Value), string.Empty), FieldType.Text));
         }
         else
         {
             fields.Add(new Field(enumProperty.Name, enumProperty.Value, FieldType.Number));
         }
     }
     else if (type == typeof(LocalizableTextPropertyType))
     {
         LocalizableTextPropertyType localizableTextProperty = (LocalizableTextPropertyType)item;
         string baseFieldTitle = localizableTextProperty.Name;
         if (!string.IsNullOrEmpty(baseFieldTitle) && localizableTextProperty.LocalizedString != null)
         {
             foreach (var localizedStringItem in localizableTextProperty.LocalizedString)
             {
                 if (string.IsNullOrEmpty(localizedStringItem.Lang))
                 {
                     fields.Add(new Field(baseFieldTitle, localizedStringItem.Value, FieldType.Text));
                 }
                 else
                 {
                     string localizedTitle = string.Format("{0} {1}", baseFieldTitle, localizedStringItem.Lang);
                     fields.Add(new Field(localizedTitle, localizedStringItem.Value, FieldType.Localization));
                 }
             }
         }
     }
     else if (type == typeof(ReferenceSlotPropertyType))
     {
         ReferenceSlotPropertyType slotProperty = (ReferenceSlotPropertyType)item;
         fields.Add(new Field(slotProperty.Name, slotProperty.IdRef, FieldType.Text));
     }
     else if (type == typeof(NumberPropertyType))
     {
         NumberPropertyType numberPropertyType = (NumberPropertyType)item;
         fields.Add(new Field(numberPropertyType.Name, numberPropertyType.Value, FieldType.Number));
     }
     else if (type == typeof(ReferenceStripPropertyType))
     {
         //--- Note: ReferenceStripPropertyType is not converted.
         Debug.LogWarning("Dialogue System: Skipping import of ReferenceStripPropertyType: " + (item as ReferenceStripPropertyType).Name);
     }
     else if (type == typeof(StringPropertyType))
     {
         StringPropertyType stringPropertyType = (StringPropertyType)item;
         fields.Add(new Field(stringPropertyType.Name, stringPropertyType.Value, FieldType.Text));
     }
 }
Ejemplo n.º 7
0
 public virtual PropertyItem GetProperty(EnumPropertyType propertyType)
 {
     return GetProperty((int)propertyType);
 }
Ejemplo n.º 8
0
 public virtual void AddProperty(EnumPropertyType propertyType,object content)
 {
     AddProperty((int)propertyType,content);
 }
Ejemplo n.º 9
0
 public void RemoveProperty(EnumPropertyType propertyType)
 {
     RemoveProperty((int)propertyType);
 }
Ejemplo n.º 10
0
                public void RemoveProperty(EnumPropertyType propertyType)
        {
                        RemoveProperty((int)propertyType);

                   
        }