Example #1
0
        /// <summary>
        /// Set the specified style.
        /// </summary>
        /// <returns><c>true</c>, if style was set for children gameobjects, <c>false</c> otherwise.</returns>
        /// <param name="styleTyped">Style for the tabs.</param>
        /// <param name="style">Style data.</param>
        public virtual bool SetStyle(StyleTabs styleTyped, Style style)
        {
            if (DefaultTabButton != null)
            {
                styleTyped.DefaultButton.ApplyTo(DefaultTabButton.gameObject);
                DefaultButtons.ForEach(x => styleTyped.DefaultButton.ApplyTo(x.gameObject));
            }

            if (ActiveTabButton != null)
            {
                styleTyped.ActiveButton.ApplyTo(ActiveTabButton.gameObject);
                ActiveButtons.ForEach(x => styleTyped.ActiveButton.ApplyTo(x.gameObject));
            }

            foreach (var tab in tabObjects)
            {
                if (tab.TabObject != null)
                {
                    styleTyped.ContentBackground.ApplyTo(tab.TabObject.GetComponent <Image>());
                    style.ApplyForChildren(tab.TabObject);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Set the specified style.
        /// </summary>
        /// <returns><c>true</c>, if style was set for children gameobjects, <c>false</c> otherwise.</returns>
        /// <param name="style">Style data.</param>
        public virtual bool SetStyle(Style style)
        {
            if (dataSource != null)
            {
                foreach (var item in dataSource)
                {
                    style.ApplyForChildren(item.ContentObject, false);
                    style.Accordion.ApplyTo(item);
                }
            }
            else if (items != null)
            {
                foreach (var item in items)
                {
                    style.ApplyForChildren(item.ContentObject, false);
                    style.Accordion.ApplyTo(item);
                }
            }

            return(true);
        }