public WeaponFireScriptsUtil( Contexts contexts, IEntityIdGenerator entityIdGenerator) { _contexts = contexts; _entityIdGenerator = entityIdGenerator; }
public static void CreateBulletDrop(ClientEffectContext context, IEntityIdGenerator idGenerator, EntityKey owner, Vector3 position, float Yaw, float pitch, int effectId, int weaponId, AudioGrp_FootMatType dropMatType) { while (_bulletDropEntities.Count >= SingletonManager.Get <ClientEffectCommonConfigManager>().GetBulletDropMaxCount(SharedConfig.IsServer)) { var val = _bulletDropEntities.First.Value; if (val.isEnabled) { val.isFlagDestroy = true; } _bulletDropEntities.RemoveFirst(); } var type = (int)EClientEffectType.BulletDrop; var entity = CreateBaseEntity(context, idGenerator, position, type); entity.AddEffectId(effectId); entity.AddOwnerId(owner); entity.lifeTime.LifeTime = SingletonManager.Get <ClientEffectCommonConfigManager>().BulletDropLifeTime; entity.AddAudio((int)AudioClientEffectType.BulletDrop); entity.audio.AudioClientEffectArg1 = SingletonManager.Get <AudioWeaponManager>().FindById(weaponId).BulletDrop; entity.audio.AudioClientEffectArg2 = (int)dropMatType; entity.AddEffectRotation(Yaw, pitch); entity.AddFlagImmutability(0); _bulletDropEntities.AddLast(entity); }
public PlayerBulletGenerateSystem(Contexts contexts) { _contexts = contexts; _bulletContext = contexts.bullet; _entityIdGenerator = contexts.session.commonSession.EntityIdGenerator; // SingletonManager.Get<WeaponResourceConfigManager>() = weaponConfigManager; }
public static ThrowingEntity CreateThrowingEntity( ThrowingContext throwingContext, IEntityIdGenerator entityIdGenerator, PlayerEntity playerEntity, int serverTime, Vector3 dir, float initVel, NewWeaponConfigItem newWeaponConfig, ThrowingConfig throwingConfig) { int throwingEntityId = entityIdGenerator.GetNextEntityId(); var emitPost = PlayerEntityUtility.GetThrowingEmitPosition(playerEntity); Vector3 velocity = dir * initVel; var throwingEntity = throwingContext.CreateEntity(); throwingEntity.AddEntityKey(new EntityKey(throwingEntityId, (int)EEntityType.Throwing)); throwingEntity.AddThrowingData( velocity, false, false, 0, serverTime, false, initVel, throwingConfig, newWeaponConfig.SubType ); throwingEntity.AddPosition(emitPost); throwingEntity.AddOwnerId(playerEntity.entityKey.Value); throwingEntity.isFlagSyncNonSelf = true; throwingEntity.AddLifeTime(DateTime.Now, throwingConfig.CountdownTime + 2000); return(throwingEntity); }
/// <summary> /// create spray paint /// </summary> /// <param name="context"></param> /// <param name="entityIdGenerator"></param> /// <param name="sprayPaintPos">起始位置</param> /// <param name="sprayPaintForward">朝向</param> /// <param name="sprayPrintMask">掩码</param> /// <param name="sprayPrintSize">大小</param> /// <param name="sprayPrintType">类型</param> /// <param name="sprayPrintSpriteId">贴图</param> /// <param name="lifeTime">生命周期</param> public static void CreateSprayPaint(ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 sprayPaintPos, Vector3 sprayPaintForward, int sprayPrintMask, Vector3 sprayPrintSize, ESprayPrintType sprayPrintType, int sprayPrintSpriteId, int lifeTime ) { int type = (int)EClientEffectType.SprayPrint; var effectEntity = context.CreateEntity(); var nextId = entityIdGenerator.GetNextEntityId(); effectEntity.AddEntityKey(new EntityKey(nextId, (int)EEntityType.ClientEffect)); effectEntity.AddPosition(); effectEntity.position.Value = sprayPaintPos; effectEntity.AddSprayPaint(); effectEntity.sprayPaint.SprayPaintPos = sprayPaintPos; effectEntity.sprayPaint.SprayPaintForward = sprayPaintForward; effectEntity.sprayPaint.SprayPrintMask = sprayPrintMask; effectEntity.sprayPaint.SprayPrintSize = sprayPrintSize; effectEntity.sprayPaint.SprayPrintType = (int)sprayPrintType; effectEntity.sprayPaint.SprayPrintSpriteId = sprayPrintSpriteId; effectEntity.AddEffectType(type); effectEntity.AddAssets(false, false); effectEntity.AddLifeTime(DateTime.Now, lifeTime); effectEntity.isFlagSyncNonSelf = true; /*effectEntity.lifeTime.LifeTime = SingletonManager.Get<ClientEffectCommonConfigManager>().DecayLifeTime;*/ effectEntity.AddFlagImmutability(0); }
public static PlayerEntity CreateNewServerPlayerEntity(PlayerContext playerContext, ICommonSessionObjects commonSessionObjects, IEntityIdGenerator entityIdGenerator, Vector3 position, IPlayerInfo playerInfo, bool allowReconnect) { if (allowReconnect) { var players = playerContext.GetEntitiesWithPlayerToken(playerInfo.Token); foreach (var player in players) { player.userCmdSeq.LastCmdSeq = 0; player.latestAdjustCmd.ClientSeq = -1; player.latestAdjustCmd.ServerSeq = -1; player.time.ClientTime = 0; player.vehicleCmdSeq.LastCmdSeq = 0; return(player); } } var entityId = entityIdGenerator.GetNextEntityId(); playerInfo.EntityId = entityId; var playerEntity = CreateNewPlayerEntity(playerContext, position, playerInfo, true, false); // 在角色Entity上追加 KeepWatchForAOIComponent,以记录 视线内残留对象 以及 其加入字典的时间 // 只应用于Server playerEntity.AddKeepWatchForAOI(new Util.WatchDict(playerEntity.entityKey.Value)); return(playerEntity); }
public static PlayerEntity CreateNewServerPlayerEntity(PlayerContext playerContext, ICommonSessionObjects commonSessionObjects, IEntityIdGenerator entityIdGenerator, Vector3 position, IPlayerInfo playerInfo, bool allowReconnect) { if (allowReconnect) { var players = playerContext.GetEntitiesWithPlayerToken(playerInfo.Token); foreach (var player in players) { player.userCmdSeq.LastCmdSeq = 0; player.latestAdjustCmd.ClientSeq = -1; player.latestAdjustCmd.ServerSeq = -1; player.time.ClientTime = 0; player.vehicleCmdSeq.LastCmdSeq = 0; return(player); } } var entityId = entityIdGenerator.GetNextEntityId(); playerInfo.EntityId = entityId; return(CreateNewPlayerEntity(playerContext, position, playerInfo, true, false)); }
public AfterFireEffectEventListener(ClientEffectContext context, IEntityIdGenerator idGenerator, WeaponEffectConfig config) { _config = config; _context = context; _idGenerator = idGenerator; }
public WeaponLogicComponentsFactory( Contexts contexts, IEntityIdGenerator entityIdGenerator) { _contexts = contexts; _entityIdGenerator = entityIdGenerator; }
public ThrowingFactory(ThrowingContext throwingContext, IEntityIdGenerator entityIdGenerator, WeaponResConfigItem newWeaponConfig, ThrowingConfig throwingConfig) { _throwingContext = throwingContext; _entityIdGenerator = entityIdGenerator; _newWeaponConfig = newWeaponConfig; _config = throwingConfig; }
public ServerSoundEntityFactory(SoundContext context, PlayerContext playerContext, IEntityIdGenerator idGenerator, ICurrentTime currentTime, ISoundConfigManager soundConfigManager) : base(context, idGenerator, currentTime, soundConfigManager) { _playerContext = playerContext; }
public EmployeeCreate(ICommandDispatcher dispatcher, IEntityIdGenerator generator) { Guard.Against.Null(dispatcher, nameof(dispatcher)); Guard.Against.Null(generator, nameof(generator)); this.dispatcher = dispatcher; this.generator = generator; }
public void Execute() { if (SharedConfig.IsOffline) { if (!_loginSended) { _loginSended = true; var sessionObjects = _contexts.session.commonSession; IEntityIdGenerator idGenerator = sessionObjects.EntityIdGenerator; var id = idGenerator.GetNextEntityId(); var _offlineSelector = new OfflineSnapshotSelector(new EntityKey(id, (int)EEntityType.Player), _contexts.session.commonSession.GameContexts); _contexts.session.clientSessionObjects.SnapshotSelectorContainer.SnapshotSelector = _offlineSelector; _contexts.session.clientSessionObjects.SimulationTimer.CurrentTime = 0; _contexts.session.entityFactoryObject.SceneObjectEntityFactory = new ServerSceneObjectEntityFactory( _contexts.sceneObject, _contexts.player, sessionObjects.EntityIdGenerator, sessionObjects.EntityIdGenerator, _contexts.session.currentTimeObject); _contexts.session.entityFactoryObject.MapObjectEntityFactory = new ServerMapObjectEntityFactory(_contexts.mapObject, sessionObjects.EntityIdGenerator); IPlayerInfo playerInfo = TestUtility.CreateTestPlayer(); playerInfo.EntityId = id; var player = PlayerEntityFactory.CreateNewPlayerEntity(_contexts.player, SingletonManager.Get <MapsDescription>().SceneParameters.PlayerBirthPosition, playerInfo, true, false); _offlineSelector.Init(); _sessionState.FullfillExitCondition(typeof(RequestPlayerInfoSystem)); SingletonManager.Get <SubProgressBlackBoard>().Step(); } } else { var channel = _contexts.session.clientSessionObjects.NetworkChannel; var token = _contexts.session.clientSessionObjects.LoginToken; if (channel != null && channel.IsConnected) { if (!_loginSended) { _loginSended = true; var message = LoginMessage.Allocate(); message.Token = token; message.LoginStage = ELoginStage.GetPlayerInfo; message.ComponentSerializerVersion = ComponentSerializerManager.HashMd5; channel.SendReliable((int)EClient2ServerMessage.Login, message); _logger.InfoFormat("Sending Login Message {0}", message); message.ReleaseReference(); } if (_loginSuccReceived) { _sessionState.FullfillExitCondition(typeof(RequestPlayerInfoSystem)); SingletonManager.Get <SubProgressBlackBoard>().Step(); } } } }
private static void CreateHitEmitEffect( ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 hitPoint, Vector3 normal, EntityKey owner, EEnvironmentType environmentType) { int type = (int)EClientEffectType.End; AudioGrp_HitMatType audioGrpHitMatType = AudioGrp_HitMatType.Concrete; switch (environmentType) { case EEnvironmentType.Wood: type = (int)EClientEffectType.WoodHit; audioGrpHitMatType = AudioGrp_HitMatType.Wood; break; case EEnvironmentType.Steel: type = (int)EClientEffectType.SteelHit; audioGrpHitMatType = AudioGrp_HitMatType.Metal; break; case EEnvironmentType.Soil: type = (int)EClientEffectType.SoilHit; break; case EEnvironmentType.Stone: type = (int)EClientEffectType.StoneHit; break; case EEnvironmentType.Glass: type = (int)EClientEffectType.GlassHit; break; case EEnvironmentType.Water: type = (int)EClientEffectType.WaterHit; audioGrpHitMatType = AudioGrp_HitMatType.Water; break; default: type = (int)EClientEffectType.DefaultHit; break; } var effectEntity = CreateBaseEntity(context, entityIdGenerator, hitPoint, type); effectEntity.AddOwnerId(owner); effectEntity.AddNormal(normal); effectEntity.AddAudio((int)AudioClientEffectType.BulletHit); effectEntity.audio.AudioClientEffectArg1 = (int)audioGrpHitMatType; effectEntity.lifeTime.LifeTime = SingletonManager.Get <ClientEffectCommonConfigManager>().DecayLifeTime; effectEntity.AddFlagImmutability(0); effectEntity.isFlagSyncNonSelf = false; }
public void CreateVehicles(IEntityIdGenerator idGenerator) { var vehicles = VehicleEntityUtility.CreateVehicles(_contexts.session.commonSession.RoomInfo.MapId, _contexts.vehicle, idGenerator); foreach (var vehicle in vehicles) { vehicle.isFlagOffline = true; } }
public ServerSceneObjectEntityFactory(SceneObjectContext sceneObjectContext, IEntityIdGenerator entityIdGenerator, IEntityIdGenerator equipGenerator, ICurrentTime currentTime) { _sceneObjectContext = sceneObjectContext; _idGenerator = entityIdGenerator; _equipGenerator = equipGenerator; _currentTime = currentTime; }
public ClientSoundEntityFactory(SoundContext context, IEntityIdGenerator idGenerator, ICurrentTime currentTime, ISoundConfigManager soundConfigManager) { _soundContext = context; _idGenerator = idGenerator; _currentTime = currentTime; _soundConfigManager = soundConfigManager; }
public EntityObject(EntityType entityType, IEntityIdGenerator entityIdGenerator, IEntityChanged entityChanged) { _entityChanged = entityChanged; EntityType = entityType; if (entityType == null) { throw new ArgumentNullException(); } _fieldsKeyValue["id"] = entityIdGenerator.GetNextId(entityType.Name); }
public BulletFactory(BulletContext bulletContext, IEntityIdGenerator entityIdGenerator, ISoundEntityFactory soundEntityFactory, IBulletEntityFactory bulletEntityFactory, BulletConfig bulletConfig) : base(bulletConfig) { _bulletContext = bulletContext; _entityIdGenerator = entityIdGenerator; _soundEntityFacotry = soundEntityFactory; _bulletEntityFactory = bulletEntityFactory; }
public static PlayerEntity CreateNewServerPlayerEntity(PlayerContext playerContext, ICommonSessionObjects commonSessionObjects, IEntityIdGenerator entityIdGenerator, Vector3 position, IPlayerInfo playerInfo) { var entityId = entityIdGenerator.GetNextEntityId(); playerInfo.EntityId = entityId; return(CreateNewPlayerEntity(playerContext, commonSessionObjects.WeaponModeLogic, position, playerInfo, true, false)); }
public BulletHitHandler(Contexts contexts, IEntityIdGenerator entityIdGenerator, IPlayerDamager damager) { AbstractHitHandler handler = new HitHumanHandler(damager, contexts); hitTargetHandlers.Add(handler); handler = new HitVehicleHandler(contexts); hitTargetHandlers.Add(handler); handler = new HitEnvironmentHandler(contexts); hitTargetHandlers.Add(handler); playerContext = contexts.player; }
public BulletHitHandler(Contexts contexts, IEntityIdGenerator entityIdGenerator, IPlayerDamager damager, IDamageInfoCollector damageInfoCollector, ISoundEntityFactory soundEntityFactory, IEnvironmentTypeConfigManager environmentTypeConfigManager) { _contexts = contexts; this._entityIdGenerator = entityIdGenerator; _damager = damager; _damageInfoCollector = damageInfoCollector; _soundEntityFactory = soundEntityFactory; _environmentTypeConfigManager = environmentTypeConfigManager; _sceneObjectEntityFactory = _contexts.session.entityFactoryObject.SceneObjectEntityFactory; _triggerObjectManager = SingletonManager.Get <TriggerObjectManager>(); }
public EmployeePayrollCreate( IQueryDispatcher queryDispatcher, ICommandDispatcher commandDispatcher, IEntityIdGenerator generator) { Guard.Against.Null(queryDispatcher, nameof(queryDispatcher)); Guard.Against.Null(commandDispatcher, nameof(commandDispatcher)); Guard.Against.Null(generator, nameof(generator)); this.commandDispatcher = commandDispatcher; this.generator = generator; this.queryDispatcher = queryDispatcher; }
public static ClientEffectEntity CreateBaseEntity(ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 pos, int type) { var effectEntity = context.CreateEntity(); var nextId = entityIdGenerator.GetNextEntityId(); effectEntity.AddEntityKey(new EntityKey(nextId, (int)EEntityType.ClientEffect)); effectEntity.AddPosition(pos); effectEntity.AddEffectType(type); effectEntity.AddLifeTime(DateTime.Now, 6000); effectEntity.isFlagSyncNonSelf = true; return(effectEntity); }
public static void CreateGrenadeExplosionEffect(ClientEffectContext context, IEntityIdGenerator entityIdGenerator, EntityKey owner, Vector3 position, float yaw, float pitch, int effectId, int effectTime, EClientEffectType effectType) { var entity = CreateBaseEntity(context, entityIdGenerator, position, (int)effectType); entity.AddOwnerId(owner); entity.lifeTime.LifeTime = effectTime; entity.AddEffectId(effectId); entity.AddEffectRotation(yaw, pitch); entity.AddFlagImmutability(0); }
public MeleeHitHandler( IPlayerDamager damager, ClientEffectContext context, IEntityIdGenerator idGenerator, IDamageInfoCollector damageInfoCollector, ISoundEntityFactory soundEntityFactory) { _damager = damager; _clientEffectContext = context; _entityIdGenerator = idGenerator; _damageInfoCollector = damageInfoCollector; _soundEntityFactory = soundEntityFactory; }
public static void CreateHitVehicleEffect(ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 hitPoint, EntityKey owner, EntityKey target, Vector3 offset, Vector3 normal) { int type = (int)EClientEffectType.SteelHit; var effectEntity = CreateBaseEntity(context, entityIdGenerator, hitPoint, type); effectEntity.AddOwnerId(owner); effectEntity.AddNormal(normal); effectEntity.AddAttachParent(target, offset); effectEntity.lifeTime.LifeTime = GlobalConst.CommonEffectLifeMScd; effectEntity.AddFlagImmutability(0); effectEntity.isFlagSyncNonSelf = false; }
public static void CreateHitEnvironmentEffect( ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 hitPoint, Vector3 normal, EntityKey owner, EEnvironmentType environmentType) { Logger.DebugFormat("CreateBulletHitEnvironmentEffet ", environmentType); CreateHitEmitEffect(context, entityIdGenerator, hitPoint, normal, owner, environmentType); Logger.DebugFormat("EnvType {0} ", environmentType); }
public DepartmentEmployeeTrigger( IApiClient apiClient, IQueryDispatcher queryDispatcher, ICommandDispatcher commandDispatcher, IEntityIdGenerator idGenerator) { Guard.Against.Null(apiClient, nameof(apiClient)); Guard.Against.Null(queryDispatcher, nameof(queryDispatcher)); Guard.Against.Null(commandDispatcher, nameof(commandDispatcher)); Guard.Against.Null(idGenerator, nameof(idGenerator)); this.apiClient = apiClient; this.queryDispatcher = queryDispatcher; this.commandDispatcher = commandDispatcher; this.idGenerator = idGenerator; }
public static void CreateHitPlayerEffect( ClientEffectContext context, IEntityIdGenerator entityIdGenerator, Vector3 hitPoint, EntityKey owner, EntityKey target, Vector3 offset) { int type = (int)EClientEffectType.HumanHitEffect; var effectEntity = CreateBaseEntity(context, entityIdGenerator, hitPoint, type); effectEntity.AddOwnerId(owner); effectEntity.AddAttachParent(target, offset); effectEntity.isFlagSyncNonSelf = false; Logger.DebugFormat("CreateHitPlayerEffect {0} {1}", effectEntity.entityKey.Value, effectEntity.isFlagSyncNonSelf); }
protected WorkflowHandler(ViewContext context, CommandBus commandBus, IEntityIdGenerator idGenerator) { _context = context; _commandBus = commandBus; _idGenerator = idGenerator; }