예제 #1
0
        public FlxPause()
        {
            //icons for the pause screen
            _imgKeyX       = FlxG.Content.Load <Texture2D>("flixel/key_x");
            _imgKeyC       = FlxG.Content.Load <Texture2D>("flixel/key_c");
            _imgKeyMouse   = FlxG.Content.Load <Texture2D>("flixel/key_mouse");
            _imgKeysArrows = FlxG.Content.Load <Texture2D>("flixel/keys_arrows");
            _imgKeyMinus   = FlxG.Content.Load <Texture2D>("flixel/key_minus");
            _imgKeyPlus    = FlxG.Content.Load <Texture2D>("flixel/key_plus");
            _imgKey0       = FlxG.Content.Load <Texture2D>("flixel/key_0");
            _imgKey1       = FlxG.Content.Load <Texture2D>("flixel/key_1");

            if (FlxG.height > 240)
            {
                _pauseScale = 2;
            }

            _pauseRect.Width  *= _pauseScale;
            _pauseRect.Height *= _pauseScale;
            _pauseRect.X       = (FlxG.width - _pauseRect.Width) / 2;
            _pauseRect.Y       = (FlxG.height - _pauseRect.Height) / 2;

            _pauseText = new FlxText(_pauseRect.X, _pauseRect.Y + (7 * _pauseScale), _pauseRect.Width, "GAME PAUSED");
            _pauseText.setFormat(null, (2 * _pauseScale) - 1, Color.White, FlxJustification.Center, Color.White);

            _posKeyX       *= _pauseScale;
            _posKeyC       *= _pauseScale;
            _posKeyMouse   *= _pauseScale;
            _posKeysArrows *= _pauseScale;
            _posKeyMinus   *= _pauseScale;
            _posKeyPlus    *= _pauseScale;
            _posKey0       *= _pauseScale;
            _posKey1       *= _pauseScale;

            _posKeyX.X       += _pauseRect.X;
            _posKeyC.X       += _pauseRect.X;
            _posKeyMouse.X   += _pauseRect.X;
            _posKeysArrows.X += _pauseRect.X;
            _posKeyMinus.X   += _pauseRect.X;
            _posKeyPlus.X    += _pauseRect.X;
            _posKey0.X       += _pauseRect.X;
            _posKey1.X       += _pauseRect.X;

            _posKeyX.Y       += _pauseRect.Y;
            _posKeyC.Y       += _pauseRect.Y;
            _posKeyMouse.Y   += _pauseRect.Y;
            _posKeysArrows.Y += _pauseRect.Y;
            _posKeyMinus.Y   += _pauseRect.Y;
            _posKeyPlus.Y    += _pauseRect.Y;
            _posKey0.Y       += _pauseRect.Y;
            _posKey1.Y       += _pauseRect.Y;
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="x">The x coordinate location of the resulting bar (in world pixels)</param>
        /// <param name="y">The y coordinate location of the resulting bar (in world pixels)</param>
        /// <param name="direction">One of the FlxBar.FILL_ constants (such as FILL_LEFT_TO_RIGHT, FILL_TOP_TO_BOTTOM etc)</param>
        /// <param name="width">The width of the bar in pixels</param>
        /// <param name="height">The height of the bar in pixels</param>
        /// <param name="parentRef">A reference to an object in your game that you wish the bar to track</param>
        /// <param name="variable">The variable of the object that is used to determine the bar position. For example if the parent was an FlxSprite this could be "health" to track the health value</param>
        /// <param name="min">The minimum value. I.e. for a progress bar this would be zero (nothing loaded yet)</param>
        /// <param name="max">The maximum value the bar can reach. I.e. for a progress bar this would typically be 100.</param>
        /// <param name="border">Include a 1px border around the bar? (if true it adds +2 to width and height to accommodate it)</param>
        public FlxBar(int x,
                      int y,
                      uint direction      = FILL_LEFT_TO_RIGHT,
                      uint width          = 100,
                      uint height         = 10,
                      FlxSprite parentRef = null,
                      string variable     = "",
                      float min           = 0,
                      float max           = 100,
                      bool border         = false)
            : base()
        {
            barWidth  = width;
            barHeight = height;
            _border   = border;
            //if (border)
            //{
            //    makeGraphic(barWidth + 2, barHeight + 2, 0xffffffff, true);
            //    filledBarPoint = new Point(1, 1);
            //}

            emptyBar  = new FlxSprite(x, y).createGraphic((int)width, (int)height, Color.DarkSlateGray);
            filledBar = new FlxSprite(x, y).createGraphic((int)width, (int)height, Color.Green);

            if (_border)
            {
                outline = new FlxSprite(x - 1, y - 1).createGraphic((int)width + 2, (int)height + 2, Color.LightGray);
            }
            if (parentRef != null)
            {
                parent         = parentRef;
                parentVariable = variable;
            }

            //setFillDirection(direction);

            setRange(min, max);

            //createFilledBar(0xff005100, 0xff00F400, border);

            //emptyKill = false;

            _text = new FlxText(x, y, 100);
            _text.setFormat(null, 1, Color.White, FlxJustification.Left, Color.Black);
            _text.text = variable;

            health = max;
        }
예제 #3
0
        public MessageBox()
            : base()
        {

            int midX = (FlxG.width / 2) - (320 / 2);
            int midY = 10;

            box = new UIBox(midX, midY, 320, 180);
            box.setScrollFactors(0, 0);
            add(box);

            textBox = new FlxText(midX+10, 20, 320, "");
            textBox.setFormat(null, 2, Color.White, FlxJustification.Left, Color.Black);
            textBox.setScrollFactors(0, 0);
            add(textBox);

            visible = false;

        }
예제 #4
0
        //@benbaird initializes the console, the pause overlay, and the soundbar
        private void initConsole()
        {
            //initialize the debug console
            _console = new FlxConsole(targetLeft, targetWidth);

            _console.log(FlxG.LIBRARY_NAME +
                         " v" + FlxG.LIBRARY_MAJOR_VERSION.ToString() + "." + FlxG.LIBRARY_MINOR_VERSION.ToString());
            _console.log("---------------------------------------");

            //Pause screen popup
            _pausePanel = new FlxPause();
            if (_helpStrings != null)
            {
                _pausePanel.helpX      = _helpStrings[0];
                _pausePanel.helpC      = _helpStrings[1];
                _pausePanel.helpMouse  = _helpStrings[2];
                _pausePanel.helpArrows = _helpStrings[3];
            }

            //Sound Tray popup
            _soundTrayRect    = new Rectangle((FlxG.width - 80) / 2, -30, 80, 30);
            _soundTrayVisible = false;

            _soundCaption = new FlxText((FlxG.width - 80) / 2, -10, 80, "VOLUME");
            _soundCaption.setFormat(null, 1, Color.White, FlxJustification.Center, Color.White).height = 10;

            int bx = 10;
            int by = 14;

            _soundTrayBars = new FlxSprite[10];
            for (int i = 0; i < 10; i++)
            {
                _soundTrayBars[i]              = new FlxSprite(_soundTrayRect.X + (bx * 1), -i, null);
                _soundTrayBars[i].width        = 4;
                _soundTrayBars[i].height       = i + 1;
                _soundTrayBars[i].scrollFactor = Vector2.Zero;
                bx += 6;
                by--;
            }
        }
예제 #5
0
        //@benbaird initializes the console, the pause overlay, and the soundbar
        private void initConsole()
        {
            //initialize the debug console
            _console = new FlxConsole(targetLeft, targetWidth);

            _console.log(FlxG.LIBRARY_NAME +
                " v" + FlxG.LIBRARY_MAJOR_VERSION.ToString() + "." + FlxG.LIBRARY_MINOR_VERSION.ToString());
            _console.log("---------------------------------------");

            //Pause screen popup
            _pausePanel = new FlxPause();
            if (_helpStrings != null)
            {
                _pausePanel.helpX = _helpStrings[0];
                _pausePanel.helpC = _helpStrings[1];
                _pausePanel.helpMouse = _helpStrings[2];
                _pausePanel.helpArrows = _helpStrings[3];
            }

            //Sound Tray popup
            _soundTrayRect = new Rectangle((FlxG.width - 80) / 2, -30, 80, 30);
            _soundTrayVisible = false;

            _soundCaption = new FlxText((FlxG.width - 80) / 2, -10, 80, "VOLUME");
            _soundCaption.setFormat(null, 1, Color.White, FlxJustification.Center, Color.White).height = 10;

            int bx = 10;
            int by = 14;
            _soundTrayBars = new FlxSprite[10];
            for(int i = 0; i < 10; i++)
            {
                _soundTrayBars[i] = new FlxSprite(_soundTrayRect.X + (bx * 1), -i, null);
                _soundTrayBars[i].width = 4;
                _soundTrayBars[i].height = i + 1;
                _soundTrayBars[i].scrollFactor = Vector2.Zero;
                bx += 6;
                by--;
            }
        }
예제 #6
0
        /// <summary>
        /// @benbaird initializes the console, the pause overlay, and the soundbar
        /// </summary>
        private void initConsole()
        {
            hud = new FlxHud(targetLeft, targetWidth);


            //initialize the debug console
            _console = new FlxConsole(targetLeft, targetWidth);

            _console.log(FlxG.LIBRARY_NAME +
                         " v" + FlxG.LIBRARY_MAJOR_VERSION.ToString() + "." + FlxG.LIBRARY_MINOR_VERSION.ToString());

            // Display some information about the engine we are using.
            Console.WriteLine("\nFlxFactory initialization\nFlixel Details LIBRARY:{0} -- v{1}.{2}", FlxG.LIBRARY_NAME, FlxG.LIBRARY_MAJOR_VERSION, FlxG.LIBRARY_MINOR_VERSION);


            /*
             * Assembly assembly = Assembly.GetExecutingAssembly();
             * FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location);
             * string version = fileVersionInfo.ProductVersion;
             * string gameName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
             * Console.WriteLine(gameName + " - Build version: " + version);
             *
             * _console.log(gameName + " - Build version: " + version);
             */


            _console.log("---------------------------------------");



            //Pause screen popup
            _pausePanel = new FlxPause();
            if (_helpStrings != null)
            {
                _pausePanel.helpX      = _helpStrings[0];
                _pausePanel.helpC      = _helpStrings[1];
                _pausePanel.helpMouse  = _helpStrings[2];
                _pausePanel.helpArrows = _helpStrings[3];
            }

            //Sound Tray popup
            _soundTrayRect    = new Rectangle((FlxG.width - 80) / 2, -30, 80, 30);
            _soundTrayVisible = false;

            _soundCaption = new FlxText((FlxG.width - 80) / 2, -10, 80, "VOLUME [=Lower ]=Higher \\=Mute or Unmute");
            _soundCaption.setFormat(null, 1, Color.White, FlxJustification.Center, Color.White).height = 10;

            int bx = 10;
            int by = 14;

            _soundTrayBars = new FlxSprite[10];
            for (int i = 0; i < 10; i++)
            {
                _soundTrayBars[i]              = new FlxSprite(_soundTrayRect.X + (bx * 1), -i, null);
                _soundTrayBars[i].width        = 4;
                _soundTrayBars[i].height       = i + 1;
                _soundTrayBars[i].scrollFactor = Vector2.Zero;
                bx += 6;
                by--;
            }
        }