Exemplo n.º 1
0
        public MenuManager()
        {
            mPanelTextures = new Texture2D[]
            {
                ContentHolder.LoadTexture("Panels/StartMenuPanel"),
                ContentHolder.LoadTexture("Panels/PlayMenuPanel")
            };
            mRegularButtonTextures = new Texture2D[]
            {
                ContentHolder.LoadTexture("Buttons/buttonLong_beige"),
                ContentHolder.LoadTexture("Buttons/buttonLong_grey")
            };
            mPressedButtonTextures = new Texture2D[]
            {
                ContentHolder.LoadTexture("Buttons/buttonLong_beige_pressed"),
                ContentHolder.LoadTexture("Buttons/buttonLong_grey_pressed")
            };
            mMapPreviews = new Texture2D[]
            {
                ContentHolder.LoadTexture("Maps/Map0Preview")
            };
            mLevelTextures = new Texture2D[]
            {
                ContentHolder.LoadTexture("Levels/EasyLevel"),
                ContentHolder.LoadTexture("Levels/NormalLevel"),
                ContentHolder.LoadTexture("Levels/HardLevel")
            };
            mArrowTextures = new Texture2D[]
            {
                ContentHolder.LoadTexture("Buttons/arrowSilver_left"),
                ContentHolder.LoadTexture("Buttons/arrowSilver_right")
            };
            mNewGameAndExitMenuPanel
                = ContentHolder.LoadTexture("Panels/NewGameAndExitMenuPanel");
            mCreditOptionTexture =
                ContentHolder.LoadTexture("panels/CreditOptionPanel");
            mCancelTexture         = ContentHolder.LoadTexture("Buttons/XButton");
            mChangingButtonTexture =
                ContentHolder.LoadTexture("Buttons/buttonRound_grey");
            mButtonBarTexture = ContentHolder.LoadTexture("Etc/OptionButtonbar");
            mFont             = ContentHolder.LoadFont("Fonts/BlockFont");

            mPanelSize =
                new Vector2(mPanelTextures[0].Width, mPanelTextures[0].Height);
            mMenuSize = new Vector2(mRegularButtonTextures[0].Width,
                                    mRegularButtonTextures[0].Height);
            mPanelPosition = Shared.Center - (mPanelSize / 2);

            for (int i = 0; i < msNames.GetLength(1); i++)
            {
                mItemPositions[i] = (mPanelPosition +
                                     new Vector2(msMargin + msPadding,
                                                 msMargin * (i + 1)
                                                 + mRegularButtonTextures[0].Height * i
                                                 + msPadding));
            }

            for (int i = 0; i < msNames.GetLength(1); i++)
            {
                mButtons[i] = new Button(mItemPositions[i],
                                         mRegularButtonTextures[0], mPressedButtonTextures[0], mFont,
                                         msNames[0, i]);
            }

            //LoadGame = new LoadMenuItem();
            NewGame =
                new NewGameOrResumeMenu(mArrowTextures, mLevelTextures,
                                        mMapPreviews, mNewGameAndExitMenuPanel, mCancelTexture,
                                        mFont);
            Credit = new CreditMenu(mCreditOptionTexture, mCancelTexture,
                                    mFont);
            Option = new OptionMenu(mChangingButtonTexture,
                                    mButtonBarTexture, mCreditOptionTexture, mCancelTexture, mFont);
            Exit = new ExitMenu(mRegularButtonTextures[1],
                                mPressedButtonTextures[1], mNewGameAndExitMenuPanel,
                                mCancelTexture, mFont);

            ChangeMenuManagerType(GameScene.Start);
        }