Exemplo n.º 1
0
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Drops down menu EXtension.
        /// </summary>
        ///
        /// <param name="htmlHelper">
        ///     The HTML helper.
        /// </param>
        /// <param name="orientation">
        ///     The orientation.
        /// </param>
        /// <param name="cssClass">
        ///     The CSS class.
        /// </param>
        /// <param name="selectedCssClass">
        ///     (optional) the selected CSS class.
        /// </param>
        /// <param name="selectionMode">
        ///     (optional) the selection mode.
        /// </param>
        ///
        /// <returns>
        ///     An instance of DropDownMenu.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------

        public static DropDownMenu DropDownMenu(this HtmlHelper htmlHelper, MenuOrientation orientation = MenuOrientation.Horizontal, string cssClass = null, string selectedCssClass = null, SelectionMode?selectionMode = null)
        {
            return(new DropDownMenu(htmlHelper, orientation)
            {
                CssClass = cssClass, SelectedCssClass = selectedCssClass, SelectionMode = selectionMode
            });
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DropDownMenu"/> class.
 /// </summary>
 /// <param name="htmlHelper">The HTML helper.</param>
 /// <param name="orientation">The orientation.</param>
 public DropDownMenu(HtmlHelper htmlHelper, MenuOrientation orientation)
     : base(htmlHelper)
 {
     this.Orientation = orientation;
     this.Items       = new MenuItemCollection <DropDownMenuItem> {
         CssClass = "menu " + (this.Orientation == MenuOrientation.Horizontal ? "horizontal-menu" : "vertical-menu"), Level = 0
     };
 }
Exemplo n.º 3
0
        private bool SetAspectRatio()
        {
            float currentAspectRatio = 0f;

            if (Screen.orientation == ScreenOrientation.LandscapeRight || Screen.orientation == ScreenOrientation.LandscapeLeft)
            {
                currentAspectRatio = (float)Screen.width / Screen.height;
            }
            else
            {
                if (Screen.height > Screen.width && KickStarter.settingsManager.landscapeModeOnly)
                {
                    currentAspectRatio = (float)Screen.height / Screen.width;
                }
                else
                {
                    currentAspectRatio = (float)Screen.width / Screen.height;
                }
            }

            // If the current aspect ratio is already approximately equal to the desired aspect ratio, use a full-screen Rect (in case it was set to something else previously)
            if (!KickStarter.settingsManager.forceAspectRatio || (int)(currentAspectRatio * 100) / 100f == (int)(KickStarter.settingsManager.wantedAspectRatio * 100) / 100f)
            {
                borderWidth       = 0f;
                borderOrientation = MenuOrientation.Horizontal;

                if (borderCam)
                {
                    Destroy(borderCam.gameObject);
                }
                return(false);
            }

            // Pillarbox
            if (currentAspectRatio > KickStarter.settingsManager.wantedAspectRatio)
            {
                borderWidth       = 1f - KickStarter.settingsManager.wantedAspectRatio / currentAspectRatio;
                borderWidth      /= 2f;
                borderOrientation = MenuOrientation.Vertical;

                borderRect1 = new Rect(0, 0, borderWidth * Screen.width, Screen.height);
                borderRect2 = new Rect(Screen.width * (1f - borderWidth), 0f, Screen.width * borderWidth, Screen.height);
            }
            // Letterbox
            else
            {
                borderWidth       = 1f - currentAspectRatio / KickStarter.settingsManager.wantedAspectRatio;
                borderWidth      /= 2f;
                borderOrientation = MenuOrientation.Horizontal;

                borderRect1 = new Rect(0, 0, Screen.width, borderWidth * Screen.height);
                borderRect2 = new Rect(0, Screen.height * (1f - borderWidth), Screen.width, Screen.width * borderWidth);
            }


            return(true);
        }
Exemplo n.º 4
0
        public ActionResult Orientation(string orientation)
        {
            MenuOrientation value = MenuOrientation.Horizontal;

            if (orientation == "vertical")
            {
                value = MenuOrientation.Vertical;
            }

            return View(value);
        }
Exemplo n.º 5
0
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            turnOff = EditorGUILayout.Toggle("Disable previous split?", turnOff);
            if (!turnOff)
            {
                string label1 = "Top";
                string label2 = "Bottom";

                orientation = (MenuOrientation)EditorGUILayout.EnumPopup("Divider:", orientation);
                if (orientation == MenuOrientation.Vertical)
                {
                    label1 = "Left";
                    label2 = "Right";
                }

                parameterID1 = Action.ChooseParameterGUI(label1 + " camera:", parameters, parameterID1, ParameterType.GameObject);
                if (parameterID1 >= 0)
                {
                    constantID1 = 0;
                    cam1        = null;
                }
                else
                {
                    cam1 = (_Camera)EditorGUILayout.ObjectField(label1 + " camera:", cam1, typeof(_Camera), true);

                    constantID1 = FieldToID <_Camera> (cam1, constantID1);
                    cam1        = IDToField <_Camera> (cam1, constantID1, false);
                }

                splitAmount1 = EditorGUILayout.Slider(label1 + " camera space:", splitAmount1, 0f, 1f);

                parameterID2 = Action.ChooseParameterGUI(label2 + " camera:", parameters, parameterID2, ParameterType.GameObject);
                if (parameterID2 >= 0)
                {
                    constantID2 = 0;
                    cam2        = null;
                }
                else
                {
                    cam2 = (_Camera)EditorGUILayout.ObjectField(label2 + " camera:", cam2, typeof(_Camera), true);

                    constantID2 = FieldToID <_Camera> (cam2, constantID2);
                    cam2        = IDToField <_Camera> (cam2, constantID2, false);
                }

                splitAmount2 = Mathf.Min(splitAmount2, 1f - splitAmount1);
                splitAmount2 = EditorGUILayout.Slider(label2 + " camera space:", splitAmount2, 0f, 1f);
                splitAmount1 = Mathf.Min(splitAmount1, 1f - splitAmount2);

                mainIsTopLeft = EditorGUILayout.Toggle("Main Camera is " + label1.ToLower() + "?", mainIsTopLeft);
            }

            AfterRunningOption();
        }
Exemplo n.º 6
0
        public void SetSplitScreen(_Camera _camera1, _Camera _camera2, MenuOrientation _splitOrientation, bool _isTopLeft, float splitAmountMain, float splitAmountOther)
        {
            splitCamera      = _camera2;
            isSplitScreen    = true;
            splitOrientation = _splitOrientation;
            isTopLeftSplit   = _isTopLeft;

            SetGameCamera(_camera1);
            SnapToAttached();

            StartSplitScreen(splitAmountMain, splitAmountOther);
        }
Exemplo n.º 7
0
        public MenuView(MenuOrientation orientation) : this()
        {
            this.MenuOrientations = orientation;
            // Vertical Menu
            if (this.MenuOrientations == MenuOrientation.TopToBottom)
            {
                // Vertical menu only need leftMargin
                // Full size Menu
                this.LeftMargin          = 0;
                this.IsFullScreen        = true;
                this.DraggerButtonHeight = 0;
            }

            if (this.MenuOrientations == MenuOrientation.BottomToTop)
            {
                // Not Full size
                this.LeftMargin   = 0;
                this.IsFullScreen = true;
                //this.MainLayout.Children.Insert (0, this.DragImage);
                this.DraggerButtonHeight = 0;
            }

            // Horizontal Menu
            if (this.MenuOrientations == MenuOrientation.LeftToRight)
            {
                // Horizaontal menu only need topMargin
                // Full size Menu
                this.TopMargin          = 0;
                this.IsFullScreen       = true;
                this.DraggerButtonWidth = 0;
            }
            if (this.MenuOrientations == MenuOrientation.RightToLeft)
            {
                // Not Full size
                this.TopMargin    = 0;
                this.IsFullScreen = true;
                //this.MainLayout.Children.RemoveAt (1);
                //this.MainLayout.Children.Insert (0, this.DragImage);
                this.DraggerButtonWidth = 30;
            }
        }
Exemplo n.º 8
0
        public QuickInnerPage(MenuOrientation orientation)
        {
            InitializeComponent();
            this.IsFullScreen        = false;
            this.BackgroundViewColor = Color.Transparent;
            this.BackgroundColor     = Color.FromHex("#C82630");
            this.MenuOrientations    = orientation;
            if (orientation == MenuOrientation.BottomToTop)
            {
                this.WidthRequest  = 50;
                this.HeightRequest = 200;

                this.DraggerButtonHeight = 30;
                this.LeftMargin          = 100;
            }

            if (orientation == MenuOrientation.TopToBottom)
            {
                this.WidthRequest        = 50;
                this.HeightRequest       = 200;
                this.DraggerButtonHeight = 40;
                this.LeftMargin          = 100;
            }

            if (orientation == MenuOrientation.LeftToRight)
            {
                this.WidthRequest       = 200;
                this.HeightRequest      = 50;
                this.DraggerButtonWidth = 40;
                this.TopMargin          = 30;
            }

            if (orientation == MenuOrientation.RightToLeft)
            {
                this.WidthRequest       = 200;
                this.HeightRequest      = 50;
                this.DraggerButtonWidth = 30;
                this.TopMargin          = 30;
            }
        }
Exemplo n.º 9
0
        public MenuView(MenuOrientation orientation)
            : this()
        {
            this.MenuOrientations = orientation;
            // Vertical Menu
            if (this.MenuOrientations == MenuOrientation.TopToBottom) {
                // Vertical menu only need leftMargin
                // Full size Menu
                this.LeftMargin = 0;
                this.IsFullScreen = true;
                this.DraggerButtonHeight = 0;
            }

            if (this.MenuOrientations == MenuOrientation.BottomToTop) {
                // Not Full size
                this.LeftMargin = 0;
                this.IsFullScreen = true;
                //this.MainLayout.Children.Insert (0, this.DragImage);
                this.DraggerButtonHeight = 0;
            }

            // Horizontal Menu
            if (this.MenuOrientations == MenuOrientation.LeftToRight) {

                // Horizaontal menu only need topMargin
                // Full size Menu
                this.TopMargin = 0;
                this.IsFullScreen = true;
                this.DraggerButtonWidth = 0;
            }
            if (this.MenuOrientations == MenuOrientation.RightToLeft) {
                // Not Full size
                this.TopMargin = 0;
                this.IsFullScreen = true;
                //this.MainLayout.Children.RemoveAt (1);
                //this.MainLayout.Children.Insert (0, this.DragImage);
                this.DraggerButtonWidth = 30;
            }
        }
Exemplo n.º 10
0
        public QuickInnerMenuView(MenuOrientation orientation)
        {
            var mainLayout = new StackLayout {
                Spacing  = 15,
                Children =
                {
                    new Image {
                        Source        = "Happy.png",
                        WidthRequest  = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source        = "Home.png",
                        WidthRequest  = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source        = "MessageFilled.png",
                        WidthRequest  = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source        = "Settings.png",
                        WidthRequest  = 25,
                        HeightRequest = 25,
                    },
                }
            };

            // In this case the IsFullScreen must set false
            this.IsFullScreen        = false;
            this.BackgroundViewColor = Color.Transparent;

            // You must set BackgroundColor,
            // and you cannot put another layout with background color cover the whole View
            // otherwise, it cannot be dragged on Android
            this.BackgroundColor  = Color.FromHex("#C82630");
            this.MenuOrientations = orientation;
            if (orientation == MenuOrientation.BottomToTop)
            {
                mainLayout.Orientation = StackOrientation.Vertical;
                mainLayout.Children.Insert(0, new Image {
                    Source        = "DoubleUp.png",
                    WidthRequest  = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness(0, 5);
                // In this case, you must set both WidthRequest and HeightRequest.
                this.WidthRequest  = 50;
                this.HeightRequest = 200;

                // A little bigger then DoubleUp.png image size, used for user drag it.
                this.DraggerButtonHeight = 30;

                // In this menu direction you must set LeftMargin.
                this.LeftMargin = 100;
            }

            if (orientation == MenuOrientation.TopToBottom)
            {
                mainLayout.Orientation = StackOrientation.Vertical;
                mainLayout.Children.Insert(4, new Image {
                    Source        = "DoubleDown_White.png",
                    WidthRequest  = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding       = new Thickness(0, 5);
                this.WidthRequest        = 50;
                this.HeightRequest       = 200;
                this.DraggerButtonHeight = 40;
                this.LeftMargin          = 100;
            }

            if (orientation == MenuOrientation.LeftToRight)
            {
                mainLayout.Orientation = StackOrientation.Horizontal;
                mainLayout.Children.Insert(4, new Image {
                    Source        = "DoubleRight.png",
                    WidthRequest  = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness(5, 0);
                this.WidthRequest  = 200;
                this.HeightRequest = 50;
                // In this case, it should be DraggerButtonWidth not DraggerButtonHeight
                this.DraggerButtonWidth = 40;

                // In this menu direction you must set TopMargin.
                this.TopMargin = 30;
            }

            if (orientation == MenuOrientation.RightToLeft)
            {
                mainLayout.Orientation = StackOrientation.Horizontal;
                mainLayout.Children.Insert(0, new Image {
                    Source        = "DoubleLeft.png",
                    WidthRequest  = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding      = new Thickness(5, 0);
                this.WidthRequest       = 200;
                this.HeightRequest      = 50;
                this.DraggerButtonWidth = 30;
                this.TopMargin          = 30;
            }
            Content = mainLayout;
        }
Exemplo n.º 11
0
        /**
         * <summary>Creates a new split-screen effect.</summary>
         * <param name = "_camera1">The first _Camera to use in the effect</param>
         * <param name = "_camera2">The second _Camera to use in the effect</param>
         * <param name = "_splitOrientation">How the two _Cameras are arranged (Horizontal, Vertical)</param>
         * <param name = "_isTopLeft">If True, the MainCamera will take the position of _camera1</param>
         * <param name = "_splitAmountMain">The proportion of the screen taken up by this Camera</param>
         * <param name = "_splitAmountOther">The proportion of the screen take up by the other _Camera</param>
         */
        public void SetSplitScreen(_Camera _camera1, _Camera _camera2, MenuOrientation _splitOrientation, bool _isTopLeft, float _splitAmountMain, float _splitAmountOther)
        {
            splitCamera = _camera2;
            isSplitScreen = true;
            splitOrientation = _splitOrientation;
            isTopLeftSplit = _isTopLeft;

            SetGameCamera (_camera1);
            StartSplitScreen (_splitAmountMain, _splitAmountOther);
        }
Exemplo n.º 12
0
        private bool SetAspectRatio()
        {
            float currentAspectRatio = 0f;

            if (Screen.orientation == ScreenOrientation.LandscapeRight || Screen.orientation == ScreenOrientation.LandscapeLeft)
            {
                currentAspectRatio = (float) Screen.width / Screen.height;
            }
            else
            {
                if (Screen.height > Screen.width && KickStarter.settingsManager.landscapeModeOnly)
                {
                    currentAspectRatio = (float) Screen.height / Screen.width;
                }
                else
                {
                    currentAspectRatio = (float) Screen.width / Screen.height;
                }
            }

            // If the current aspect ratio is already approximately equal to the desired aspect ratio, use a full-screen Rect (in case it was set to something else previously)
            if (!KickStarter.settingsManager.forceAspectRatio || (int) (currentAspectRatio * 100) / 100f == (int) (KickStarter.settingsManager.wantedAspectRatio * 100) / 100f)
            {
                borderWidth = 0f;
                borderOrientation = MenuOrientation.Horizontal;

                if (borderCam)
                {
                    Destroy (borderCam.gameObject);
                }
                return false;
            }

            // Pillarbox
            if (currentAspectRatio > KickStarter.settingsManager.wantedAspectRatio)
            {
                borderWidth = 1f - KickStarter.settingsManager.wantedAspectRatio / currentAspectRatio;
                borderWidth /= 2f;
                borderOrientation = MenuOrientation.Vertical;

                borderRect1 = new Rect (0, 0, borderWidth * Screen.width, Screen.height);
                borderRect2 = new Rect (Screen.width * (1f - borderWidth), 0f, Screen.width * borderWidth, Screen.height);
            }
            // Letterbox
            else
            {
                borderWidth = 1f - currentAspectRatio / KickStarter.settingsManager.wantedAspectRatio;
                borderWidth /= 2f;
                borderOrientation = MenuOrientation.Horizontal;

                borderRect1 = new Rect (0, 0, Screen.width, borderWidth * Screen.height);
                borderRect2 = new Rect (0, Screen.height * (1f - borderWidth), Screen.width, Screen.width * borderWidth);
            }

            return true;
        }
Exemplo n.º 13
0
        public QuickInnerMenuView(MenuOrientation orientation)
        {
            var mainLayout = new StackLayout {
                Spacing = 15,
                Children = {
                    new Image {
                        Source = "Happy.png",
                        WidthRequest = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source = "Home.png",
                        WidthRequest = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source = "MessageFilled.png",
                        WidthRequest = 25,
                        HeightRequest = 25,
                    },
                    new Image {
                        Source = "Settings.png",
                        WidthRequest = 25,
                        HeightRequest = 25,
                    },
                }
            };
            // In this case the IsFullScreen must set false
            this.IsFullScreen = false;
            this.BackgroundViewColor = Color.Transparent;

            // You must set BackgroundColor,
            // and you cannot put another layout with background color cover the whole View
            // otherwise, it cannot be dragged on Android
            this.BackgroundColor = Color.FromHex ("#C82630");
            this.MenuOrientations = orientation;
            if (orientation == MenuOrientation.BottomToTop) {
                mainLayout.Orientation = StackOrientation.Vertical;
                mainLayout.Children.Insert (0, new Image {
                    Source = "DoubleUp.png",
                    WidthRequest = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness (0, 5);
                // In this case, you must set both WidthRequest and HeightRequest.
                this.WidthRequest = 50;
                this.HeightRequest = 200;

                // A little bigger then DoubleUp.png image size, used for user drag it.
                this.DraggerButtonHeight = 30;

                // In this menu direction you must set LeftMargin.
                this.LeftMargin = 100;

            }

            if (orientation == MenuOrientation.TopToBottom) {
                mainLayout.Orientation = StackOrientation.Vertical;
                mainLayout.Children.Insert (4, new Image {
                    Source = "DoubleDown_White.png",
                    WidthRequest = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness (0, 5);
                this.WidthRequest = 50;
                this.HeightRequest = 200;
                this.DraggerButtonHeight = 40;
                this.LeftMargin = 100;

            }

            if (orientation == MenuOrientation.LeftToRight) {
                mainLayout.Orientation = StackOrientation.Horizontal;
                mainLayout.Children.Insert (4, new Image {
                    Source = "DoubleRight.png",
                    WidthRequest = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness (5, 0);
                this.WidthRequest = 200;
                this.HeightRequest = 50;
                // In this case, it should be DraggerButtonWidth not DraggerButtonHeight
                this.DraggerButtonWidth = 40;

                // In this menu direction you must set TopMargin.
                this.TopMargin = 30;

            }

            if (orientation == MenuOrientation.RightToLeft) {
                mainLayout.Orientation = StackOrientation.Horizontal;
                mainLayout.Children.Insert (0, new Image {
                    Source = "DoubleLeft.png",
                    WidthRequest = 25,
                    HeightRequest = 25,
                });
                mainLayout.Padding = new Thickness (5, 0);
                this.WidthRequest = 200;
                this.HeightRequest = 50;
                this.DraggerButtonWidth = 30;
                this.TopMargin = 30;
            }
            Content = mainLayout;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Sets the menu orientation.
        /// </summary>
        /// <param name="value">The desired orientation.</param>
        /// <example>
        /// <code lang="CS">
        ///  &lt;%= Html.Kendo().Menu()
        ///             .Name("Menu")
        ///             .Orientation(MenuOrientation.Vertical)
        /// %&gt;
        /// </code>
        /// </example>
        public MenuBuilder Orientation(MenuOrientation value)
        {
            Component.Orientation = value;

            return(this);
        }
Exemplo n.º 15
0
		override public void ShowGUI (List<ActionParameter> parameters)
		{
			turnOff = EditorGUILayout.Toggle ("Disable previous split?", turnOff);
			if (!turnOff)
			{
				string label1 = "Top";
				string label2 = "Bottom";

				orientation = (MenuOrientation) EditorGUILayout.EnumPopup ("Divider:", orientation);
				if (orientation == MenuOrientation.Vertical)
				{
					label1 = "Left";
					label2 = "Right";
				}

				parameterID1 = Action.ChooseParameterGUI (label1 + " camera:", parameters, parameterID1, ParameterType.GameObject);
				if (parameterID1 >= 0)
				{
					constantID1 = 0;
					cam1 = null;
				}
				else
				{
					cam1 = (_Camera) EditorGUILayout.ObjectField (label1 + " camera:", cam1, typeof (_Camera), true);
					
					constantID1 = FieldToID <_Camera> (cam1, constantID1);
					cam1 = IDToField <_Camera> (cam1, constantID1, false);
				}

				splitAmount1 = EditorGUILayout.Slider (label1 + " camera space:", splitAmount1, 0f, 1f);

				parameterID2 = Action.ChooseParameterGUI (label2 + " camera:", parameters, parameterID2, ParameterType.GameObject);
				if (parameterID2 >= 0)
				{
					constantID2 = 0;
					cam2 = null;
				}
				else
				{
					cam2 = (_Camera) EditorGUILayout.ObjectField (label2 + " camera:", cam2, typeof (_Camera), true);
					
					constantID2 = FieldToID <_Camera> (cam2, constantID2);
					cam2 = IDToField <_Camera> (cam2, constantID2, false);
				}

				splitAmount2 = Mathf.Min (splitAmount2, 1f-splitAmount1);
				splitAmount2 = EditorGUILayout.Slider (label2 + " camera space:", splitAmount2, 0f, 1f);
				splitAmount1 = Mathf.Min (splitAmount1, 1f-splitAmount2);

				mainIsTopLeft = EditorGUILayout.Toggle ("Main Camera is " + label1.ToLower () + "?", mainIsTopLeft);
			}
			
			AfterRunningOption ();
		}
Exemplo n.º 16
0
 public UIMenu SetOrientation(MenuOrientation orientation)
 {
     this.orientation = orientation;
     return(this);
 }
Exemplo n.º 17
0
    /// <summary>
    /// Creates the LevelMenu2D from scratch.
    /// </summary>
    public void createMenu()
    {
        // If autoOffset is true, then set itemOffset to zero.
        if (autoOffset)
        {
            itemOffset = Vector3.zero;
        }
        // If autoSet is false, then set orientation to Custom.
        else
        {
            orientation = MenuOrientation.Custom;
        }

        // If showNextBeckButtons is false, then use items as buttons
        //if (showNextBackButtons == false)
        {
            for (int i = 0; i < itemsList.Count; i++)
            {
                if (nextButtonObject != null)
                {
                    nextButtonObject.SetActive(false);
                }
                if (backButtonObject != null)
                {
                    backButtonObject.SetActive(false);
                }
                itemsList[i].AddComponent <ClickTouchScript>();
                itemsList[i].AddComponent <BoxCollider>();
            }
        }
        // If showNextBackButtons is true, then place the hidden buttons for carousel
        if (showNextBackButtons == true)
        {
            if (nextButtonObject != null && backButtonObject != null)
            {
                nextButtonObject.SetActive(true);
                backButtonObject.SetActive(true);
                nextButtonObject.AddComponent <ClickTouchScript>();
                backButtonObject.AddComponent <ClickTouchScript>();
                nextButtonObject.AddComponent <BoxCollider>();
                backButtonObject.AddComponent <BoxCollider>();
                nextButtonObject.GetComponent <Renderer>().sortingOrder = itemsList.Count;
                backButtonObject.GetComponent <Renderer>().sortingOrder = itemsList.Count;
            }
        }

        if (itemsList.Count > 0)
        {
            Camera  cam    = (Camera)GameObject.FindObjectOfType <Camera>();
            Vector3 camPos = cam.transform.position;
            camPos.z = 0f;
            camPos.y = 0f;
            //itemsList[0].transform.position = camPos;
            //itemsList[0].transform.position = this.transform.position;
            itemsList[0].transform.position = firstItem.transform.position;

            for (int i = 1; i < itemsList.Count; i++)
            {
                Vector3 changePos = itemsList[i - 1].transform.position;
                if (autoOffset)
                {
                    if (orientation == MenuOrientation.Custom || orientation == MenuOrientation.Horizontal)
                    {
                        itemOffset.x = itemsList[i - 1].GetComponent <Renderer>().bounds.size.x + spacingBetweenItems;
                    }
                    else if (orientation == MenuOrientation.Vertical)
                    {
                        itemOffset.y = itemsList[i - 1].GetComponent <Renderer>().bounds.size.y + spacingBetweenItems;
                    }
                }
                changePos.x += itemOffset.x;
                changePos.y += itemOffset.y;
                itemsList[i].transform.position = changePos;
                if (shouldIncreaseOrder)
                {
                    itemsList[i].GetComponent <Renderer>().sortingOrder = itemsList[i - 1].GetComponent <Renderer>().sortingOrder + 1;
                }
                else
                {
                    itemsList[i].GetComponent <Renderer>().sortingOrder = itemsList[i - 1].GetComponent <Renderer>().sortingOrder - 1;
                }
            }
        }
    }