public ServerSessionStateMachine(Contexts contexts, ServerRoom room) : base(new ServerSessionStateMachineMonitor(room)) { BackroundloadSettings defaultSettings = BackroundloadSettings.GetServerCurrentSettings(); AddState(new ServerLoadConfigurationState(contexts, EServerSessionStates.LoadConfig, EServerSessionStates.LoadSubResourceConfig) .WithEnterAction(() => { BackroundloadSettings.SetCurrentSettings(BackroundloadSettings.LoadSettsings); //Application.targetFrameRate = 1000; _logger.WarnFormat("LoadConfig backgroundLoadingPriority:{0}, targetFrameRate:{1}", Application.backgroundLoadingPriority, Application.targetFrameRate); }) ); AddState(new ServerLoadSubResourceState(contexts, EServerSessionStates.LoadSubResourceConfig, EServerSessionStates.PreLoad)); AddState(new ServerPreLoadState(contexts, EServerSessionStates.PreLoad, EServerSessionStates.LoadSceneMapConfig)); AddState(new ServerLoadMapConfigState(contexts, EServerSessionStates.LoadSceneMapConfig, EServerSessionStates.Gaming)); AddState(new GameSessionState(contexts, room, EServerSessionStates.Gaming, EServerSessionStates.Gaming) .WithEnterAction(() => { BackroundloadSettings.SetCurrentSettings(defaultSettings); //Application.targetFrameRate = SharedConfig.ServerFrameRate; _logger.WarnFormat("Gaming backgroundLoadingPriority:{0}, targetFrameRate:{1}", Application.backgroundLoadingPriority, Application.targetFrameRate); }) ); Initialize((int)EServerSessionStates.LoadConfig); }
public ServerSessionStateMachine(Contexts contexts, ServerRoom room) : base(new ServerSessionStateMachineMonitor(contexts, room)) { AddState(new ServerLoadConfigurationState(contexts, EServerSessionStates.LoadConfig, EServerSessionStates.LoadSubResourceConfig)); AddState(new ServerLoadSubResourceState(contexts, EServerSessionStates.LoadSubResourceConfig, EServerSessionStates.PreLoad)); AddState(new ServerPreLoadState(contexts, EServerSessionStates.PreLoad, EServerSessionStates.LoadSceneMapConfig)); AddState(new ServerLoadMapConfigState(contexts, EServerSessionStates.LoadSceneMapConfig, EServerSessionStates.Gaming)); AddState(new GameSessionState(contexts, room, EServerSessionStates.Gaming, EServerSessionStates.Gaming)); Initialize((int)EServerSessionStates.LoadConfig); }
public ServerRoom Create(RequestCreateRoomMessage message) { _logger.InfoFormat("Handle CreateRoom Message"); var serverRoom = new ServerRoom(new RoomId(1), _contexts, _dispatcher, _coRouitneManager, _assetMananger, _tokenGenerator); ResetEventDispacther(); if (message != null) { HallRoom hallRoom = new HallRoom(_dispatcher, _contexts); hallRoom.HallRoomId = message.HallRoomId; hallRoom.ModeId = message.ModeId; hallRoom.TeamCapacity = message.TeamCapacity; hallRoom.MapId = message.MapId; hallRoom.RevivalTime = message.RevivalTime; hallRoom.MultiAngleStatus = message.MultiAngleStatus; hallRoom.WatchStatus = message.WatchStatus; hallRoom.HelpStatus = message.HelpStatus; hallRoom.HasFriendHarm = message.HasFriendHarm; hallRoom.WaitTimeNum = message.WaitTimeNum; hallRoom.OverTime = message.OverTime; hallRoom.ConditionValue = message.ConditionValue; hallRoom.ConditionType = message.ConditionType; hallRoom.ChannelName = message.ChannelName; hallRoom.RoomName = message.CustomRoomName; hallRoom.RoomCapacity = message.CustomRoomCapacity; hallRoom.RoomDisplayId = (int)message.CustomRoomDisplayId; hallRoom.Init(); serverRoom.SetHallRoom(hallRoom); serverRoom.SetRoomInfo(hallRoom); serverRoom.SetGameMode(message.ModeId); _logger.InfoFormat("Create Room {0}", message.MapId); } else { //serverRoom.SetHallRoom(new DummyHallRoom(_dispatcher, _contexts)); HallRoom hallRoom = new DummyHallRoom(_dispatcher, _contexts); hallRoom.Init(); serverRoom.SetHallRoom(hallRoom); serverRoom.SetGameMode(RuleMap.GetRuleId(SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.Rule)); } //serverRoom.Reset(); return(serverRoom); }
public void OnDebugMessage(ServerRoom room, DebugCommand message, PlayerEntity player, SessionStateMachine sessionStateMachine) { FreeDebugCommandHandler.Handle(room.ContextsWrapper.FreeArgs, message, player); SharedCommandHandler.ProcessGameSettingCommnands(message, sessionStateMachine); SharedCommandHandler.ProcessDebugCommand(message, _contexts); SharedCommandHandler.ProcessHitBoxCommands(message); SharedCommandHandler.ProcessPlayerCommands(message, _contexts, player, _contexts.session.commonSession, _contexts.session.currentTimeObject); SharedCommandHandler.ProcessVehicleCommand(message, _contexts.vehicle, player); SharedCommandHandler.ProcessSceneObjectCommand(message, _contexts.sceneObject, _contexts.session.entityFactoryObject.SceneObjectEntityFactory, player); SharedCommandHandler.ProcessMapObjectCommand(message, _contexts.mapObject, _contexts.session.entityFactoryObject.MapObjectEntityFactory, player); SharedCommandHandler.ProcessCommands(message, _contexts, player); }
public ServerSessionStateMachine(Contexts contexts, ServerRoom room) : base( new ServerSessionStateMachineMonitor(room)) { BackroundloadSettings defaultSettings = BackroundloadSettings.GetServerCurrentSettings(); AddState(new ServerLoadConfigurationState(contexts, EServerSessionStates.LoadConfig, EServerSessionStates.LoadSubResourceConfig).WithEnterAction(() => { BackroundloadSettings.SetCurrentSettings(BackroundloadSettings.LoadSettsings); //Application.targetFrameRate = 1000; _logger.WarnFormat("LoadConfig backgroundLoadingPriority:{0}, targetFrameRate:{1}", Application.backgroundLoadingPriority, Application.targetFrameRate); })); AddState(new ServerLoadSubResourceState(contexts, EServerSessionStates.LoadSubResourceConfig, EServerSessionStates.PreLoad)); AddState(new ServerPreLoadState(contexts, EServerSessionStates.PreLoad, EServerSessionStates.LoadOptionConfig)); AddState(new ServerOptionLoadState(contexts, EServerSessionStates.LoadOptionConfig, EServerSessionStates.LoadSceneMapConfig)); AddState(new ServerLoadMapConfigState(contexts, EServerSessionStates.LoadSceneMapConfig, EServerSessionStates.Gaming)); AddState(new GameSessionState(contexts, room, EServerSessionStates.Gaming, EServerSessionStates.Gaming) .WithEnterAction(() => { BackroundloadSettings.SetCurrentSettings(defaultSettings); if (SharedConfig.DisableGc) { SingletonManager.Get <gc_manager>().disable_gc(); SingletonManager.Get <gc_manager>().manual_gc_factor_threshold = 2.5f; SingletonManager.Get <gc_manager>().manual_gc_bytes_threshold_mb = 1500; SingletonManager.Get <gc_manager>().manual_gc_min_time_delta_seconds = 60; } SingletonManager.Get <gc_manager>().gc_collect(); //Application.targetFrameRate = SharedConfig.ServerFrameRate; _logger.WarnFormat("Gaming backgroundLoadingPriority:{0}, targetFrameRate:{1}", Application.backgroundLoadingPriority, Application.targetFrameRate); }).WithLevelAction(() => { if (SharedConfig.DisableGc) { SingletonManager.Get <gc_manager>().enable_gc(); } SingletonManager.Get <gc_manager>().gc_collect(); })); Initialize((int)EServerSessionStates.LoadConfig); }
public GameSessionState(IContexts contexts, ServerRoom room, EServerSessionStates state, EServerSessionStates next) : base(contexts, (int)state, (int)next) { this.room = room; }
public ServerSessionStateMachineMonitor(ServerRoom room) { AddMonitor(new ServerSessionStateProgress(room)); }
public ServerSessionStateProgress(ServerRoom room) { _room = room; }