Пример #1
0
        public void Regist(GameObject obj)
        {
            if (canvasDics.ContainsKey(obj))
            {
                UnRegist(obj);
            }
            var canvas = GameObjectEx.Create <Canvas>("ReelText", obj.transform, relativePosition);

            canvas.transform.localScale = canvasScale;
            canvas.GetComponent <RectTransform>().SetSize(canvasSize);
            canvas.worldCamera      = Camera.main;
            canvas.sortingLayerName = sortingLayerName;
            canvas.sortingOrder     = sortingOrder;
            var text = GameObjectEx.Create <Text>("Text", canvas.transform, Vector3.zero);

            text.font      = font;
            text.fontSize  = fontSize;
            text.color     = fontColor;
            text.alignment = TextAnchor.MiddleCenter;
            text.GetComponent <RectTransform>().SetFullSize();
            text.raycastTarget = false;
            canvasDics[obj]    = canvas;
        }