コード例 #1
0
 public Menu(Globals.MenuLayout layout, List<MenuIcon> icons, String explanation, Color explanationColor)
 {
     this.explanation = insertLineBreaksForString(explanation);
     this.explanationColor = explanationColor;
     this.explanationDrawPos = new Vector2(Recellection.viewPort.Width / 2, Recellection.viewPort.Height / 2);
     switch (layout)
     {
         case Globals.MenuLayout.Prompt:
             CreatePrompt(icons);
             break;
         case Globals.MenuLayout.NineMatrix:
             CreateNineMatrix(icons);
             break;
         case Globals.MenuLayout.FourMatrix:
             CreateFourMatrix(icons);
             break;
     }
 }
コード例 #2
0
        /// <summary>
        /// This method sets the eye tracking region for a N*M matrix menu, the number
        /// of icons in the list shall be N*M.
        /// </summary>
        /// <param name="cols">The number of cols of the matrix menu</param>
        /// <param name="rows">The number of rows of the matrix menu</param>
        /// <param name="icons">The list of icons</param>
        private void FreeStyle(int cols, int rows, List<MenuIcon> icons,Globals.TextureTypes menuTexture, bool scrollZone)
        {
            if (icons.Count != cols*rows)
            {
                throw new ArgumentException("Wrong amount of icons in menu");
            }
            int iconWidth = (int)(Recellection.viewPort.Width / cols);
            int iconHeight = (int)(Recellection.viewPort.Height / rows);

            if (menuTexture != Globals.TextureTypes.NoTexture)
            {
                menuPic = Recellection.textureMap.GetTexture(menuTexture);
            }
            else
            {
                for (int i = 0; i < cols * rows; i++)
                {
                    icons[i].targetTextureRectangle = new Microsoft.Xna.Framework.Rectangle((i % cols) * iconWidth, (i / rows) * iconHeight, iconWidth, iconHeight);

                    icons[i].region = new GUIRegion(Recellection.windowHandle,
                        new System.Windows.Rect((i % cols) * iconWidth, (i / rows) * iconHeight, iconWidth, iconHeight));
                }
            }
            this.icons = icons;
        }
コード例 #3
0
 public Menu(Globals.MenuLayout layout, List<MenuIcon> icons, String explanation)
     : this(layout, icons, explanation, Color.Black)
 {
 }
コード例 #4
0
 public void PlaySong(Globals.Songs song)
 {
     MediaPlayer.Play(songs[(int)song]);
 }