コード例 #1
0
    private void U3DClientOnLine_Callback(INotification notification)
    {
        //数据解析
        object[]       objs           = notification.Body as object[];
        U3DClientLogin u3dClientLogin = (U3DClientLogin)objs[0];

        System.Net.IPEndPoint endPoint = (System.Net.IPEndPoint)objs[1];
        string content = u3dClientLogin.m_clientId + " " + u3dClientLogin.m_clientName + " (" +
                         endPoint.Address.ToString() + " " + endPoint.Port.ToString() + ")";
        //UI处理
        GameObject clientOnLineItemGo = SingletonMgr.ObjectManager.Instantiate("Assets/Prefabs/UI/ClientOnLineItem.prefab", false);

        if (clientOnLineItemGo != null && m_clientOnLineItemContentTrans != null)
        {
            clientOnLineItemGo.transform.SetParent(m_clientOnLineItemContentTrans);
            clientOnLineItemGo.transform.localPosition    = Vector3.zero;
            clientOnLineItemGo.transform.localScale       = Vector3.one;
            clientOnLineItemGo.transform.localEulerAngles = Vector3.zero;
            ClientOnLineItem itemCom = clientOnLineItemGo.GetComponent <ClientOnLineItem>();
            if (itemCom != null)
            {
                itemCom.SetCell(content);
                AddClientOnLineItem(u3dClientLogin.m_clientId, itemCom);
            }
        }
        m_onlineCountText.text     = ActorManager.Instance.GetActor <WorldActor>().OnLineCount.ToString();
        m_linkSocketCountText.text = ActorManager.Instance.GetActor <WorldActor>().LinkSocketCount.ToString();
    }
コード例 #2
0
    public override void ReceivePacket(Packet packet)
    {
        if (packet == null)
        {
            return;
        }
        U3DClientLogin u3dClientLogin = new U3DClientLogin(packet.m_data);

        System.Net.IPEndPoint ipEndPoint = (System.Net.IPEndPoint)m_agent.EndPoint;
        object[] objs = new object[2];
        objs[0] = u3dClientLogin;
        objs[1] = ipEndPoint;
        if (m_worldActor.PlayerActorIsExitsByU3dId(u3dClientLogin.m_clientId))
        {
            //表示同一个U3DID的客户端登录到服务器,返回登录失败
            SendU3DClientLoginFailResponse();
        }
        else
        {
            m_playerActor.PlayerActorType = PlayerActorType.U3DPlayerActorType;
            m_playerActor.U3DId           = u3dClientLogin.m_clientId;
            // //默认登录的U3D客户端都属于站台0,CCTV视频监控都看向站台0的情况
            // m_playerActor.BelongStationIndex = 0;
            // //默认登录的U3D客户端都属于站台0,CCTV视频监控都看向站台0的情况
            // m_playerActor.AddBelongStationIndex2List(0);
            //默认登录的U3D客户端都属于站台0,CCTV视频监控都看向站台0的情况, 优化版本
            TDFramework.SingletonMgr.ModuleMgr.StationModule.AddPlayerActor(5, m_playerActor);
            m_worldActor.AddPlayerActor2U3DDict(m_playerActor);
            // m_worldActor.AddU3DPlayerActor2BelongStationDict(m_playerActor);
            SendU3DClientLoginSuccessResponse();
            m_playerActor.SendNotification(EventID_Cmd.U3DClientOnLine, objs, null); //通知UI Command
        }
    }
コード例 #3
0
    public override void ReceivePacket(Packet packet)
    {
        if (packet == null)
        {
            return;
        }
        U3DClientLogin u3dClientLogin = new U3DClientLogin(packet.m_data);

        System.Net.IPEndPoint ipEndPoint = (System.Net.IPEndPoint)m_agent.EndPoint;
        object[] objs = new object[2];
        objs[0] = u3dClientLogin;
        objs[1] = ipEndPoint;
    }
コード例 #4
0
    public void SendU3DClientLoginInfoRequest()
    {
        U3DClientLogin u3dClientLogin = new U3DClientLogin()
        {
            m_clientId   = 0,
            m_clientName = "TianShanShan",
        };
        Packet packet = new Packet(u3dClientLogin.m_clientId, 0,
                                   0, 0, u3dClientLogin.Size, u3dClientLogin.Packet2Bytes());

        if (m_remoteClient != null)
        {
            m_remoteClient.Send(packet.Packet2Bytes());
        }
    }