protected override void Initialize(UIAdvPanel WindowPanel)
        {
            WindowPanel.MainTexture = ServerSideCharacter2.ModTexturesTable["AdvInvBack1"];
            WindowPanel.Left.Set(Main.screenWidth / 2 - WINDOW_WIDTH / 2, 0f);
            WindowPanel.Top.Set(Main.screenHeight / 2 - WINDOW_HEIGHT / 2, 0f);
            WindowPanel.Width.Set(WINDOW_WIDTH, 0f);
            WindowPanel.Height.Set(WINDOW_HEIGHT, 0f);
            WindowPanel.Color = Color.White * 0.8f;

            _itemPanel = new UIPanel {
                BackgroundColor = Color.DarkBlue * 0.75f
            };
            _itemPanel.Top.Set(ITEM_BROWSER_OFFSETY, 0f);
            _itemPanel.Left.Set(ITEM_BROWSER_OFFSETX, 0f);
            _itemPanel.Width.Set(-2 * ITEM_BROWSER_OFFSETX, 1f);
            _itemPanel.Height.Set(-20 - ITEM_BROWSER_OFFSETY, 1f);

            _npcGrid = new UIAdvGrid();
            _npcGrid.Width.Set(-25f, 1f);
            _npcGrid.Height.Set(0f, 1f);
            _npcGrid.ListPadding = 5f;
            _itemPanel.Append(_npcGrid);


            uISlots = new List <UISimpleSlot>();
            for (var i = 1; i < Main.npcTexture.Length; i++)
            {
                var simpleslot = new UISimpleSlot(i);

                simpleslot.Width.Set(40f, 0f);
                simpleslot.Height.Set(40f, 0f);
                uISlots.Add(simpleslot);
            }
            _npcGrid.AddRange(uISlots);

            // ScrollBar设定
            var uiscrollbar = new UIAdvScrollBar();

            uiscrollbar.SetView(100f, 1000f);
            uiscrollbar.Height.Set(0f, 1f);
            uiscrollbar.HAlign = 1f;
            _itemPanel.Append(uiscrollbar);
            _npcGrid.SetScrollbar(uiscrollbar);

            WindowPanel.Append(_itemPanel);

            _searchTextBox = new UIAdvTextBox();
            _searchTextBox.Left.Set(-ITEM_BROWSER_OFFSETX - SEARCH_BAR_WIDTH, 1f);
            _searchTextBox.Top.Set(50, 0f);
            _searchTextBox.Width.Set(SEARCH_BAR_WIDTH, 0f);
            _searchTextBox.Height.Set(SEARCH_BAR_HEIGHT, 0f);
            _searchTextBox.OnTextChange += _searchTextBox_OnTextChange;
            WindowPanel.Append(_searchTextBox);
        }
        private void _searchTextBox_OnTextChange(string oldString, string curString)
        {
            curString = curString.Trim(' ');
            if (curString == "")
            {
                _itemGrid.Clear();
                _itemGrid.AddRange(uISlots);
                return;
            }
            var kmp = new KMP(curString.ToLower());

            _itemGrid.Clear();
            var slots = new List <UISimpleSlot>();

            for (var i = 1; i < Main.itemTexture.Length; i++)
            {
                if (kmp.Match(uISlots[i - 1].Item.Name.ToLower()))
                {
                    slots.Add(uISlots[i - 1]);
                }
            }
            _itemGrid.AddRange(slots);
        }
        private void _searchTextBox_OnTextChange(string oldString, string curString)
        {
            curString = curString.Trim(' ');
            if (curString == "")
            {
                _npcGrid.Clear();
                _npcGrid.AddRange(uISlots);
                return;
            }
            var kmp = new KMP(curString.ToLower());

            _npcGrid.Clear();
            var slots = new List <UISimpleSlot>();

            for (var i = 0; i < uISlots.Count; i++)
            {
                if (kmp.Match(Lang.GetNPCNameValue(uISlots[i].Npc.netID).ToLower()))
                {
                    slots.Add(uISlots[i]);
                }
            }
            _npcGrid.AddRange(slots);
        }