Esempio n. 1
0
 public virtual void AddRichElement(RichElement element)
 {
     if (element != null)
     {
         m_richElements.Add(element);
     }
 }
        public override GameObject Create(RichElement element)
        {
            var imageSizeableElement = element as UGUIRichElementImageSizeable;

            if (imageSizeableElement != null)
            {
                var gameObject = base.Create(element);
                if (gameObject != null)
                {
                    var image = gameObject.GetComponent <Image>();
                    if (image != null)
                    {
                        // first delete ContentSizeFitter
                        // TODO improve ?
                        RichTextUtil.DestroyComponent <ContentSizeFitter>(gameObject);
                        // then set size
                        var size = imageSizeableElement.GetSize();
                        image.rectTransform.sizeDelta = size;
                    }
                }

                return(gameObject);
            }

            return(null);
        }
Esempio n. 3
0
 public virtual void RemoveRichElement(RichElement element)
 {
     if (element != null)
     {
         m_richElements.Remove(element);
     }
 }
Esempio n. 4
0
        public override GameObject Create(RichElement element)
        {
            var textElement = element as RichElementText;

            Debug.Assert(textElement != null);
            return(Create(textElement.GetText(), textElement.GetStyle(), textElement.GetClickHandler()));
        }
 public override void Destroy(RichElement element, GameObject gameObject)
 {
     var gameObjectManager = RichTextManager.GetGameObjectManager();
     if (gameObjectManager != null)
     {
         gameObjectManager.DestroyImage(gameObject);
     }
 }
 public override void Destroy(RichElement element, GameObject gameObject)
 {
     if (gameObject)
     {
         UGUIUtil.DestroyAnimationImage(gameObject);
         base.Destroy(element, gameObject);
     }
 }
 public override void Destroy(RichElement element, GameObject gameObject)
 {
     if (gameObject != null)
     {
         UGUIUtil.DestroyTextUnderline(gameObject);
         base.Destroy(element, gameObject);
     }
 }
        public override void Destroy(RichElement element, GameObject gameObject)
        {
            var textElement = element as UGUIRichElementText;
            Debug.Assert(textElement != null);

            var gameObjectManager = RichTextManager.GetGameObjectManager();
            if (gameObjectManager != null)
            {
                gameObjectManager.DestroyText(textElement.GetStyle(), gameObject);
            }
        }
Esempio n. 9
0
        public virtual List <GameObject> GetRichElementRenderers(RichElement element)
        {
            if (element != null)
            {
                if (m_richElementRenderers.ContainsKey(element))
                {
                    return(new List <GameObject>(m_richElementRenderers[element]));
                }
            }

            return(null);
        }
Esempio n. 10
0
 void AddElementRenderer(RichElement element, GameObject renderer)
 {
     if (m_richElementRenderers.ContainsKey(element))
     {
         m_richElementRenderers[element].Add(renderer);
     }
     else
     {
         m_richElementRenderers[element] = new List <GameObject> {
             renderer
         };
     }
 }
        public override GameObject Create(RichElement element)
        {
            var imageElement = element as RichElementImage;
            Debug.Assert(imageElement != null);

            var gameObjectManager = RichTextManager.GetGameObjectManager();
            if (gameObjectManager != null)
            {
                return gameObjectManager.CreateImage(imageElement.GetImage(), imageElement.GetClickHandler());
            }

            return null;
        }
        public override GameObject Create(RichElement element)
        {
            var richElementCustom = element as RichElementCustom;
            Debug.Assert(richElementCustom != null);

            var gameObjectManager = RichTextManager.GetGameObjectManager();
            if (gameObjectManager != null)
            {
                return gameObjectManager.CreateCustom(richElementCustom.GetGameObject());
            }

            return null;
        }
        public override GameObject Create(RichElement element)
        {
            var imageGO = base.Create(element);

            if (imageGO != null)
            {
                var animationImage = element as UGUIRichElementAnimationImage;
                Debug.Assert(animationImage != null);

                UGUIUtil.CreateAnimationImage(imageGO, animationImage.GetImage(), animationImage.GetImageCount(), animationImage.GetAnimFPS());
            }

            return(imageGO);
        }
Esempio n. 14
0
        public RichElementProxy GetOrCreateProxy(RichElement element)
        {
            Debug.Assert(element != null);
            var type = element.GetType();

            if (m_richElementProxies.ContainsKey(type))
            {
                return(m_richElementProxies[type]);
            }
            else
            {
                var proxy = element.CreateElementProxy();
                m_richElementProxies[type] = proxy;
                return(proxy);
            }
        }
        public override GameObject Create(RichElement element)
        {
            var imageSizeableElement = element as NGUIRichElementImageSizeable;

            if (imageSizeableElement != null)
            {
                var gameObject = base.Create(element);
                if (gameObject != null)
                {
                    var uiSprite = gameObject.GetComponent <UISprite>();
                    if (uiSprite != null)
                    {
                        var size = imageSizeableElement.GetSize();
                        uiSprite.SetDimensions((int)size.x, (int)size.y);
                    }
                }

                return(gameObject);
            }

            return(null);
        }
 public abstract void Destroy(RichElement element, GameObject gameObject);
 public override GameObject Create(RichElement element)
 {
     return(null);
 }
 public static RichElementProxy GetOrCreateProxy(RichElement element)
 {
     return(s_proxyManager.GetOrCreateProxy(element));
 }
 public abstract GameObject Create(RichElement element);
 public override void Destroy(RichElement element, GameObject gameObject)
 {
 }