コード例 #1
0
        //---------------------------------------------------------------------
        public PhotonServerPeerC(IRpcProtocol protocol, IPhotonPeer unmanaged_peer,
                                 EntityMgr entity_mgr, byte remote_node_type, RpcSessionListener listener)
            : base(protocol, unmanaged_peer)
        {
            mEntityMgr      = entity_mgr;
            mRpcSession     = new RpcSession(mEntityMgr, this);
            mListener       = listener;
            mRemoteNodeType = remote_node_type;

            Dictionary <byte, object> map_param = new Dictionary <byte, object>();

            map_param[0] = mEntityMgr.NodeType;
            map_param[1] = 0;// local_node_id
            OperationRequest operation_request = new OperationRequest((byte)_eRpcCmd.SyncPeerInfo, map_param);
            SendResult       r = SendOperationRequest(operation_request, new SendParameters {
                ChannelId = 0
            });

            if (r != SendResult.Ok)
            {
                EbLog.Error("PhotonServerPeerC SyncPeerInfo Result=" + r);
            }

            if (mListener != null)
            {
                mListener.onSessionConnect(mEntityMgr.NodeType, mRemoteNodeType, mRpcSession);
            }
        }
コード例 #2
0
 //---------------------------------------------------------------------
 public PhotonServerPeerS(IRpcProtocol rpc_protocol, IPhotonPeer native_peer,
                          EntityMgr entity_mgr, RpcSessionListener listener)
     : base(rpc_protocol, native_peer)
 {
     mEntityMgr  = entity_mgr;
     mRpcSession = new RpcSession(mEntityMgr, this);
     mListener   = listener;
 }
コード例 #3
0
ファイル: NetBridge.cs プロジェクト: LazyPlanet/CasinosClient
 //---------------------------------------------------------------------
 public void connectBase(string base_ip, int base_port)
 {
     RpcSession.close();
     RpcSession.OnSocketConnected = _onSocketConnected;
     RpcSession.OnSocketClosed    = _onSocketClosed;
     RpcSession.OnSocketError     = _onSocketError;
     RpcSession.connect(base_ip, base_port);
 }
コード例 #4
0
 //---------------------------------------------------------------------
 public void Connect(string ip, int port)
 {
     RpcSession.Close();
     RpcSession.OnSocketConnected = _onSocketConnected;
     RpcSession.OnSocketClosed    = _onSocketClosed;
     RpcSession.OnSocketError     = _onSocketError;
     RpcSession.Connect(ip, port);
 }
コード例 #5
0
        protected virtual RpcSession CreateSession()
        {
            var session_ = rpcPeer.CreateSession(CreateContext());

            session_.InitializeRemotingObject(session_);
            this.session = session_;

            return(session_);
        }
コード例 #6
0
        //---------------------------------------------------------------------
        // Interface: RpcSessionListener.onSessionConnect
        public void onSessionConnect(byte node_type_local, byte node_type_remote, RpcSession session)
        {
            SessionEvent se;

            se.connect          = true;
            se.node_type_local  = node_type_local;
            se.node_type_remote = node_type_remote;
            se.session          = session;
            mQueSessionEvent.Enqueue(se);
        }
コード例 #7
0
ファイル: ClientUCenterSession.cs プロジェクト: xubingyue/def
    //-------------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("ClientUCenterSession.init()");

        defRpcMethod((byte)_eUCenterNodeType.UCenter, (ushort)_eUCenterMethodType.login2ClientOnLogin, login2ClientOnLogin);

        // 设置session
        RpcSession session = (RpcSession)Entity.getCacheData("RemoteSession");

        Entity.setSession((byte)_eUCenterNodeType.UCenter, session);
    }
コード例 #8
0
 internal SessionOpenedEventArgs(RpcSession session, IRpcConnection connection)
 {
     if (session == null)
     {
         throw new ArgumentNullException(nameof(session));
     }
     if (connection == null)
     {
         throw new ArgumentNullException(nameof(connection));
     }
     this.Session    = session;
     this.Connection = connection;
 }
コード例 #9
0
    //-------------------------------------------------------------------------
    // 响应登陆请求
    public void client2LoginLogin(RpcSession s, Dictionary <byte, object> map_param)
    {
        EbLog.Note("LoginUCenterSession.client2LoginLogin()");

        string account     = (string)map_param[0];
        string password    = (string)map_param[1];
        string serverGroup = (string)map_param[2];
        string channel     = (string)map_param[3];

        LoginApp <ComponentDef> login = EntityMgr.findFirstEntity("EtApp").getComponent <LoginApp <ComponentDef> >();

        login.addLoginPlayer(serverGroup, account, password, channel, this);
    }
コード例 #10
0
    //-------------------------------------------------------------------------
    public override void init()
    {
        EbLog.Note("LoginUCenterSession.init()");

        defRpcMethod((byte)_eUCenterNodeType.Client, (ushort)_eUCenterMethodType.client2LoginLogin, client2LoginLogin);

        // 设置session
        RpcSession session = (RpcSession)Entity.getCacheData("RemoteSession");

        Entity.setSession((byte)_eUCenterNodeType.Client, session);

        // Create Client Remote
        rpcOneCreateRemote((byte)_eUCenterNodeType.Client, false);
    }
コード例 #11
0
ファイル: PhotonClientPeer.cs プロジェクト: xubingyue/def
        //---------------------------------------------------------------------
        public PhotonClientPeer(EntityMgr entity_mgr, byte remote_node_type, RpcSessionListener listener)
            : base(ConnectionProtocol.Tcp)
        {
            Listener        = this;
            mEntityMgr      = entity_mgr;
            mRpcSession     = new RpcSession(mEntityMgr, this);
            mListener       = listener;
            mRemoteNodeType = remote_node_type;

            DebugOut = DebugLevel.ERROR;
            //WarningSize = 500;
            //CommandBufferSize = 500;
            //TrafficStatsEnabled = true;
            //this.IsSimulationEnabled = true;
            //NetworkSimulationSet NetworkSimulationSettings
        }
コード例 #12
0
ファイル: ClientUCenterSession.cs プロジェクト: xubingyue/def
    //-------------------------------------------------------------------------
    // 响应登陆请求
    public void login2ClientOnLogin(RpcSession s, Dictionary <byte, object> map_param)
    {
        EbLog.Note("ClientUCenterSession.login2ClientOnLogin()");

        string result = (string)map_param[0];
        string token  = (string)map_param[1];
        byte   count  = (byte)map_param[2];
        Dictionary <byte, object> param = new Dictionary <byte, object>();

        for (byte idx = 0; idx < count; idx++)
        {
            param[idx] = map_param[(byte)(3 + idx)];
        }

        mCoUCenter._onLogin(result, token, param);
    }
コード例 #13
0
ファイル: RpcUdpClient.cs プロジェクト: Agasper/Warden.NetRpc
        void OnSessionStarted(SessionOpenedEventArgs args)
        {
            this.Session = args.Session;

            try
            {
                OnSessionOpened(args);
            }
            catch (Exception e)
            {
                logger.Error($"Unhandled exception on {this.GetType().Name}.{nameof(OnSessionOpened)}: {e}");
            }

            try
            {
                OnSessionOpenedEvent?.Invoke(args);
            }
            catch (Exception e)
            {
                logger.Error($"Unhandled exception on {this.GetType().Name}.{nameof(OnSessionOpenedEvent)}: {e}");
            }
        }
コード例 #14
0
ファイル: RpcUdpClient.cs プロジェクト: Agasper/Warden.NetRpc
        void IRpcPeer.OnSessionClosed(SessionClosedEventArgs args)
        {
            this.Session = null;

            try
            {
                OnSessionClosed(args);
            }
            catch (Exception e)
            {
                logger.Error($"Unhandled exception on {this.GetType().Name}.{nameof(OnSessionClosed)}: {e}");
            }

            try
            {
                OnSessionClosedEvent?.Invoke(args);
            }
            catch (Exception e)
            {
                logger.Error($"Unhandled exception on {this.GetType().Name}.{nameof(OnSessionClosedEvent)}: {e}");
            }
        }
コード例 #15
0
ファイル: SessionHandler.cs プロジェクト: yuailong/GF.Gateway
 public override void OnDefRpcMethod()
 {
     RpcSession.defRpcMethod <int, string>(2, _onRpcMethod1);
 }
コード例 #16
0
 //-------------------------------------------------------------------------
 public void onSessionDisconnect(byte node_type_local, byte node_type_remote, RpcSession session)
 {
     EbLog.Note("ClientUCenter.onSessionDisconnect()");
 }
コード例 #17
0
 //-------------------------------------------------------------------------
 public override void onRpcPropSync(RpcSession session, byte from_node, ushort reason)
 {
 }
コード例 #18
0
ファイル: NetBridge.cs プロジェクト: LazyPlanet/CasinosClient
 //---------------------------------------------------------------------
 public void update(float tm)
 {
     RpcSession.update(tm);
 }
コード例 #19
0
ファイル: EcApp.cs プロジェクト: xubingyue/def
 //---------------------------------------------------------------------
 //[EntityRpcMethod(_eEtNode.Anonymous)],定义NodeType,与Rpc委托比较校验函数参数
 public void es2ecOnLogin(RpcSession s, Dictionary <byte, object> map_param)
 {
     EbLog.Note("EsApp.es2ecOnLogin()");
 }
コード例 #20
0
ファイル: EcApp.cs プロジェクト: xubingyue/def
 //---------------------------------------------------------------------
 // Interface: RpcSessionListener.onSessionDisconnect
 public void onSessionDisconnect(byte node_type_local, byte node_type_remote, RpcSession session)
 {
     EbLog.Note("EcApp.onSessionDisconnect() node_type_local=" + node_type_local
                + " node_type_remote=" + node_type_remote);
 }
コード例 #21
0
ファイル: NetBridge.cs プロジェクト: LazyPlanet/CasinosClient
 //---------------------------------------------------------------------
 public void disconnect()
 {
     RpcSession.close();
 }
コード例 #22
0
 //---------------------------------------------------------------------
 public void Send(ushort method_id, byte[] data)
 {
     RpcSession.Send(method_id, data);
 }
コード例 #23
0
 //---------------------------------------------------------------------
 public void Disconnect()
 {
     RpcSession.Close();
 }
コード例 #24
0
 //-------------------------------------------------------------------------
 public void onRpcNodeMethod(RpcSession session, byte from_node, ushort method_id, Dictionary <byte, object> map_param)
 {
 }
コード例 #25
0
 //---------------------------------------------------------------------
 public void Update(float tm)
 {
     RpcSession.Update(tm);
 }
コード例 #26
0
ファイル: EsApp.cs プロジェクト: xubingyue/def
 //---------------------------------------------------------------------
 public void nodeEc2EsLogin(RpcSession s, Dictionary <byte, object> map_param)
 {
     EbLog.Note("EsApp.nodeEc2EsLogin()");
 }
コード例 #27
0
 //-------------------------------------------------------------------------
 public Entity onRpcEntityCreateRemote(RpcSession session, EntityData entity_data, bool from_db)
 {
     return(null);
 }