示例#1
0
 public StatusPane(GraphicsDevice graphicsDevice)
 {
     _graphicsDevice = graphicsDevice;
     _spriteBatch    = new SpriteBatch(_graphicsDevice);
     _font           = new PixelFont(_graphicsDevice);
     _fps            = new FramesPerSecondCounter(_graphicsDevice);
 }
示例#2
0
 public override void Draw(PixelFont f,AD2SpriteBatch sb)
 {
     if (HP > 0)
         f.Draw(sb, Symbol.ToString(), BasementExplorer.MapXOffset + X, BasementExplorer.MapYOffset + Y, Color.Red);
     else
         f.Draw(sb, Symbol.ToString(), BasementExplorer.MapXOffset + X, BasementExplorer.MapYOffset + Y, Color.DarkRed);
 }
        public void ShowClock(Color color)
        {
            var font          = new PixelFont(new TryOutLetters(), new TryOutNumbers(color), new TryOutSpecialSigns(color));
            var cultureInfo   = CultureInfo.CreateSpecificCulture("de-DE");
            var oldTimeMinute = -1;

            while (true)
            {
                if (oldTimeMinute != -1 && DateTime.Now.Minute == oldTimeMinute)
                {
                    Thread.Sleep(2000);
                    continue;
                }

                oldTimeMinute = DateTime.Now.Minute;

                var time = GetLocalDateTime().ToString("t", cultureInfo);
                if (_stateHandler.GetCurrentState().StateCode != StateCode.ShowClock)
                {
                    break;
                }

                _resetLogic.Reset();
                Console.WriteLine(time);
                for (var i = 0; time.Length > i; i++)
                {
                    int spaceTop = TopRowSpace, spaceLeft = GetColSpace(i);
                    PrintPixelFont(MapStringToPixel(font, time[i].ToString()), spaceTop, spaceLeft);
                }

                Thread.Sleep(1000);
            }
        }
示例#4
0
        private void calculateBaseSizes()
        {
            // compute the max size of a digit and separators in the English font, for the timer part.
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float digitWidth = pixelFontSize.Measure(i.ToString()).X;
                if (digitWidth > numberWidth)
                {
                    numberWidth = digitWidth;
                }
            }
            spacerWidth  = pixelFontSize.Measure('.').X;
            numberHeight = pixelFontSize.Measure("0:.").Y;

            // measure the ranks in the font for the current language.
            rankMeasurements = new Dictionary <string, Vector2>()
            {
                { "Gold", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_gold") + " ") * targetTimeScale },
                { "Silver", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_silver") + " ") * targetTimeScale },
                { "Bronze", ActiveFont.Measure(Dialog.Clean("collabutils2_speedberry_bronze") + " ") * targetTimeScale }
            };
        }
示例#5
0
        private void drawTime(Vector2 position, string timeString, Color color, float scale = 1f, float alpha = 1f)
        {
            PixelFont font         = Dialog.Languages["english"].Font;
            float     fontFaceSize = Dialog.Languages["english"].FontFaceSize;
            float     currentScale = scale;
            float     currentX     = position.X;
            float     currentY     = position.Y;

            color = color * alpha;
            Color colorDoubleAlpha = color * alpha;

            foreach (char c in timeString)
            {
                bool flag2 = c == '.';
                if (flag2)
                {
                    currentScale = scale * 0.7f;
                    currentY    -= 5f * scale;
                }
                Color colorToUse = (c == ':' || c == '.' || currentScale < scale) ? colorDoubleAlpha : color;
                float advance    = (((c == ':' || c == '.') ? spacerWidth : numberWidth) + 4f) * currentScale;
                font.DrawOutline(fontFaceSize, c.ToString(), new Vector2(currentX + advance / 2, currentY), new Vector2(0.5f, 1f), Vector2.One * currentScale, colorToUse, 2f, Color.Black);
                currentX += advance;
            }
        }
示例#6
0
        public static PixelFont Load(string face)
        {
            PixelFont font = orig_Load(face);

            Emoji.Fill(font);
            return(font);
        }
示例#7
0
 public override void Initialize()
 {
     _font       = new PixelFont(GraphicsDevice);
     _camera     = new Camera2D(GraphicsDevice);
     _statusPane = new StatusPane(GraphicsDevice);
     _landscape  = new Landscape(GraphicsDevice);
     _landscape.Initialize();
 }
示例#8
0
        private static void DrawTime(Vector2 position, string timeString, float scale = 1f, bool valid = true,
                                     bool finished = false, bool bestTime = false, float alpha = 1f)
        {
            float         numberWidth   = 0f;
            float         spacerWidth   = 0f;
            PixelFontSize pixelFontSize =
                Dialog.Languages["english"].Font.Get(Dialog.Languages["english"].FontFaceSize);

            for (int index = 0; index < 10; ++index)
            {
                float x1 = pixelFontSize.Measure(index.ToString()).X;
                if ((double)x1 > numberWidth)
                {
                    numberWidth = x1;
                }
            }

            spacerWidth = pixelFontSize.Measure('.').X;

            PixelFont font         = Dialog.Languages["english"].Font;
            float     fontFaceSize = Dialog.Languages["english"].FontFaceSize;
            float     num1         = scale;
            float     x            = position.X;
            float     y            = position.Y;
            Color     color1       = Color.White * alpha;
            Color     color2       = Color.LightGray * alpha;

            if (!valid)
            {
                color1 = Calc.HexToColor("918988") * alpha;
                color2 = Calc.HexToColor("7a6f6d") * alpha;
            }
            else if (bestTime)
            {
                color1 = Calc.HexToColor("fad768") * alpha;
                color2 = Calc.HexToColor("cfa727") * alpha;
            }
            else if (finished)
            {
                color1 = Calc.HexToColor("6ded87") * alpha;
                color2 = Calc.HexToColor("43d14c") * alpha;
            }

            for (int index = 0; index < timeString.Length; ++index)
            {
                char ch = timeString[index];

                Color color3 = ch == ':' || ch == '.' || (double)num1 < (double)scale ? color2 : color1;

                float num2 = (float)((ch == ':' || ch == '.' ? spacerWidth : numberWidth) + 4.0) * num1;
                font.DrawOutline(fontFaceSize, ch.ToString(), new Vector2(x + num2 / 2f, y), new Vector2(0.5f, 1f),
                                 Vector2.One * num1, color3, 2f, Color.Black);
                x += num2;
            }
        }
示例#9
0
文件: Emoji.cs 项目: tytrdev/Everest
 /// <summary>
 /// Fill a font with emoji.
 /// </summary>
 /// <param name="font">The font to fill.</param>
 public static void Fill(PixelFont font)
 {
     Auto();
     foreach (PixelFontSize size in font.Sizes)
     {
         foreach (PixelFontCharacter c in _Chars)
         {
             size.Characters[c.Character] = c;
         }
     }
 }
示例#10
0
    //Loads a basic rectangle, some text, some sounds. And a RNG.
    public static void Load()
    {
        #if DEBUG
        WhiteRect   = Utils.TextureLoader(@"..\..\API\assets\rect.png");
        DefaultFont = new PixelFont(@"..\..\API\assets\spireFont.xml");
        #else
        WhiteRect   = Utils.TextureLoader(@"rect.png");
        DefaultFont = new PixelFont(@"spireFont.xml");
        #endif

        SoundManager.Load("sounds/");
        Random = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
    }
示例#11
0
        public static TextLabel AddTextLabel(PixelFont font, Vector2 position, string text, Panel panel = null, int glyphSpacing = 1)
        {
            TextLabel textLabel = new TextLabel();

            textLabel.AutoSize = AutoSizeModes.None;
            textLabel.Font     = font;
            textLabel.Position = position;
            textLabel.Text     = text;
            if (panel != null)
            {
                panel.Components.Add(textLabel);
            }

            return(textLabel);
        }
示例#12
0
            public new void Draw(PixelFont font, float baseSize, Vector2 position, Vector2 scale, float alpha)
            {
                Color prevColor = Color;

                if (Emoji.Start <= Character &&
                    Character <= Emoji.Last &&
                    !Emoji.IsMonochrome((char)Character))
                {
                    Color = new Color(Color.A, Color.A, Color.A, Color.A);
                }

                orig_Draw(font, baseSize, position, scale, alpha);

                Color = prevColor;
            }
示例#13
0
        public static void CalculateBaseSizes()
        {
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float x = pixelFontSize.Measure(i.ToString()).X;
                if (x > numberWidth)
                {
                    numberWidth = x;
                }
            }
            spacerWidth = pixelFontSize.Measure('.').X;
        }
示例#14
0
        private void CalculateBaseSizes()
        {
            // compute the max size of a digit and separators in the English font, for the timer part.
            PixelFont     font          = Dialog.Languages["english"].Font;
            float         fontFaceSize  = Dialog.Languages["english"].FontFaceSize;
            PixelFontSize pixelFontSize = font.Get(fontFaceSize);

            for (int i = 0; i < 10; i++)
            {
                float digitWidth = pixelFontSize.Measure(i.ToString()).X;
                if (digitWidth > numberWidth)
                {
                    numberWidth = digitWidth;
                }
            }
            spacerWidth = pixelFontSize.Measure('.').X;
        }
        private BaseFont MapStringToPixel(PixelFont pixelfont, string stringToMap)
        {
            switch (stringToMap)
            {
            case "0":
                return(pixelfont.Numbers.zero);

            case "1":
                return(pixelfont.Numbers.one);

            case "2":
                return(pixelfont.Numbers.two);

            case "3":
                return(pixelfont.Numbers.three);

            case "4":
                return(pixelfont.Numbers.four);

            case "5":
                return(pixelfont.Numbers.five);

            case "6":
                return(pixelfont.Numbers.six);

            case "7":
                return(pixelfont.Numbers.seven);

            case "8":
                return(pixelfont.Numbers.eight);

            case "9":
                return(pixelfont.Numbers.nine);

            case ":":
                return(pixelfont.SpecialSigns.colon);

            default:
                return(null);
            }
        }
示例#16
0
        public static void DrawTime(Vector2 position, string timeString, float scale = 1f, bool valid = true, bool finished = false, bool bestTime = false, float alpha = 1f)
        {
            PixelFont font         = Dialog.Languages["english"].Font;
            float     fontFaceSize = Dialog.Languages["english"].FontFaceSize;
            float     num          = scale;
            float     num2         = position.X;
            float     num3         = position.Y;
            Color     color        = Color.White * alpha;
            Color     color2       = Color.LightGray * alpha;

            if (!valid)
            {
                color  = Calc.HexToColor("918988") * alpha;
                color2 = Calc.HexToColor("7a6f6d") * alpha;
            }
            else if (bestTime)
            {
                color  = Calc.HexToColor("fad768") * alpha;
                color2 = Calc.HexToColor("cfa727") * alpha;
            }
            else if (finished)
            {
                color  = Calc.HexToColor("6ded87") * alpha;
                color2 = Calc.HexToColor("43d14c") * alpha;
            }
            for (int i = 0; i < timeString.Length; i++)
            {
                char c = timeString[i];
                if (c == '.')
                {
                    num   = scale * 0.7f;
                    num3 -= 5f * scale;
                }
                Color color3 = (c == ':' || c == '.' || num < scale) ? color2 : color;
                float num4   = (((c == ':' || c == '.') ? spacerWidth : numberWidth) + 4f) * num;
                font.DrawOutline(fontFaceSize, c.ToString(), new Vector2(num2 + num4 / 2f, num3), new Vector2(0.5f, 1f), Vector2.One * num, color3, 2f, Color.Black);
                num2 += num4;
            }
        }
示例#17
0
        public override void Render()
        {
            base.Render();
            if (DrawLerp > 0f)
            {
                float num = -300f * Ease.CubeIn(1f - DrawLerp);

                int index = 0;
                for (int i = 0; i < GameData.Instance.players.Length; i++)
                {
                    if (GameData.Instance.players[i] != null)
                    {
                        bg.Draw(new Vector2(num, Y + 44 * (index + 1)));
                        PlayerToken token = GameData.Instance.players[i].token;
                        token.textures[(int)token.frame].DrawCentered(new Vector2(num + 60, Y - 8 + 44 * (index + 1.5f)), Color.White, .3f);

                        PixelFont font         = Dialog.Languages["english"].Font;
                        float     fontFaceSize = Dialog.Languages["english"].FontFaceSize;
                        font.DrawOutline(fontFaceSize, string.Format("{0:F1} M", (GameData.Instance.minigameResults.FirstOrDefault((t) => t.Item1 == i)?.Item2 ?? GameData.Instance.minigameStatus[i]) / 50.0), new Vector2(num + 200, Y + 44f * (index + 2)), new Vector2(0.5f, 1f), Vector2.One * (1f + wiggler.Value * 0.15f), Color.White, 2f, Color.Black);
                        index++;
                    }
                }
            }
        }
示例#18
0
        public override void Render()
        {
            base.Render();
            if (DrawLerp > 0f)
            {
                float num = -300f * Ease.CubeIn(1f - DrawLerp);

                int index = 0;
                for (int i = 0; i < GameData.Instance.players.Length; i++)
                {
                    if (GameData.Instance.players[i] != null)
                    {
                        scoreBg.Draw(new Vector2(num, Y + 44 * (index + 1)));
                        GFX.Gui[PlayerToken.GetFullPath(BoardController.TokenPaths[i]) + "00"].DrawCentered(new Vector2(num + 40, Y - 8 + 44 * (index + 1.5f)), Color.White, .3f);

                        PixelFont font         = Dialog.Languages["english"].Font;
                        float     fontFaceSize = Dialog.Languages["english"].FontFaceSize;
                        string    text         = (GameData.Instance.minigameStatus.ContainsKey(i) ? GameData.Instance.minigameStatus[i].ToString() : "0") + (max > 0 ? "/" + max : "");
                        font.DrawOutline(fontFaceSize, text, new Vector2(num + 120, Y + 44f * (index + 2)), new Vector2(0.5f, 1f), Vector2.One * (1f + wiggler.Value * 0.15f), Color.White, 2f, Color.Black);
                        index++;
                    }
                }
            }
        }
示例#19
0
    public void Draw(PixelFont f, AD2SpriteBatch sb)
    {
        Utils.DrawRect(sb, 0, 0, 200, 20, Player.DarkColor);
        Utils.DrawRect(sb, 0, 0, 70, 150, Player.DarkColor);

        //print message in message zone.
        f.Draw(sb, Messages.CurrentMessage.RevealedText(), 2, 11, Color.White);
        f.Draw(sb, Messages.LastMessage.RevealedText(), 2, 1, Color.White);

        //Print HP Bar.
        Utils.DrawRect(sb, 1, 23, 67, 13, Color.White);
        if (Player.HP > 0)
        {
            Utils.DrawRect(sb, 2, 24, (int)(65 * ((double)Player.HP / Player.MaxHP())), 11, Color.Red);
        }

        string HPmsg = Player.HP +"";
        //center it up.
        //ignore space of last letter.
        f.Draw(sb, HPmsg, 35 - ((f.GetWidth(HPmsg, true) - 2) / 2), 26,Color.White,1,true);

        PrimaryWeapon primaryDisplay = PrimaryWeaponDisplay == null ? Player.PrimaryWeapon : PrimaryWeaponDisplay;

        if (PrimaryWeaponDisplay != null)
        {
            Utils.DrawRect(sb, 0, 37, 70, 59, Player.MainColor);

        }

        if (primaryDisplay != null)
        {
            f.Draw(sb, primaryDisplay.Name, 2, 38, Color.White, 1);

            f.Draw(sb, "Pow:  " + primaryDisplay.Power(Player), 2, 48, Color.White);
            f.Draw(sb, "Acc:  " + primaryDisplay.Accuracy(Player), 2, 58, Color.White);
            //Special ability here if applicable.
            //TODO: CRIT, +HP, -HP, STUN,
            f.Draw(sb, primaryDisplay.SpecialMessage(), 2, 68, Color.White);
            f.Draw(sb, primaryDisplay.WarningMessage(Player), 2, 78, Color.Gray);
        } else
        {
            f.Draw(sb, "Punch", 2, 38, Color.White, 1);

            f.Draw(sb, "Pow:  " + Player.PunchPower(), 2, 48, Color.White);
            f.Draw(sb, "Acc:  " + (Player).PunchAccuracy(), 2, 58, Color.White);

        }

        f.Draw(sb, "9 Darts", 2, 98, Color.White);
        f.Draw(sb, "Pow:  99", 2, 108, Color.White);
        f.Draw(sb, "Range 99", 2, 118, Color.White);

        Utils.DrawRect(sb, 24, 129, 12, 12, Color.Yellow);
        for (int i = 3; i < 62; i = i + 11)
        {
            Utils.DrawRect(sb, i, 130, 10, 10, Color.Gray);
        }

        f.Draw(sb, ".", 1+4, 131, Color.White);
        f.Draw(sb, "=", 1+15, 131, Color.Red);
        f.Draw(sb, ",", 1+26, 131, Color.Green);
        f.Draw(sb, "Y", 1+37, 131, Color.Brown);
    }
示例#20
0
 public abstract void Draw(PixelFont f, AD2SpriteBatch sb);
示例#21
0
 public override void Draw(PixelFont f, AD2SpriteBatch sb)
 {
     f.Draw(sb, Symbol.ToString(), BasementExplorer.MapXOffset + X, BasementExplorer.MapYOffset + Y, (HP > 0) ? MainColor : DarkColor);
 }
示例#22
0
 public extern void orig_Draw(PixelFont font, float baseSize, Vector2 position, Vector2 scale, float alpha);
示例#23
0
    //Loads a basic rectangle, some text, some sounds. And a RNG.
    public static void Load()
    {
        #if DEBUG
            WhiteRect = Utils.TextureLoader(@"..\..\API\assets\rect.png");
            DefaultFont = new PixelFont(@"..\..\API\assets\spireFont.xml");
        #else
            WhiteRect = Utils.TextureLoader(@"rect.png");
            DefaultFont = new PixelFont(@"spireFont.xml");
        #endif

        SoundManager.Load("sounds/");
        Random = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
    }
示例#24
0
        public override void LoadConent(ContentManager _content)
        {
            m_background1 = _content.Load<Texture2D>("Menu\\Graphic\\intro1");
            m_background2 = _content.Load<Texture2D>("Menu\\Graphic\\intro2");
            m_arrowSheet = _content.Load<Texture2D>("Menu\\Graphic\\Arrow");
            m_blueShipTexture = _content.Load<Texture2D>("Menu\\Graphic\\blueShip");
            m_redShipTexture = _content.Load<Texture2D>("Menu\\Graphic\\redShip");
            m_greenShipTexture = _content.Load<Texture2D>("Menu\\Graphic\\greenShip");
            m_titleTexture = _content.Load<Texture2D>("Menu\\Graphic\\title");
            m_subtitleTexture = _content.Load<Texture2D>("Menu\\Graphic\\Subtitle");
            m_segaLogoSheet = _content.Load<Texture2D>("Menu\\Graphic\\SegaLogo");
            m_logoTexture = _content.Load<Texture2D>("Menu\\Graphic\\Logo");
            m_pixelFontSheet = _content.Load<Texture2D>("Menu\\Font\\Standart2");

            m_standartFont = _content.Load<SpriteFont>("Menu\\Font\\Standart");

            m_titleMusic = _content.Load<SoundEffect>("Menu\\Music\\Title");
            m_menuSelect = _content.Load<SoundEffect>("Menu\\Sound\\Menu Select");

            m_standartPixelFont = new PixelFont(new Spritesheet(m_pixelFontSheet, new Vector2(8, 8)));
        }
示例#25
0
 public override void Draw(PixelFont f, AD2SpriteBatch sb)
 {
     if (OnFloor)
         f.Draw(sb, Symbol.ToString(), BasementExplorer.MapXOffset +  X, BasementExplorer.MapYOffset + Y, this.Color);
 }
示例#26
0
 public TextBox(Vector2 offset, Vector2 size, Vector2 scale, MTexture unsel, bool selectable, bool blockClickThrough) : base(offset, size, scale, unsel, selectable, blockClickThrough)
 {
     Logger.Log("CLE", Dialog.Language.FontFace);
     pixelFont   = Fonts.Faces[Dialog.Language.FontFace];
     currentText = "N/A";
 }
    protected override void AD2LoadContent()
    {
        P = new Player("Blue",Color.Blue, new Color(0, 0, 100, 255), 100, 100);
        H = new HUD(1, P);
        P.AddObserver(H);
        IBMFont = new PixelFont("fonts/IBMCGA.xml");
        TestMap = new OcclusionMap("testmap/testmap.xml",BaseWidth,BaseHeight);

        //functionify this
        Entities = new LinkedList<Entity>();
        AliveCreatures = new LinkedList<Creature>();
        DeadCreatures = new LinkedList<Creature>();
        ItemsOnGround = new LinkedList<Item>();

        AddCreature(P);
        AddCreature(new Rodent("Hamster",'h', 30, 30, 0, 20));
        AddCreature(new Rodent("Gerbil", 'g', 40, 30, 2, 20));
        AddItem(new PrimaryCrit("Stick", '/', Color.Brown, 0, 10, 0, 4, 30, 50, 10));
        //A god pwns you.
        AddCreature(new Rodent("God",'G', 80, 200, 100, 100));

        MapGenerator.Generate();
    }