예제 #1
0
        private static string GetStripStringValue(ReferenceStripPropertyType stripPropertyType)
        {
            var s = string.Empty;

            if (stripPropertyType != null)
            {
                foreach (var reference in stripPropertyType.Reference)
                {
                    if (!string.IsNullOrEmpty(s))
                    {
                        s += ";";
                    }
                    s += reference.IdRef;
                }
            }
            return(s);
        }
예제 #2
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));
            }
        }