Beispiel #1
0
        private void UpdateNewGameMenu(IEnumerable <SubmarineInfo> submarines)
        {
            pageContainer =
                new GUIListBox(new RectTransform(Vector2.One, newGameContainer.RectTransform), style: null, isHorizontal: true)
            {
                ScrollBarEnabled = false,
                ScrollBarVisible = false,
                HoverCursor      = CursorState.Default
            };

            GUILayoutGroup createPageLayout()
            {
                var containerItem =
                    new GUIFrame(new RectTransform(Vector2.One, pageContainer.Content.RectTransform), style: null);

                return(new GUILayoutGroup(new RectTransform(Vector2.One * 0.95f, containerItem.RectTransform,
                                                            Anchor.Center)));
            }

            CreateFirstPage(createPageLayout(), submarines);
            CreateSecondPage(createPageLayout());

            pageContainer.RecalculateChildren();
            pageContainer.GetAllChildren().ForEach(c =>
            {
                c.ClampMouseRectToParent = true;
            });
            pageContainer.GetAllChildren <GUIDropDown>().ForEach(dd =>
            {
                dd.ListBox.ClampMouseRectToParent         = false;
                dd.ListBox.Content.ClampMouseRectToParent = false;
            });
            SetPage(0);
        }