コード例 #1
0
        public UIDrawCallForShaderMat GetDrawCall(UILabel uilabel)
        {
            GameObject obj = new GameObject();

            obj.transform.localScale = new Vector3(0.004f, 0.004f, 0.004f);
            UIDrawCallForShaderMat dc = obj.AddComponent <UIDrawCallForShaderMat>();

            //obj.layer = LayerMask.NameToLayer("2D");
            BetterList <Vector3> verts = new BetterList <Vector3>();
            BetterList <Vector2> uvs   = new BetterList <Vector2>();
            BetterList <Color32> cols  = new BetterList <Color32>();

            dc.material = uilabel.material;
            uilabel.Update();
            uilabel.OnFill(verts, uvs, cols);
            dc.Set(verts, null, null, uvs, cols);

            return(dc);
        }
コード例 #2
0
        public void CreateTipEnum(GameObject _root, Vector3 position, Vector3 delta, string num, TipFontData data, string animName, NumTip.OFFSET_TYPE type)
        {
            if (null == effectRoot)
            {
                effectRoot = new GameObject("EffectRoot");
            }
            GameObject eff = GameObject.Instantiate(animDict[animName]) as GameObject;

            eff.transform.parent     = effectRoot.transform;
            eff.transform.localScale = new Vector3(1f, 1f, 1f);
            if (null != Owner)
            {
                eff.transform.position = Owner.transform.position;
            }
            eff.layer = 9;
            GameObject go = new GameObject();

            go.transform.parent = _root.transform;
            go.name             = "Tips";
            UILabel label = data.label;

            label.text = num;
            NumTip tip = go.AddComponent <NumTip>();

            tip.aim = eff.transform.GetChild(0).gameObject;
            //tip.label = label;
            tip.root     = eff;
            tip.position = position;
            tip.delta    = delta;
            tip.owner    = Owner.gameObject;
            UIDrawCallForShaderMat dc = GetDrawCall(label);

            dc.gameObject.name  = "dc";
            tip.dc              = dc;
            dc.transform.parent = tip.transform;
            dc.gameObject.renderer.sharedMaterial = data.material;
            dc.transform.localPosition            = Vector3.zero;
            dc.transform.rotation = Quaternion.identity;
            //dc.gameObject.transform.position = tip.position + Vector3.up;
        }