Esempio n. 1
0
        internal IngameMenuWindow(Race setRace)
        {
            curRace = setRace;
            LevelGameScreen.Game.GamePaused = true;

            BackgroundColor = new Microsoft.Xna.Framework.Color(0.3f, 0.0f, 0.0f, 0.5f);

            //Width = background.Width;
            //Height = background.Height;

            UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 368 : 369);

            background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
            background.InitWithUIResource(res);
            AddComponent(background);

            background.X = 120;
            background.Y = 20;

            continueButton = (UIButton)background.Components [6];
            continueButton.OnMouseUpInside += closeButton_OnMouseUpInside;

            quitButton = (UIButton)background.Components [5];
            quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

            MouseCursor.State = MouseCursorState.Pointer;
        }
Esempio n. 2
0
        private void AutoSetButtonImage(int releaseButtonResourceIndex, int pressedButtonResourceIndex)
        {
            backgroundNotClicked = WWTexture.FromImageResource(WarFile.GetImageResource(releaseButtonResourceIndex));
            backgroundClicked    = WWTexture.FromImageResource(WarFile.GetImageResource(pressedButtonResourceIndex));

            Width  = (int)(backgroundNotClicked.Width);
            Height = (int)(backgroundNotClicked.Height);
        }
Esempio n. 3
0
        internal static WWTexture FromImageResource(string name)
        {
            int idx = WarFile.KnowledgeBase.IndexByName(name);

            if (idx == -1)
            {
                return(null);
            }

            ImageResource ir = WarFile.GetImageResource(idx);

            return(FromImageResource(ir));
        }
Esempio n. 4
0
        internal IngameQuitMenuWindow(Race setRace)
        {
            UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 391 : 392);

            background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
            background.InitWithUIResource(res);
            AddComponent(background);

            background.CenterOnScreen();

            cancelButton = (UIButton)background.Components [3];
            cancelButton.OnMouseUpInside += cancelButton_OnMouseUpInside;

            menuButton = (UIButton)background.Components [2];
            menuButton.OnMouseUpInside += menuButton_OnMouseUpInside;

            quitButton = (UIButton)background.Components [1];
            quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

            MouseCursor.State = MouseCursorState.Pointer;
        }