public static BulletScreenDisplayer Create(BulletScreenDisplayerInfo displayerInfo) { BulletScreenDisplayer instance = displayerInfo.Owner.gameObject.AddComponent <BulletScreenDisplayer>(); instance._info = displayerInfo; return(instance); }
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); } if (textContent.Contains("1")) { // Debug.Log("ddd2222"); GameObject go = Instantiate(displayer.TextElementPrefab) as GameObject; go.transform.SetParent(displayer.GetTempRoot()); go.transform.localPosition = Vector3.up * 10000F; go.transform.localScale = Vector3.one; instance = go.AddComponent <BulletScreenTextElement>(); instance._displayer = displayer; instance._textContent = textContent; // instance._showBox = showBox; instance._showBox = true; //限制方向 //instance._scrollDirection = direction; instance._scrollDirection = ScrollDirection.RightToLeft; } else if (textContent.Contains("2")) { //Debug.Log("ddd"); GameObject go = Instantiate(displayer.HandElementPrefab) as GameObject; go.transform.SetParent(displayer.GetTempHandRoot()); go.transform.localPosition = Vector3.up * 10000F; go.transform.localScale = Vector3.one; instance = go.AddComponent <BulletScreenTextElement>(); instance._displayer = displayer; instance._textContent = textContent; instance._showBox = showBox; instance._showBox = true; //限制方向 instance._scrollDirection = direction; instance._scrollDirection = ScrollDirection.RightToLeft; } return(instance); }