コード例 #1
0
        public void Initialize()
        {
            var pos = Position;
            var i   = 0;

            foreach (var tex in _textures)
            {
                var menuEntry = new MenuImageEntry(tex, pos)
                {
                    Tag    = i,
                    Origin = new Vector2(tex.Width, tex.Height) / 2
                };
                menuEntry.Selected += menuEntry_Selected;
                pos.X += tex.Width + SpacingX;
                MenuImageEntries.Add(menuEntry);
                _menuScreen.MenuEntries.Add(menuEntry);
                i++;
                if (i % CountX == 0)
                {
                    pos.Y += tex.Height + SpacingY;
                    pos.X  = Position.X;
                }
            }
            UpdatePositions();
        }
コード例 #2
0
        public void Initialize()
        {
            var pos = Position;
            var i   = 0;

            foreach (var path in _paths)
            {
                var tex       = _menuScreen.content.Load <Texture2D>(path);
                var menuEntry = new MenuImageEntry(tex, pos)
                {
                    Tag = i
                };
                menuEntry.Selected += menuEntry_Selected;
                pos.X += tex.Width + Spacing;
                MenuImageEntries.Add(menuEntry);
                _menuScreen.MenuEntries.Add(menuEntry);
                i++;
            }
            UpdatePositions();
        }