Ejemplo n.º 1
0
        public void Start()
        {
            //強連線流程
            Uri gamingUrl = new Uri(urls.GamingUrl);

            var initGameResult = Init.Rudp(gamingUrl);

            _Connect           = initGameResult.Item1;
            _systemHandler     = initGameResult.Item2;
            _lobbyHandler      = initGameResult.Item3;
            _toArenaHandler    = initGameResult.Item4;
            _gamingHandler     = initGameResult.Item5;
            _gamePacketHandler = initGameResult.Item6;
            _gameRoomHandler   = initGameResult.Item7;
            _systemHandler.ConnectToServer();
            _systemHandler.Connect   += ConnectedToServer;
            _lobbyHandler.RecvPacket += ReceiveLobbyPacket;
            _toArenaHandler.SetCallBack(this);
            _gamePacketHandler.Receive = ReceiveGamePacket;

            this.onReceiveEnterArena  += ReceiveToArena;
            this.onDeleteArenaPlayers += ReceiveDeletePlayer;

            NetworkService.RegisteredToNetworkTask(_Connect.Service);
            Logic.RegisteredToNetworkTask(Update);
        }
Ejemplo n.º 2
0
        public void Start(string agentServer, IBotProxy botProxy)
        {
            this.botProxy = botProxy;
            //基本的 Http 初始流程
            var initResult = Init.Http(agentServer, _devicedId);

            urls        = initResult.Item1;
            accessToken = initResult.Item2;
            account     = initResult.Item3;

            //強連線流程
            Uri gamingUrl = new Uri(urls.GamingUrl);

            var initGameResult = Init.Rudp(gamingUrl);

            _Connect           = initGameResult.Item1;
            _systemHandler     = initGameResult.Item2;
            _lobbyHandler      = initGameResult.Item3;
            _toArenaHandler    = initGameResult.Item4;
            _gamingHandler     = initGameResult.Item5;
            _gamePacketHandler = initGameResult.Item6;
            _gameRoomHandler   = initGameResult.Item7;
            _systemHandler.ConnectToServer();
            _systemHandler.Connect   += ConnectedToServer;
            _lobbyHandler.RecvPacket += ReceiveLobbyPacket;
            _toArenaHandler.SetCallBack(this);
            _gamePacketHandler.Receive = ReceiveGamePacket;

            this.onReceiveEnterArena  += ReceiveToArena;
            this.onDeleteArenaPlayers += ReceiveDeletePlayer;

            NetworkService.RegisteredToNetworkTask(_Connect.Service);
            Logic.RegisteredToNetworkTask(Update);
        }