Ejemplo n.º 1
0
        public ServerMapInfo[] GetAllServerMap()
        {
            List <ServerMapInfo> infos  = new List <ServerMapInfo>();
            SqlDataReader        reader = null;

            try
            {
                db.GetReader(ref reader, "SP_Maps_Server_All");
                while (reader.Read())
                {
                    ServerMapInfo info = new ServerMapInfo();
                    info.ServerID  = (int)reader["ServerID"];
                    info.OpenMap   = reader["OpenMap"].ToString();
                    info.IsSpecial = (int)reader["IsSpecial"];
                    infos.Add(info);
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("GetAllMapWeek", e);
                }
            }
            finally
            {
                if (reader != null && !reader.IsClosed)
                {
                    reader.Close();
                }
            }
            return(infos.ToArray());
        }
Ejemplo n.º 2
0
 public static XElement CreateMapServer(ServerMapInfo info)
 {
     return(new XElement("Item", new object[]
     {
         new XAttribute("ServerID", info.ServerID),
         new XAttribute("OpenMap", info.OpenMap),
         new XAttribute("IsSpecial", info.IsSpecial)
     }));
 }
Ejemplo n.º 3
0
        public static bool InitServerMap(Dictionary <int, List <int> > servermap)
        {
            MapBussiness mapBussiness = new MapBussiness();

            ServerMapInfo[] allServerMap = mapBussiness.GetAllServerMap();
            try
            {
                int             item  = 0;
                ServerMapInfo[] array = allServerMap;
                for (int i = 0; i < array.Length; i++)
                {
                    ServerMapInfo serverMapInfo = array[i];
                    if (!servermap.Keys.Contains(serverMapInfo.ServerID))
                    {
                        string[] array2 = serverMapInfo.OpenMap.Split(new char[]
                        {
                            ','
                        });
                        List <int> list   = new List <int>();
                        string[]   array3 = array2;
                        for (int j = 0; j < array3.Length; j++)
                        {
                            string text = array3[j];
                            if (!string.IsNullOrEmpty(text) && int.TryParse(text, out item))
                            {
                                list.Add(item);
                            }
                        }
                        servermap.Add(serverMapInfo.ServerID, list);
                    }
                }
            }
            catch (Exception ex)
            {
                MapMgr.log.Error(ex.ToString());
            }
            return(true);
        }
Ejemplo n.º 4
0
        public static bool InitServerMap(Dictionary <int, List <int> > _serverMap, Dictionary <int, List <int> > simpleMapList, Dictionary <int, List <int> > normalMapList, Dictionary <int, List <int> > difficultMapList, Dictionary <int, List <int> > professionalMapList)
        {
            bool result;

            using (MapBussiness db = new MapBussiness())
            {
                ServerMapInfo[] serverMapList = db.GetAllServerMap();
                try
                {
                    ServerMapInfo[] array = serverMapList;
                    for (int i = 0; i < array.Length; i++)
                    {
                        ServerMapInfo serverMap = array[i];
                        if (!_serverMap.Keys.Contains(serverMap.ServerID))
                        {
                            string[] mapStr = serverMap.OpenMap.Split(new char[]
                            {
                                '|'
                            });
                            if (mapStr.Length < 4)
                            {
                                MapMgr.log.Error(serverMap.ServerID + " 号服务器新手地图加载失败,数据格式错误!");
                            }
                            else
                            {
                                string[] simpleMap = mapStr[0].Split(new char[]
                                {
                                    ','
                                });
                                string[] normalMap = mapStr[1].Split(new char[]
                                {
                                    ','
                                });
                                string[] difficultMap = mapStr[2].Split(new char[]
                                {
                                    ','
                                });
                                string[] professionalMap = mapStr[3].Split(new char[]
                                {
                                    ','
                                });
                                List <int> smaps   = new List <int>();
                                List <int> nmaps   = new List <int>();
                                List <int> dmaps   = new List <int>();
                                List <int> pmaps   = new List <int>();
                                List <int> allmaps = new List <int>();
                                string[]   array2  = simpleMap;
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    string map = array2[j];
                                    if (!string.IsNullOrEmpty(map))
                                    {
                                        int mapId = int.Parse(map);
                                        allmaps.Add(mapId);
                                        smaps.Add(mapId);
                                    }
                                }
                                simpleMapList.Add(serverMap.ServerID, smaps);
                                array2 = normalMap;
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    string map = array2[j];
                                    if (!string.IsNullOrEmpty(map))
                                    {
                                        int mapId = int.Parse(map);
                                        allmaps.Add(mapId);
                                        nmaps.Add(mapId);
                                    }
                                }
                                normalMapList.Add(serverMap.ServerID, nmaps);
                                array2 = difficultMap;
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    string map = array2[j];
                                    if (!string.IsNullOrEmpty(map))
                                    {
                                        int mapId = int.Parse(map);
                                        allmaps.Add(mapId);
                                        dmaps.Add(mapId);
                                    }
                                }
                                difficultMapList.Add(serverMap.ServerID, dmaps);
                                array2 = professionalMap;
                                for (int j = 0; j < array2.Length; j++)
                                {
                                    string map = array2[j];
                                    if (!string.IsNullOrEmpty(map))
                                    {
                                        int mapId = int.Parse(map);
                                        allmaps.Add(mapId);
                                        pmaps.Add(mapId);
                                    }
                                }
                                professionalMapList.Add(serverMap.ServerID, pmaps);
                                _serverMap.Add(serverMap.ServerID, allmaps);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MapMgr.log.Error(ex.ToString());
                    result = false;
                    return(result);
                }
            }
            result = true;
            return(result);
        }