public ContextsServerWrapper(Contexts contexts, IUnityAssetManager assetManager, ICoRoutineManager coRoutineManager) { var ruleId = RuleMap.GetRuleId(SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.Rule); this.contexts = contexts; #if (!ENTITASDISABLEVISUALDEBUGGING && UNITYEDITOR) this.contexts.InitializeContexObservers(); #endif SingletonManager.Get <MyProfilerManager>().Contexts = contexts; IBin2DManager bin2DManager = CreateBin2DManager(); IniCurrentTimeSession(); var entityIdGenerator = new EntityIdGenerator(EntityIdGenerator.GlobalBaseId); var equipmentEntityIdGenerator = new EntityIdGenerator(EntityIdGenerator.EquipmentBaseId); InitEntityFactorySession(entityIdGenerator, equipmentEntityIdGenerator); InitCommonSession(bin2DManager, entityIdGenerator, equipmentEntityIdGenerator, ruleId, assetManager, coRoutineManager); InitServerSession(bin2DManager, ruleId); contexts.vehicle.SetSimulationTime(0); InitialWeaponSkill(); }
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 ServerRoom(IRoomId roomId, Contexts contexts, IRoomEventDispatchter eventDispatcher, ICoRoutineManager coRoutineManager, IUnityAssetManager assetManager, IPlayerTokenGenerator tokenGenerator) { //SingletonManager.Get<ServerFileSystemConfigManager>().Reload(); _state = RoomState.Initialized; _tokenGenerator = tokenGenerator; _coRoutineManager = coRoutineManager; var entityIdGenerator = new EntityIdGenerator(EntityIdGenerator.GlobalBaseId); var equipmentEntityIdGenerator = new EntityIdGenerator(EntityIdGenerator.EquipmentBaseId); var ruleId = RuleMap.GetRuleId(SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.Rule); RoomId = roomId; _contexts = contexts; #if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) _contexts.InitializeContexObservers(); #endif SingletonManager.Get <MyProfilerManager>().Contexts = _contexts; _eventDispatcher = eventDispatcher; _bin2DManager = CreateBin2DManager(); IniCurrentTimeSession(); InitEntityFactorySession(entityIdGenerator, equipmentEntityIdGenerator); _assetManager = assetManager; InitCommonSession(entityIdGenerator, equipmentEntityIdGenerator, ruleId); InitServerSession(_bin2DManager, ruleId); _contexts.vehicle.SetSimulationTime(0); MessageDispatcher = CreateNetworMessageHandlers(); _snapshotFactory = new SnapshotFactory(_contexts.session.commonSession.GameContexts); _sessionStateMachine = new ServerSessionStateMachine(_contexts, this); _damager = new SimplePlayerDamager(this); VehicleDamageUtility._damager = _damager; _sendSnapshotManager = new SendSnapshotManager(_contexts); InitialWeaponSkill(); }