Exemple #1
0
        public static BulletScreenDisplayer Create(BulletScreenDisplayerModel displayerInfo)
        {
            BulletScreenDisplayer instance = displayerInfo.Owner.gameObject.AddComponent <BulletScreenDisplayer>();

            instance._info = displayerInfo;
            return(instance);
        }
Exemple #2
0
        /// <summary>
        /// Create the specified displayer, textContent, showBox and direction.
        /// </summary>
        /// <param name="displayer">Displayer.</param>
        /// <param name="textContent">Text content.</param>
        /// <param name="showBox">If set to <c>true</c> show box.</param>
        /// <param name="direction">Direction.</param>
        public static BulletScreenTextElement Create(BulletScreenDisplayer displayer, string textContent,
                                                     bool showBox = false,
                                                     ScrollDirection direction = ScrollDirection.RightToLeft)
        {
            BulletScreenTextElement instance = null;

            if (displayer == null)
            {
                Debug.Log("BulletScreenTextElement.Create(), displayer can not be null !");
                return(null);
            }

            GameObject go = Instantiate(displayer.TextElementPrefab) as GameObject;

            go.transform.SetParent(displayer.GetTempRoot());
            go.transform.localPosition = Vector3.up * 10000F;
            go.transform.localScale    = Vector3.one;
            //RectTransform rect = go.GetComponent<RectTransform> ();
            //rect.rect.height = 100;
            //rect.rect.width = 100;
            instance                  = go.AddComponent <BulletScreenTextElement>();
            instance._displayer       = displayer;
            instance._textContent     = textContent;
            instance._showBox         = showBox;
            instance._scrollDirection = direction;
            return(instance);
        }