12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class ServerData
- {
- public string serverName;//服务器的名字
- public string ipStr;//服务器地址
- public int port;//端口号
- public ServerType serverType;// 学校自己的服务器 还是
- }
- public enum ServerType
- {
- Public,
- Private,
- }
- public class GameServerInfo
- {
- private static GameServerInfo _instance;
- public static GameServerInfo Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new GameServerInfo();
- }
- return _instance;
- }
- }
- public ServerData CurServer;
- public List<ServerData> servers;
- private GameServerInfo()
- {
- servers = new List<ServerData>();
- }
- //初始化服务器列表
- public void InitServerInfo()
- {
- servers.Clear();//先清空原有的服务器数据
- }
- public void AddServer(string serverName, string ipStr, int port, ServerType serverType)
- {
- ServerData data = new ServerData();
- data.serverName = serverName;
- data.serverType = serverType;
- data.ipStr = ipStr;
- data.port = port;
- servers.Add(data);
- }
- }
|