/// <summary>
        /// Set the layer's RenderOrder to the render the groups/items with the given names.
        /// </summary>
        /// <param name="type">The type that each name represents (item or group).</param>
        /// <param name="names"></param>
        public void SetRenderOrder(RenderOrder.RenderType type, params string[] names)
        {
            var renderOrder = new RenderOrder();

            switch (type)
            {
            case RenderOrder.RenderType.Item:
                foreach (var name in names)
                {
                    renderOrder.AddRenderItem(name);
                }
                break;

            case RenderOrder.RenderType.Group:
                foreach (var name in names)
                {
                    renderOrder.AddRenderGroup(name);
                }
                break;

            default:
                throw new RenderOrderException(
                          String.Format(
                              "Can't handle RenderOrder.RenderType '{0}'" +
                              " for more options see the other overloads of `SetRenderOrder`.", type
                              )
                          );
            }
            SetRenderOrder(renderOrder);
        }
        /// <summary>
        /// Set the render order to the given RenderOrder object.
        /// </summary>
        /// <param name="order"></param>
        public void SetRenderOrder(RenderOrder order)
        {
            if (MidRender)
            {
                throw new RenderOrderException(
                          String.Format(
                              "Cannot set render order on layer '{0}' during the render cycle.", FullName));
            }
            RenderOrder = order;

            // Calculate render order.
        }
        /// <summary>
        /// Set the render order to the render the given list of groups/items with the given
        /// names and types.
        /// </summary>
        /// <param name="types"></param>
        /// <param name="names"></param>
        public void SetRenderOrder(RenderOrder.RenderType[] types, string[] names)
        {
            if (types.Length != names.Length)
            {
                throw new RenderOrderException(
                          "The length of the given types array must match the length of the given names array.");
            }

            var renderOrder = new RenderOrder();

            for (int i = 0; i < types.Length; i++)
            {
                if (types[i] == RenderOrder.RenderType.Item)
                {
                    renderOrder.AddRenderItem(names[i]);
                }
                else if (types[i] == RenderOrder.RenderType.Group)
                {
                    renderOrder.AddRenderGroup(names[i]);
                }
            }
            SetRenderOrder(renderOrder);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Set the RenderOrder to the given RenderOrder object.
 /// </summary>
 /// <param name="order"></param>
 public void SetRenderOrder(RenderOrder order)
 {
     RenderOrder = order;
 }