Ejemplo n.º 1
0
 private void ValidateItemFilter()
 {
     if (itemNameFilter.currentString.Length > 0)
     {
         bool found = false;
         foreach (var itemSlot in itemSlots)
         {
             if (itemSlot.item.Name.IndexOf(itemNameFilter.currentString, StringComparison.OrdinalIgnoreCase) != -1)
             {
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             itemNameFilter.SetText(itemNameFilter.currentString.Substring(0, itemNameFilter.currentString.Length - 1));
         }
     }
     updateNeeded = true;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks text to verify input is in
 /// </summary>
 private void ValidateItemFilter()
 {
     if (itemNameFilter.currentString.Length > 0)
     {
         bool found = false;
         for (int i = 0; i < Recipe.numRecipes; i++)
         {
             Recipe recipe = Main.recipe[i];
             if (recipe.createItem.Name.ToLower().IndexOf(itemNameFilter.currentString, StringComparison.OrdinalIgnoreCase) != -1)
             {
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             itemNameFilter.SetText(itemNameFilter.currentString.Substring(0, itemNameFilter.currentString.Length - 1));
         }
     }
     updateNeeded = true;
 }
Ejemplo n.º 3
0
 private void ValidateNPCFilter()
 {
     if (npcNameFilter.currentString.Length > 0)
     {
         bool found = false;
         for (int type = 1; type < NPCLoader.NPCCount; type++)
         {
             string name = Lang.GetNPCNameValue(type);
             if (name.IndexOf(npcNameFilter.currentString, StringComparison.OrdinalIgnoreCase) != -1)
             {
                 found = true;
                 break;
             }
         }
         if (!found)
         {
             npcNameFilter.SetText(npcNameFilter.currentString.Substring(0, npcNameFilter.currentString.Length - 1));
         }
     }
     updateNeeded = true;
 }