public Menu(List<MenuIcon> icons, MenuIcon leftOff, MenuIcon rightOff, MenuIcon topOff, MenuIcon botOff)
 {
     this.leftOff = leftOff;
     this.rightOff = rightOff;
     this.topOff = topOff;
     this.botOff = botOff;
     this.icons = icons;
 }
Beispiel #2
0
 public Menu(List <MenuIcon> icons, MenuIcon leftOff, MenuIcon rightOff, MenuIcon topOff, MenuIcon botOff)
 {
     this.leftOff  = leftOff;
     this.rightOff = rightOff;
     this.topOff   = topOff;
     this.botOff   = botOff;
     this.icons    = icons;
 }
Beispiel #3
0
        private void CreateNineMatrix(List <MenuIcon> icons)
        {
            int iconWidth  = (int)(Recellection.viewPort.Width / 3);
            int iconHeight = (int)(Recellection.viewPort.Height / 3);

            menuPic = Recellection.textureMap.GetTexture(Globals.TextureTypes.ThreeByThree);
            for (int i = 0; i < icons.Count; i++)
            {
                MenuIcon mi       = icons[i];
                int      position = (i >= 4 ? i + 1 : i);


                if (mi.texture != null)
                {
                    mi.targetTextureRectangle =
                        new Microsoft.Xna.Framework.Rectangle(
                            (position % 3) * iconWidth + (iconWidth / 2) - (mi.texture.Width / 2),
                            (position / 3) * iconHeight + (iconHeight / 2) - (mi.texture.Height / 2),
                            (mi.texture.Width),
                            (mi.texture.Height));
                }
                int textWidth = 0;

                if (mi.label != null)
                {
                    mi.label = insertLineBreaksForString(mi.label);

                    textWidth = mi.label.Length * FONT_WIDTH;

                    Vector2 temp = new Vector2(
                        (position % 3) * (iconWidth) + (iconWidth / 2),
                        (position / 3) * (iconHeight) + (iconHeight / 2));

                    mi.targetLabelRectangle = new Rectangle((int)temp.X, (int)temp.Y, textWidth, FONT_SIZE);
                }
                if (mi.label != null && mi.texture != null)
                {
                    mi.targetTextureRectangle = new Rectangle(
                        mi.targetTextureRectangle.Location.X, mi.targetTextureRectangle.Location.Y - 40,
                        mi.texture.Width, mi.texture.Height);

                    mi.targetLabelRectangle = new Rectangle(
                        mi.targetLabelRectangle.Location.X, mi.targetLabelRectangle.Location.Y + mi.texture.Height - 15,
                        textWidth, FONT_SIZE);
                }

                mi.region = new GUIRegion(Recellection.windowHandle,
                                          new System.Windows.Rect(
                                              (position % 3) * iconWidth,
                                              (position / 3) * iconHeight,
                                              iconWidth, iconHeight));
            }

            this.icons = icons;
        }
 public Menu(Globals.MenuLayout layout, List<MenuIcon> icons, String explanation, Color explanationColor, MenuIcon leftOff, MenuIcon rightOff, MenuIcon topOff, MenuIcon botOff)
 {
     this.explanation = insertLineBreaksForString(explanation);
     this.explanationColor = explanationColor;
     this.explanationDrawPos = new Vector2(Recellection.viewPort.Width / 2, Recellection.viewPort.Height / 2);
     this.leftOff = leftOff;
     this.rightOff = rightOff;
     this.topOff = topOff;
     this.botOff = botOff;
     switch (layout)
     {
         case Globals.MenuLayout.Prompt:
             CreatePrompt(icons);
             break;
         case Globals.MenuLayout.NineMatrix:
             CreateNineMatrix(icons);
             break;
         case Globals.MenuLayout.FourMatrix:
             CreateFourMatrix(icons);
             break;
     }
 }
Beispiel #5
0
        public Menu(Globals.MenuLayout layout, List <MenuIcon> icons, String explanation, Color explanationColor, MenuIcon leftOff, MenuIcon rightOff, MenuIcon topOff, MenuIcon botOff)
        {
            this.explanation        = insertLineBreaksForString(explanation);
            this.explanationColor   = explanationColor;
            this.explanationDrawPos = new Vector2(Recellection.viewPort.Width / 2, Recellection.viewPort.Height / 2);
            this.leftOff            = leftOff;
            this.rightOff           = rightOff;
            this.topOff             = topOff;
            this.botOff             = botOff;
            switch (layout)
            {
            case Globals.MenuLayout.Prompt:
                CreatePrompt(icons);
                break;

            case Globals.MenuLayout.NineMatrix:
                CreateNineMatrix(icons);
                break;

            case Globals.MenuLayout.FourMatrix:
                CreateFourMatrix(icons);
                break;
            }
        }