Esempio n. 1
0
            public RecordButton(int pos, bool latest, Record rec)
            {
                _rec = rec;

                if (latest)
                {
                    _flare = new Flare(6, 24);
                    _flare.AngularSpeed = 90;
                    _flare.Color(rec.win ? FlareWin : FlareLose);
                    AddToBack(_flare);
                }

                _position.Text((pos + 1).ToString());
                _position.Measure();

                _desc.Text(rec.info);
                _desc.Measure();

                if (rec.win)
                {
                    _shield.View(ItemSpriteSheet.AMULET, null);
                    _position.Hardlight(TextWin);
                    _desc.Hardlight(TextWin);
                }
                else
                {
                    _position.Hardlight(TextLose);
                    _desc.Hardlight(TextLose);
                }

                _classIcon.Copy(IconsExtensions.Get(rec.heroClass));
            }
Esempio n. 2
0
        public virtual Item PickUp()
        {
            var item = Items[0];

            Items.RemoveAt(0);
            if (Items.Count == 0)
            {
                Destroy();
            }
            else
            if (Sprite != null)
            {
                Sprite.View(Image(), Glowing());
            }

            return(item);
        }
Esempio n. 3
0
 public ListItem(Type itemType)
 {
     try
     {
         _item       = (Item)Activator.CreateInstance(itemType);
         _identified = _item.Identified;
         if (_identified)
         {
             _sprite.View(_item.image, null);
             _label.Text(_item.Name);
         }
         else
         {
             _sprite.View(127, null);
             _label.Text(_item.TrueName());
             _label.Hardlight(0xCCCCCC);
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 4
0
        public virtual void Item(Item item)
        {
            if (item == null)
            {
                Active       = false;
                Icon.Visible = TopLeft.Visible = TopRight.Visible = BottomRight.Visible = false;
            }
            else
            {
                Active       = true;
                Icon.Visible = TopLeft.Visible = TopRight.Visible = BottomRight.Visible = true;

                Icon.View(item.Image, item.Glowing());

                TopLeft.Text(item.Status());

                var isArmor  = item is Armor;
                var isWeapon = item is Weapon;
                if (isArmor || isWeapon)
                {
                    if (item.levelKnown || (isWeapon && !(item is MeleeWeapon)))
                    {
                        var str = isArmor ? ((Armor)item).Str : ((Weapon)item).Str;
                        TopRight.Text(Utils.Format(TxtStrength, str));
                        if (str > Dungeon.Hero.STR)
                        {
                            TopRight.Hardlight(Degraded);
                        }
                        else
                        {
                            TopRight.ResetColor();
                        }
                    }
                    else
                    {
                        TopRight.Text(Utils.Format(TxtTypicalStr,
                                                   isArmor ? ((Armor)item).TypicalStr() : ((MeleeWeapon)item).TypicalStr()));
                        TopRight.Hardlight(Warning);
                    }

                    TopRight.Measure();
                }
                else
                {
                    TopRight.Text(null);
                }

                var level = item.VisiblyUpgraded();

                if (level != 0 || (item.cursed && item.cursedKnown))
                {
                    BottomRight.Text(item.levelKnown ? Utils.Format(TxtLevel, level) : "");
                    BottomRight.Measure();
                    BottomRight.Hardlight(level > 0 ? Upgraded : Degraded);
                }
                else
                {
                    BottomRight.Text(null);
                }

                Layout();
            }
        }