/// <summary> /// 通过关键字,得到可能有多个的数据 /// </summary> /// <param name="name"></param> /// <returns></returns> public List <OutFood> GetOutFoodsByName(string name) { //之前检索过,从缓存里直接返回 if (m_dicFuzzyChecked.ContainsKey(name)) { return(m_dicFuzzyChecked[name]); } List <OutFood> lst = new List <OutFood>(); foreach (var item in m_dicOutFood) { bool b1 = UnityHelper.FuzzyCheck(name, item.Value.V_Adress); bool b2 = UnityHelper.FuzzyCheck(name, item.Value.V_GoodFoodName); bool b3 = UnityHelper.FuzzyCheck(name, item.Value.V_StoreName); bool b4 = UnityHelper.FuzzyCheck(name, item.Value.V_BadFoodName); bool b5 = UnityHelper.FuzzyCheck(name, item.Value.V_Line); if (b1 || b2 || b3 || b4 || b5) { lst.Add(item.Value); } } if (lst.Count > 0) { if (!m_dicFuzzyChecked.ContainsKey(name)) { m_dicFuzzyChecked.Add(name, lst); } } return(lst); }
/// <summary> /// 根据食物名称 获取所有的该食物信息 /// </summary> /// <param name="foodName"></param> /// <returns></returns> public Dictionary <string, OutFood> GetFoodsByFoodName(string foodName) { Dictionary <string, OutFood> dic = new Dictionary <string, OutFood>(); foreach (var item in m_dicOutFood) { //只检索好吃的 bool chcek = UnityHelper.FuzzyCheck(foodName, item.Value.V_GoodFoodName); if (chcek) { dic.Add(foodName, item.Value); } } return(dic); }