/// <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); } }
/// <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(); } }
/// <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; }