public override void OnEvent(EventData photonEvent)
        {
            switch (photonEvent.Code)
            {
            case EventCode.AppStats:

                break;

            case EventCode.LobbyStats:
                this.RoomInfoList.Keys.ToList().ForEach(roomName =>
                {
                    var roomProp    = this.RoomInfoList[roomName] as RoomInfo;
                    var playerCount = roomProp.PlayerCount;
                    var maxPlayers  = roomProp.MaxPlayers;
                    var isOpen      = roomProp.IsOpen;

                    if (isOpen && playerCount < maxPlayers)
                    {
                        RoomShared roomShared = new RoomShared();
                        for (int i = playerCount, clientId = 0; i < maxPlayers; ++i, ++clientId)
                        {
                            RobotClient client = new RobotClient(true, clientId, roomShared);
                            client.OpJoinRoom(roomName);
                        }
                    }
                });
                break;

            case EventCode.GameListUpdate:
                // todo: Enter a room automatically.
                if (photonEvent.Parameters[ParameterCode.GameList] is Hashtable)
                {
                    var hashtable = photonEvent.Parameters[ParameterCode.GameList] as Hashtable;

                    this.RoomInfoList.Keys.ToList().ForEach(roomName =>
                    {
                        var roomNames = hashtable.Keys.OfType <string>();
                        if (roomNames.Count() > 0 && roomNames.Contains(roomName))
                        {
                            var roomProp    = hashtable[roomName] as Hashtable;
                            var playerCount = Convert.ToInt32(roomProp[GamePropertyKey.PlayerCount]);
                            var maxPlayers  = Convert.ToInt32(roomProp[GamePropertyKey.MaxPlayers]);
                            var isOpen      = Convert.ToBoolean(roomProp[GamePropertyKey.IsOpen]);

                            if (isOpen && playerCount < maxPlayers)
                            {
                                RoomShared roomShared = new RoomShared();
                                for (int i = playerCount, clientId = 0; i < maxPlayers; ++i, ++clientId)
                                {
                                    RobotClient client = new RobotClient(true, clientId, roomShared);

                                    client.OnStateChangeAction += (ClientState obj) =>
                                    {
                                        if (obj == ClientState.JoinedLobby)
                                        {
                                            client.OpJoinRoom(roomName);
                                        }
                                    };
                                }
                            }
                        }
                    });
                }

                break;
            }
            base.OnEvent(photonEvent);
        }