Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        public ServerRoom(RoomId id, ContextsServerWrapper contextsServerWrapper, RoomEventDispatcher dispatcher,
                          IPlayerTokenGenerator playerTokenGenerator)
        {
            state               = RoomState.Initialized;
            isDisposed          = false;
            RoomId              = id;
            ContextsWrapper     = contextsServerWrapper;
            MessageDispatcher   = CreateNetworMessageHandlers();
            tokenGenerator      = playerTokenGenerator;
            eventDispatcher     = dispatcher;
            snapshotFactory     = new SnapshotFactory(ContextsWrapper.GameContexts);
            sessionStateMachine = new ServerSessionStateMachine(ContextsWrapper.contexts, this);
            damager             = new SimplePlayerDamager(this);
            compensationManager = new CompensationManager();

            VehicleDamageUtility._damager = damager;
            sendSnapshotManager           = new SendSnapshotManager(ContextsWrapper.contexts);
        }