mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update NetTestMain.cs
This commit is contained in:
@@ -7,6 +7,10 @@ using UnityEngine;
|
|||||||
public class NetTestMain : MonoBehaviour
|
public class NetTestMain : MonoBehaviour
|
||||||
{
|
{
|
||||||
public const string MainTcp = "MainTcp";
|
public const string MainTcp = "MainTcp";
|
||||||
|
|
||||||
|
public string Ip = "127.0.0.1";
|
||||||
|
|
||||||
|
public int Port = 8080;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@@ -32,7 +36,7 @@ public class NetTestMain : MonoBehaviour
|
|||||||
_networkChannel = TEngine.Runtime.Network.Instance.CreateNetworkChannel(MainTcp, ServiceType.Tcp, new NetworkChannelHelper());
|
_networkChannel = TEngine.Runtime.Network.Instance.CreateNetworkChannel(MainTcp, ServiceType.Tcp, new NetworkChannelHelper());
|
||||||
|
|
||||||
//连接Channel 本地8081 需要开启服务器
|
//连接Channel 本地8081 需要开启服务器
|
||||||
_networkChannel.Connect(IPAddress.Parse("127.0.0.1"),8081);
|
_networkChannel.Connect(IPAddress.Parse(Ip),Port);
|
||||||
|
|
||||||
//注册消息包回调 ActionCode.Login -> Action Login
|
//注册消息包回调 ActionCode.Login -> Action Login
|
||||||
TEngine.Runtime.Network.Instance.RegisterHandler(MainTcp,(int)ActionCode.Login,Login);
|
TEngine.Runtime.Network.Instance.RegisterHandler(MainTcp,(int)ActionCode.Login,Login);
|
||||||
|
Reference in New Issue
Block a user