Example #1
0
    protected virtual void TryConnect()
    {
        // First, we check that we aren't already connected to a client or a server...
        if (!UFE.multiplayerAPI.IsConnected() && !this._connecting)
        {
            MultiplayerAPI.MatchInformation match = null;

            // After that, check if we have found one match with at least one player which isn't already full...
            while (match == null && this._foundServers.Count > 0)
            {
                match = this._foundServers[0];
                this._foundServers.RemoveAt(0);
            }


            if (match != null)
            {
                // In that case, try connecting to that match
                this._connecting = true;

                UFE.multiplayerAPI.OnJoined    += this.OnJoined;
                UFE.multiplayerAPI.OnJoinError += this.OnJoinError;
                UFE.JoinGame(match);
            }
            else
            {
                // Otherwise, return a net a new match
                this.OnLanGameNotFound();
            }
        }
    }
Example #2
0
 public virtual void JoinGame(Text textUI)
 {
     UFE.JoinGame(textUI.text);
 }
Example #3
0
 public virtual void JoinGame(Text textUI)
 {
     this.StopSearchingLanGames();
     UFE.JoinGame(new MultiplayerAPI.MatchInformation(textUI.text, UFE.config.networkOptions.port));
 }