Ejemplo n.º 1
0
        private void textbox_KeyPressed(object sender, char key)
        {
            if (this.textbox.Text.Length <= 0)
            {
                this.npcView.activeSlots = this.npcView.selectedCategory;
                this.npcView.ReorderSlots();
                return;
            }
            List <int> list = new List <int>();

            int[] category = this.npcView.selectedCategory;
            for (int i = 0; i < category.Length; i++)
            {
                int     num  = category[i];
                NPCSlot slot = this.npcView.allNPCSlot[num];
                if (slot.displayName.ToLower().IndexOf(this.textbox.Text.ToLower(), StringComparison.Ordinal) != -1)
                {
                    list.Add(num);
                }
            }
            if (list.Count > 0)
            {
                this.npcView.activeSlots = list.ToArray();
                this.npcView.ReorderSlots();
                return;
            }
            this.textbox.Text = this.textbox.Text.Substring(0, this.textbox.Text.Length - 1);
        }
Ejemplo n.º 2
0
        public NPCView()
        {
            Width      = (slotSize + slotSpace) * slotColumns + slotSpace + 20f;
            Height     = 200f;
            allNPCSlot = new NPCSlot[TextureAssets.Npc.Length + negativeSlots];
            for (int i = 0; i < allNPCSlot.Length; i++)
            {
                int type = i >= allNPCSlot.Length - negativeSlots ? -(i - allNPCSlot.Length + negativeSlots + 1) : i;
                allNPCSlot[i] = new NPCSlot(type, i);
            }

            //	this.allNPCSlot = (from s in this.allNPCSlot
            //					   select s).ToArray<NPCSlot>();
        }
Ejemplo n.º 3
0
 public void ReorderSlots()
 {
     base.ScrollPosition = 0f;
     base.ClearContent();
     for (int i = 0; i < this.activeSlots.Length; i++)
     {
         int     num  = i;
         NPCSlot slot = this.allNPCSlot[this.activeSlots[num]];
         int     num2 = i % this.slotColumns;
         int     num3 = i / this.slotColumns;
         float   x    = (float)this.slotSpace + (float)num2 * (slot.Width + (float)this.slotSpace);
         float   y    = (float)this.slotSpace + (float)num3 * (slot.Height + (float)this.slotSpace);
         slot.Position = new Vector2(x, y);
         slot.Offset   = Vector2.Zero;
         this.AddChild(slot);
     }
     base.ContentHeight = base.GetLastChild().Y + base.GetLastChild().Height + this.spacing;
 }
Ejemplo n.º 4
0
        public void ReorderSlots()
        {
            ScrollPosition = 0f;
            ClearContent();
            for (int i = 0; i < activeSlots.Length; i++)
            {
                int     num  = i;
                NPCSlot slot = allNPCSlot[activeSlots[num]];
                int     num2 = i % slotColumns;
                int     num3 = i / slotColumns;
                float   x    = slotSpace + num2 * (slot.Width + slotSpace);
                float   y    = slotSpace + num3 * (slot.Height + slotSpace);
                slot.Position = new Vector2(x, y);
                slot.Offset   = Vector2.Zero;
                AddChild(slot);
            }

            ContentHeight = GetLastChild().Y + GetLastChild().Height + spacing;
        }