当前位置: 首页>>代码示例>>C#>>正文


C# NetSocket.StartSocket方法代码示例

本文整理汇总了C#中NetSocket.StartSocket方法的典型用法代码示例。如果您正苦于以下问题:C# NetSocket.StartSocket方法的具体用法?C# NetSocket.StartSocket怎么用?C# NetSocket.StartSocket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NetSocket的用法示例。


在下文中一共展示了NetSocket.StartSocket方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        private void Start() {
            socket = GetComponent<NetSocket>();
            viewManager = GetComponent<NetViewManager>();
            zoneClient = GetComponent<NetZoneClient>();

            ExampleItems.PopulateItemDatabase();

            zoneClient.OnZoneSetupSuccess += ZoneSetupSuccessful;

            socket.Events.OnDisconnectedFromServer += DisconnectedFromServer;

            socket.StartSocket();
            socket.RegisterRpcListener(this);
        }
开发者ID:RainsSoft,项目名称:MassiveNet,代码行数:14,代码来源:ClientModel.cs

示例2: Start

        private void Start() {
            socket = GetComponent<NetSocket>();
            viewManager = GetComponent<NetViewManager>();
            zoneClient = GetComponent<NetZoneClient>();

            zoneClient.OnZoneSetupSuccess += ZoneSetupSuccessful;

            socket.Events.OnDisconnectedFromServer += DisconnectedFromServer;
            socket.Events.OnConnectedToServer += ConnectedToServer;

            socket.StartSocket();
            socket.RegisterRpcListener(this);

            socket.Connect(ServerAddress);
        }
开发者ID:RainsSoft,项目名称:MassiveNet,代码行数:15,代码来源:ClientModel.cs

示例3: Start

        private void Start() {
            socket = GetComponent<NetSocket>();
            viewManager = GetComponent<NetViewManager>();
            zoneManager = GetComponent<NetZoneManager>();
            zoneServer = GetComponent<NetZoneServer>();

            zoneServer.OnAssignment += AssignedToZone;

            socket.ProtocolAuthority = true;
            socket.AcceptConnections = true;
            socket.MaxConnections = 512;

            socket.Events.OnClientDisconnected += ClientDisconnected;
            socket.Events.OnPeerApproval += PeerApproval;
            socket.Events.OnSocketStart += SocketStart;
            socket.Events.OnFailedToConnect += FailedToConnect;

            socket.StartSocket(ServerAddress + ":" + ServerPortRoot);
            socket.RegisterRpcListener(this);
        }
开发者ID:RainsSoft,项目名称:MassiveNet,代码行数:20,代码来源:ServerModel.cs

示例4: Start

        private void Start() {
            socket = GetComponent<NetSocket>();
            zoneManager = GetComponent<NetZoneManager>();
            zoneServer = GetComponent<NetZoneServer>();

            aiManager = GetComponent<AiManager>();

            ExampleItems.PopulateItemDatabase();

            zoneServer.OnAssignment += AssignedToZone;

            socket.ProtocolAuthority = true;
            socket.AcceptConnections = true;
            socket.MaxConnections = 512;

            socket.Events.OnPeerApproval += PeerApproval;
            socket.Events.OnSocketStart += SocketStart;
            socket.Events.OnFailedToConnect += FailedToConnect;

            socket.StartSocket(ServerAddress + ":" + ServerPortRoot);
            socket.RegisterRpcListener(this);
        }
开发者ID:RainsSoft,项目名称:MassiveNet,代码行数:22,代码来源:ServerModel.cs

示例5: OnGUI

    void OnGUI()
    {
        if (mode == netMode.client)
        {
            if (GUI.Button(new Rect(10, 10, 50, 50), "Client")) { }
        }
        else if (mode == netMode.server)
        {
            if (GUI.Button(new Rect(10, 10, 50, 50), "Server")) { }
            if (GUI.Button(new Rect(10, 70, 50, 50), "Peers"))
            {
                zoneManager.ListPeers();
            }
            if (GUI.Button(new Rect(10, 140, 50, 50), "UPeers"))
            {
                zoneManager.ListUPeers();
            }
        }
        else
        {
            if (GUI.Button(new Rect(10, 10, 50, 50), "Server"))
            {
                mode = netMode.server;
        //                netManager = (GameObject)GameObject.Instantiate(Resources.Load("ServerGameManager"));
                gameObject.AddComponent<NetSocket>();
                socket = GetComponent<NetSocket>();

                gameObject.AddComponent<NetViewManager>();
                viewManager = GetComponent<NetViewManager>();

                gameObject.AddComponent<NetZoneManager>();
                zoneManager = GetComponent<NetZoneManager>();

                gameObject.AddComponent<NetZoneServer>();
                zoneServer = GetComponent<NetZoneServer>();
                zoneServer.OnAssignment += AssignedToZone;

                gameObject.AddComponent<NetScopeManager>();

                socket.ProtocolAuthority = true;
                socket.AcceptConnections = true;
                socket.MaxConnections = 512;

                socket.Events.OnClientDisconnected += ClientDisconnected;
                socket.Events.OnPeerApproval += PeerApproval;
                socket.Events.OnSocketStart += SocketStart;
                socket.Events.OnFailedToConnect += FailedToConnect;

                socket.StartSocket(ServerAddress + ":" + ServerPortRoot);
                socket.RegisterRpcListener(this);
                serverCamera.enabled = true;
            }
            if (GUI.Button(new Rect(10, 70, 50, 30), "Client"))
            {
                mode = netMode.client;
                netManager = (GameObject)GameObject.Instantiate(Resources.Load("ClientGameManager"));
            }
        }
    }
开发者ID:fredrickvaughn,项目名称:Base,代码行数:59,代码来源:GameManager.cs


注:本文中的NetSocket.StartSocket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。