internal void Init(PBChannel channel) { channel_ = channel; channel_.Register <LNReq_Connect>(ConnectHandler); channel_.Register <LNReq_Load>(LoadHandler); LogSys.Log(LOG_TYPE.INFO, "DataScheduler initialized"); }
internal void Init(PBChannel channel) { m_DataStoreChannel = channel; channel.Register <Msg_DL_Connect>(OnConnectDataStore); channel.Register <Msg_DL_LoadResult>(OnLoadReply); channel.Register <Msg_DL_SaveResult>(OnSaveReply); }
internal void Init(PBChannel channel) { channel_ = channel; channel_.Register <LNReq_Connect>(ConnectHandler); channel_.Register <LNReq_Load>(LoadHandler); channel_.Register <LNReq_Save>(SaveHandler); InitDSNodeVersion(); LogSys.Log(LOG_TYPE.INFO, "DataOperator initialized"); }
internal void Init(PBChannel channel) { channel_ = channel; channel_.Register<Msg_LD_Connect>(DSConnectHandler); channel_.Register<Msg_LD_Load>(DSLoadHandler); channel_.Register<Msg_LD_Save>(DSSaveHandler); InitDSNodeVersion(); InitGlobalDataVersion(); LogSys.Log(LOG_TYPE.INFO, "DataOperator initialized"); }
internal void Init(PBChannel channel) { channel_ = channel; channel_.Register <Msg_LD_Connect>(DSConnectHandler); channel_.Register <Msg_LD_Load>(DSLoadHandler); channel_.Register <Msg_LD_Save>(DSSaveHandler); InitDSNodeVersion(); InitGlobalDataVersion(); LogSys.Log(LOG_TYPE.INFO, "DataOperator initialized"); }
public DataStoreClient(PBChannel channel, ArkCrossEngine.MyServerThread thread) { channel_ = channel; m_RunningThread = thread; channel_.Register <NLRep_Connect>(OnConnectReply); channel_.Register <NLRep_Save>(OnSaveReply); channel_.Register <NLRep_Load>(OnLoadReply); Config.Init(); current_status = ConnectStatus.None; loadOpt_timeout_ = new ArkCrossEngine.Timeout <LoadCBBox>(); loadOpt_timeout_.DefaultTimeoutMS = Config.DSRequestTimeout; saveOpt_timeout_ = new ArkCrossEngine.Timeout <SaveCallback>(); saveOpt_timeout_.DefaultTimeoutMS = Config.DSRequestTimeout; }
//-------------------------------------- internal void RegisterMsgHandler(PBChannel channel) { channel.Register <Msg_LR_EnterScene>(HandleEnterScene); channel.Register <Msg_LR_ChangeScene>(HandleChangeScene); channel.Register <Msg_LR_ActiveScene>(HandleActiveScene); channel.Register <Msg_LR_ReconnectUser>(HandleReconnectUser); channel.Register <Msg_LR_UserReLive>(HandleUserRelive); channel.Register <Msg_LR_UserQuit>(HandleUserQuit); channel.Register <Msg_LR_ReclaimItem>(HandleReclaimItem); channel.Register <Msg_LRL_StoryMessage>(HandleRoomStoryMessage); }
/// <summary> /// 注意,bigworld的消息已经分发到RoomProcessThread线程里进行处理,不需要再QueueAction到RoomProcessThread线程 /// </summary> private void InstallBigworldHandlers() { if (UserServerConfig.WorldIdNum > 0) { m_BigworldChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_BigworldChannel.WorldId = UserServerConfig.WorldId1; m_BigworldChannel.DefaultServiceName = "Lobby"; m_BigworldChannel.Register <Msg_LBL_Message>(HandleGeneralMessage); m_BigworldChannel.Register <Msg_BL_QueryUserStateResult>(HandleQueryUserStateResult); m_BigworldChannel.Register <Msg_BL_UserOffline>(HandleUserOffline); m_BigworldChannel.Register <Msg_BL_BroadcastText>(HandleBroadcastText); m_BigworldChannel.Register <Msg_BL_UserChangeScene>(HandleUserChangeScene); m_BigworldChannel.Register <Msg_RL_UserDrop>(HandleUserDrop); m_BigworldChannel.Register <Msg_RL_UserQuit>(HandleUserQuit); m_BigworldChannel.Register <Msg_RL_PickMoney>(HandlePickMoney); m_BigworldChannel.Register <Msg_RL_PickItem>(HandlePickItem); m_BigworldChannel.Register <Msg_LRL_StoryMessage>(HandleRoomStoryMessage); } }
public BillingClient(PBChannel channel, MyServerThread thread) { channel_ = channel; m_RunningThread = thread; channel_.Register <BL_VerifyAccountResult>(OnVerifyAccountResult); m_VerifyAccountTimeout = new Timeout <VerifyAccountCB>(); m_VerifyAccountTimeout.DefaultTimeoutMS = 10000; //超时时间 m_VerifyAccountWatch = new OperationWatch(); }
/// <summary> /// 注意,userserver来的消息在主线程处理,再分发到其它线程 /// </summary> private void InstallUserHandlers() { m_UserChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_UserChannel.Register <Msg_LBL_Message>(HandleGeneralMessage); m_UserChannel.Register <Msg_LB_UpdateUserServerInfo>(HandleUpdateUserServerInfo); m_UserChannel.Register <Msg_LB_QueryUserState>(HandleQueryUserState); m_UserChannel.Register <Msg_LB_UserOffline>(HandleUserOffline); m_UserChannel.Register <Msg_LB_UserRelogin>(HandleUserRelogin); m_UserChannel.Register <Msg_LB_RequestEnterScene>(HandleRequestEnterScene); m_UserChannel.Register <Msg_LRL_StoryMessage>(HandleStoryMessageFromUserServer); }
private void InstallServerHandlers() { m_RoomSvrChannel = new PBChannel(MessageMapping.Query, MessageMapping.Query); m_RoomSvrChannel.Register <Msg_RL_RegisterRoomServer>(HandleRegisterRoomServer); m_RoomSvrChannel.Register <Msg_RL_RoomServerUpdateInfo>(HandleRoomServerUpdateInfo); m_RoomSvrChannel.Register <Msg_RL_ReplyCreateBattleRoom>(HandelReplyCreateBattleRoom); m_RoomSvrChannel.Register <Msg_RL_UserQuit>(HandleUserQuit); m_RoomSvrChannel.Register <Msg_RL_ReplyReconnectUser>(HandelReplyReconnectUser); m_RoomSvrChannel.Register <Msg_RL_BattleEnd>(HandleBattleEnd); }
private void Init(string[] args) { m_NameHandleCallback = this.OnNameHandleChanged; m_MsgCallback = this.OnMessage; m_CmdCallback = this.OnCommand; m_MsgResultCallback = this.OnMessageResult; CenterClientApi.Init("bridge", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback); m_Channel = new PBChannel(DashFire.Billing.MessageMapping.Query, DashFire.Billing.MessageMapping.Query); m_Channel.DefaultServiceName = "Lobby"; m_Channel.Register <LB_VerifyAccount>(HandleVerifyAccount); LogSys.Init("./config/logconfig.xml"); StringBuilder sb = new StringBuilder(256); if (CenterClientApi.GetConfig("AppKey", sb, 256)) { m_AppKey = sb.ToString(); } if (CenterClientApi.GetConfig("AppSecret", sb, 256)) { m_AppSecret = sb.ToString(); } if (CenterClientApi.GetConfig("BillingServerUrl", sb, 256)) { m_BillingServerUrl = sb.ToString(); } if (CenterClientApi.GetConfig("TestBillingServerUrl", sb, 256)) { m_TestBillingServerUrl = sb.ToString(); } if (CenterClientApi.GetConfig("HttpRequestTimeout", sb, 256)) { m_HttpRequestTimeout = int.Parse(sb.ToString()); } LogSys.Log(LOG_TYPE.INFO, "BillingSystem initialized"); }
private void Init(string[] args) { m_NameHandleCallback = this.OnNameHandleChanged; m_MsgCallback = this.OnMessage; m_MsgResultCallback = this.OnMessageResultCallback; m_CmdCallback = this.OnCommand; m_LogHandler = this.OnCenterLog; CenterClientApi.SetCenterLogHandler(m_LogHandler); CenterClientApi.Init("roomserver", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback); Console.WriteLine("begin init roomserver..."); HomePath.InitHomePath(); bool ret = LogSys.Init("./config/logconfig.xml"); System.Diagnostics.Debug.Assert(ret); m_LastTickTimeForSend = TimeUtility.GetLocalMilliseconds(); m_LastSendRoomInfoTime = m_LastTickTimeForSend; m_IsContinueRegister = true; m_Channel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_Channel.DefaultServiceName = "Lobby"; m_LobbyConnector = new Connector(m_Channel); m_ServerIp = "127.0.0.1"; m_ServerPort = 9528; InitConfig(); GlobalVariables.Instance.IsClient = false; string key = "防君子不防小人"; byte[] xor = Encoding.UTF8.GetBytes(key); ResourceReadProxy.OnReadAsArray = ((string filePath) => { byte[] buffer = null; try { buffer = File.ReadAllBytes(filePath); } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace); return(null); } return(buffer); }); LogSystem.OnOutput += (Log_Type type, string msg) => { switch (type) { case Log_Type.LT_Debug: LogSys.Log(LOG_TYPE.DEBUG, msg); break; case Log_Type.LT_Info: LogSys.Log(LOG_TYPE.INFO, msg); break; case Log_Type.LT_Warn: LogSys.Log(LOG_TYPE.WARN, msg); break; case Log_Type.LT_Error: case Log_Type.LT_Assert: LogSys.Log(LOG_TYPE.ERROR, msg); break; } }; LoadData(); LogSys.Log(LOG_TYPE.DEBUG, "room server init ip: {0} port: {1}", m_ServerIp, m_ServerPort); uint tick_interval = 33; m_RoomMgr = new RoomManager(1280, c_ThreadCount, c_PerThreadRoomCount, tick_interval, m_LobbyConnector); m_RoomMgr.Init(m_RoomServerName); IOManager.Instance.Init((int)m_ServerPort); m_RoomMgr.StartRoomThread(); SceneLogicViewManager.Instance.Init(); ServerStorySystem.StaticInit(); GameFramework.GmCommands.GmStorySystem.StaticInit(); m_Channel.Register <Msg_LR_ReplyRegisterRoomServer>(HandleReplyRegisterRoomServer); m_RoomMgr.RegisterMsgHandler(m_Channel); LogSys.Log(LOG_TYPE.DEBUG, "room server init ok."); }
/// <summary> /// 注意,room来的消息已经分发到RoomProcessThread线程里进行处理,不需要再QueueAction到RoomProcessThread线程 /// </summary> private void InstallServerHandlers() { m_RoomSvrChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_RoomSvrChannel.Register <Msg_RL_RegisterRoomServer>(HandleRegisterRoomServer); m_RoomSvrChannel.Register <Msg_RL_RoomServerUpdateInfo>(HandleRoomServerUpdateInfo); m_RoomSvrChannel.Register <Msg_RL_EnterSceneResult>(HandleEnterSceneResult); m_RoomSvrChannel.Register <Msg_RL_ChangeScene>(HandleChangeScene); m_RoomSvrChannel.Register <Msg_RL_ChangeSceneResult>(HandleChangeSceneResult); m_RoomSvrChannel.Register <Msg_RL_ActiveScene>(HandleActiveScene); m_RoomSvrChannel.Register <Msg_RL_ActiveSceneResult>(HandleActiveSceneResult); m_RoomSvrChannel.Register <Msg_RL_UserDrop>(HandleUserDrop); m_RoomSvrChannel.Register <Msg_RL_ReplyReconnectUser>(HandelReplyReconnectUser); m_RoomSvrChannel.Register <Msg_RL_UserQuit>(HandleUserQuit); m_RoomSvrChannel.Register <Msg_RL_PickMoney>(HandlePickMoney); m_RoomSvrChannel.Register <Msg_RL_PickItem>(HandlePickItem); m_RoomSvrChannel.Register <Msg_LRL_StoryMessage>(HandleStoryMessageFromRoom); }
private void Init(string[] args) { m_NameHandleCallback = this.OnNameHandleChanged; m_MsgCallback = this.OnMessage; m_CmdCallback = this.OnCommand; m_MsgResultCallback = this.OnMessageResult; CenterClientApi.Init("roomserver", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback); Console.WriteLine("begin init roomserver..."); HomePath.InitHomePath(); bool ret = LogSys.Init("./config/logconfig.xml"); System.Diagnostics.Debug.Assert(ret); last_tick_time_ = TimeUtility.GetServerMilliseconds(); last_send_roominfo_time_ = last_tick_time_; is_continue_register_ = true; channel_ = new PBChannel(MessageMapping.Query, MessageMapping.Query); channel_.DefaultServiceName = "Lobby"; lobby_connector_ = new Connector(channel_); server_ip_ = "127.0.0.1"; server_port_ = 9528; StringBuilder sb = new StringBuilder(256); if (CenterClientApi.GetConfig("name", sb, 256)) { room_server_name_ = sb.ToString(); } if (CenterClientApi.GetConfig("ServerIp", sb, 256)) { server_ip_ = sb.ToString(); } if (CenterClientApi.GetConfig("ServerPort", sb, 256)) { server_port_ = uint.Parse(sb.ToString()); } if (CenterClientApi.GetConfig("Debug", sb, 256)) { int debug = int.Parse(sb.ToString()); if (debug != 0) { GlobalVariables.Instance.IsDebug = true; } } GlobalVariables.Instance.IsClient = false; FileReaderProxy.RegisterReadFileHandler((string filePath) => { byte[] buffer = null; try { buffer = File.ReadAllBytes(filePath); } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace); return(null); } return(buffer); }, (string filepath) => { return(File.Exists(filepath)); }); LogSystem.OnOutput += (Log_Type type, string msg) => { switch (type) { case Log_Type.LT_Debug: LogSys.Log(LOG_TYPE.DEBUG, msg); break; case Log_Type.LT_Info: LogSys.Log(LOG_TYPE.INFO, msg); break; case Log_Type.LT_Warn: LogSys.Log(LOG_TYPE.WARN, msg); break; case Log_Type.LT_Error: case Log_Type.LT_Assert: LogSys.Log(LOG_TYPE.ERROR, msg); break; } }; LoadData(); LogSys.Log(LOG_TYPE.DEBUG, "room server init ip: {0} port: {1}", server_ip_, server_port_); ret = Serialize.Init(); if (!ret) { LogSys.Log(LOG_TYPE.DEBUG, "Serialize init error !!!"); } else { LogSys.Log(LOG_TYPE.DEBUG, "Serialize init OK."); } thread_count_ = 16; per_thread_room_count_ = 20; uint tick_interval = 50; room_mgr_ = new RoomManager(thread_count_, per_thread_room_count_, tick_interval, lobby_connector_); room_mgr_.Init(); IOManager.Instance.Init((int)server_port_); room_mgr_.StartRoomThread(); AiViewManager.Instance.Init(); SceneLogicViewManager.Instance.Init(); ImpactViewManager.Instance.Init(); ServerSkillSystem.StaticInit(); ServerStorySystem.StaticInit(); DashFire.GmCommands.GmStorySystem.StaticInit(); channel_.Register <Msg_LR_ReplyRegisterRoomServer>(HandleReplyRegisterRoomServer); room_mgr_.RegisterMsgHandler(channel_); LogSys.Log(LOG_TYPE.DEBUG, "room server init ok."); }
/// <summary> /// 注意,bigworld的消息已经分发到RoomProcessThread线程里进行处理,不需要再QueueAction到RoomProcessThread线程 /// </summary> private void InstallBigworldHandlers() { if (UserServerConfig.WorldIdNum > 0) { m_BigworldChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_BigworldChannel.WorldId = UserServerConfig.WorldId1; m_BigworldChannel.DefaultServiceName = "Lobby"; m_BigworldChannel.Register<Msg_LBL_Message>(HandleGeneralMessage); m_BigworldChannel.Register<Msg_BL_QueryUserStateResult>(HandleQueryUserStateResult); m_BigworldChannel.Register<Msg_BL_UserOffline>(HandleUserOffline); m_BigworldChannel.Register<Msg_BL_BroadcastText>(HandleBroadcastText); m_BigworldChannel.Register<Msg_BL_UserChangeScene>(HandleUserChangeScene); m_BigworldChannel.Register<Msg_RL_UserDrop>(HandleUserDrop); m_BigworldChannel.Register<Msg_RL_UserQuit>(HandleUserQuit); m_BigworldChannel.Register<Msg_RL_PickMoney>(HandlePickMoney); m_BigworldChannel.Register<Msg_RL_PickItem>(HandlePickItem); m_BigworldChannel.Register<Msg_LRL_StoryMessage>(HandleRoomStoryMessage); } }
/// <summary> /// 注意,userserver来的消息在主线程处理,再分发到其它线程 /// </summary> private void InstallUserHandlers() { m_UserChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_UserChannel.Register<Msg_LBL_Message>(HandleGeneralMessage); m_UserChannel.Register<Msg_LB_UpdateUserServerInfo>(HandleUpdateUserServerInfo); m_UserChannel.Register<Msg_LB_QueryUserState>(HandleQueryUserState); m_UserChannel.Register<Msg_LB_UserOffline>(HandleUserOffline); m_UserChannel.Register<Msg_LB_UserRelogin>(HandleUserRelogin); m_UserChannel.Register<Msg_LB_RequestEnterScene>(HandleRequestEnterScene); m_UserChannel.Register<Msg_LRL_StoryMessage>(HandleStoryMessageFromUserServer); }
//-------------------------------------- internal void RegisterMsgHandler(PBChannel channel) { channel.Register <Msg_LR_CreateBattleRoom>(HandleCreateBattleRoom); channel.Register <Msg_LR_ReconnectUser>(HandleReconnectUser); channel.Register <Msg_LR_UserReLive>(HandleUserRelive); }
private void Init(string[] args) { m_NameHandleCallback = this.OnNameHandleChanged; m_MsgCallback = this.OnMessage; m_MsgResultCallback = this.OnMessageResultCallback; m_CmdCallback = this.OnCommand; m_LogHandler = this.OnCenterLog; CenterClientApi.SetCenterLogHandler(m_LogHandler); CenterClientApi.Init("roomserver", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback); Console.WriteLine("begin init roomserver..."); HomePath.InitHomePath(); bool ret = LogSys.Init("./config/logconfig.xml"); System.Diagnostics.Debug.Assert(ret); last_tick_time_ = TimeUtility.GetLocalMilliseconds(); last_send_roominfo_time_ = last_tick_time_; is_continue_register_ = true; channel_ = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); channel_.DefaultServiceName = "Lobby"; lobby_connector_ = new Connector(channel_); server_ip_ = "127.0.0.1"; server_port_ = 9528; InitConfig(); GlobalVariables.Instance.IsClient = false; string key = "防君子不防小人"; byte[] xor = Encoding.UTF8.GetBytes(key); ResourceReadProxy.OnReadAsArray = ((string filePath) => { byte[] buffer = null; try { buffer = File.ReadAllBytes(filePath); } catch (Exception e) { LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace); return null; } return buffer; }); LogSystem.OnOutput += (Log_Type type, string msg) => { switch (type) { case Log_Type.LT_Debug: LogSys.Log(LOG_TYPE.DEBUG, msg); break; case Log_Type.LT_Info: LogSys.Log(LOG_TYPE.INFO, msg); break; case Log_Type.LT_Warn: LogSys.Log(LOG_TYPE.WARN, msg); break; case Log_Type.LT_Error: case Log_Type.LT_Assert: LogSys.Log(LOG_TYPE.ERROR, msg); break; } }; LoadData(); LogSys.Log(LOG_TYPE.DEBUG, "room server init ip: {0} port: {1}", server_ip_, server_port_); uint tick_interval = 33; room_mgr_ = new RoomManager(1280, c_thread_count, c_per_thread_room_count, tick_interval, lobby_connector_); room_mgr_.Init(room_server_name_); IOManager.Instance.Init((int)server_port_); room_mgr_.StartRoomThread(); AiViewManager.Instance.Init(); SceneLogicViewManager.Instance.Init(); ServerStorySystem.StaticInit(); GameFramework.GmCommands.GmStorySystem.StaticInit(); channel_.Register<Msg_LR_ReplyRegisterRoomServer>(HandleReplyRegisterRoomServer); room_mgr_.RegisterMsgHandler(channel_); LogSys.Log(LOG_TYPE.DEBUG, "room server init ok."); }
/// <summary> /// 注意,room来的消息已经分发到RoomProcessThread线程里进行处理,不需要再QueueAction到RoomProcessThread线程 /// </summary> private void InstallServerHandlers() { m_RoomSvrChannel = new PBChannel(BigworldAndRoomServerMessageEnum2Type.Query, BigworldAndRoomServerMessageEnum2Type.Query); m_RoomSvrChannel.Register<Msg_RL_RegisterRoomServer>(HandleRegisterRoomServer); m_RoomSvrChannel.Register<Msg_RL_RoomServerUpdateInfo>(HandleRoomServerUpdateInfo); m_RoomSvrChannel.Register<Msg_RL_EnterSceneResult>(HandleEnterSceneResult); m_RoomSvrChannel.Register<Msg_RL_ChangeScene>(HandleChangeScene); m_RoomSvrChannel.Register<Msg_RL_ChangeSceneResult>(HandleChangeSceneResult); m_RoomSvrChannel.Register<Msg_RL_ActiveScene>(HandleActiveScene); m_RoomSvrChannel.Register<Msg_RL_ActiveSceneResult>(HandleActiveSceneResult); m_RoomSvrChannel.Register<Msg_RL_UserDrop>(HandleUserDrop); m_RoomSvrChannel.Register<Msg_RL_ReplyReconnectUser>(HandelReplyReconnectUser); m_RoomSvrChannel.Register<Msg_RL_UserQuit>(HandleUserQuit); m_RoomSvrChannel.Register<Msg_RL_PickMoney>(HandlePickMoney); m_RoomSvrChannel.Register<Msg_RL_PickItem>(HandlePickItem); m_RoomSvrChannel.Register<Msg_LRL_StoryMessage>(HandleStoryMessageFromRoom); }
//-------------------------------------- internal void RegisterMsgHandler(PBChannel channel) { channel.Register<Msg_LR_EnterScene>(HandleEnterScene); channel.Register<Msg_LR_ChangeScene>(HandleChangeScene); channel.Register<Msg_LR_ActiveScene>(HandleActiveScene); channel.Register<Msg_LR_ReconnectUser>(HandleReconnectUser); channel.Register<Msg_LR_UserReLive>(HandleUserRelive); channel.Register<Msg_LR_UserQuit>(HandleUserQuit); channel.Register<Msg_LR_ReclaimItem>(HandleReclaimItem); channel.Register<Msg_LRL_StoryMessage>(HandleRoomStoryMessage); }