Exemplo n.º 1
0
    public VOServerData getDefaultServer()
    {
        VOWorldServerData worldServerData = m_datas.serverList.serverListData;

        if (worldServerData.areaList == null || worldServerData.areaList.Count <= 0)
        {
            return(null);
        }

        VOServerAreaData areaData = worldServerData.areaList[0];

        if (areaData == null || areaData.serverList == null || areaData.serverList.Count == 0)
        {
            return(null);
        }

        VOServerData serverData = areaData.serverList[0];

        if (serverData == null)
        {
            return(null);
        }

        if (string.IsNullOrEmpty(serverData.url))
        {
            areaData.serverList.RemoveAt(0);
            return(null);
        }

        return(serverData);
    }
Exemplo n.º 2
0
    public void parseSvrListXML(string xmlText)
    {
        Dictionary <int, VOServerData> serverDict = m_datas.serverList.serverDict;

        serverDict.Clear();

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(xmlText);
        XmlElement  xmlRoot     = doc.DocumentElement;
        XmlNodeList xmlAreaList = (xmlRoot.GetElementsByTagName("SvrList")[0] as XmlElement).GetElementsByTagName("Area");

        VOWorldServerData worldServerData = new VOWorldServerData();

        foreach (XmlNode node in xmlAreaList)
        {
            VOServerAreaData areaData = new VOServerAreaData();
            worldServerData.areaList.Add(areaData);

            XmlElement areaElement = (XmlElement)node;
            areaData.name = areaElement.GetAttribute("name");
            XmlNodeList serverNodeList = areaElement.GetElementsByTagName("Server");
            foreach (XmlNode server in serverNodeList)
            {
                VOServerData serverData = new VOServerData();
                areaData.serverList.Add(serverData);

                XmlElement serverElement = (XmlElement)server;
                serverData.tag  = serverElement.GetElementsByTagName("Tag")[0].InnerText;
                serverData.port = (ushort)(System.Int32.Parse(serverElement.GetElementsByTagName("Port")[0].InnerText));
                serverData.zone = System.Int32.Parse(serverElement.GetElementsByTagName("Zone")[0].InnerText);
                serverData.url  = serverElement.GetElementsByTagName("Url")[0].InnerText;

                serverData.status = System.Int32.Parse(serverElement.GetElementsByTagName("Status")[0].InnerText);
                //serverData.r = System.Int32.Parse(serverElement.GetElementsByTagName("R")[0].InnerText);
                //serverData.o = System.Int32.Parse(serverElement.GetElementsByTagName("O")[0].InnerText);
                XmlNodeList rList = serverElement.GetElementsByTagName("R");
                if (rList != null && rList.Count > 0)
                {
                    serverData.r = System.Int32.Parse(rList[0].InnerText);
                }

                if (!serverDict.ContainsKey(serverData.zone))
                {
                    serverDict.Add(serverData.zone, serverData);
                }
            }
            areaData.serverList.Sort(new ServerComparer());
        }
        worldServerData.areaList.Sort(new AreaComparer());
        m_datas.serverList.serverListData = worldServerData;

        EventManager.Send(EventType_Global.SERVERlIST_LOAD_SUCCESS);
    }
Exemplo n.º 3
0
 public void EnterGame(VOServerData server)
 {
     GlobalData.system.serverData = server;
     m_servers.ConnectToGameSvr();
 }
Exemplo n.º 4
0
 public void SetServerInfo(VOServerData serverInfo)
 {
     _serverInfo = serverInfo;
     txServerName.text = _serverInfo.tag;
 }
Exemplo n.º 5
0
 public void EnterGame(VOServerData server)
 {
     m_models.Account.EnterGame(server);
 }
Exemplo n.º 6
0
 private void EnterGame(object data)
 {
     VOServerData server = (VOServerData)data;
     loginCtrl.EnterGame(server);
 }
Exemplo n.º 7
0
 private void updateServer(VOServerData serverData)
 {
     GlobalData.system.serverData = serverData;
     loginUI.SetServerInfo(serverData);
 }
Exemplo n.º 8
0
 private void updateServer(GEvent e)
 {
     VOServerData serverData = e.data as VOServerData;
     updateServer(serverData);
 }
Exemplo n.º 9
0
 private void loadServerListComplete(GEvent e = null)
 {
     VOServerData serverData = serverSelectCtrl.getDefaultServer();
     updateServer(serverData);
 }