Пример #1
0
        protected Client(string gamePlugin, string gameVersion, IMessageSerializationHandler messageSerializationHandler)
        {
            ClientState = ClientState.Disconnected;

            _clientGameObject    = new GameObject("Playgen.PhotonClient", typeof(DontDestroyOnLoad));
            _photonClientWrapper = _clientGameObject.AddComponent <PhotonClientWrapper>();
            _photonClientWrapper.Initialize(gameVersion, gamePlugin);

            _messageSerializationHandler = messageSerializationHandler;

            _photonClientWrapper.ConnectedEvent    += OnConnected;
            _photonClientWrapper.DisconnectedEvent += OnDisconnected;
            _photonClientWrapper.JoinedRoomEvent   += OnJoinedRoom;
            _photonClientWrapper.LeftRoomEvent     += OnLeftRoom;
            _photonClientWrapper.ExceptionEvent    += OnException;
        }
Пример #2
0
        public ClientRoom(PhotonClientWrapper photonClientWrapper,
                          IMessageSerializationHandler messageSerializationHandler,
                          Action <ClientRoom <TPlayer> > initializedCallback)
        {
            _photonClientWrapper = photonClientWrapper;
            _initializedCallback = initializedCallback;

            Messenger = new Messenger(messageSerializationHandler, photonClientWrapper);
            Logger.SetMessenger(Messenger);
            Logger.PlayerPhotonId = photonClientWrapper.Player.ID;
            Messenger.Subscribe((int)Channels.Players, ProcessPlayersMessage);

            //if (VoiceSettings.Instance.Enabled)
            //{
            _voiceClient = new VoiceClient();
            //}

            Players = new List <TPlayer>();

            _photonClientWrapper.EventRecievedEvent += OnRecievedEvent;

            Logger.LogDebug("Created ClientRoom");
        }
Пример #3
0
 protected abstract TClientRoom CreateClientRoom(PhotonClientWrapper photonClientWrapper,
                                                 IMessageSerializationHandler messageSerializationHandler,
                                                 Action <ClientRoom <TPlayer> > initializedCallback);