Ejemplo n.º 1
0
            public ArchiveSettings(ArchiveType type, CustomFileName fileName)
            {
                // Setup defaults
                enable = false;

                // Setup filenames
                this.type     = type;
                this.fileName = fileName;
            }
Ejemplo n.º 2
0
        private string AppendArchiveFileName(string originalString, System.Text.StringBuilder builder)
        {
            builder.Clear();
            int endIndex = originalString.LastIndexOf(Helpers.PathDivider);

            builder.Append(originalString.Substring(0, endIndex));
            builder.Append(Helpers.PathDivider);

            CustomFileName name = CustomFileNameDrawer.GetTarget(archiveFileName);

            builder.Append(name.ToString((IBuildSetting)target));
            return(builder.ToString());
        }
        private string AppendFileName(string originalString, System.Text.StringBuilder builder)
        {
            builder.Clear();
            builder.Append(originalString);
            builder.Append(Helpers.PathDivider);

            // Add file name
            CustomFileName name = CustomFileNameDrawer.GetTarget(fileName);

            builder.Append(name.ToString((IBuildSetting)target));
            builder.Append(FileExtension);
            return(builder.ToString());
        }
        public static CustomFileName GetTarget(SerializedProperty names, SerializedProperty asSlug)
        {
            CustomFileName.Prefill[]
            prefills = new CustomFileName.Prefill[names.arraySize];
            for (int index = 0; index < prefills.Length; ++index)
            {
                SerializedProperty element = names.GetArrayElementAtIndex(index);
                SerializedProperty type    = element.FindPropertyRelative("type");
                SerializedProperty text    = element.FindPropertyRelative("text");
                prefills[index] = new CustomFileName.Prefill((CustomFileName.PrefillType)type.enumValueIndex, text.stringValue);
            }
            CustomFileName name = new CustomFileName(asSlug.boolValue, prefills);

            return(name);
        }
Ejemplo n.º 5
0
        private void DrawNamesListElement(Rect rect, int index, bool isActive, bool isFocused)
        {
            // Get all the properties
            SerializedProperty element = NamesProperty.GetArrayElementAtIndex(index);
            SerializedProperty type    = element.FindPropertyRelative("type");
            SerializedProperty text    = element.FindPropertyRelative("text");

            // Draw the text
            float originalWidth = rect.width;

            rect.width = TypeWidth;
            rect.y    += EditorHelpers.VerticalMargin;

            // Draw enumerator
            type.enumValueIndex = EditorGUI.IntPopup(rect, type.enumValueIndex, type.enumDisplayNames, PrefillTypeValues);

            // Draw the text field (if necessary)
            rect.x    += (EditorHelpers.VerticalMargin + TypeWidth);
            rect.width = (originalWidth - (TypeWidth + EditorHelpers.VerticalMargin));

            // Draw text field
            bool originalEnabled = GUI.enabled;

            if (CustomFileName.CanEditText(type.enumValueIndex) == true)
            {
                rect.y          -= EditorHelpers.VerticalMargin / 2f;
                rect.height      = EditorGUIUtility.singleLineHeight;
                text.stringValue = EditorGUI.TextField(rect, text.stringValue);
            }
            //else
            //{
            //    GUI.enabled = false;
            //    EditorGUI.SelectableLabel(rect, text.stringValue);
            //    GUI.enabled = originalEnabled;
            //}
        }