Guest User

Client code

a guest
Aug 27th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.Networking.Match;
  4. using UnityEngine.Networking;
  5. using Steamworks;
  6. using System;
  7.  
  8. [RequireComponent(typeof(TextMesh))]
  9. public class SelectableMatch : Selectable {
  10. CSteamID _joinThis;
  11. public CSteamID JoinThis {
  12. set {
  13. if(SteamManager.Initialized) {
  14. var text = GetComponent<TextMesh>();
  15. text.text = SteamMatchmaking.GetLobbyData(value, "name");
  16. _joinThis = value;
  17. }
  18. }
  19. get {
  20. return _joinThis;
  21. }
  22. }
  23. public NATTraversal.NetworkManager manager;
  24.  
  25. // Use this for initialization
  26. void Start () {
  27.  
  28. }
  29.  
  30. // Update is called once per frame
  31. void Update () {
  32.  
  33. }
  34.  
  35. public override void OnSelect() {
  36. print("Selected!");
  37. print(JoinThis);
  38. if(SteamManager.Initialized) {
  39. print("Joining: " + SteamMatchmaking.GetLobbyData(JoinThis, "name") + " at " + SteamMatchmaking.GetLobbyData(JoinThis, "publicIP"));
  40. manager.StartClientAll(SteamMatchmaking.GetLobbyData(JoinThis, "publicIP"),
  41. SteamMatchmaking.GetLobbyData(JoinThis, "internalIP"),
  42. Convert.ToUInt64(SteamMatchmaking.GetLobbyData(JoinThis, "guid")));
  43. //manager.StartClient();
  44. }
  45. }
  46. }
Add Comment
Please, Sign In to add comment