Esempio n. 1
0
        private static void DrawIcons()
        {
            for (int v = 0; v < whitelistPos.Count; v++)
            {
                int type = WhiteListType(whitelistType[v]);
                if (type == -1)
                {
                    continue;
                }
                if (type == 1 && !BossChecklist.ClientConfig.FragmentsBool)
                {
                    continue;
                }
                if (type == 2 && !BossChecklist.ClientConfig.ScalesBool)
                {
                    continue;
                }

                Texture2D     drawTexture = Main.itemTexture[whitelistType[v]];
                DrawAnimation drawAnim    = Main.itemAnimations[whitelistType[v]];
                Rectangle     sourceRect  = drawAnim != null?drawAnim.GetFrame(drawTexture) : drawTexture.Bounds;

                Vector2 drawPosition = CalculateDrawPos(new Vector2(whitelistPos[v].X / 16, whitelistPos[v].Y / 16));

                DrawTextureOnMap(drawTexture, drawPosition, sourceRect);
            }
        }
Esempio n. 2
0
        public void DrawPaint(object sender, PaintEventArgs e)
        {
            if (!drawing)
            {
                return;
            }
            Graphics g = e.Graphics;

            g.CompositingQuality = CompositingQuality.HighQuality;
            g.SmoothingMode      = SmoothingMode.AntiAlias;
            g.InterpolationMode  = InterpolationMode.Low;
            g.TextRenderingHint  = TextRenderingHint.AntiAlias;

            g.ScaleTransform(scalar, scalar);

            try {
                Map?.Draw(g);

                DrawWhite?.Invoke(g);
                Blast.DrawAll(g);
                DrawTail?.Invoke(g);
                DrawBullet?.Invoke(g);
                DrawHead?.Invoke(g);

                DrawKeys?.Invoke(g);
                DrawAnimation?.Invoke(g);

                if (ActiveKeys.Contains(Leader))
                {
                    Map.DrawCrown(g);
                }

                MVP.Draw(g);
            } catch (Exception) { }
        }
Esempio n. 3
0
        internal void SetupContent()
        {
            foreach (ModItem item in items.Values)
            {
                ItemLoader.itemTexture[item.item.type] = Loader.GetTexture(item.mod.ModAssembly.GetName().Name + item.texture);
                item.SetDefaults();
                DrawAnimation animation = item.GetAnimation();

                if (animation != null)
                {
                    Main.RegisterItemAnimation(item.item.type, animation);
                    ItemLoader.animations.Add(item.item.type);
                }
            }
            foreach (ModNPC npc in npcs.Values)
            {
                NPCLoader.npcTexture[npc.npc.type] = Loader.GetTexture(npc.mod.ModAssembly.GetName().Name + npc.texture);
                npc.SetDefaults();
                if (npc.npc.lifeMax > 32767 || npc.npc.boss)
                {
                    Main.npcLifeBytes[npc.npc.type] = 4;
                }
                else if (npc.npc.lifeMax > 127)
                {
                    Main.npcLifeBytes[npc.npc.type] = 2;
                }
                else
                {
                    Main.npcLifeBytes[npc.npc.type] = 1;
                }
            }
        }
Esempio n. 4
0
        public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
        {
            Texture2D     texture    = mod.GetTexture("Items/CraftingMaterials/" + Name);
            DrawAnimation drawAnim   = Main.itemAnimations[item.type];
            Rectangle     sourceRect = drawAnim.GetFrame(texture);

            spriteBatch.Draw(texture, item.Center - Main.screenPosition + new Vector2(0f, 1f), sourceRect, Color.White, 0f, new Vector2(texture.Width / 2f, item.height / 2f), 1f, SpriteEffects.None, 0);
            return(false);
        }
Esempio n. 5
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            //Main.instance.LoadItem(itemType);
            Texture2D itemTexture = Main.itemTexture[itemType];

            int width  = itemTexture.Width;
            int height = itemTexture.Height;

            Rectangle     itemDrawRectangle;
            DrawAnimation drawAnim = Main.itemAnimations[itemType];

            if (drawAnim != null)
            {
                itemDrawRectangle = drawAnim.GetFrame(itemTexture);
                height            = itemDrawRectangle.Height;
                width             = itemDrawRectangle.Width;
            }
            else
            {
                itemDrawRectangle = itemTexture.Bounds;
            }

            CalculatedStyle dimensions = base.GetInnerDimensions();

            spriteBatch.Draw(backgroundTexture, dimensions.Position(), null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f);

            float drawScale      = 2f;
            float availableWidth = (float)backgroundTexture.Width * scale;

            if (width * drawScale > availableWidth || height * drawScale > availableWidth)
            {
                if (width > height)
                {
                    drawScale = availableWidth / width;
                }
                else
                {
                    drawScale = availableWidth / height;
                }
            }
            Vector2 drawPosition = dimensions.Position();

            drawPosition.X += backgroundTexture.Width * scale / 2f - (float)width * drawScale / 2f;
            drawPosition.Y += backgroundTexture.Height * scale / 2f - (float)height * drawScale / 2f;

            Color color = (item.color != new Color(byte.MinValue, byte.MinValue, byte.MinValue, byte.MinValue)) ? new Color(item.color.R, item.color.G, item.color.B, 255f) : new Color(1f, 1f, 1f);

            spriteBatch.Draw(itemTexture, drawPosition, itemDrawRectangle, color, 0, Vector2.Zero, drawScale, SpriteEffects.None, 0);

            if (IsMouseHovering)
            {
                string name;
                if (itemType <= 0)
                {
                    name = "Nothing";
                }
                else
                {
                    name = Lang.GetItemNameValue(item.type) + (item.modItem != null ? " [" + item.modItem.mod.Name + "]" : "");
                }
                Main.hoverItemName = name;
            }
        }
Esempio n. 6
0
 internal void SetupContent()
 {
     foreach (ModItem item in items.Values)
     {
         Main.itemTexture[item.item.type] = ModLoader.GetTexture(item.texture);
         Main.itemName[item.item.type]    = item.item.name;
         EquipLoader.SetSlot(item.item);
         item.SetDefaults();
         DrawAnimation animation = item.GetAnimation();
         if (animation != null)
         {
             Main.RegisterItemAnimation(item.item.type, animation);
             ItemLoader.animations.Add(item.item.type);
         }
         if (item.flameTexture.Length > 0)
         {
             Main.itemFlameTexture[item.item.type] = ModLoader.GetTexture(item.flameTexture);
         }
     }
     foreach (ModDust dust in dusts.Values)
     {
         dust.SetDefaults();
     }
     foreach (ModTile tile in tiles.Values)
     {
         Main.tileTexture[tile.Type] = ModLoader.GetTexture(tile.texture);
         TileLoader.SetDefaults(tile);
     }
     foreach (GlobalTile globalTile in globalTiles.Values)
     {
         globalTile.SetDefaults();
     }
     foreach (ModWall wall in walls.Values)
     {
         Main.wallTexture[wall.Type] = ModLoader.GetTexture(wall.texture);
         wall.SetDefaults();
     }
     foreach (GlobalWall globalWall in globalWalls.Values)
     {
         globalWall.SetDefaults();
     }
     foreach (ModProjectile projectile in projectiles.Values)
     {
         Main.projectileTexture[projectile.projectile.type] = ModLoader.GetTexture(projectile.texture);
         Main.projFrames[projectile.projectile.type]        = 1;
         projectile.SetDefaults();
         if (projectile.projectile.hostile)
         {
             Main.projHostile[projectile.projectile.type] = true;
         }
         if (projectile.projectile.aiStyle == 7)
         {
             Main.projHook[projectile.projectile.type] = true;
         }
     }
     foreach (ModNPC npc in npcs.Values)
     {
         Main.npcTexture[npc.npc.type] = ModLoader.GetTexture(npc.texture);
         Main.npcName[npc.npc.type]    = npc.npc.name;
         npc.SetDefaults();
         if (npc.npc.lifeMax > 32767 || npc.npc.boss)
         {
             Main.npcLifeBytes[npc.npc.type] = 4;
         }
         else if (npc.npc.lifeMax > 127)
         {
             Main.npcLifeBytes[npc.npc.type] = 2;
         }
         else
         {
             Main.npcLifeBytes[npc.npc.type] = 1;
         }
     }
     foreach (ModMountData modMountData in mountDatas.Values)
     {
         Mount.MountData temp = modMountData.mountData;
         temp.modMountData = modMountData;
         MountLoader.SetupMount(modMountData.mountData);
         Mount.mounts[modMountData.Type] = temp;
     }
     foreach (ModBuff buff in buffs.Values)
     {
         Main.buffTexture[buff.Type] = ModLoader.GetTexture(buff.texture);
         Main.buffName[buff.Type]    = buff.Name;
         buff.SetDefaults();
     }
 }