using FL.Network; using XGame.Framework.Network; using XGame.Framework.Nodes; namespace FL.Nodes.Network { public class SessionComponent : NodeComponent, INetModuleListener { INetModule _netModule; public override void OnEnable(object intent) { _netModule = NetModule.Init(Context.Time, new FLMsgGenerator(), this); _netModule.Connect(new AddressInfo() { Address = "flkaifa.xmsgame.com", Port = 4001, ProtocolType = ProtocolType.WSS }); } public override void OnDisable() { _netModule = null; NetModule.Dispose(); } void INetModuleListener.OnHeartbeatTimeout() { throw new System.NotImplementedException(); } void INetModuleListener.OnConnectStart() { XGame.Log.Info($"OnConnectStart"); } void INetModuleListener.OnConnected() { XGame.Log.Info($"OnConnected"); //_netModule.StartHeartbeat(); //NetModule.Request(new PlayerLoginRequest() //{ // pid = "1", //}); } void INetModuleListener.OnDisconnected() { XGame.Log.Info($"OnDisconnected"); } void INetModuleListener.OnSessionError(SessionEventArgs args) { XGame.Log.Info($"OnSessionError Args:{args}"); } void INetModuleListener.OnRequest(RequestEventArgs args) { XGame.Log.Info($"OnRequest Args:{args}"); } void INetModuleListener.OnResponseSeqError(int seqId, int requestId, int responseId) { XGame.Log.Info($"OnResponseSeqError seqId:{seqId} requestId:{requestId} responseId:{responseId}"); } void INetModuleListener.OnResponseFinish(ResponseEventArgs args) { XGame.Log.Info($"OnResponseFinish args:{args}"); } } }