本文整理汇总了C#中UnityEngine.HostData类的典型用法代码示例。如果您正苦于以下问题:C# HostData类的具体用法?C# HostData怎么用?C# HostData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HostData类属于UnityEngine命名空间,在下文中一共展示了HostData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JoinServer
private void JoinServer(HostData hostData)
{
#if UNITY_ANDROID
//AndroidJNI.CallIntMethod ();
#endif
Network.Connect (hostData);
}
示例2: JoinServer
private void JoinServer(HostData hostData)
{
Network.Connect (hostData);
recoClient = GameObject.Find ("VoiceTranslation");;
recoClient.GetComponentInChildren<UDP_RecoServer> ().StartServer ();
}
示例3: RetrievePing
public void RetrievePing(HostData host)
{
testing = true;
Network.Connect(host);
PingLabel.text = "--";
ip = string.Concat(host.ip);
}
示例4: JoinServer
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: CreateClientButton
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;
}
}
示例6: OnListItemUnselected
void OnListItemUnselected(ComboBox.ComboItem unselectedItem)
{
if (selectedHost == (HostData)unselectedItem.value)
{
selectedHost = null;
}
}
示例7: SetServer
public void SetServer(HostData data)
{
info = data;
label.text = data.gameName;
comment.text = data.comment;
comment.text += data.connectedPlayers + "/" + data.playerLimit;
}
示例8: ConnectToServer
void ConnectToServer(HostData hostData)
{
var err = Network.Connect(hostData);
if (err != NetworkConnectionError.NoError) {
Debug.Log(string.Format("error initializing server {0}", err));
return;
}
}
示例9: Join
public void Join(HostData host) {
if(!host.passwordProtected)
Network.Connect(host);
else{
Protected = true;
select = host;
}
}
示例10: HandleOnServerSelected
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: JoinServer
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: getDebugName
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 = "P:" + host.passwordProtected;
return string.Join(" ", new string[] {hostName, players, addresses, nat, password});
}
示例13: JoinServer
private void JoinServer(HostData hostData)
{
hostList = null;
if (selectingIP) {
Network.Connect (hostData.ip [0], hostData.port);
} else {
Network.Connect(hostData);
}
}
示例14: Start
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: JoinGame
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);
}