상속: Object
예제 #1
0
    private void JoinServer(HostData hostData)
    {
        Network.Connect (hostData);

        recoClient = GameObject.Find ("VoiceTranslation");;
        recoClient.GetComponentInChildren<UDP_RecoServer> ().StartServer ();
    }
 private void JoinServer(HostData hostData)
 {
     #if UNITY_ANDROID
     //AndroidJNI.CallIntMethod ();
     #endif
     Network.Connect (hostData);
 }
예제 #3
0
	public void RetrievePing(HostData host)
	{
		testing = true;
		Network.Connect(host);
		PingLabel.text = "--";
		ip = string.Concat(host.ip);
	}
예제 #4
0
    private void JoinServer(HostData hostData)
    {
        Debug.Log("Joining to server: "+hostData.gameName+" | "+hostData.ip[0]+":"+hostData.port.ToString());

        clientState=ClientState.ClientJoin;
        Network.Connect(hostData);
    }
예제 #5
0
 void OnListItemUnselected(ComboBox.ComboItem unselectedItem)
 {
     if (selectedHost == (HostData)unselectedItem.value)
     {
         selectedHost = null;
     }
 }
예제 #6
0
        private void CreateClientButton(Type type, HostData hostData, int carNumber, float x, float y)
        {
            Texture2D texture;
            if (carNumber == 0)
            {
                texture = type == typeof(Driver) ? _textureDriverRed : _textureThrottlerRed;
            }
            else
            {
                texture = type == typeof(Driver) ? _textureDriverBlue : _textureThrottlerBlue;
            }

            if (DrawTextureButton(new Rect(x, y, ButtonWidth, ButtonHeight), texture))
            {
                MainScript.SelfType = MainScript.PlayerType.Client;
                MainScript.SelfCar = new Car(carNumber);

                //Based on: http://stackoverflow.com/a/755
                MainScript.SelfPlayer = new Player(MainScript.SelfCar, (IPlayerRole)Activator.CreateInstance(type));
                MainScript.SelfPlayer.Role.Initialize();

                MainScript.Client.ChooseJobWhenConnected(type.Name, carNumber);
                if (hostData == null)
                {
                    Network.Connect(GameData.IP, GameData.PORT);
                }
                else
                {
                    Network.Connect(hostData);
                }
                NetworkController.Connected = true;
            }
        }
예제 #7
0
    public void SetServer(HostData data)
    {
        info = data;

        label.text = data.gameName;
        comment.text = data.comment;
        comment.text += data.connectedPlayers + "/" + data.playerLimit;
    }
예제 #8
0
 void ConnectToServer(HostData hostData)
 {
     var err = Network.Connect(hostData);
     if (err != NetworkConnectionError.NoError) {
         Debug.Log(string.Format("error initializing server {0}", err));
         return;
     }
 }
예제 #9
0
파일: MultiPlayer.cs 프로젝트: MizzKii/WarB
	public void Join(HostData host) {
		if(!host.passwordProtected)
			Network.Connect(host);
		else{
			Protected = true;
			select = host;
		}
	}
예제 #10
0
 void HandleOnServerSelected(HostData selectedServer)
 {
     //When the "Connect" button is pressed in the MasterServerInterface behavior, this is called
     if(selectedServer != null) {
         //Join and hide the host list interface
         JoinServer(selectedServer);
     }
 }
예제 #11
0
 private void JoinServer(HostData hostData)
 {
     GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
     for (int i = 0; i<players.Length; i++)
     {
         Destroy(players[i]);
     }
     Network.Connect(hostData);
 }
예제 #12
0
 public static string getDebugName(HostData host)
 {
     string hostName = host.gameType + " " + host.gameName + " " + host.comment + " [" + host.guid + "]";
     string players = "(" + host.connectedPlayers + "/" + host.playerLimit + ")";
     string addresses = "{" + string.Join(":", host.ip) + ":" + host.port + "}";
     string nat = "N:" + host.useNat;
     string password = "******" + host.passwordProtected;
     return string.Join(" ", new string[] {hostName, players, addresses, nat, password});
 }
예제 #13
0
    private void JoinServer(HostData hostData)
    {
        hostList = null;

        if (selectingIP) {
            Network.Connect (hostData.ip [0], hostData.port);
        } else {
            Network.Connect(hostData);
        }
    }
예제 #14
0
 public MyHostData Start(HostData hd)
 {
     this.hd = hd;
     foreach (var ip in hd.ip)
     {
         var p = new Ping(ip);
         pp.Add(p);
     }
     return this;
 }
예제 #15
0
    public static void Connect(HostData host)
    {
        CurrentPlayerIsHost = false;

        NetworkConnectionError code =  Network.Connect(host);

        if(code == NetworkConnectionError.NoError)
        {
            Connected();
        }
    }
예제 #16
0
 void ConnectTo(HostData hostData)
 {
     // Set NAT functionality based on the host information
     //		Network.useNat = hostData.useNat;
     //		if (Network.useNat)
     //			log.Add("Using Nat punchthrough to connect to host");
     //		else
     //			log.Add("Connecting directly to host: " + string.Join(" ", hostData.ip));
     Network.Connect(hostData.ip, hostData.port);
     Application.LoadLevel(Networking.STARTING_LEVEL);
 }
예제 #17
0
파일: NetUIScript.cs 프로젝트: jminor/FTJ
 void ConnectToServer(HostData server, string password)
 {
     last_tried_server_ = server;
     game_name_ = server.gameName;
     SetState(State.JOINING);
     NetworkConnectionError err = Network.Connect(server, password);
     if(err != NetworkConnectionError.NoError){
         display_err_ = ""+err;
         SetState(State.JOIN_FAIL);
     }
 }
예제 #18
0
 //Shows a single row of valid server.
 void connectionRow(HostData host)
 {
     GUILayout.BeginHorizontal();
         GUILayout.Label(host.gameName + " (" + host.connectedPlayers + " / " + host.playerLimit + ")");
         GUILayout.Label(host.comment);
         if (GUILayout.Button("Connect", GUILayout.MaxWidth(Screen.width/10)))
         {
             Network.Connect(host);	//Uses unitys server connection protocal
         }
     GUILayout.EndHorizontal();
 }
예제 #19
0
파일: JoinGame.cs 프로젝트: bajuwa/IAT410
	void OnGUI(){
		if(hostData != null){
			for (int i = 0; i<hostData.Length; i++) {
				if(GUI.Button(new Rect(Screen.width/2 - buttonWidth/2, 100+(buttonHeight*i), buttonWidth, buttonHeight), hostData[i].gameName)){
					hostGame = hostData[i];
					Application.LoadLevel(int.Parse(hostGame.comment));
					//Network.Connect(hostData[i]);
				}
			} 
		} 
	}
    /*
     * @brief		Connects to a specified server
     * @param
     * @return	void
     */
    public void ConnectWithServer(HostData hostToConnect)
    {
        if(hostToConnect != null) {

            Network.Connect(hostToConnect);
        }
        else {

            Network.Connect(connectToIP, networkConnectPort);
        }
    }
예제 #21
0
 public static void ConnectToServer(HostData server)
 {
     if (server != null)
     {
         Network.Connect(server);
     }
     else
     {
         Debug.LogError("Missing Host Data");
     }
 }
예제 #22
0
 public void JoinGame(HostData hd)
 {
     //Network.Connect(hd);
     //Debug.Log("Turning off SetSendingEnabled");
     //Network.SetSendingEnabled(0, false);
     //Debug.Log("Turning off isMessageQueueRunning");
     //Network.isMessageQueueRunning = false;
     //Debug.Log("Loading main level");
     locHD = hd;
     Application.LoadLevel(2);
 }
예제 #23
0
 /// <summary>
 ///   <para>Connect to the host represented by a HostData structure returned by the Master Server.</para>
 /// </summary>
 /// <param name="hostData"></param>
 /// <param name="password"></param>
 public static NetworkConnectionError Connect(HostData hostData, [DefaultValue("\"\"")] string password)
 {
     if (hostData == null)
     {
         throw new NullReferenceException();
     }
     if (hostData.guid.Length > 0 && hostData.useNat)
     {
         return(Network.Connect(hostData.guid, password));
     }
     return(Network.Connect(hostData.ip, hostData.port, password));
 }
    private void JoinServer(HostData hostData)
    {
        Debug.Log ("joining server: ");
        Network.Connect(hostData);
        foreach (var host in hostData.ip) {
            Debug.Log (host + ":" + hostData.port + " " );
        }

        //saves the meteor DB url
        GameObject.Find ("GameManager").GetComponent<ClientInitialization> ().setMeteorURL (hostData.ip [0]);
        GameObject.Find ("ChooseSessionCanvas").SetActive (false);
    }
    static bool Network_Connect__HostData(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 1)
        {
            UnityEngine.HostData arg0 = (UnityEngine.HostData)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            JSApi.setEnum((int)JSApi.SetType.Rval, (int)UnityEngine.Network.Connect(arg0));
        }

        return(true);
    }
예제 #26
0
 public static NetworkConnectionError Connect(HostData hostData, [DefaultValue("\"\"")] string password)
 {
     if (hostData == null)
     {
         throw new NullReferenceException();
     }
     if ((hostData.guid.Length > 0) && hostData.useNat)
     {
         return Connect(hostData.guid, password);
     }
     return Connect(hostData.ip, hostData.port, password);
 }
    static bool Network_Connect__HostData__String(JSVCall vc, int argc)
    {
        int len = argc;

        if (len == 2)
        {
            UnityEngine.HostData arg0 = (UnityEngine.HostData)JSMgr.datax.getObject((int)JSApi.GetType.Arg);
            System.String        arg1 = (System.String)JSApi.getStringS((int)JSApi.GetType.Arg);
            JSApi.setEnum((int)JSApi.SetType.Rval, (int)UnityEngine.Network.Connect(arg0, arg1));
        }

        return(true);
    }
예제 #28
0
    public NetworkConnectionError ConnectToHostIndex( int _index )
    {
        if ( _index < 0 || _index >= this.gameHosts.Length )
        {
            DebugConsole.Error( "Index out of range: " + _index, this );
            return NetworkConnectionError.ConnectionFailed;
        }

        this.connectionHost = this.gameHosts[ _index ];
        this.gameName = this.connectionHost.gameName;
        this.gameComment = this.connectionHost.comment;
        return this.Connect( this.connectionHost.ip[0], this.connectionHost.port, "" );
    }
예제 #29
0
    public ServerData(HostData hostData)
    {
        this.ParseServerDataSeparatedString(hostData.comment);

        /* * /
        // We could also overwrite it with this, by why...
        this.guid = hostData.guid;
        this.serverName = WWW.UnEscapeURL(hostData.gameName);

        this.pwProtected = hostData.passwordProtected;

        this.connectedPlayers = hostData.connectedPlayers;
        this.playerLimit = hostData.playerLimit;
        /* */
    }
예제 #30
0
    public void JoinRoom(HostData hostData)
    {
        roomToJoin = hostData;
        int i = 1;
        roomToJoinIP = roomToJoin.ip[0];

        while (i < roomToJoin.ip.Length)
        {
            roomToJoinIP += "." + roomToJoin.ip[i];
            i++;
        }
        //Debug.Log("Room IP: " + roomToJoinIP);
        JoinedRoomFlag = 0; // Set joining status
        MasterServer.RequestHostList(GameName);
        //Network.Connect(hostData);
    }
예제 #31
0
    public void OnDisconnectedFromServer(NetworkDisconnection info)
    {
        if (UnitZ.chatLog != null)
            UnitZ.chatLog.Clear ();

        UnitZ.gameManager.ClearNetworkGameObject ();
        UnitZ.gameManager.IsPlaying = false;

        if (Application.loadedLevelName != PlayerPrefs.GetString ("landingpage")) {
            Application.LoadLevel (PlayerPrefs.GetString ("landingpage"));
            GameObject.Destroy (this.gameObject);
        }

        ServerSelected = null;
        isConnecting = false;
        Debug.Log ("Disconnected from server!");
    }
예제 #32
0
    public void StartServer(string gameName)
    {
        ConnectedPlayers = new List<NetworkPlayer>();

        MasterServer.ipAddress = "127.0.0.1";
        MasterServer.port = 23466;
        Network.natFacilitatorIP = "127.0.0.1";
        Network.natFacilitatorPort = 50005;

        bool useNat = !Network.HavePublicAddress();
        Network.InitializeServer(32, 25000, useNat);
        CurrentHost = new HostData()
        {
            gameName = gameName
        };
        MasterServer.RegisterHost(GameName, gameName);
        PlayersCount = 0;
    }
예제 #33
0
	void Start()
	{
		GameToJoin = null;
		
		_bgRect = new Rect(0, 0, Screen.width, Screen.height);

		// Rectangles pour les boutons
		_startBtnRect = new Rect(
			Screen.width - 250, 
			Screen.height / 2 - 35, 200, 50);
			
		
		_joinBtnRect = new Rect(
			Screen.width - 250, 
			Screen.height / 2 + 35, 200, 50);
			
		_cacheRect = new Rect(0, 0, 200, 50);
	}
예제 #34
0
 public static NetworkConnectionError Connect(HostData hostData, string password)
 {
     throw new NotSupportedException("The legacy networking system has been removed in Unity 2018.2. Use Unity Multiplayer and NetworkIdentity instead.");
 }
예제 #35
0
        public static NetworkConnectionError Connect(HostData hostData)
        {
            string password = "";

            return(Network.Connect(hostData, password));
        }
예제 #36
0
        public static NetworkConnectionError Connect(HostData hostData)
        {
            string password = string.Empty;

            return(Connect(hostData, password));
        }
예제 #37
0
        public static NetworkConnectionError Connect(HostData hostData)
        {
            string empty = string.Empty;

            return(Network.Connect(hostData, empty));
        }