Exemple #1
0
        public void Test_LoadTextResource()
        {
            Trace.WriteLine(Configuration.GetGenericHeader());

            TextResourceManager manager = new TextResourceManager("tr_Resources.TwoCultures.xml"
                                                                  , Configuration.TextResourcesRootFolder
                                                                  , "Resources.TwoCultures.xml"
                                                                  , "en-gb"
                                                                  , "resource"
                                                                  , "key");

            Assert.IsTrue(manager.GetResourceText("resource1") == "First resource");
            Assert.IsTrue(manager.GetResourceText("resource2") == "Second resource");
            Assert.IsTrue(manager.GetResourceText("resource3") == "Third resource");
            Assert.IsTrue(manager.GetResourceText("resource1", "de-at") == "Erster text");
            Assert.IsTrue(manager.GetResourceText("resource2", "de-at") == "Zweiter text");
            Assert.IsTrue(manager.GetResourceText("resource3", "de-at") == "Third resource");

            manager = new TextResourceManager("tr_Resources.OneCulture.xml"
                                              , Configuration.TextResourcesRootFolder
                                              , "Resources.OneCulture.xml"
                                              , "en-gb"
                                              , "resource"
                                              , "key");

            Assert.IsTrue(manager.GetResourceText("resource1") == "First resource");
            Assert.IsTrue(manager.GetResourceText("resource2") == "Second resource");
            Assert.IsTrue(manager.GetResourceText("resource3") == "Third resource");
            Assert.IsTrue(manager.GetResourceText("resource1", "de-at") == "First resource");
            Assert.IsTrue(manager.GetResourceText("resource2", "de-at") == "Second resource");
            Assert.IsTrue(manager.GetResourceText("resource3", "de-at") == "Third resource");

            Trace.WriteLine(Configuration.GetGenericFooter());
        }
        static AssetDeleteResult OnWillDeleteAsset(string path, RemoveAssetOptions opt)
        {
            if (AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(FontAsset))
                TextResourceManager.RebuildFontAssetCache();

            return AssetDeleteResult.DidNotDelete;
        }
Exemple #3
0
 public TextController(TextResourceManager textResourceManager, ITextConverter textConverter, SearchManager searchManager, IPageWithHtmlTagsCreator pageWithHtmlTagsCreator)
 {
     m_textResourceManager     = textResourceManager;
     m_textConverter           = textConverter;
     m_searchManager           = searchManager;
     m_pageWithHtmlTagsCreator = pageWithHtmlTagsCreator;
 }
Exemple #4
0
        public AzureTableUserManager(
            AzureTableUserStore <AzureTableUser> store,
            IOptions <IdentityOptions> optionsAccessor,
            IPasswordHasher <AzureTableUser> passwordHasher,
            IEnumerable <IUserValidator <AzureTableUser> > userValidators,
            IEnumerable <IPasswordValidator <AzureTableUser> > passwordValidators,
            ILookupNormalizer keyNormalizer,
            IdentityErrorDescriber errors,
            IServiceProvider services,
            ILogger <UserManager <AzureTableUser> > logger,
            TextResourceManager textResourceManager,
            IEmailSender emailSender,
            Utility userTokenUtility)
            : base(store
                   , optionsAccessor
                   , passwordHasher
                   , userValidators
                   , passwordValidators
                   , keyNormalizer
                   , errors
                   , services
                   , logger
                   )
        {
            base.RegisterTokenProvider(
                TokenOptions.DefaultPhoneProvider,
                new PhoneNumberTokenProvider <AzureTableUser>()
                );

            this.textResourceManager = textResourceManager;
            this.emailSender         = emailSender;
            this.UserTokenUtility    = userTokenUtility;
        }
Exemple #5
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnPreRender(EventArgs e)
        {
            if (TextResourceManager == null)
            {
                throw new TextResourceManagerException("TextResourceManager must not be null.");
            }

            this.Text = TextResourceManager.GetResourceText(this.ResourceKey, this.Culture);

            base.OnPreRender(e);
        }
Exemple #6
0
        static void ClearFontAssetData(MenuCommand command)
        {
            FontAsset fontAsset = command.context as FontAsset;

            if (fontAsset == null)
            {
                return;
            }

            if (Selection.activeObject != fontAsset)
            {
                Selection.activeObject = fontAsset;
            }

            fontAsset.ClearFontAssetData(true);
            TextResourceManager.RebuildFontAssetCache();

            TextEventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
        }
 public SnapshotResourceBuilder(TextResourceManager textResourceManager, IMarkdownToPlainTextConverter markdownToPlainTextConverter)
 {
     m_textResourceManager          = textResourceManager;
     m_markdownToPlainTextConverter = markdownToPlainTextConverter;
 }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            string evt_cmd = Event.current.commandName;

            float labelWidth = EditorGUIUtility.labelWidth;
            float fieldWidth = EditorGUIUtility.fieldWidth;

            // TextMeshPro Font Info Panel
            EditorGUI.indentLevel = 0;

            // FONT ASSET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultFontAssetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropFontAsset, Styles.defaultFontAssetLabel);
            EditorGUILayout.PropertyField(m_PropDefaultFontAssetPath, Styles.defaultFontAssetPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // FONT ASSET FALLBACK(s)
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.fallbackFontAssetsLabel, EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            m_FontAssetFallbackList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                TextResourceManager.RebuildFontAssetCache();
            }

            GUILayout.Label(Styles.fallbackMaterialSettingsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropMatchMaterialPreset, Styles.matchMaterialPresetLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // MISSING GLYPHS
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.dynamicFontSystemSettingsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            //EditorGUILayout.PropertyField(m_GetFontFeaturesAtRuntime, Styles.getFontFeaturesAtRuntime);
            EditorGUILayout.PropertyField(m_PropMissingGlyphCharacter, Styles.missingGlyphLabel);
            EditorGUILayout.PropertyField(m_PropClearDynamicDataOnBuild, Styles.clearDynamicDataOnBuildLabel);
            EditorGUILayout.PropertyField(m_PropDisplayWarnings, Styles.disableWarningsLabel);
            //EditorGUILayout.PropertyField(m_DynamicAtlasTextureManager, Styles.dynamicAtlasTextureManager);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // TEXT OBJECT DEFAULT PROPERTIES

            /*
             * EditorGUILayout.BeginVertical(EditorStyles.helpBox);
             * GUILayout.Label(Styles.containerDefaultSettingsLabel, EditorStyles.boldLabel);
             * EditorGUI.indentLevel = 1;
             *
             * EditorGUILayout.PropertyField(m_PropDefaultTextMeshProTextContainerSize, Styles.textMeshProLabel);
             * EditorGUILayout.PropertyField(m_PropDefaultTextMeshProUITextContainerSize, Styles.textMeshProUiLabel);
             * EditorGUILayout.PropertyField(m_PropEnableRaycastTarget, Styles.enableRaycastTarget);
             * EditorGUILayout.PropertyField(m_PropAutoSizeTextContainer, Styles.autoSizeContainerLabel);
             * EditorGUI.indentLevel = 0;
             *
             * EditorGUILayout.Space();
             *
             * GUILayout.Label(Styles.textComponentDefaultSettingsLabel, EditorStyles.boldLabel);
             * EditorGUI.indentLevel = 1;
             * EditorGUILayout.PropertyField(m_PropDefaultFontSize, Styles.defaultFontSize);
             *
             * EditorGUILayout.BeginHorizontal();
             * {
             *  EditorGUILayout.PrefixLabel(Styles.autoSizeRatioLabel);
             *  EditorGUIUtility.labelWidth = 32;
             *  EditorGUIUtility.fieldWidth = 10;
             *
             *  EditorGUI.indentLevel = 0;
             *  EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMinRatio, Styles.minLabel);
             *  EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMaxRatio, Styles.maxLabel);
             *  EditorGUI.indentLevel = 1;
             * }
             * EditorGUILayout.EndHorizontal();
             *
             * EditorGUIUtility.labelWidth = labelWidth;
             * EditorGUIUtility.fieldWidth = fieldWidth;
             *
             * EditorGUILayout.PropertyField(m_PropWordWrapping, Styles.wordWrappingLabel);
             * EditorGUILayout.PropertyField(m_PropKerning, Styles.kerningLabel);
             *
             * EditorGUILayout.PropertyField(m_PropExtraPadding, Styles.extraPaddingLabel);
             * EditorGUILayout.PropertyField(m_PropTintAllSprites, Styles.tintAllSpritesLabel);
             *
             * EditorGUILayout.PropertyField(m_PropParseEscapeCharacters, Styles.parseEscapeCharactersLabel);
             *
             * EditorGUI.indentLevel = 0;
             *
             * EditorGUILayout.Space();
             * EditorGUILayout.EndVertical();
             */

            // SPRITE ASSET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultSpriteAssetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropSpriteAsset, Styles.defaultSpriteAssetLabel);
            EditorGUILayout.PropertyField(m_PropMissingSpriteCharacterUnicode, Styles.missingSpriteCharacterUnicodeLabel);
            //EditorGUILayout.PropertyField(m_PropEnableEmojiSupport, Styles.enableEmojiSupportLabel);
            //EditorGUILayout.PropertyField(m_PropSpriteRelativeScaling, Styles.spriteRelativeScale);
            EditorGUILayout.PropertyField(m_PropSpriteAssetPath, Styles.spriteAssetsPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // SPRITE ASSET FALLBACK(s)
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.fallbackSpriteAssetsLabel, EditorStyles.boldLabel);
            m_SpriteAssetFallbackList.DoLayoutList();

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // STYLE SHEET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultStyleSheetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_PropStyleSheet, Styles.defaultStyleSheetLabel);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();

                TextStyleSheet styleSheet = m_PropStyleSheet.objectReferenceValue as TextStyleSheet;
                if (styleSheet != null)
                {
                    styleSheet.RefreshStyles();
                }
            }
            EditorGUILayout.PropertyField(m_PropStyleSheetsResourcePath, Styles.styleSheetResourcePathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // COLOR GRADIENT PRESETS
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.colorGradientPresetsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropColorGradientPresetsPath, Styles.colorGradientsPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // LINE BREAKING RULE
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.lineBreakingLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropUnicodeLineBreakingRules);
            //EditorGUILayout.Space();
            //GUILayout.Label(Styles.koreanSpecificRules, EditorStyles.boldLabel);
            //EditorGUILayout.PropertyField(m_PropUseModernHangulLineBreakingRules, new GUIContent("Use Modern Line Breaking", "Determines if traditional or modern line breaking rules will be used to control line breaking. Traditional line breaking rules use the Leading and Following Character rules whereas Modern uses spaces for line breaking."));

            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            if (serializedObject.ApplyModifiedProperties() || evt_cmd == k_UndoRedo)
            {
                EditorUtility.SetDirty(target);
                TextEventManager.ON_TMP_SETTINGS_CHANGED();
            }
        }
Exemple #9
0
 private void SetupFeatures()
 {
     TextResourceManager.RegisterKeys(TBLocalisation.Defaults);
 }
Exemple #10
0
 public CommonToolsTextResource()
 {
     _Resources = new WebResourceManager();
 }