Exemplo n.º 1
0
    // -----------------------------------------------------------------------------------------------------

    static TEXEditorMenus()
    {
        TEXSupplementEditor.isHelpShown = EditorPrefs.GetBool("TEXDraw_ShowTipOnSupplement", true);
        if (EditorPrefs.GetBool("TEXDraw_WillProceedTMP", false))
        {
            EditorApplication.delayCall += delegate()
            {
                TEXPreferenceEditor.willFocusOnImport = true;
                TEXPreference.Initialize();
                Selection.activeObject = TEXPreference.main;
#if TEXDRAW_TMP
                TexTMPImporter.onRenderingBatch = 2;
                TexTMPImporter.DoBatchRendering();
#endif
                EditorPrefs.DeleteKey("TEXDraw_WillProceedTMP");
            };
        }
    }
Exemplo n.º 2
0
    void DrawImporter()
    {
        //GUILayoutOption max = GUILayout.MaxWidth(EditorGUIUtility.labelWidth);

        GUILayout.Label(selectedAsset.id, Styles.SetterTitle);

        // The options for sprite assets
        if (selectedSprite != null)
        {
            EditorGUI.BeginChangeCheck();
            float w = EditorGUILayout.FloatField("Line Offset", selectedSprite.lineOffset);
            float h = EditorGUILayout.FloatField("Line Height", selectedSprite.lineHeight);
            bool  v = EditorGUILayout.Toggle("Alpha Only", selectedSprite.alphaOnly);
            if (EditorGUI.EndChangeCheck())
            {
                RecordDirty();
                selectedSprite.lineOffset = w;
                selectedSprite.lineHeight = h;
                selectedSprite.alphaOnly  = v;
            }
            if (GUILayout.Button("Apply"))
            {
                selectedSprite.ImportDictionary();
                targetPreference.CallRedraw();
            }
        }

        // The options for import presets
        EditorGUILayout.Space();
        EditorGUI.BeginChangeCheck();
        var ctgImport = (ImportCharPresetsType)EditorGUILayout.EnumPopup("Import Preset", TexCharPresets.guessEnumPresets(selectedAsset.catalogRaw));

        if (EditorGUI.EndChangeCheck())
        {
            RecordUndo();
            selectedAsset.catalogRaw = TexCharPresets.charsFromEnum(ctgImport);
            selectedAsset.ImportCharacters(selectedAsset.catalogRaw);
        }

        selectedAsset.catalogRaw = EditorGUILayout.TextArea(selectedAsset.catalogRaw, Styles.ImporterPresetArea, GUILayout.Height(60));

        if (GUILayout.Button("Reimport"))
        {
            selectedAsset.ImportCharacters(selectedAsset.catalogRaw);
        }

        EditorGUILayout.Space();
#if !TEXDRAW_TMP
        if (ctgImport == ImportCharPresetsType.Custom)
        {
            GUILayout.Label("Preview:");
            if (Event.current.type == EventType.Repaint || Event.current.type == EventType.Layout)
            {
                GUILayout.Label(string.Join(", ", System.Array.ConvertAll(
                                                TexCharPresets.CharsFromString(selectedAsset.catalogRaw), x => x.ToString())), Styles.ImporterOptionFontStyle, GUILayout.ExpandHeight(true));
            }
            else
            {
                GUILayout.Label("X");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Please note that characters outside from the list is still available. Only type on characters that need to be turn into symbols. Max allowed symbol count is 256 per font", Styles.ImporterOptionFontStyle);
        }
#else
        if (selectedAsset.type != TexAssetType.Sprite)
        {
            TexTMPImporter.SetupGUI(selectedAsset);
        }
#endif
    }