当前位置: 首页>>代码示例>>C#>>正文


C# NetworkClient.Connect方法代码示例

本文整理汇总了C#中NetworkClient.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# NetworkClient.Connect方法的具体用法?C# NetworkClient.Connect怎么用?C# NetworkClient.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetworkClient的用法示例。


在下文中一共展示了NetworkClient.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: connect

 public void connect(string server, NetworkMessageDelegate onConnect)
 {
     client = new NetworkClient ();
     if(onConnect != null)
         client.RegisterHandler (MsgType.Connect, onConnect);
     client.Connect (server, PORT);
 }
开发者ID:moodever,项目名称:TeachingBadApple,代码行数:7,代码来源:NetworkConsole.cs

示例2: InitializeScene

        public override void InitializeScene(ICanvas canvas)
        {
            // Connect with simulator
            connection = new NetworkClient();
            if (!connection.Connect("ganberg2", 9999))
            {
                throw new ApplicationException("Unable to establish connection with host.");
            }
            else
            {
                connection.Subscribe("TimeTick");
                connection.Subscribe("ViewProUpdate");
            }

            // Create and initialize Gameboard.
            background = new Obj_Sprite(texture_file, SpriteFlags.SortTexture | SpriteFlags.AlphaBlend);
            background.Initialize(canvas);
            background.Position = new Vector3(0, 0, 0);
            background.Rotation = new Vector3(0, 0, 0);
            background.Scaling = new Vector3(1, 1, 1);
            background.Texture(canvas);

            // Initialize and create Font;
            this._myFont = canvas.CreateFont(new System.Drawing.Font("Arial", 10));
            message = string.Empty;

            //f16 = new Obj_Sprite("f16.png", SpriteFlags.AlphaBlend);
            //f16.Initialize(canvas);
            //f16.Texture(canvas);
            //f16.Position = new Vector3(0, 0, 0);
            //f16.Rotation = new Vector3(0, 0, 0);
            //f16.Scaling = new Vector3(1, 1, 1);

        }
开发者ID:wshanshan,项目名称:DDD,代码行数:34,代码来源:GIS_Scene.cs

示例3: SetupClient

 public void SetupClient()
 {
     myClient = new NetworkClient();
     myClient.RegisterHandler(MsgType.Connect, OnConnected);
     myClient.Connect("192.16.7.21", 8888);
     isAtStartup = false;
 }
开发者ID:coringuyen,项目名称:Networking,代码行数:7,代码来源:clientandsever.cs

示例4: SetupClient

 // Create a client and connect to the server port
 public void SetupClient()
 {
     myClient = new NetworkClient();
     myClient.RegisterHandler(MsgType.Connect, OnConnected);
     myClient.RegisterHandler(MyMsgType.Info, OnInfo);
     myClient.Connect("10.250.235.162", 3000);
 }
开发者ID:LinasKo,项目名称:MetaVerse,代码行数:8,代码来源:NetworkManager.cs

示例5: SetupClient

 private void SetupClient()
 {
     if (client == null)
     {
         client = new NetworkClient();
         client.Connect("127.0.0.1", serverPort);
     }
 }
开发者ID:wudixiaop,项目名称:UNet,代码行数:8,代码来源:SendMessageX.cs

示例6: Awake

 void Awake()
 {
     myClient = new NetworkClient ();
     ConnectionConfig config = new ConnectionConfig ();
     config.AddChannel (QosType.ReliableFragmented);
     myClient.Configure (config, 1);
     myClient.Connect (IP, 7777);
     myClient.RegisterHandler (MyMsgType.Info, OnInfoMessage);
 }
开发者ID:Fayanzar,项目名称:Shogi,代码行数:9,代码来源:NetworkInit.cs

示例7: setupClient

    void setupClient()
    {
        //registerPrefabs ();
        //Spawn ();

        myClient = new NetworkClient();
        myClient.RegisterHandler(MsgType.Connect, OnConnectedRemotePlayer);
        myClient.RegisterHandler (MsgType.Error, OnErrorRemotePlayer);
        myClient.Connect(gameIP, gamePort);
    }
开发者ID:stawrocek,项目名称:pongman,代码行数:10,代码来源:PongmanNetworkManager_old.cs

示例8: Start

    public void Start()
    {
        ClientScene.RegisterPrefab(Player);
        ClientScene.RegisterPrefab (Bolt);

        myClient = new NetworkClient();
        Debug.Log("oollolo");
        //myClient.RegisterHandler(MsgType.Connect, OnConnected);
        myClient.Connect("127.0.0.1", 7777);
    }
开发者ID:ZloyHolodec,项目名称:SpaceGunner,代码行数:10,代码来源:ClientSetup.cs

示例9: SetupClient

    public void SetupClient()
    {
        StartClient();
        Debug.Log("SetupClient()");

        discovery.Initialize();
        discovery.StartAsClient();

        myClient = new NetworkClient();
        myClient.Connect("127.0.0.1", 4444);
    }
开发者ID:ifndefdeadmau5,项目名称:HLAPI_tutorial,代码行数:11,代码来源:MyNetManager.cs

示例10: Start

	// Use this for initialization
	void Start () {
		nc = new NetworkClient ();
		nc.Connect("192.168.1.19", 5678);
		Debug.Log ("Client : " + nc);
		Debug.Log (nc.isConnected);
		if (nc.isConnected) {
			int score = snake.score;
			Debug.Log ("Derp " + score);
			scoreText.text = "Score: " + score;
		} else {
			scoreText.text = "Score: ERROR";
		}
	}
开发者ID:generalpaulinski,项目名称:snake_minigame,代码行数:14,代码来源:GameOverScript.cs

示例11: SetupClient

    // Create a client and connect to the server port
    public void SetupClient()
    {
        Debug.Log ("SetupClient.");
        foreach (GameObject prefab in prefabs) {
            if (prefab != null)
                ClientScene.RegisterPrefab (prefab);
        }

        myClient = new NetworkClient ();

        myClient.RegisterHandler (MsgType.Connect, OnConnected);
        myClient.Connect (base.networkAddress, base.networkPort);
    }
开发者ID:stefanseibert,项目名称:padawan101,代码行数:14,代码来源:MyNetworkManager.cs

示例12: joinGame

	public void joinGame()
	{
		// Check if there is a room

		// Has the game Started?

		// If no, send the player to the Waiting For Players page

		// If yes, give error message.
		Debug.Log (string.Format ("join button clicked"));
		client = new NetworkClient();
		client.Connect ("192.168.1.103", 4444);
		client.RegisterHandler(MsgType.Connect, OnConnected);
		client.RegisterHandler(MsgType.Error, OnError);
		client.RegisterHandler (Message.GET_HAS_ROOM, OnGetRoom);
	}
开发者ID:AE2GRP-CH,项目名称:game,代码行数:16,代码来源:MainMenu.cs

示例13: Start

    void Start()
    {
        //on client, this isn't required but is nice for testing.
        Application.runInBackground = true;

        var globals = FindObjectOfType<GlobalAssets>();

        _networkStateEntityProtoType = globals.NetworkEntityStatePrototype.GetComponent<NetworkIdentity>();

        ClientScene.RegisterSpawnHandler(_networkStateEntityProtoType.assetId, OnSpawnEntity, OnDespawnEntity);

        _client = new NetworkClient();
        _client.Connect("localhost", 7777);
        _client.RegisterHandler(MsgType.Connect, OnClientConnected);

    }
开发者ID:michaelmanus,项目名称:Unet-Client-Server-Example,代码行数:16,代码来源:MyClient.cs

示例14: Main

        static void Main(string[] args)
        {
            string scenarioFile = args[0];
            new ScenarioToQueues(scenarioFile);
 //           string hostname = "dgeller";
            string hostname=args[1];
//            int port = 9999;
            int port = int.Parse(args[2]);
 //           string simModelName = "SimulationModel.xml";
            string simModelName = args[3];
            NetworkClient c = new NetworkClient();
            c.Connect(hostname, port);
            EventCommunicator eventCommunicator = new EventCommunicator(c);

            SimulationModelReader smr = new SimulationModelReader();
            SimulationModelInfo simModelInfo = smr.readModel(simModelName);

            SimulationEventDistributor dist = new SimulationEventDistributor(ref simModelInfo);
            SimulationEventDistributorClient cc = new SimulationEventDistributorClient();

            dist.RegisterClient(ref cc);



            sink = new Watcher(400);
            ThreadStart stub = new ThreadStart(sink.WatcherThread);
            Thread stubThread = new Thread(stub);
            stubThread.Start();


            for (int i = 0; i < 5; i++) // in test the move happens at time 2
            {
                TimerTicker.NextTick();
            }
            IncomingList.Add(new MoveComplete_Event("UNIT0"));
            for (int i = 0; i < 2; i++)
            {
                TimerTicker.NextTick();
            }
 
            Console.WriteLine("The end");


        }
开发者ID:wshanshan,项目名称:DDD,代码行数:44,代码来源:Program.cs

示例15: OnMatchJoined

 public void OnMatchJoined(JoinMatchResponse matchJoin)
 {
     if (matchJoin.success)
     {
         Debug.Log("Join match succeeded");
         if (matchCreated)
         {
             Debug.LogWarning("Match already set up, aborting...");
             return;
         }
         Utility.SetAccessTokenForNetwork(matchJoin.networkId, new NetworkAccessToken(matchJoin.accessTokenString));
         NetworkClient myClient = new NetworkClient();
         myClient.RegisterHandler(MsgType.Connect, OnConnected);
         myClient.Connect(new MatchInfo(matchJoin));
     }
     else
     {
         Debug.LogError("Join match failed");
     }
 }
开发者ID:tylertks,项目名称:AnthemOfIron,代码行数:20,代码来源:MatchMaking.cs


注:本文中的NetworkClient.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。