Beispiel #1
0
        public EquipInfoGump(Scripts.Mythik.Mobiles.MythikPlayerMobile from, Item item) : base(from.GetGumpLoc(typeof(EquipInfoGump)).Item1, from.GetGumpLoc(typeof(EquipInfoGump)).Item2)
        {
            from.CloseGump(typeof(EquipInfoGump));
            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            var height = 200;

            if (item != null)
            {
                height = CliLoc.GetPropertiesList(item).Count * 23;
            }
            height += 5;
            this.AddBackground(2, 8, 196, 46 + height, 9270);
            this.AddBackground(9, 17, 182, 29 + height, 9270);
            this.AddAlphaRegion(0, 7, 191, 50 + height);
            this.AddButton(156, 20, 4011, 4012, 1, GumpButtonType.Reply, 0);
            if (item == null)
            {
                return;
            }
            var text       = @"<CENTER><BASEFONT COLOR=GREEN>";
            var textHeader = @"<CENTER><BASEFONT COLOR=WHITE>";
            int y          = 20;
            //if (string.IsNullOrWhiteSpace(item.Name))
            //    AddHtmlLocalized(98, y += 17, 100, 15, item.LabelNumber, false, false);
            // else
            //    AddHtml(98, y += 17, 100, 15, item.Name, false, false);
            int cnt = 0;

            foreach (var prop in CliLoc.GetPropertiesList(item))
            {
                if (cnt == 0 && prop?.Length > 1)
                {
                    AddHtml(18, y += 23, 160, 17, textHeader + char.ToUpper(prop[0]) + prop.Substring(1), false, false);
                }
                else
                {
                    AddHtml(18, y += 23, 160, 17, text + prop, false, false);
                }
                cnt++;

                /*if (prop.Item2 == null)
                 *  AddHtmlLocalized(98, y += 17, 100, 15, prop.Item1, false, false);
                 * else
                 *  AddHtmlLocalized(98, y += 17, 100, 15, prop.Item1, prop.Item2, 0, false, false);*/
            }
            //this.AddHtml(90, 87, 119, 231, text, (bool)false, (bool)false);
        }
        //this calculates all stuff needed to display the gump properly
        protected void DeterminePageLayout()
        {
            _PropsList = CliLoc.GetPropertiesList(_Object);

            if (_PropsList == null)
            {
                _Width  = 100;
                _Height = 100;
                return;
            }

            //determine the required width of the gump based on the object property list contents
            _Width = Math.Max(ARTWORK_WIDTH + 40, CliLoc.PixelsPerCharacter * CliLoc.GetMaxLength(_PropsList) + 50);

            _Height = ARTWORK_HEIGHT + _PropsList.Count * EntryLineSpacing + 60;
        }