public IdentityTestsEntityApp() { var area = AddArea("ident"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(ICar), typeof(IPerson)); }
public SequenceDefinition FindSequence(string name, EntityModule module = null) { //If it is a simple name, find in the sequences defined in the module if (module != null && !name.Contains('.')) { return(module.Sequences.FirstOrDefault(s => s.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); } //It is a fully-qualified name: schema.name var segms = name.Split('.'); var schema = segms[0]; var nm = segms[1]; foreach (var m in this.App.Modules) { if (!m.Area.Name.Equals(schema, StringComparison.OrdinalIgnoreCase)) { continue; } var seq = m.Sequences.FirstOrDefault(s => s.Name.Equals(nm, StringComparison.OrdinalIgnoreCase)); if (seq != null) { return(seq); } } return(null); //not found }
public DtoActionResult AddModule(EntityScriptModule module) { var validationResult = ValidateModule(module, true); var actionResult = new DtoActionResult(); if (validationResult.Success) { if (module.ScriptType == EnumScriptModule.ScriptType.ImagingClient_Bash) { var fixedLineEnding = module.ScriptContents.Replace("\r\n", "\n"); module.ScriptContents = fixedLineEnding; } _uow.ScriptModuleRepository.Insert(module); var moduleType = new EntityModule(); moduleType.ModuleType = EnumModule.ModuleType.Script; moduleType.Guid = module.Guid; _uow.ModuleRepository.Insert(moduleType); _uow.Save(); actionResult.Success = true; actionResult.Id = module.Id; } else { actionResult.ErrorMessage = validationResult.ErrorMessage; } return(actionResult); }
public IdentityRefTestEntityApp() { var area = AddArea("ident2"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IUser), typeof(IUserPost)); }
public UpdateSortEntityApp() { var area = AddArea(Schema); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IEmployee), typeof(IDepartment)); }
public DtoActionResult AddModule(EntityPrinterModule module) { var validationResult = ValidateModule(module, true); var actionResult = new DtoActionResult(); if (validationResult.Success) { _uow.PrinterModuleRepository.Insert(module); var moduleType = new EntityModule(); moduleType.ModuleType = EnumModule.ModuleType.Printer; moduleType.Guid = module.Guid; _uow.ModuleRepository.Insert(moduleType); _uow.Save(); actionResult.Success = true; actionResult.Id = module.Id; } else { actionResult.ErrorMessage = validationResult.ErrorMessage; } return(actionResult); }
public MiscLinqEntityApp() { var area = AddArea(Schema); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IArithmData)); }
public void AppendToStream(EntityModule entity, long expectedVersion, ICollection <Event> events) { if (events.Count == 0) { return; } var name = entity.ID.GetEntityID(); var EventArgs = new JObject(); EventArgs["Event"] = JsonConvert.DeserializeObject <JArray>(JsonConvert.SerializeObject(events)); EventArgs["Version"] = expectedVersion; string path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/事件"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path += "/" + DateTime.Now.ToString("yyyy-MM-dd") + "事件" + name.ToString() + ".txt"; using (StreamWriter writer = File.CreateText(path)) { JsonSerializer serializer = JsonSerializer.Create(new JsonSerializerSettings { Formatting = Formatting.Indented }); serializer.Serialize(writer, EventArgs); } entity.Changes = new List <Event>(); Events = new List <Event>(); }
public OneToOneEntityApp() { var area = AddArea("one"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IDocHeader), typeof(IDocDetails), typeof(IDocDetails2), typeof(IDocComments)); }
public MiscTestsEntityApp() { var area = AddArea("misc"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IVehicle), typeof(IDriver)); }
protected override void Tick(float deltaTimeSeconds) { base.Tick(deltaTimeSeconds); var angularDisplacement = GetAngularDisplacementForTick(deltaTimeSeconds); AssetLocator.MainGeometryPass._EGGHACK_ROT *= angularDisplacement; //AngularVelocity = new Vector3(angularDisplacement.RotAroundX, angularDisplacement.RotAroundY, angularDisplacement.RotAroundZ); AngularVelocity = Vector3.ZERO; //float downwardVeloComponent = Velocity.ProjectedOnto(GameCoordinator.BoardDownDir).Length; //Velocity -= GameCoordinator.BoardDownDir.WithLength(downwardVeloComponent); // OPTION 1 //var veloChangeAngle = Vector3.AngleBetween( // velocityLastFrame.ProjectedOnto(GameCoordinator.BoardDownDir), // Velocity.ProjectedOnto(GameCoordinator.BoardDownDir) //); //if (veloChangeAngle > MathUtils.PI_OVER_TWO) { // if (Vector3.AngleBetween(velocityLastFrame, GameCoordinator.BoardDownDir) < Vector3.AngleBetween(Velocity, GameCoordinator.BoardDownDir)) { // SetTranslation(lastPositions[((nextPositionSlot - 2) % lastPositions.Length)]); // Velocity = TrueVelocity; // HUDSound.UISelectNegativeOption.Play(); // } //} // OPTION 2 var downDir = GameCoordinator.BoardDownDir; Ray rollTestRay = new Ray( Transform.Translation - downDir.WithLength(GameplayConstants.EGG_COLLISION_RADIUS), downDir, GameplayConstants.EGG_COLLISION_RADIUS * 3f ); EntityModule.RayTestAllLessGarbage(rollTestRay, bulletBugRayTestReusableList, 5U); for (int i = 0; i < bulletBugRayTestReusableList.Count; ++i) { GeometryEntity touchedEntity = bulletBugRayTestReusableList[i].Entity as GeometryEntity; if (touchedEntity != null) { BulletBugRayHandle(touchedEntity); } } CheckForAndCorrectBulletBug(deltaTimeSeconds); lastPositions[(nextPositionSlot % lastPositions.Length)] = Transform.Translation; elapsedTimes[(nextPositionSlot % lastPositions.Length)] = EntityModule.ElapsedTime; ++nextPositionSlot; velocityLastFrame = Velocity; if (GameCoordinator.CurrentGameState == GameCoordinator.OverallGameState.LevelPlaying) { airtime += deltaTimeSeconds; topSpeed = Math.Max(topSpeed, TrueVelocity.Length); } }
internal int CreationOrder; //used for keeping 'natural' (creation order) to later use it when applying scripts public DbMigration(EntityModule module, string version, string name, string description) { Module = module; Version = new Version(version); Name = name; Description = description; CreationOrder = System.Threading.Interlocked.Increment(ref _creationCount); }
public EventStream LoadEventStream(EntityModule id) { EventStream stream = new EventStream(); stream.Version = Version; stream.Events = Events; return(stream); }
public DbMigration(EntityModule module, string version, string name, string description) { Module = module; Version = new Version(version); Name = name; Description = description; CreationOrder = System.Threading.Interlocked.Increment(ref _creationCount); }
public void RegisterSize(string code, int size, EntityModule module = null) { CheckNotClosed(); SizeTable[code] = size; var fullCode = module.Name + "#" + code; SizeTable[fullCode] = size; }
public ViewDefinition(EntityModule module, Type entityType, EntityQuery query, DbViewOptions options, string name) { Module = module; EntityType = entityType; Options = options; Name = name; Command = new LinqCommand(query, LinqCommandType.Select, LinqCommandKind.View, null); }
public string ExplicitSchema; //if provided, used instead of module.area.schema public SequenceDefinition(EntityModule module, string name, Type dataType, int startValue = 0, int increment = 0, string schema = null) { Module = module; Name = name; DataType = dataType; StartValue = startValue; Increment = increment; ExplicitSchema = schema; }
public DataTypesTestEntityApp() { var area = AddArea("types"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IDataTypesEntity)); switch (Startup.ServerType) { case DbServerType.MsSql: mainModule.RegisterEntities(typeof(IMsSqlDataTypesEntity), typeof(IMsSqlRowVersionedProduct)); break; } }
public Version GetModuleDbVersion(EntityModule module) { if (_oldDbModel.VersionInfo == null) { return(DbVersionInfo.ZeroVersion); } var schema = DbModel.Config.GetSchema(module.Area); var mi = _oldDbModel.VersionInfo.GetModule(schema, module.Name); if (mi == null) { return(DbVersionInfo.ZeroVersion); } return(mi.Version); }
public SequenceDefinition FindSequence(string name, EntityModule module = null) { //If it is a simple name, find in the sequences defined in the module if (module != null && !name.Contains('.')) { return(module.Sequences.FirstOrDefault(s => s.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); } //It is a fully-qualified name: schema.name var segms = name.Split('.'); string seqName; string schema; switch (segms.Length) { case 1: seqName = segms[0]; foreach (var m in this.App.Modules) { var seq = m.Sequences.FirstOrDefault(s => s.Name.Equals(seqName, StringComparison.OrdinalIgnoreCase)); if (seq != null) { return(seq); } } return(null); case 2: schema = segms[0]; seqName = segms[1]; foreach (var m in this.App.Modules) { if (!m.Area.Name.Equals(schema, StringComparison.OrdinalIgnoreCase)) { continue; } var seq = m.Sequences.FirstOrDefault(s => s.Name.Equals(seqName, StringComparison.OrdinalIgnoreCase)); if (seq != null) { return(seq); } } return(null); default: Util.Throw("Invalid sequence name: {0}", name); return(null); } }
public ModelViewModule Update(ModelViewModule model) { EntityModule data = new EntityModule() { ModuleID = model.ModuleID, Module = model.Module, Description = model.Description, Status = model.Status, URL = model.URL, Section = model.Section }; data = new RepositoryModule().Update(data); model.ModuleID = data.ModuleID; return(model); }
public DataTypesTestEntityApp() { var area = AddArea("types"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IDataTypesEntity)); //Make sure setup is run and ServerType is set if (Startup.Driver == null) { Startup.SetupForTestExplorerMode(); } switch (Startup.ServerType) { case DbServerType.MsSql: mainModule.RegisterEntities(typeof(IMsSqlDataTypesEntity), typeof(IMsSqlRowVersionedProduct)); break; } }
} //method private EntityInfo AddEntity(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table) { EntityInfo entInfo = Model.GetEntityInfo(entityType); if (entInfo != null) { return(entInfo); // tolerate dupes } var area = _customization.GetNewAreaForEntity(entityType); //might be null entInfo = new EntityInfo(module, entityType, kind, area); // Do not use inherited attributes for Views var allAttrs = entityType.GetAllAttributes(inherit: kind == EntityKind.Table); entInfo.Attributes.AddRange(allAttrs); Model.RegisterEntity(entInfo); return(entInfo); }
private void GenerateModulesAndAreas() { if (_dbModel.Driver.Supports(DbFeatures.Schemas)) { // var schemas = _dbSettings.GetSchemas().ToList(); foreach (var schInfo in _dbModel.Schemas) { var sch = schInfo.Schema; // if(schemas.Count > 0 && !schemas.Contains(sch)) // continue; var area = _app.AddArea(sch); var module = new EntityModule(area, "EntityModule" + sch.FirstCap()); } } else { var area = _app.AddArea("Default"); var module = new EntityModule(area, "EntityModuleDefault"); } }
public EntityInfo(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table, EntityArea altArea = null) { Module = module; EntityType = entityType; Area = altArea ?? Module.Area; Kind = kind; Name = entityType.Name; Members = new List <EntityMemberInfo>(); Events = new EntityEvents(); //Check for generic types - happens in modules with generic entities (interfaces), provided for customization if (Name.Contains('`')) { Name = Name.Substring(0, Name.IndexOf('`')); } if (EntityType.IsInterface && Name.Length > 1 && Name.StartsWith("I")) { Name = Name.Substring(1); } FullName = Area.Name + "." + Name; EntitySetConstant = ExpressionMaker.MakeEntitySetConstant(this.EntityType); }
public ModelViewModule Insert(ModelViewModule model) { model.Status = true; EntityModule data = new EntityModule() { ModuleID = model.ModuleID, Module = model.Module, Description = model.Description, Status = model.Status, URL = model.URL, Section = model.Section }; data = new RepositoryModule().Insert(data); model.ModuleID = data.ModuleID; new BusinessPermission().Set(null, model.ModuleID); return(model); }
public EntityInfo(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table) { Module = module; EntityType = entityType; Kind = kind; Name = entityType.Name; //Check for generic types - happens in modules with generic entities (interfaces), provided for customization if (Name.Contains('`')) { Name = Name.Substring(0, Name.IndexOf('`')); } if (EntityType.IsInterface && Name.Length > 1 && Name.StartsWith("I")) { Name = Name.Substring(1); } //check if entity was moved if (!module.App.MovedEntities.TryGetValue(entityType, out this.Area)) { Area = Module.Area; } FullName = Area.Name + "." + Name; }
private void GenerateModulesAndAreas() { if( _dbModel.Driver.Supports(DbFeatures.Schemas)) { var schemas = _dbSettings.GetSchemas().ToList(); foreach(var schInfo in _dbModel.Schemas) { var sch = schInfo.Schema; if(schemas.Count > 0 && !schemas.Contains(sch)) continue; var area = _app.AddArea(sch); var module = new EntityModule(area, "EntityModule" + sch.FirstCap()); } } else { var area = _app.AddArea("Default"); var module = new EntityModule(area, "EntityModuleDefault"); } }
public SqlMigration(EntityModule module, string version, string name, string description, string sql, DbMigrationTiming timing ) : base(module, version, name, description) { Sql = sql; Timing = timing; }
public ActionMigration(EntityModule module, string version, string name, string description, Action<IEntitySession> action) : base(module, version, name, description) { Action = action; }
public DataTypesTestEntityApp() { var area = AddArea("types"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IDataTypesEntity)); switch(SetupHelper.ServerType) { case DbServerType.MsSql: mainModule.RegisterEntities(typeof(IMsSqlDataTypesEntity), typeof(IMsSqlRowVersionedProduct)); break; } }
private static void TickSound(float deltaTime) { Vector3 ballVelo = egg.Velocity; float ballSpeed = ballVelo.Length; float speedLastFrame = velocityLastFrame.Length; const int TICK_SOUND_EARLINESS_MS = 200; // Tick int adjustedTimeRemainingMs = timeRemainingMs - TICK_SOUND_EARLINESS_MS; int timeRemainingSecs = adjustedTimeRemainingMs / 1000; if (timeRemainingSecs != 0 && timeRemainingSecs != (int)(adjustedTimeRemainingMs + deltaTime * 1000f) / 1000) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.TickSound); AudioModule.PlaySoundInstance( instanceId, false, 0.2f * Config.SoundEffectVolume, adjustedTimeRemainingMs > Config.TimePitchRaiseMs ? 1f : (adjustedTimeRemainingMs > Config.TimeWarningMs ? 1.1f : 1.2f) ); } // Bounce if (velocityLastFrame != Vector3.ZERO && ballSpeed >= MIN_SPEED_FOR_DIFFERENTIAL_ANGLE_BOUNCE_SOUND && Vector3.AngleBetween(ballVelo, velocityLastFrame) >= MIN_VELO_DIFFERENTIAL_ANGLE_FOR_BOUNCE_SOUND) { if (lastBounceSoundTime - timeRemainingMs >= BOUNCE_SOUND_MIN_INTERVAL) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.ObtuseBounceSound); AudioModule.PlaySoundInstance( instanceId, false, BOUNCE_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(BOUNCE_PITCH_MIN, BOUNCE_PITCH_MAX) ); instanceId = AudioModule.CreateSoundInstance(AssetLocator.ImpactSounds[RandomProvider.Next(0, AssetLocator.ImpactSounds.Length)]); AudioModule.PlaySoundInstance( instanceId, false, IMPACT_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(IMPACT_PITCH_MIN, IMPACT_PITCH_MAX) ); lastBounceSoundTime = timeRemainingMs; } float speedDiff = Math.Abs(speedLastFrame - ballSpeed); int baseBitsCount = 3; if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 10f) { baseBitsCount = 13; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 8f) { baseBitsCount = 11; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 6f) { baseBitsCount = 7; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 4f) { baseBitsCount = 5; } CollisionBitPool.DisseminateBits(egg.Transform.Translation, -boardDownDir.WithLength(speedDiff * 0.65f), baseBitsCount * (int)Config.PhysicsLevel); MaybePlayAllBounce(speedDiff); } else if (Math.Abs(ballSpeed - speedLastFrame) >= MIN_SPEED_CHANGE_FOR_BOUNCE_SOUND) // bounce in same direction { if (lastBounceSoundTime - timeRemainingMs >= BOUNCE_SOUND_MIN_INTERVAL) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.AcuteBounceSound); AudioModule.PlaySoundInstance( instanceId, false, BOUNCE_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(BOUNCE_PITCH_MIN, BOUNCE_PITCH_MAX) ); instanceId = AudioModule.CreateSoundInstance(AssetLocator.ImpactSounds[RandomProvider.Next(0, AssetLocator.ImpactSounds.Length)]); AudioModule.PlaySoundInstance( instanceId, false, IMPACT_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(IMPACT_PITCH_MIN, IMPACT_PITCH_MAX) ); lastBounceSoundTime = timeRemainingMs; } float speedDiff = Math.Abs(speedLastFrame - ballSpeed); int baseBitsCount = 2; if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 10f) { baseBitsCount = 13; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 8f) { baseBitsCount = 11; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 6f) { baseBitsCount = 7; } else if (speedDiff >= PhysicsManager.ONE_METRE_SCALED * 4f) { baseBitsCount = 3; } CollisionBitPool.DisseminateBits(egg.Transform.Translation, -boardDownDir.WithLength(speedDiff * 0.65f), baseBitsCount * (int)Config.PhysicsLevel); MaybePlayAllBounce(speedDiff); } // Roll float rollVolFraction = (ballSpeed - GameplayConstants.EGG_SPEED_FOR_MIN_ROLL_VOL) / (GameplayConstants.EGG_SPEED_FOR_MAX_ROLL_VOL - GameplayConstants.EGG_SPEED_FOR_MIN_ROLL_VOL); float rollFreqFraction = (ballSpeed - GameplayConstants.EGG_SPEED_FOR_MIN_ROLL_FREQ) / (GameplayConstants.EGG_SPEED_FOR_MAX_ROLL_FREQ - GameplayConstants.EGG_SPEED_FOR_MIN_ROLL_FREQ); Vector3 eggPos = egg.Transform.Translation; Ray rollTestRay = Ray.FromStartAndEndPoint( eggPos, eggPos + boardDownDir.WithLength(GameplayConstants.EGG_COLLISION_RADIUS + ROLL_MARGIN) ); EntityModule.RayTestAllLessGarbage(rollTestRay, reusableRayTestResultsList); bool isRolling = false; for (int i = 0; i < reusableRayTestResultsList.Count; ++i) { if (reusableRayTestResultsList[i].Entity != egg) { isRolling = true; break; } } if (isRolling) { if (unbrokenRollTime == 0) { unbrokenRollTime = (int)(deltaTime * 1000f); } else { unbrokenRollTime += lastRollTime - timeRemainingMs; } lastRollTime = timeRemainingMs; } else { if (unbrokenRollTime < UNBROKEN_ROLL_TIME_BEFORE_ROLL_SOUND || lastRollTime - timeRemainingMs > ROLL_RAY_FAIL_MAX_TIME_BEFORE_UNBROKEN_ROLL_RESET) { unbrokenRollTime = 0; } } if (unbrokenRollTime < UNBROKEN_ROLL_TIME_BEFORE_ROLL_SOUND || lastRollTime - timeRemainingMs > ROLL_RAY_FAIL_MAX_TIME_BEFORE_NO_SOUND_MS || rollVolFraction <= 0f || rollFreqFraction <= 0f) { AudioModule.SetSoundInstanceVolume(AssetLocator.RollSound.SoundInstanceIds.First(), 0f); } else { if (rollVolFraction > 1f) { rollVolFraction = 1f; } if (rollFreqFraction > 1f) { rollFreqFraction = 1f; } AudioModule.SetSoundInstanceFrequency(AssetLocator.RollSound.SoundInstanceIds.First(), ROLL_FREQ_MIN + (ROLL_FREQ_MAX - ROLL_FREQ_MIN) * rollFreqFraction); AudioModule.SetSoundInstanceVolume(AssetLocator.RollSound.SoundInstanceIds.First(), ROLL_VOLUME_MIN + (ROLL_VOLUME_MAX - ROLL_VOLUME_MIN) * rollVolFraction * Config.SoundEffectVolume); } // Highspeed if (ballSpeed >= HIGHSPEED_SOUND_MIN_SPEED) { float angleToUp = Vector3.AngleBetween(ballVelo, -boardDownDir); float angleToDown = Vector3.AngleBetween(ballVelo, boardDownDir); if (angleToUp <= MathUtils.PI_OVER_TWO * 0.5f) { if (highspeedUpMetadata.TimeAtLastSound - timeRemainingMs >= MIN_INTERVAL_BETWEEN_HIGHSPEED_SOUNDS_MS && highspeedUpMetadata.CollidedSinceLastSound && highspeedUpMetadata.SlowedSinceLastSound) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.HighSpeedUpSounds[RandomProvider.Next(0, AssetLocator.HighSpeedUpSounds.Length)]); AudioModule.PlaySoundInstance( instanceId, false, HIGHSPEED_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(HIGHSPEED_PITCH_MIN, HIGHSPEED_PITCH_MAX) ); highspeedUpMetadata.CollidedSinceLastSound = highspeedUpMetadata.SlowedSinceLastSound = false; highspeedUpMetadata.TimeAtLastSound = timeRemainingMs; } } else if (angleToDown <= MathUtils.PI_OVER_TWO * 0.5f) { Ray downRay = Ray.FromStartAndEndPoint(eggPos, eggPos + boardDownDir.WithLength(PARALLEL_HIGHSPEED_DOWN_BUFFER)); bool somethingBeneath = EntityModule.RayTestAll(downRay).Any(rtc => rtc.Entity != egg); if (highspeedDownMetadata.TimeAtLastSound - timeRemainingMs >= MIN_INTERVAL_BETWEEN_HIGHSPEED_SOUNDS_MS && highspeedDownMetadata.CollidedSinceLastSound && highspeedDownMetadata.SlowedSinceLastSound && !somethingBeneath) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.HighSpeedDownSounds[RandomProvider.Next(0, AssetLocator.HighSpeedDownSounds.Length)]); AudioModule.PlaySoundInstance( instanceId, false, HIGHSPEED_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(HIGHSPEED_PITCH_MIN, HIGHSPEED_PITCH_MAX) ); highspeedDownMetadata.CollidedSinceLastSound = highspeedDownMetadata.SlowedSinceLastSound = false; highspeedDownMetadata.TimeAtLastSound = timeRemainingMs; } } else if (ballSpeed >= HIGHSPEED_SOUND_MIN_SPEED + HIGHSPEED_SOUND_ADDITIONAL_SPEED_FOR_PARALLEL) { if (highspeedParallelMetadata.TimeAtLastSound - timeRemainingMs >= MIN_INTERVAL_BETWEEN_HIGHSPEED_SOUNDS_MS && highspeedParallelMetadata.CollidedSinceLastSound && highspeedParallelMetadata.SlowedSinceLastSound) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.HighSpeedParallelSounds[RandomProvider.Next(0, AssetLocator.HighSpeedParallelSounds.Length)]); AudioModule.PlaySoundInstance( instanceId, false, HIGHSPEED_VOLUME * Config.SoundEffectVolume, RandomProvider.Next(HIGHSPEED_PITCH_MIN, HIGHSPEED_PITCH_MAX) ); highspeedParallelMetadata.CollidedSinceLastSound = highspeedParallelMetadata.SlowedSinceLastSound = false; highspeedParallelMetadata.TimeAtLastSound = timeRemainingMs; } } } else { highspeedUpMetadata.SlowedSinceLastSound = highspeedDownMetadata.SlowedSinceLastSound = highspeedParallelMetadata.SlowedSinceLastSound = true; } // Countdown Timer if (!playingCountdownTimer && timeRemainingMs <= COUNTDOWN_TIMER_START_TIME_MS) { int instanceId = AudioModule.CreateSoundInstance(AssetLocator.CountdownLoopSound.File); AssetLocator.CountdownLoopSound.AddInstance(instanceId); AudioModule.PlaySoundInstance(instanceId, true, COUNTDOWN_VOLUME); playingCountdownTimer = true; } velocityLastFrame = ballVelo; }
public ActionMigration(EntityModule module, string version, string name, string description, Action <IEntitySession> action) : base(module, version, name, description) { Action = action; }
public EventStream LoadEventStream(EntityModule id, long skipEvents, int maxCount) { throw new NotImplementedException(); }
public ApplicationService(IEventStore eventStore, EntityModule entity) { EventStore = eventStore; Entity = entity; }
public SequenceDefinition FindSequence(string name, EntityModule module = null) { //If it is a simple name, find in the sequences defined in the module if (module != null && !name.Contains('.')) return module.Sequences.FirstOrDefault(s => s.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); //It is a fully-qualified name: schema.name var segms = name.Split('.'); var schema = segms[0]; var nm = segms[1]; foreach (var m in this.App.Modules) { if (!m.Area.Name.Equals(schema, StringComparison.InvariantCultureIgnoreCase)) continue; var seq = m.Sequences.FirstOrDefault(s => s.Name.Equals(nm, StringComparison.InvariantCultureIgnoreCase)); if (seq != null) return seq; } return null; //not found }
public UpdateSortEntityApp() { var area = AddArea("updsort"); var mainModule = new EntityModule(area, "MainModule"); mainModule.RegisterEntities(typeof(IEmployee), typeof(IDepartment)); }