Exemplo n.º 1
0
        public static void DrawSpriteHPBar(RendererDestinationData destData, ISprite sprite, int hp, int maxHP)
        {
            int x = 0;
            int y = 0;

            x = ScreenRenderer.ToTileX(sprite.Location.X) + sprite.Offset.X;
            y = ScreenRenderer.ToTileY(sprite.Location.Y) + sprite.Offset.Y;
            //if (sprite == ScreenRenderer.Camera.FocusedSprite) {
            //    x = ScreenRenderer.NewX;
            //    y = ScreenRenderer.NewY;
            //} else {

            //}

            //if (MaxInfo.SpriteSize == 0) {
            //    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + 50, y + 36));
            //    destSurf.Draw(hpBox, Color.Black, false, true);
            //    if (maxHP < 1) {
            //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + ((hp / 100) / ((maxHP + 1) / 100) * 50), y + 36));
            //    } else {
            //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + ((hp / 100) / (maxHP / 100) * 50), y + 36));
            //    }
            //    destSurf.Draw(hpBox, Color.LightGreen, false, true);
            //} else {
            Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 36), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 40));

            destData.Draw(hpBox, Color.Black, false, true);
            if (maxHP > 0)
            {
                hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 37), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(hp, maxHP) * 0.01) * 31), destData.Location.Y + y + 39));
            }
            destData.Draw(hpBox, Color.LightGreen, false, true);
            //}
        }
Exemplo n.º 2
0
        public static void DrawMiniBars(RendererDestinationData destData)
        {
            int userHPBarStartX = 40;//DrawingSupport.GetCenterX(destData.Size.Width, 100);

            TextRenderer.DrawText(destData, "HP:", Color.WhiteSmoke, Color.Black, new Point(userHPBarStartX - 30, 5));
            SdlDotNet.Graphics.Primitives.Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userHPBarStartX - 1, destData.Location.Y + 17), new Point(destData.Location.X + userHPBarStartX + 100 + 1, destData.Location.Y + 27));
            destData.Draw(hpBox, Color.Black, false, false);
            hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userHPBarStartX, destData.Location.Y + 17 + 1), new Point(Convert.ToInt32(destData.Location.X + userHPBarStartX + (Logic.MathFunctions.CalculatePercent(PlayerManager.MyPlayer.GetActiveRecruit().HP, PlayerManager.MyPlayer.GetActiveRecruit().MaxHP) * 0.01) * 100), destData.Location.Y + 27 - 1));

            Color hpColor;

            if (PlayerManager.MyPlayer.GetActiveRecruit().HP < PlayerManager.MyPlayer.GetActiveRecruit().MaxHP / 5)
            {
                hpColor = Color.Red;
            }
            else if (PlayerManager.MyPlayer.GetActiveRecruit().HP < PlayerManager.MyPlayer.GetActiveRecruit().MaxHP / 2)
            {
                hpColor = Color.Yellow;
            }
            else
            {
                hpColor = Color.Green;
            }

            destData.Draw(hpBox, hpColor, false, true);

            int userBellyBarStartX = 205;//DrawingSupport.GetCenterX(destData.Size.Width, 100);

            TextRenderer.DrawText(destData, "Hunger:", Color.WhiteSmoke, Color.Black, new Point(userBellyBarStartX - 45, 5));
            SdlDotNet.Graphics.Primitives.Box bellyBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userBellyBarStartX - 1, destData.Location.Y + 17), new Point(destData.Location.X + userBellyBarStartX + 100 + 1, destData.Location.Y + 27));
            destData.Draw(bellyBox, Color.Black, false, false);
            bellyBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userBellyBarStartX, destData.Location.Y + 17 + 1), new Point(Convert.ToInt32(destData.Location.X + userBellyBarStartX + (Logic.MathFunctions.CalculatePercent(PlayerManager.MyPlayer.Belly, PlayerManager.MyPlayer.MaxBelly) * 0.01) * 100), destData.Location.Y + 27 - 1));

            Color bellyColor;

            if (PlayerManager.MyPlayer.Belly < PlayerManager.MyPlayer.MaxBelly / 5)
            {
                bellyColor = Color.Red;
            }
            else if (PlayerManager.MyPlayer.Belly < PlayerManager.MyPlayer.MaxBelly / 2)
            {
                bellyColor = Color.Yellow;
            }
            else
            {
                bellyColor = Color.Green;
            }

            destData.Draw(bellyBox, bellyColor, false, true);
        }
Exemplo n.º 3
0
        public static void DrawSpriteHPBar(RendererDestinationData destData, ISprite sprite, int hp, int maxHP)
        {
            int x = 0;
            int y = 0;

            x = ScreenRenderer.ToTileX(sprite.Location.X) + sprite.Offset.X;
            y = ScreenRenderer.ToTileY(sprite.Location.Y) + sprite.Offset.Y;

            Box hpBox = new Box(new Point(destData.Location.X + x, destData.Location.Y + y + 36), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 40));

            destData.Draw(hpBox, Color.Black, false, true);
            if (maxHP > 0)
            {
                hpBox = new Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 37), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(hp, maxHP) * 0.01) * 31), destData.Location.Y + y + 39));
            }
            destData.Draw(hpBox, Color.LightGreen, false, true);
        }
Exemplo n.º 4
0
        public static void DrawNpcBars(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int npcSlot)
        {
            MapNpc npc = map.MapNpcs[npcSlot];
            int    x, y;

            if (npc != null && npc.HP > 0 && npc.Num > 0 && npc.ScreenActive)
            {
                if (npc.HP != npc.MaxHP)
                {
                    //if (Npc.NpcHelper.Npcs[npc.Num].Big) {
                    //    x = (npc.Location.X * Constants.TILE_WIDTH - 9 + npc.Offset.X) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    //    y = (npc.Location.Y * Constants.TILE_HEIGHT + npc.Offset.Y) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    //    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 50, destData.Location.Y + y + 36));
                    //    destData.Draw(hpBox, Color.Black, false, true);
                    //    if (npc.MaxHP < 1) {
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / ((npc.MaxHP + 1) / 100) * 50), destData.Location.Y + y + 36));
                    //    } else {
                    //        double
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / (double)((double)npc.MaxHP / 100) * 50)), destData.Location.Y + y + 36));
                    //    }
                    //    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //} else {
                    int npcX = npc.Location.X;
                    int npcY = npc.Location.Y;
                    Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref npcX, ref npcY);

                    x = ScreenRenderer.ToTileX(npcX) + npc.Offset.X; //(npc.X * Constants.TILE_WIDTH + sx + npc.XOffset) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    y = ScreenRenderer.ToTileY(npcY) + npc.Offset.Y; //(npc.Y * Constants.TILE_HEIGHT + sx + npc.YOffset) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    destData.Draw(hpBox, Color.Black, false, true);
                    if (npc.MaxHP < 1)
                    {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    }
                    else
                    {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 33), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(npc.HP, npc.MaxHP) * 0.01) * 31), destData.Location.Y + y + 35));
                    }
                    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //}
                }
            }
        }
Exemplo n.º 5
0
        public static void DrawMiniBars(RendererDestinationData destData)
        {
            int userHPBarStartX = 40;//DrawingSupport.GetCenterX(destData.Size.Width, 100);
            TextRenderer.DrawText(destData, "HP:", Color.WhiteSmoke, Color.Black, new Point(userHPBarStartX - 30, 5));
            SdlDotNet.Graphics.Primitives.Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userHPBarStartX - 1, destData.Location.Y + 17), new Point(destData.Location.X + userHPBarStartX + 100 + 1, destData.Location.Y + 27));
            destData.Draw(hpBox, Color.Black, false, false);
            hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userHPBarStartX, destData.Location.Y + 17 + 1), new Point(Convert.ToInt32(destData.Location.X + userHPBarStartX + (Logic.MathFunctions.CalculatePercent(PlayerManager.MyPlayer.GetActiveRecruit().HP, PlayerManager.MyPlayer.GetActiveRecruit().MaxHP) * 0.01) * 100), destData.Location.Y + 27 - 1));

            Color hpColor;
            if (PlayerManager.MyPlayer.GetActiveRecruit().HP < PlayerManager.MyPlayer.GetActiveRecruit().MaxHP / 5) {
                hpColor = Color.Red;
            } else if (PlayerManager.MyPlayer.GetActiveRecruit().HP < PlayerManager.MyPlayer.GetActiveRecruit().MaxHP / 2) {
                hpColor = Color.Yellow;
            } else {
                hpColor = Color.Green;
            }

            destData.Draw(hpBox, hpColor, false, true);

            int userBellyBarStartX = 205;//DrawingSupport.GetCenterX(destData.Size.Width, 100);
            TextRenderer.DrawText(destData, "Belly:", Color.WhiteSmoke, Color.Black, new Point(userBellyBarStartX - 45, 5));
            SdlDotNet.Graphics.Primitives.Box bellyBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userBellyBarStartX - 1, destData.Location.Y + 17), new Point(destData.Location.X + userBellyBarStartX + 100 + 1, destData.Location.Y + 27));
            destData.Draw(bellyBox, Color.Black, false, false);
            bellyBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + userBellyBarStartX, destData.Location.Y + 17 + 1), new Point(Convert.ToInt32(destData.Location.X + userBellyBarStartX + (Logic.MathFunctions.CalculatePercent(PlayerManager.MyPlayer.Belly, PlayerManager.MyPlayer.MaxBelly) * 0.01) * 100), destData.Location.Y + 27 - 1));

            Color bellyColor;
            if (PlayerManager.MyPlayer.Belly < PlayerManager.MyPlayer.MaxBelly / 5) {
                bellyColor = Color.Red;
            } else if (PlayerManager.MyPlayer.Belly < PlayerManager.MyPlayer.MaxBelly / 2) {
                bellyColor = Color.Yellow;
            } else {
                bellyColor = Color.Green;
            }

            destData.Draw(bellyBox, bellyColor, false, true);
        }
Exemplo n.º 6
0
        public static void DrawSpriteHPBar(RendererDestinationData destData, ISprite sprite, int hp, int maxHP)
        {
            int x = 0;
            int y = 0;

            x = ScreenRenderer.ToTileX(sprite.Location.X) + sprite.Offset.X;
            y = ScreenRenderer.ToTileY(sprite.Location.Y) + sprite.Offset.Y;
            //if (sprite == ScreenRenderer.Camera.FocusedSprite) {
            //    x = ScreenRenderer.NewX;
            //    y = ScreenRenderer.NewY;
            //} else {

            //}

            //if (MaxInfo.SpriteSize == 0) {
            //    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + 50, y + 36));
            //    destSurf.Draw(hpBox, Color.Black, false, true);
            //    if (maxHP < 1) {
            //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + ((hp / 100) / ((maxHP + 1) / 100) * 50), y + 36));
            //    } else {
            //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(x, y + 32), new Point(x + ((hp / 100) / (maxHP / 100) * 50), y + 36));
            //    }
            //    destSurf.Draw(hpBox, Color.LightGreen, false, true);
            //} else {
            Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 36), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 40));
            destData.Draw(hpBox, Color.Black, false, true);
            if (maxHP > 0) {
                hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 37), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(hp, maxHP) * 0.01) * 31), destData.Location.Y + y + 39));
            }
            destData.Draw(hpBox, Color.LightGreen, false, true);
            //}
        }
Exemplo n.º 7
0
        public static void DrawNpcBars(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int npcSlot)
        {
            MapNpc npc = map.MapNpcs[npcSlot];
            int x, y;

            if (npc != null && npc.HP > 0 && npc.Num > 0 && npc.ScreenActive) {
                if (npc.HP != npc.MaxHP) {
                    //if (Npc.NpcHelper.Npcs[npc.Num].Big) {
                    //    x = (npc.Location.X * Constants.TILE_WIDTH - 9 + npc.Offset.X) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    //    y = (npc.Location.Y * Constants.TILE_HEIGHT + npc.Offset.Y) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    //    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 50, destData.Location.Y + y + 36));
                    //    destData.Draw(hpBox, Color.Black, false, true);
                    //    if (npc.MaxHP < 1) {
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / ((npc.MaxHP + 1) / 100) * 50), destData.Location.Y + y + 36));
                    //    } else {
                    //        double
                    //        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + ((npc.HP / 100) / (double)((double)npc.MaxHP / 100) * 50)), destData.Location.Y + y + 36));
                    //    }
                    //    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //} else {
                    int npcX = npc.Location.X;
                    int npcY = npc.Location.Y;
                    Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref npcX, ref npcY);

                    x = ScreenRenderer.ToTileX(npcX) + npc.Offset.X;//(npc.X * Constants.TILE_WIDTH + sx + npc.XOffset) - (Globals.NewMapX * Constants.TILE_WIDTH) - Globals.NewMapXOffset;
                    y = ScreenRenderer.ToTileY(npcY) + npc.Offset.Y;//(npc.Y * Constants.TILE_HEIGHT + sx + npc.YOffset) - (Globals.NewMapY * Constants.TILE_HEIGHT) - Globals.NewMapYOffset;

                    Box hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    destData.Draw(hpBox, Color.Black, false, true);
                    if (npc.MaxHP < 1) {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x, destData.Location.Y + y + 32), new Point(destData.Location.X + x + 32, destData.Location.Y + y + 36));
                    } else {
                        hpBox = new SdlDotNet.Graphics.Primitives.Box(new Point(destData.Location.X + x + 1, destData.Location.Y + y + 33), new Point(Convert.ToInt32(destData.Location.X + x + (Logic.MathFunctions.CalculatePercent(npc.HP, npc.MaxHP) * 0.01) * 31), destData.Location.Y + y + 35));
                    }
                    destData.Draw(hpBox, Color.LightGreen, false, true);
                    //}
                }
            }
        }