Example #1
0
        /// <summary>
        /// Connects to the Photon cloud with the given settings.
        /// </summary>
        /// Since you have to call <see cref="Update"/> manually, it is recommended to create an instance with
        /// <see cref="NewContext"/> instead
        ///
        /// <param name="settings">The settings for connecting</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">If <see cref="settings"/> is null</exception>
        /// <exception cref="ArgumentException">If properties on the settings are missing</exception>
        public IObservable <PhotonMatchmaker> ConnectToCloudWithSettings(PhotonSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrEmpty(settings.AppId))
            {
                throw new ArgumentException($"{nameof(settings.AppId)} on {nameof(PhotonSettings)} must not be null or empty.");
            }
            if (string.IsNullOrEmpty(settings.Region))
            {
                throw new ArgumentException($"{nameof(settings.Region)} on {nameof(PhotonSettings)} must not be null or empty.");
            }
            if (string.IsNullOrEmpty(settings.AppVersion))
            {
                throw new ArgumentException($"{nameof(settings.AppVersion)} on {nameof(PhotonSettings)} must not be null or empty.");
            }

            _photonClient.AppId            = settings.AppId;
            _photonClient.AppVersion       = settings.AppVersion;
            _photonClient.ExpectedProtocol = settings.Protocol;

            _photonSettings = settings;

            return(Connect());
        }
Example #2
0
 public PhotonUpdateContext WithSettings(PhotonSettings settings)
 {
     _settings = settings;
     return(this);
 }
Example #3
0
 internal PhotonUpdateContext(PhotonMatchmaker matchmaker)
 {
     _matchmaker = matchmaker;
     _settings   = new PhotonSettings();
 }