Ejemplo n.º 1
0
        public bool GetGuanZhanPos(int mapCode, ref int posX, ref int posY)
        {
            ChuanSongItem item = null;

            lock (this.Mutex)
            {
                foreach (ChuanSongItem v in this.ChuanSongDict.Values)
                {
                    if (v.MapCode == mapCode)
                    {
                        item = v;
                        if (v.PosX == posX && v.PosY == posY)
                        {
                            return(true);
                        }
                    }
                }
                if (null != item)
                {
                    posX = item.PosX;
                    posY = item.PosY;
                }
            }
            return(item != null);
        }
Ejemplo n.º 2
0
 public void LoadVideoXml()
 {
     lock (this.Mutex)
     {
         this.VideoList.Clear();
         string   fileName = Global.GameResPath("Config/Viedo.xml");
         XElement xml      = ConfigHelper.Load(fileName);
         if (null == xml)
         {
             LogManager.WriteLog(LogTypes.Fatal, "未找到配置文件:" + fileName, null, true);
         }
         else
         {
             IEnumerable <XElement> xmlItems = xml.Elements();
             foreach (XElement xmlItem in xmlItems)
             {
                 VideoData data = new VideoData();
                 data.TalkID         = Convert.ToInt32(Global.GetSafeAttributeStr(xmlItem, "TalkID"));
                 data.MinZhuanSheng  = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MinZhuanSheng"));
                 data.MinLevel       = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MinLevel"));
                 data.MaxZhuanSheng  = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MaxZhuanSheng"));
                 data.MaxLevel       = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MaxLevel"));
                 data.MinVip         = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MinVip"));
                 data.MaxVip         = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "MaxVip"));
                 data.PassWord       = Global.GetSafeAttributeStr(xmlItem, "PassWord");
                 data.ZhuanshengSift = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "ZhuanshengSift"));
                 data.LevelSift      = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "LevelSift"));
                 data.VIPSift        = (int)Convert.ToByte(Global.GetSafeAttributeStr(xmlItem, "VIPSift"));
                 this.VideoList.Add(data);
             }
             this.VideoList = (from x in this.VideoList
                               orderby x.MinVip descending
                               select x).ToList <VideoData>();
         }
         this.VideoGMDict.Clear();
         fileName = Global.IsolateResPath("Config/GuanZhanList.xml");
         xml      = ConfigHelper.Load(fileName);
         if (null != xml)
         {
             foreach (XElement xmlItem in xml.Elements())
             {
                 this.VideoGMDict[Global.GetSafeAttributeStr(xmlItem, "UID")] = (int)ConfigHelper.GetElementAttributeValueLong(xmlItem, "ZoneID", 0L);
             }
         }
         else
         {
             LogManager.WriteLog(LogTypes.Fatal, "未找到配置文件:" + fileName, null, true);
         }
         this.ChuanSongDict.Clear();
         fileName = Global.IsolateResPath("Config/GuanZhanTransfer.xml");
         xml      = ConfigHelper.Load(fileName);
         if (null != xml)
         {
             foreach (XElement xmlItem in xml.Elements())
             {
                 ChuanSongItem data2 = new ChuanSongItem();
                 data2.ID      = (int)Global.GetSafeAttributeLong(xmlItem, "ID");
                 data2.MapCode = (int)Global.GetSafeAttributeLong(xmlItem, "MapCode");
                 List <int> arr = Global.StringToIntList(Global.GetSafeAttributeStr(xmlItem, "Site"), '|');
                 data2.PosX = arr[0];
                 data2.PosY = arr[1];
                 this.ChuanSongDict.Add(data2.ID, data2);
             }
         }
         else
         {
             LogManager.WriteLog(LogTypes.Fatal, "未找到配置文件:" + fileName, null, true);
         }
     }
 }