rename cs(std::wstring, System.String); global Simple 1000 { RequestLogin([in] std::wstring id, [in] std::wstring password); NotifyLoginSuccess(); NotifyLoginFailed([in] std::wstring reason); } |
class SimpleServer :public Simple::Stub { public: Simple:: Proxy m_proxy; |
m_netServer->AttachProxy(&m_proxy); m_netServer->AttachStub(this); |
Simple.Proxy m_proxy = new Simple.Proxy(); Simple.Stub m_stub = new Simple.Stub(); |
m_netClient.AttachProxy(m_proxy); m_netClient.AttachStub(m_stub); |
m_netClient.JoinServerCompleteHandler = (ErrorInfo info, ByteArray replyFromServer) => { if (info.errorType == ErrorType.ErrorType_Ok) { m_proxy.RequestLogin(HostID.HostID_Server, RmiContext.SecureReliableSend, m_userID, m_password); // (1) m_state = MyState.Connecting; |
class SimpleServer { DECRMI_Simple_RequestLogin; |
DEFRMI_Simple_RequestLogin(SimpleServer) { cout << "RequestLogin " << StringT2A(id.c_str()) << " " << StringT2A(password.c_str()) << endl; // success! m_proxy.NotifyLoginSuccess(remote, RmiContext::ReliableSend); return true; } |
m_stub.NotifyLoginSuccess = (HostID remote, RmiContext rmiContext) => { m_state = MyState.Connected; return true; }; m_stub.NotifyLoginFailed = (HostID remote, RmiContext rmiContext, System.String reason) => { Debug.Log(reason); m_disconnectNow = true; return true; }; |
class NetManager { void Update() { if (m_disconnectNow) { m_netClient.Disconnect(); m_state = MyState.Disconnected; m_disconnectNow = false; } |
登录 后参与讨论
暂无评论,来抢沙发








