Exemplo n.º 1
0
        public MainService(Mode mode, Protocol protocol)
        {
            instance  = this;
            mTcp      = new TcpService(ServerConfig.TCP_PORT);
            mMode     = mode;
            mProtocol = protocol;

            if (mProtocol == Protocol.KCP)
            {
                mKcp = new KcpService(ServerConfig.UDP_PORT);
            }
            else
            {
                mUdp = new UdpService(ServerConfig.UDP_PORT);
            }

            mUserManager   = new UserManager();
            mMatchManager  = new MatchManager();
            mBattleManager = new BattleManager();

            Debug.Log(string.Format("Server start success,mode={0} ip={1} tcp port={2} udp port={3}",
                                    mMode.ToString(), GetLocalIP(), ServerConfig.TCP_PORT, ServerConfig.UDP_PORT), ConsoleColor.Green);
        }
Exemplo n.º 2
0
 public KcpService(int port) : base(port)
 {
     instance = this;
     mPort    = port;
 }