Beispiel #1
0
 public GamerEntity(string id)
 {
     _devicedId      = id;
     input           = new GamerInput();
     mPlayerNameList = new Dictionary <int, string>();
     botProxy        = new ConsoleBotProxy();
 }
Beispiel #2
0
 public GamerEntity(string id, IBotProxy bot)
 {
     _devicedId      = id;
     input           = new GamerInput();
     mPlayerNameList = new Dictionary <int, string>();
     botProxy        = bot;
 }
Beispiel #3
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);
        }