示例#1
0
        public Pest(Vector2 pos, HoeDirt hd)
        {
            this.pos = pos;
            this.hd  = hd;

            /*
             * this.adjacentTiles.Add(new Vector2(pos.X - 1, pos.Y));
             * this.adjacentTiles.Add(new Vector2(pos.X - 1, pos.Y - 1));
             * this.adjacentTiles.Add(new Vector2(pos.X - 1, pos.Y + 1));
             * this.adjacentTiles.Add(new Vector2(pos.X, pos.Y - 1));
             * this.adjacentTiles.Add(new Vector2(pos.X, pos.Y + 1));
             * this.adjacentTiles.Add(new Vector2(pos.X + 1, pos.Y));
             * this.adjacentTiles.Add(new Vector2(pos.X + 1, pos.Y - 1));
             * this.adjacentTiles.Add(new Vector2(pos.X + 1, pos.Y + 1));
             */
            this.adjacentTiles = ModComponent.GetAdjacentTiles(pos);

            bfList = new List <PestFly>();
            bfList.Add(new PestFly(pos));
            if (Pests.CheckChance(50))
            {
                bfList.Add(new PestFly(pos));
            }
            if (Pests.CheckChance(50))
            {
                bfList.Add(new PestFly(pos));
            }
            //ModEntry.GetMonitor().Log("pos is " + pos + " and pestfly pos is" + pos * Game1.tileSize);
        }
示例#2
0
        public override void draw(SpriteBatch b)
        {
            if (!applyMode)
            {
                base.draw(b);

                //IClickableMenu.drawTextureBox(b, xPositionOnScreen - 96, yPositionOnScreen - 16, compostInventoryMenu.width + 64, compostInventoryMenu.height*2 + space + nutrition_area_height + space + 64*2, Color.White);
                IClickableMenu.drawTextureBox(b, xPositionOnScreen, yPositionOnScreen, width, height, Color.White);

                compostInventoryMenu.draw(b);
                playerInventoryMenu.draw(b);
                nutritionsComponent.draw(b);
                if (state == State.ready)
                {
                    b.Draw(Game1.mouseCursors, applyButton.bounds, new Rectangle(366, 373, 16, 16), Color.White); //okButton (366, 373, 16, 16)
                }
                else if (state == State.fill && nutritionsComponent.GoodDistribution())
                {
                    b.Draw(Game1.mouseCursors, activateButton.bounds, new Rectangle(175, 379, 190 - 175, 394 - 379), Color.White);
                }

                if (state == State.fill)
                {
                    SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.fillheadline"), Game1.viewport.Width / 2, 64);
                }
            }
            else
            {
                int color = 0; //1: red, 0: green
                foreach (Vector2 vec in Composting.CompostApplied)
                {
                    for (int i = 1; i <= 3; i++)
                    {
                        b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, vec * 64f), new Rectangle(194 + color * 16, 388, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.999f);
                    }

                    foreach (Vector2 v in ModComponent.GetAdjacentTiles(vec))
                    {
                        b.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, (new Vector2(v.X, v.Y)) * 64f), new Rectangle(194 + color * 16, 388, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.999f);
                    }
                }
                b.Draw(Game1.mouseCursors, cancelButton.bounds, new Rectangle(192, 256, 256 - 192, 320 - 256), Color.White);

                SpriteText.drawStringWithScrollCenteredAt(b, ModEntry.GetHelper().Translation.Get("composter.applyheadline"), Game1.viewport.Width / 2, 64);
            }

            drawMouse(b);
            if (heldItem != null)
            {
                heldItem.drawInMenu(b, new Vector2(Game1.getOldMouseX() + 32, Game1.getOldMouseY() - 32), 1);
            }

            if (hoverText.Length > 0)
            {
                drawHoverText(b, hoverText, Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null);
            }
        }
 private void UpdateGreenTiles()
 {
     greenTiles = new List <Vector2>(Composting.CompostAppliedDays.Keys);
     foreach (Vector2 tile in greenTiles.ToList())
     {
         List <Vector2> adjacents = ModComponent.GetAdjacentTiles(tile);
         foreach (Vector2 adj in adjacents)
         {
             if (!greenTiles.Contains(adj))
             {
                 greenTiles.Add(adj);
             }
         }
     }
 }