本文整理汇总了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);
}
示例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);
}
示例3: SetupClient
public void SetupClient()
{
myClient = new NetworkClient();
myClient.RegisterHandler(MsgType.Connect, OnConnected);
myClient.Connect("192.16.7.21", 8888);
isAtStartup = false;
}
示例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);
}
示例5: SetupClient
private void SetupClient()
{
if (client == null)
{
client = new NetworkClient();
client.Connect("127.0.0.1", serverPort);
}
}
示例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);
}
示例7: setupClient
void setupClient()
{
//registerPrefabs ();
//Spawn ();
myClient = new NetworkClient();
myClient.RegisterHandler(MsgType.Connect, OnConnectedRemotePlayer);
myClient.RegisterHandler (MsgType.Error, OnErrorRemotePlayer);
myClient.Connect(gameIP, gamePort);
}
示例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);
}
示例9: SetupClient
public void SetupClient()
{
StartClient();
Debug.Log("SetupClient()");
discovery.Initialize();
discovery.StartAsClient();
myClient = new NetworkClient();
myClient.Connect("127.0.0.1", 4444);
}
示例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";
}
}
示例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);
}
示例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);
}
示例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);
}
示例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");
}
示例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");
}
}