public void GetNpcInfo(int npcId, out string npcName, out BitmapSource headBitmapSource, out string mapName) { var npcInfo = (from target in NpcConfigNode.Descendants("record") where target.Attribute("id").Value == npcId.ToString() select new { name = target.Attribute("name").Value, modelID = target.Attribute("modelID").Value, mapid = target.Attribute("mapid").Value }).FirstOrDefault(); npcName = npcInfo.name; int headId = GetHeadId(Convert.ToInt32(npcInfo.modelID)); headBitmapSource = GetImage(HeadImageset, headId.ToString()); mapName = GetMapName(Convert.ToInt32(npcInfo.mapid)); }
public void GetNpcInfo(int npcId, out string npcName, out BitmapSource headBitmapSource) { //主角特殊处理 if (npcId == 1) { npcName = "主角"; headBitmapSource = GetImage(HeadImageset, "9000"); return; } var npcInfo = (from target in NpcConfigNode.Descendants("record") where target.Attribute("id").Value == npcId.ToString() select new { name = target.Attribute("name").Value, modelID = target.Attribute("modelID").Value, }).FirstOrDefault(); npcName = npcInfo.name; int headId = GetHeadId(Convert.ToInt32(npcInfo.modelID)); headBitmapSource = GetImage(HeadImageset, headId.ToString()); }