Пример #1
0
 public PublishMenu(PublishMenu publishMenu)
     : base(publishMenu)
 {
     eButton = publishMenu.eButton;
     pButton = publishMenu.pButton;
     activeBook = new Book(publishMenu.activeBook);
     playerIndex = -1;
 }
Пример #2
0
        public void AddBook(Book book)
        {
            if (NumberOfBooks + 1 > rows * columns * numOfShelves)
                numOfShelves++;
            if (books.Count > rows * columns * numOfShelves)
                numOfShelves++;

            books.Add(book);
        }
Пример #3
0
        public bool BookSold(Book book)
        {
            if (book.Stock <= 0 && !book.eBook) return false;
            if (!book.eBook)
            {
                book.Stock -= 1;
            }

            salesMade += 1;
            int profit = (int)(book.SalePrice * book.Profitablity);
            book.totalProfit += profit;
            budget += profit;
            return true;
        }
Пример #4
0
 public Book(Book book)
 {
     Owner = book.Owner;
     PrintSize = book.PrintSize;
     Profitablity = book.Profitablity;
     SalePrice = book.SalePrice;
     ageFactor = book.ageFactor;
     publishingCost = book.publishingCost;
     PrintCost = book.PrintCost;
     totalCost = book.totalCost;
     baseTexture = book.baseTexture;
     detailTexture = book.detailTexture;
     genre = book.genre;
 }
Пример #5
0
 public void AddBook(Book book)
 {
     archive.AddBook(book);
 }
Пример #6
0
 public void Open(Book activeBook)
 {
     this.activeBook = activeBook;
     done = false;
 }
Пример #7
0
        private void DrawStats(SpriteBatch spriteBatch, Book book, Vector2 position, SpriteFont font)
        {
            Rectangle source;
            Vector2 offset;

            int totalLength = (int)(Book.Height * scale * 0.9 - 10);
            int lossLength = 0;

            #region No Owner
            if (book.Owner == -1)
            {
                offset = new Vector2(-10, -10);
                totalLength = (int)(book.totalCost / (100 * ((float)Book.maxPublishCost-1)) * totalLength);
                lossLength = totalLength - 2;
                source = new Rectangle(0, 0, 8, totalLength);
                spriteBatch.Draw(outlineTexture, position + new Vector2(Book.Width * scale, Book.Height * scale - totalLength) + offset, source, Color.White);
                source = new Rectangle(0, 0, 6, lossLength);
                spriteBatch.Draw(lossTexture, position + new Vector2(Book.Width * scale + 1, Book.Height * scale - totalLength + 1) + offset, source, Color.White);
            }
            #endregion
            else
            {
                if (book.totalProfit != 0)
                {
                    if (book.totalCost > book.totalProfit)
                    {
                        lossLength = totalLength - (int)((book.totalProfit / (float)(book.totalCost + book.totalProfit)) * totalLength);
                        if (lossLength > totalLength)
                            lossLength = 0;
                    }
                    else
                    {
                        if (book.totalCost == 0) lossLength = 0;
                        else if (book.totalCost == book.totalProfit) lossLength = (int)(totalLength * 0.5f);
                        else
                        {
                            lossLength = (int)((book.totalCost / (float)(book.totalCost + book.totalProfit)) * totalLength);
                        }
                    }
                    lossLength -= 2;
                }
                else lossLength = totalLength - 2;

                offset = new Vector2(-10, 8);
                source = new Rectangle(0, 0, 8, totalLength);
                spriteBatch.Draw(outlineTexture, position + new Vector2(Book.Width * scale, 0) + offset, source, Color.White);
                source = new Rectangle(0, 0, 6, totalLength - 2);
                spriteBatch.Draw(profitTexture, position + new Vector2(Book.Width * scale + 1, 1) + offset, source, Color.White);
                source = new Rectangle(0, 0, 6, lossLength);
                spriteBatch.Draw(lossTexture, position + new Vector2(Book.Width * scale + 1, 1) + offset, source, Color.White);

                if (!book.eBook)
                {
                    Color color = Color.White;
                    if (book.Stock <= 0) color = Color.Black;
                    spriteBatch.DrawString(font, book.Stock.ToString(), position + new Vector2(10, Book.Height - 40) * scale, color);
                }
            }
            //spriteBatch.DrawString(font, book.GetGenre().ToString(), position + new Vector2(Book.Width / 2, Book.Height / 2) * scale, Color.White);
        }