Esempio n. 1
0
        internal void UpdatePosition(Vector2i position, out int bodySize)
        {
            this.localPosition = position;
            bodySize           = size.Y;

            icon.SetPosition(position + new Vector2i(53 / 2 - icon.dimensions.X / 2, 38 / 2 - icon.dimensions.Y / 2));

            Font priceOne = headerF[0];

            priceOne.SetText(item.GetPrices()[0].ToString());
            priceOne.SetPosition(position + new Vector2i(34 - priceOne.measureString().X, 41 + ((11 / 2) - (priceOne.measureString().Y / 2))));

            switch (item.GetPricesTypes()[0])
            {
            case PriceTypes.CREDITS:
                smallCredit.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                break;

            case PriceTypes.DUCKETS:
                smallDucket.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                break;

            case PriceTypes.DIAMONDS:
                smallDiamond.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                break;

            case PriceTypes.GOTW:
                smallGotw.SetPosition(position + new Vector2i(37, 41 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                break;
            }

            if (item.IsDubbelPriced())
            {
                Font priceTwo = headerF[1];
                priceTwo.SetText("+ " + item.GetPrices()[1].ToString());
                priceTwo.SetPosition(position + new Vector2i(34 - priceTwo.measureString().X, 55 + ((11 / 2) - (priceTwo.measureString().Y / 2))));

                switch (item.GetPricesTypes()[1])
                {
                case PriceTypes.DUCKETS:
                    smallDucket.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                    break;

                case PriceTypes.DIAMONDS:
                    smallDiamond.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                    break;

                case PriceTypes.GOTW:
                    smallGotw.SetPosition(position + new Vector2i(37, 55 + ((11 / 2) - (smallCredit.GetTexture().Height / 2))));
                    break;
                }
            }

            UploadTextures();
        }
Esempio n. 2
0
        internal void DrawItemIsSelected(SpriteBatch spriteBatch, IPageItem item, float depth = 0.92f)
        {
            if (item.CanGift())
            {
                present.Draw(spriteBatch, position + new Vector2i(207, headerHeight + rootContainer.GetHeight() + 5 + 90 + 439), depth);
            }
            else
            {
                presentDisabled.Draw(spriteBatch, position + new Vector2i(207, headerHeight + rootContainer.GetHeight() + 5 + 90 + 439), depth - 0.01f);
                presentDisabledText.Draw(spriteBatch, new Vector2i((presentDisabled.Size.X / 2) - (presentDisabledText.measureString().X / 2), (presentDisabled.Size.Y / 2) - (presentDisabledText.measureString().Y / 2)) + position + new Vector2i(207, headerHeight + rootContainer.GetHeight() + 5 + 90 + 439), depth);
            }
            buy.Draw(spriteBatch, position + new Vector2i(387, headerHeight + rootContainer.GetHeight() + 5 + 90 + 439), depth);

            Amount.Draw(spriteBatch, position + new Vector2i(207, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (Amount.measureString().Y / 2))), depth);
            Price.Draw(spriteBatch, position + new Vector2i(387, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (Price.measureString().Y / 2))), depth);

            amountText.Draw(spriteBatch, position + new Vector2i(207 + Amount.measureString().X + 20, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (amountText.measureString().Y / 2))), depth);

            if (item.IsDubbelPriced())
            {
                priceOneText.Draw(spriteBatch, position + new Vector2i(536 - priceCredits.GetTexture().Width - priceTwoText.measureString().X - 5 - priceOneText.measureString().X, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceOneText.measureString().Y / 2))), depth);
                priceCredits.Draw(spriteBatch, position + new Vector2i(536 - priceCredits.GetTexture().Width - priceTwoText.measureString().X, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceCredits.GetTexture().Height / 2))), depth);


                priceTwoText.Draw(spriteBatch, position + new Vector2i(536 - priceTwoText.measureString().X, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceTwoText.measureString().Y / 2))), depth);
                switch (item.GetPricesTypes()[1])
                {
                case PriceTypes.DUCKETS:
                    priceDuckets.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceDuckets.GetTexture().Height / 2))), depth);
                    break;

                case PriceTypes.DIAMONDS:
                    priceDiamonds.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceDiamonds.GetTexture().Height / 2))), depth);
                    break;

                case PriceTypes.GOTW:
                    priceGotw.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceGotw.GetTexture().Height / 2))), depth);
                    break;

                default:
                    Logger.Error("Unknown price type:", item.GetPricesTypes()[0].ToString());
                    break;
                }
            }
            else
            {
                priceOneText.Draw(spriteBatch, position + new Vector2i(536 - priceOneText.measureString().X, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceOneText.measureString().Y / 2))), depth);

                switch (item.GetPricesTypes()[0])
                {
                case PriceTypes.CREDITS:
                    priceCredits.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceCredits.GetTexture().Height / 2))), depth);
                    break;

                case PriceTypes.DUCKETS:
                    priceDuckets.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceDuckets.GetTexture().Height / 2))), depth);
                    break;

                case PriceTypes.DIAMONDS:
                    priceDiamonds.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceDiamonds.GetTexture().Height / 2))), depth);
                    break;

                case PriceTypes.GOTW:
                    priceGotw.Draw(spriteBatch, position + new Vector2i(538, headerHeight + rootContainer.GetHeight() + 5 + 90 + 406 + ((33 / 2) - (priceGotw.GetTexture().Height / 2))), depth);
                    break;

                default:
                    Logger.Error("Unknown price type:", item.GetPricesTypes()[0].ToString());
                    break;
                }
            }
        }
Esempio n. 3
0
        public CataItemSection(ContentManager content, int pageId, IPageItem item, Vector2i position, Vector2i size, out int bodySize)
        {
            images  = new List <Image>();
            fonts   = new List <Font>();
            headerT = new List <Image>();
            headerF = new List <Font>();

            this.size          = size;
            this.localPosition = position;
            this.item          = item;
            this.pageId        = pageId;
            delay          = new Timer(200);
            delay.Elapsed += Delay_Elapsed;

            #region Section Header
            String classname = String.Empty;
            if (GameScreenManager.Instance.GetFurniTypeBySpriteId(item.GetSpriteId()) != null)
            {
                classname = GameScreenManager.Instance.GetFurniTypeBySpriteId(item.GetSpriteId()).classname;
            }

            Logger.Debug("Generating header for:", classname);

            if (classname != String.Empty)
            {
                if (File.Exists(@"Content/Client/Items/" + classname + "/icon.xnb"))
                {
                    GameScreenManager.Instance.GetCatalogusManager().catalogusImageManager.GetFurniIcon(classname, out icon);
                }
                else
                {
                    icon = new Image(content, @"Client/Items/CantFindTextureTextures/item_small", Vector2.Zero);
                }
            }
            else
            {
                icon = new Image(content, @"Client/Items/CantFindTextureTextures/item_small", Vector2.Zero);
            }
            icon.SetPosition(position + new Vector2i(size.X / 2 - icon.dimensions.X / 2, size.Y / 2 - icon.dimensions.Y / 2));
            headerT.Add(icon);

            smallCredit  = new Image(content, @"Menu/Catalogus/Items/Small/credits", Vector2.Zero);
            smallDiamond = new Image(content, @"Menu/Catalogus/Items/Small/diamonds", Vector2.Zero);
            smallDucket  = new Image(content, @"Menu/Catalogus/Items/Small/duckets", Vector2.Zero);
            smallGotw    = new Image(content, @"Menu/Catalogus/Items/Small/gotw", Vector2.Zero);

            Font priceOne = new Font(content, "Fonts/Catalogus/CurrencyTitle", item.GetPrices()[0].ToString(), new Color(11, 11, 11)); //125, 216, 246
            priceOne.SetPosition(position + new Vector2i(34 - priceOne.measureString().X, 41 + ((11 / 2) - (priceOne.measureString().Y / 2))));
            headerF.Add(priceOne);

            Font priceTwo = new Font(content, "Fonts/Catalogus/CurrencyTitle", "+ 0", new Color(11, 11, 11)); //125, 216, 246
            priceTwo.SetPosition(position + new Vector2i(34 - priceTwo.measureString().X, 55 + ((11 / 2) - (priceOne.measureString().Y / 2))));

            switch (item.GetPricesTypes()[0])
            {
            case PriceTypes.CREDITS:
                headerT.Add(smallCredit);
                break;

            case PriceTypes.DUCKETS:
                headerT.Add(smallDucket);
                break;

            case PriceTypes.DIAMONDS:
                headerT.Add(smallDiamond);
                break;

            case PriceTypes.GOTW:
                headerT.Add(smallGotw);
                break;

            default:
                Logger.Error("Unknown price type:", item.GetPricesTypes()[0].ToString());
                break;
            }

            if (item.IsDubbelPriced())
            {
                headerF.Add(priceTwo);

                switch (item.GetPricesTypes()[1])
                {
                case PriceTypes.DUCKETS:
                    headerT.Add(smallDucket);
                    break;

                case PriceTypes.DIAMONDS:
                    headerT.Add(smallDiamond);
                    break;

                case PriceTypes.GOTW:
                    headerT.Add(smallGotw);
                    break;

                default:
                    Logger.Error("Unknown price type:", item.GetPricesTypes()[1].ToString());
                    break;
                }
            }

            #endregion

            bodySize = size.Y;
        }