コード例 #1
0
 /// <summary>
 /// Attach markup theme. Should be called before any visuals with content from this theme will be created.
 /// </summary>
 /// <param name="theme">Markup theme.</param>
 public void AttachTheme(MarkupTheme theme)
 {
     if ((object)theme != null && !_themes.Contains(theme))
     {
         _themes.Add(theme);
     }
 }
コード例 #2
0
        /// <summary>
        /// Full cleanup of container (destroy widgets, unload xml, unregister generators).
        /// </summary>
        /// <param name="unregisterGenerators">Unregister generators or not.</param>
        public void Clear(bool unregisterGenerators = true)
        {
            ClearVisuals();

            if (_xmlTree != null)
            {
                _xmlTree.Recycle();
                _xmlTree = null;
            }

            _defaultFont  = null;
            _defaultTheme = null;

            if (unregisterGenerators)
            {
                _areGeneratorsAttached = false;
                Generators.Clear();
            }
        }
コード例 #3
0
 /// <summary>
 /// Force cleanup / create widgets infrastructure from attached xml-schema.
 /// </summary>
 public void CreateVisuals()
 {
     if (_isVisualized)
     {
         return;
     }
     ValidateGenerators();
     if ((object)_defaultFont == null)
     {
         _defaultFont = _fonts.Count > 0 ? _fonts[0] : Resources.GetBuiltinResource <Font> ("Arial.ttf");
     }
     if ((object)_defaultTheme == null)
     {
         _defaultTheme = _themes.Count > 0 ? _themes[0] : ScriptableObject.CreateInstance <MarkupTheme> ();
     }
     if (_xmlTree == null)
     {
         _xmlTree = LoadXml(_markupPath);
     }
     ClearVisuals();
     CreateVisualNode(_xmlTree, MarkupUtils.CreateUiObject("root", transform));
     _isVisualized = true;
 }