Esempio n. 1
0
        /// <summary>
        /// 指定された TMPRule を持つオブジェクトに設定を反映します
        /// </summary>
        public static void Apply(TMPRuleSettings settings, TMPRule tmpRule)
        {
            var ruleName = tmpRule.RuleName;

            if (ruleName == TMPRule.INVALID_RULE_NAME)
            {
                return;
            }

            var setting = Array.Find(settings.List, c => c.Name == ruleName);

            if (setting == null)
            {
                return;
            }

            var tmpText    = tmpRule.GetComponent <TMP_Text>();
            var canApplyTo = setting.CanApplyTo(tmpText);

            if (!canApplyTo)
            {
                return;
            }

            Undo.RecordObject(tmpText, "Inspector");
            setting.ApplyTo(tmpText);
            EditorUtility.SetDirty(tmpText);
        }
Esempio n. 2
0
        /// <summary>
        /// 指定された TMPRule の設定を反映します
        /// </summary>
        private static void Apply(TMPRule tmpRule)
        {
            if (m_settings == null)
            {
                m_settings = TMPRuleEditorUtils.GetSettings();

                if (m_settings == null)
                {
                    return;
                }
            }

            TMPRuleEditorUtils.Apply(m_settings, tmpRule);
        }