Exemplo n.º 1
0
        // ----------------------
        static public DynamicTouchControl CreateDynamicControlWithRegion(
            System.Type controlType,
            TouchControlPanel panel,
            string name,
            float size,
            //Sprite				sprite,
            Rect regionRect,
            float regionDepth,
            float controlDepth)
        {
            DynamicRegion region = (DynamicRegion)CreateStretchyRectTr(typeof(DynamicRegion), panel.transform, name + "-Region", regionRect, regionDepth);

            region.InvalidateHierarchy();

            DynamicTouchControl c = (DynamicTouchControl)CreateConstSizeRectTr(controlType, region.transform, name, new Vector2(0.5f, 0.5f),
                                                                               Vector2.zero, Vector2.one * size, (controlDepth - regionDepth));

            c.InvalidateHierarchy();

            c.SetTargetDynamicRegion(region);
            region.SetTargetControl(c);

            return(c);
        }