public static string Bulid(HttpContext context) { bool value = false; string message = "Fail!"; XElement result = new XElement("Result"); try { using (ProduceBussiness db = new ProduceBussiness()) { NpcInfo[] infos = db.GetAllNPCInfo(); foreach (NpcInfo info in infos) { result.Add(FlashUtils.CreatNPCInfo(info)); } value = true; message = "Success!"; } } catch (Exception ex) { log.Error("Load NPCInfoList is fail!", ex); } result.Add(new XAttribute("value", value)); result.Add(new XAttribute("message", message)); return(csFunction.CreateCompressXml(context, result, "NPCInfoList", true)); }
private static void InitBlood() { using (var a = new ProduceBussiness()) { MaxBlood = a.GetAllNPCInfo().ToList().Find((b) => b.ID == 70002).Blood; Blood = MaxBlood; } }
private static Dictionary <int, NpcInfo> LoadFromDatabase() { Dictionary <int, NpcInfo> dictionary = new Dictionary <int, NpcInfo>(); using (ProduceBussiness produceBussiness = new ProduceBussiness()) { NpcInfo[] allNPCInfo = produceBussiness.GetAllNPCInfo(); NpcInfo[] array = allNPCInfo; for (int i = 0; i < array.Length; i++) { NpcInfo npcInfo = array[i]; if (!dictionary.ContainsKey(npcInfo.ID)) { dictionary.Add(npcInfo.ID, npcInfo); } } } return(dictionary); }
private static Dictionary <int, NpcInfo> LoadFromDatabase() { Dictionary <int, NpcInfo> list = new Dictionary <int, NpcInfo>(); using (ProduceBussiness db = new ProduceBussiness()) { NpcInfo[] infos = db.GetAllNPCInfo(); foreach (NpcInfo info in infos) { if (!list.ContainsKey(info.ID)) { list.Add(info.ID, info); } } } return(list); }
private static Dictionary <int, NpcInfo> LoadFromDatabase() { Dictionary <int, NpcInfo> list = new Dictionary <int, NpcInfo>(); using (ProduceBussiness db = new ProduceBussiness()) { NpcInfo[] infos = db.GetAllNPCInfo(); NpcInfo[] array = infos; for (int i = 0; i < array.Length; i++) { NpcInfo info = array[i]; if (!list.ContainsKey(info.ID)) { list.Add(info.ID, info); } } } return(list); }