StartCreateLogicMultiPlayer
This commit is contained in:
parent
b1f24ce81b
commit
f6663bdd3c
2 changed files with 22 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
|
@ -62,10 +63,18 @@ public class SelectingServerGUI : AbstractGUI
|
||||||
};
|
};
|
||||||
joinButton.LeftButtonPressed += () =>
|
joinButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
|
||||||
// join
|
// join
|
||||||
|
Client client = new Client();
|
||||||
// ваш код здесь
|
var endpoint = ipBox.text.Split(':');
|
||||||
|
int port;
|
||||||
|
if (int.TryParse(endpoint[1], out port))
|
||||||
|
{
|
||||||
|
client.JoinRoom(endpoint[0], port);
|
||||||
|
AppManager.Instance.SetClient(client);
|
||||||
|
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
||||||
|
}
|
||||||
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(joinButton);
|
Elements.Add(joinButton);
|
||||||
Button hostButton = new Button(Manager)
|
Button hostButton = new Button(Manager)
|
||||||
|
|
|
@ -71,6 +71,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
listen.IsBackground = true;
|
listen.IsBackground = true;
|
||||||
listen.Start();
|
listen.Start();
|
||||||
}
|
}
|
||||||
|
public void JoinRoom(IPEndPoint endPoint) // multyplayer
|
||||||
|
{
|
||||||
|
|
||||||
|
this.endPoint = endPoint;
|
||||||
|
socket.Connect(endPoint);
|
||||||
|
SendData();
|
||||||
|
Thread listen = new Thread(StartListening);
|
||||||
|
listen.IsBackground = true;
|
||||||
|
listen.Start();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// создается одиночная комната к которой ты подключаешься
|
/// создается одиночная комната к которой ты подключаешься
|
||||||
|
|
Loading…
Add table
Reference in a new issue