示例#1
0
        private static void DrawInteractions(VirtualItemDecorator item, float width, float height)
        {
            Rect buttonLocation = new Rect(0, height - width * 0.175f, width * 0.2f, width * 0.175f);

            if (item.IsPurchasable())
            {
                if (GUI.Button(buttonLocation, (item as PurchasableVirtualItemDecorator).Price + string.Empty))
                    item.Buy();
            }

            buttonLocation.x += buttonLocation.width + 10;
            if (item.IsEquippable() && GUI.Button(buttonLocation, "Equip"))
            {
                item.Equip();
            }

            buttonLocation.x += buttonLocation.width + 10;
            if (item.IsUpgradable() && GUI.Button(buttonLocation, "Upgr"))
            {
                item.Upgrade();
            }
        }
示例#2
0
        /// <summary>
        /// Dibuja en pantalla la informacion de un item
        /// </summary>
        /// <param name="item">Item a dibujar</param>
        /// <param name="width">Ancho a ocupar</param>
        /// <param name="height">Alto a ocupar</param>
        private static void DrawItem(VirtualItemDecorator item, float width, float height)
        {
            Rect rect = new Rect(0, 0, width, height);
            GUI.Label(rect, "Name: " + item.Name);

            rect.y += 25;
            GUI.Label(rect, "Desc: " + item.Description);

            rect.y += 25;
            GUI.Label(rect, "Balance: " + item.Balance);

            if (item.IsEquippable())
            {
                rect.y += 25;
                GUI.Label(rect, "Equipped: " + (item as EquippableVGDecorator).Equipped);
            }

            if (item.IsUpgradable())
            {
                rect.y += 25;
                GUI.Label(rect, "Lvl: " + (item as VirtualGoodDecorator).UpgradeLevel);
            }
        }