浏览代码

renaming GameNetHub to GameNetPortal

/main
David Woodruff 4 年前
当前提交
82c1a99a
共有 10 个文件被更改,包括 12 次插入12 次删除
  1. 10
      Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs
  2. 6
      Assets/BossRoom/Scripts/Client/UI/MainMenuUI.cs
  3. 6
      Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs
  4. 2
      Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs
  5. 0
      /Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs.meta
  6. 0
      /Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs
  7. 0
      /Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs.meta
  8. 0
      /Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs
  9. 0
      /Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs.meta
  10. 0
      /Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs

10
Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs


/// <summary>
/// Client logic for the GameNetHub. Contains implementations for all of GameNetHub's S2C RPCs.
/// </summary>
[RequireComponent(typeof(GameNetHub))]
public class ClientGNHLogic : MonoBehaviour
[RequireComponent(typeof(GameNetPortal))]
public class ClientGameNetPortal : MonoBehaviour
private GameNetHub m_Hub;
private GameNetPortal m_Hub;
m_Hub = GetComponent<GameNetHub>();
m_Hub = GetComponent<GameNetPortal>();
m_Hub.NetworkStartEvent += this.NetworkStart;
m_Hub.ConnectFinishedEvent += this.OnConnectFinished;
}

/// </remarks>
/// <param name="ipaddress">the IP address of the host to connect to. (currently IPV4 only)</param>
/// <param name="port">The port of the host to connect to. </param>
public static void StartClient(GameNetHub hub, string ipaddress, int port)
public static void StartClient(GameNetPortal hub, string ipaddress, int port)
{
string client_guid = GetOrCreateGuid();
string payload = $"client_guid={client_guid}\n"; //minimal format where key=value pairs are separated by newlines.

6
Assets/BossRoom/Scripts/Client/UI/MainMenuUI.cs


public GameObject GameHubGO;
public GameObject InputTextGO;
private BossRoom.GameNetHub m_netHub;
private BossRoom.GameNetPortal m_netHub;
/// <summary>
/// This will get more sophisticated as we move to a true relay model.

// Start is called before the first frame update
void Start()
{
m_netHub = GameHubGO.GetComponent<BossRoom.GameNetHub>();
m_netHub = GameHubGO.GetComponent<BossRoom.GameNetPortal>();
}
/// <summary>

public void OnConnectClicked()
{
BossRoom.Client.ClientGNHLogic.StartClient(m_netHub, GetIPAddress(), k_connectPort);
BossRoom.Client.ClientGameNetPortal.StartClient(m_netHub, GetIPAddress(), k_connectPort);
}
}
}

6
Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs


/// <summary>
/// Server logic plugin for the GameNetHub. Contains implementations for all GameNetHub's C2S RPCs.
/// </summary>
public class ServerGNHLogic : MonoBehaviour
public class ServerGameNetPortal : MonoBehaviour
private GameNetHub m_Hub;
private GameNetPortal m_Hub;
// used in ApprovalCheck. This is intended as a bit of light protection against DOS attacks that rely on sending silly big buffers of garbage.
private const int k_MaxConnectPayload = 1024;

m_Hub = GetComponent<GameNetHub>();
m_Hub = GetComponent<GameNetPortal>();
m_Hub.NetworkStartEvent += NetworkStart;
// we add ApprovalCheck callback BEFORE NetworkStart to avoid spurious MLAPI warning:
// "No ConnectionApproval callback defined. Connection approval will timeout"

2
Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs


/// in player prefs, so it persists across sessions of the game.
/// </remarks>
///
public class GameNetHub : MonoBehaviour
public class GameNetPortal : MonoBehaviour
{
public GameObject NetworkingManagerGO;

/Assets/BossRoom/Scripts/Client/Net/ClientGNHLogic.cs.meta → /Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs.meta

/Assets/BossRoom/Scripts/Client/Net/ClientGNHLogic.cs → /Assets/BossRoom/Scripts/Client/Net/ClientGameNetPortal.cs

/Assets/BossRoom/Scripts/Server/Net/ServerGNHLogic.cs.meta → /Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs.meta

/Assets/BossRoom/Scripts/Server/Net/ServerGNHLogic.cs → /Assets/BossRoom/Scripts/Server/Net/ServerGameNetPortal.cs

/Assets/BossRoom/Scripts/Shared/Net/GameNetHub.cs.meta → /Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs.meta

/Assets/BossRoom/Scripts/Shared/Net/GameNetHub.cs → /Assets/BossRoom/Scripts/Shared/Net/GameNetPortal.cs

正在加载...
取消
保存