private static void FillFields() { _siteIds = BuildSiteIds(); _entityMetadata = _metadataXmlInitializer.Entities; _applicationMetadata = _metadataXmlInitializer.Applications; _entityQueries = _metadataXmlInitializer.Queries; }
internal ICollection <EntityMetadata> InitializeEntityMetadata(IEnumerable <EntityMetadata> sourceEntities, Stream streamValidator = null) { var resultEntities = new HashSet <EntityMetadata>(); IReadOnlyCollection <EntityMetadata> clientEntities; using (var stream = MetadataParsingUtils.GetStreamImpl(Metadata, false, streamValidator)) { var parsingResult = new XmlEntitySourceMetadataParser().Parse(stream); clientEntities = parsingResult.Item1; Queries = parsingResult.Item2; } foreach (var sourceEntity in sourceEntities) { var overridenEntity = clientEntities.FirstOrDefault(a => a.Name == sourceEntity.Name); if (overridenEntity != null) { MergeEntities(sourceEntity, overridenEntity); } resultEntities.Add(sourceEntity); } foreach (var clientEntity in clientEntities) { resultEntities.Add(clientEntity); } return(resultEntities); }
public static void Start(List <Entity> matchingEntities) { var loveStoryActions = LoveStory.DayTwoNight(); foreach (var actionPair in loveStoryActions) { var entity = actionPair.GetEntity(); var action = actionPair.GetGameAction(); ActionManagerSystem.Instance.QueueAction(entity, action); } var mcGraw = EntityQueries.GetEntityWithName(matchingEntities, NPCS.McGraw.Name); var jannet = EntityQueries.GetEntityWithName(matchingEntities, NPCS.Jannet.Name); var q = EntityQueries.GetEntityWithName(matchingEntities, NPCS.Q.Name); var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You); //Jannet var jannetSequence = new ActionSequence("Jannet night"); jannetSequence.Add(new CallbackAction(() => { EventSystem.EndDrinkMakingEvent.Invoke(); ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(player, new TeleportAction(Locations.CenterOfBar())); })); //This is kind of dirty - but demo! jannetSequence.Add(new PauseAction(0.1f)); //WORKAROUND FOR SYNC ACTION BUG jannetSequence.Add(new TeleportAction(Locations.SitDownPoint1())); jannetSequence.Add(new SetReactiveConversationAction(new JannetNightTwo(), jannet)); jannetSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(jannet, jannetSequence); //McGraw and Q DrugStory.DrugPusherInspectorShowdown(mcGraw, q, Locations.SitDownPoint2()); }
public SecondDay(List <Entity> allPeople) { // ScheduleEvent(11, 13, () => // { // ActionManagerSystem.Instance.QueueAction( // EntityQueries.GetEntityWithName(allPeople, NPCS.McGraw.Name), // DrugStory.InspectorQuestions(EntityQueries.GetEntityWithName(allPeople, NPCS.McGraw.Name)) // ); // }); // // ScheduleEvent(13, 40, () => // { // var jannet = EntityQueries.GetEntityWithName(allPeople, NPCS.Jannet.Name); // // ActionManagerSystem.Instance.QueueAction(jannet, StoryActions.GettingFrosty(EntityQueries.GetEntityWithName(allPeople, NPCS.Jannet.Name))); // ActionManagerSystem.Instance.QueueAction(jannet, CommonActions.LeaveBar()); // }); // // ScheduleEvent(17, 3, () => // { // DrugStory.DrugPusherInspectorShowdown( // EntityQueries.GetEntityWithName(allPeople, NPCS.McGraw.Name), // EntityQueries.GetEntityWithName(allPeople, NPCS.Q.Name) // ); // }); // SchedualWalkHallway(this, EntityQueries.GetNPCSWithName(allPeople, NPCName.Expendable)); // SchedualRushHours(this, allPeople); }
public static void Start(List <Entity> matchingEntities) { Analytics.CustomEvent("Day Two Started"); var mcGraw = EntityQueries.GetEntityWithName(matchingEntities, NPCS.McGraw.Name); var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You); var loveStoryActions = LoveStory.DayTwoMorning(); foreach (var actionPair in loveStoryActions) { var entity = actionPair.GetEntity(); var action = actionPair.GetGameAction(); ActionManagerSystem.Instance.QueueAction(entity, action); } //McGraw var mcGrawSequence = new ActionSequence("McGraw Day Two Morning"); mcGrawSequence.Add(new CallbackAction(() => { EventSystem.EndDrinkMakingEvent.Invoke(); ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(player, new TeleportAction(Locations.CenterOfBar())); })); //This is kind of dirty - but demo! mcGrawSequence.Add(new PauseAction(2.0f)); //WORKAROUND FOR SYNC ACTION BUG mcGrawSequence.Add(DrugStory.InspectorQuestions(mcGraw)); ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence); }
public FirstDay(List <Entity> allPeople) { // var q = EntityQueries.GetEntityWithName(allPeople, NPCS.Q.Name); // var tolstoy = EntityQueries.GetEntityWithName(allPeople, NPCS.Tolstoy.Name); // var ellie = EntityQueries.GetEntityWithName(allPeople, NPCS.Ellie.Name); // var mcGraw = EntityQueries.GetEntityWithName(allPeople, NPCS.McGraw.Name); // // ScheduleEvent(12, 1, () => { ActionManagerSystem.Instance.QueueAction(mcGraw, CommonActions.LeaveBar()); }); // // ScheduleEvent(13, 15, () => { ActionManagerSystem.Instance.QueueAction(q, DrugStory.DrugPusherIntro(q)); }); // // ScheduleEvent(15, 20, () => // { // ActionSequence mainSequence; // ActionSequence otherSequence; // StoryActions.TolstoyRomantic(tolstoy, ellie, out mainSequence, out otherSequence); // ActionManagerSystem.Instance.QueueAction(tolstoy, mainSequence); // ActionManagerSystem.Instance.QueueAction(ellie, otherSequence); // }); // // ScheduleEvent(18, 0, () => { ActionManagerSystem.Instance.QueueAction(ellie, CommonActions.LeaveBar()); }); // // ScheduleEvent(18, 30, () => { ActionManagerSystem.Instance.QueueAction(q, DrugStory.DrugPusherPaysYou(q)); }); SchedualWalkHallway(this, EntityQueries.GetNPCSWithName(allPeople, NPCName.Expendable)); }
public void OnEndInit(List <Entity> allPeople) { dayPhase = StaticStates.Get <DayPhaseState>(); time = StaticStates.Get <TimeState>(); people = allPeople; hallwayWalkers = EntityQueries.GetNPCSWithName(allPeople, NPCName.Expendable); dayPhase.DayPhaseChangedTo += OnDayPhaseChanged; }
/// <summary> /// Preparies simple details entities queries. /// </summary> private void PrepareSimpleDetailsEntityQueries() { foreach (var detail in SimpleDetails) { EntitySchemaQuery esq = PrepareDetailEsq(detail); if (esq != null) { EntityQueries.Add(detail.Key, esq); } } }
/// <summary> /// Prepares entities queries. /// </summary> protected override void PrepareEntityQueries() { var entitySchemaQueries = GetEntitySchemaQueries(IndexingSectionsUIds); foreach (var esq in entitySchemaQueries) { EntitySchema schema = esq.RootSchema; if (!EntityQueries.ContainsKey(schema.Name)) { EntityQueries.Add(schema.Name, esq); } } RemoveEmptyEsqList(EntityQueries); }
public static void Start(List <Entity> matchingEntities) { var seats = EntityStateSystem.Instance.GetEntitiesWithState <GoalSatisfierState>().Where(entity => entity.GetState <GoalSatisfierState>().SatisfiedGoals.Contains(Goal.Sit)); var chosenSeats = seats.PickRandom(4).ToArray(); var loveStoryActions = LoveStory.DayOneNight(chosenSeats); foreach (var actionPair in loveStoryActions) { var entity = actionPair.GetEntity(); var action = actionPair.GetGameAction(); ActionManagerSystem.Instance.QueueAction(entity, action); } var jannet = EntityQueries.GetEntityWithName(matchingEntities, NPCS.Jannet.Name); var q = EntityQueries.GetEntityWithName(matchingEntities, NPCS.Q.Name); var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You); //Jannet var jannetSequence = new ActionSequence("Jannet night"); jannetSequence.Add(new CallbackAction(() => { EventSystem.EndDrinkMakingEvent.Invoke(); ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(player, new TeleportAction(Locations.CenterOfBar())); })); //This is kind of dirty - but demo! jannetSequence.Add(new TeleportAction(chosenSeats[0].GameObject.transform)); jannetSequence.Add(new SetReactiveConversationAction(new JannetNightOne(), jannet)); jannetSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(jannet, jannetSequence); //Q var qSequence = new ActionSequence("Q night"); qSequence.Add(new PauseAction(2.0f)); //WORKAROUND FOR SYNC ACTION BUG if (StaticStates.Get <PlayerDecisionsState>().AcceptedDrugPushersOffer) { qSequence.Add(DrugPusherPaysYou()); } else { qSequence.Add(new TeleportAction(chosenSeats[3].GameObject.transform)); qSequence.Add(new SetReactiveConversationAction(new QNightOneRefused(), q)); qSequence.Add(CommonActions.SitDownLoop()); } ActionManagerSystem.Instance.QueueAction(q, qSequence); }
/// <summary> /// Preparies communication details entities queries. /// </summary> /// <param name="filterType">Filter type.</param> /// <param name="numberColumnAlias">Alias name of the number column.</param> private void PrepareCommunicationDetailEntityQueries(FilterComparisonType filterType, string numberColumnAlias) { foreach (var detail in CommunicationDetails) { EntitySchemaQuery esq = PrepareDetailEsq(detail, numberColumnAlias); if (esq != null) { ApplyDetailPhoneFilter(esq, filterType); var numberColumn = esq.Columns.FindByName(CommunicationNumberColumnName); if (numberColumn == null) { continue; } string numberColumnAliasWrap = GetColumnAliasWrapper(numberColumnAlias); numberColumn.SetForcedQueryColumnValueAlias(numberColumnAliasWrap); var key = string.Format("{0}_{1}", detail.Key, numberColumnAlias); EntityQueries.Add(key, esq); } } }
public EntityContextServices( ILogger <TContext> logger, ICollectionService <TContext> collectionsService, EntityQueries <TContext> queries, EntityCommands <TContext> commands, EntityConfigurator <TContext> configurator, IEntityPropertyResolver <TContext> propertyResolver, IPathBuilder <TContext> pathBuilder, EntityContextInitializer <TContext> initializer, IEntityNotificationService <TContext> notificationService, ISecurityDisablerService securityDisablerService) { Logger = logger; Collections = collectionsService ?? throw new ArgumentException(nameof(collectionsService)); Queries = queries ?? throw new ArgumentNullException(nameof(queries)); Commands = commands ?? throw new ArgumentNullException(nameof(commands)); Configurator = configurator ?? throw new ArgumentNullException(nameof(configurator)); PropertyResolver = propertyResolver ?? throw new ArgumentNullException(nameof(propertyResolver)); PathBuilder = pathBuilder ?? throw new ArgumentNullException(nameof(pathBuilder)); Initializer = initializer ?? throw new ArgumentNullException(nameof(initializer)); NotificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); SecurityDisablerService = securityDisablerService ?? throw new ArgumentNullException(nameof(securityDisablerService)); }
public Tuple <IReadOnlyCollection <EntityMetadata>, EntityQueries> Parse([NotNull] TextReader stream) { if (stream == null) { throw new ArgumentNullException("stream"); } var document = XDocument.Load(stream); if (null == document.Root) { throw new InvalidDataException(); } var entities = document .Root .Elements().FirstOrDefault(e => e.Name.LocalName == XmlMetadataSchema.EntitiesElement); IReadOnlyCollection <EntityMetadata> entityMetadatas; if (null == entities) { entityMetadatas = new ReadOnlyCollection <EntityMetadata>(Enumerable .Empty <EntityMetadata>() .ToList()); return(new Tuple <IReadOnlyCollection <EntityMetadata>, EntityQueries>(entityMetadatas, new EntityQueries(new Dictionary <string, string>()))); } entityMetadatas = (from entitiesEl in entities.Elements().Where(e => e.Name.LocalName == XmlMetadataSchema.EntityElement) select ParseEntity(entitiesEl)).ToList(); var queries = entities .Elements().FirstOrDefault(e => e.Name.LocalName == XmlMetadataSchema.QueriesElement); var resultQueries = new EntityQueries(ParseQueries(queries)); return(new Tuple <IReadOnlyCollection <EntityMetadata>, EntityQueries>(entityMetadatas, resultQueries)); }
public async Task <EntitySource> GetWithTermsByDomainAsync(string domain) { var query = EntityQueries.GetWithTermsByDomain(domain); return(await Collection.Aggregate <EntitySource>(query).FirstOrDefaultAsync()); }
public static void Start(List <Entity> matchingEntities) { Analytics.CustomEvent("Day Three Started"); var mcGraw = EntityQueries.GetEntityWithName(matchingEntities, NPCS.McGraw.Name); var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You); //McGraw var mcGrawSequence = new ActionSequence("McGrawTutorial"); if (!GameSettings.DisableTutorial) { mcGrawSequence.Add(new TeleportAction(Locations.OutsideDoorLocation())); mcGrawSequence.Add(new GetWaypointAction(Goal.PayFor)); mcGrawSequence.Add(new GoToWaypointAction()); mcGrawSequence.Add(new ConversationAction(new TutorialIntroDiaglogue())); mcGrawSequence.Add(new DialogueBranchAction(new Dictionary <DialogueOutcome, Action> { { DialogueOutcome.Nice, () => { ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(mcGraw, new UpdateMoodAction(Mood.Happy)); StaticStates.Get <OutcomeTrackerState>().AddOutcome("You made a good impression on McGraw."); } }, { DialogueOutcome.Mean, () => { ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(mcGraw, new UpdateMoodAction(Mood.Angry)); StaticStates.Get <OutcomeTrackerState>().AddOutcome("You and McGraw haven't got off to the best start."); } } })); mcGrawSequence.Add(CommonActions.QueueForDrinkOrder(mcGraw, 10, 20)); const string drinkName = "Mind Meld"; var drinkRecipe = DrinkRecipes.GetDrinkRecipe(drinkName); var orderSequence = new ConditionalActionSequence("Drink order", false); var drinkOrder = new DrinkOrders.ExactDrinkorder(drinkRecipe, mcGraw.GetState <NameState>().Name); orderSequence.Add(new StartDrinkOrderAction(drinkOrder)); mcGrawSequence.Add(orderSequence); orderSequence.Add(CommonActions.WaitForDrink(mcGraw, drinkName, drinkOrder, 90, true, new DrinkSucsessDialogue())); mcGrawSequence.Add(new RemoveTutorialControlLockAction()); mcGrawSequence.Add(new FadeToBlackAction(6.5f, "First day. Just open the bar then serve the right drinks, Easy?")); mcGrawSequence.Add(new PauseAction(3.0f)); mcGrawSequence.Add(new CallbackAction(() => { EventSystem.EndDrinkMakingEvent.Invoke(); ActionManagerSystem.Instance.AddActionToFrontOfQueueForEntity(player, new TeleportAction(Locations.CenterOfBar())); })); //This is kind of dirty - but demo! mcGrawSequence.Add(new DestoryEntityInInventoryAction()); mcGrawSequence.Add(new TeleportAction(Locations.SitDownPoint3())); mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawMorningOne(), mcGraw)); mcGrawSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence); //Player var playerSequence = new ActionSequence("PlayerTutorial"); playerSequence.Add(new TeleportAction(Locations.OutsideDoorLocation())); playerSequence.Add(new GetWaypointAction(Goal.RingUp)); playerSequence.Add(new GoToWaypointAction()); ActionManagerSystem.Instance.QueueAction(player, playerSequence); } else { mcGrawSequence.Add(new TeleportAction(Locations.SitDownPoint3())); mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawMorningOne())); mcGrawSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence); } var loveStoryActions = LoveStory.DayOneMorning(); foreach (var actionPair in loveStoryActions) { var entity = actionPair.GetEntity(); var action = actionPair.GetGameAction(); ActionManagerSystem.Instance.QueueAction(entity, action); } }
public static void Start(List <Entity> matchingEntities) { var mcGraw = EntityQueries.GetEntityWithName(matchingEntities, NPCName.McGraw); var ellie = EntityQueries.GetEntityWithName(matchingEntities, NPCName.Ellie); var tolstoy = EntityQueries.GetEntityWithName(matchingEntities, NPCName.Tolstoy); var player = EntityQueries.GetEntityWithName(matchingEntities, NPCName.You); var q = EntityQueries.GetEntityWithName(matchingEntities, NPCName.Q); var jannet = EntityQueries.GetEntityWithName(matchingEntities, NPCName.Jannet); var cheeringStartPoint = new SyncedAction(new List <Entity> { mcGraw, ellie, tolstoy, q, jannet }); //Player var playerSequence = new ActionSequence("Player Party"); playerSequence.Add(new CallbackAction(() => WelcomeSignControllerVisualizer.Instance.SetWelcomeSignActive(true))); playerSequence.Add(new TeleportAction(Locations.StandPoint1())); ActionManagerSystem.Instance.QueueAction(player, playerSequence); var mcGrawSequence = new ActionSequence("McGraw Party"); var qSequence = new ActionSequence("Q Party"); //Either McGraw or Q can be your friend at the end. Not both. if (mcGraw.GetState <RelationshipState>().PlayerOpinion >= 0) { mcGrawSequence.Add(new TeleportAction(Locations.StandPoint3())); mcGrawSequence.Add(new ConversationAction(new McGrawPartyGreeting())); mcGrawSequence.Add(cheeringStartPoint); mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawPartyPositive(), mcGraw)); mcGrawSequence.Add(new PauseAction(1f)); mcGrawSequence.Add(CheerLoop(2)); mcGrawSequence.Add(new GetWaypointAction(Goal.Sit, true, true)); mcGrawSequence.Add(new GoToWaypointAction()); mcGrawSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence); qSequence.Add(new TeleportAction(Locations.SitDownPoint1())); qSequence.Add(cheeringStartPoint); qSequence.Add(new SetReactiveConversationAction(new QPartyNegative(), q)); qSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(q, qSequence); } else { qSequence.Add(new TeleportAction(Locations.StandPoint3())); qSequence.Add(new ConversationAction(new QPartyGreeting())); qSequence.Add(cheeringStartPoint); qSequence.Add(new SetReactiveConversationAction(new QPartyPositive(), q)); qSequence.Add(new PauseAction(0.5f)); qSequence.Add(CheerLoop(3)); qSequence.Add(new GetWaypointAction(Goal.Sit, true, true)); qSequence.Add(new GoToWaypointAction()); qSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(q, qSequence); mcGrawSequence.Add(new TeleportAction(Locations.SitDownPoint1())); mcGrawSequence.Add(cheeringStartPoint); mcGrawSequence.Add(new SetReactiveConversationAction(new McGrawPartyNegative(), mcGraw)); mcGrawSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(mcGraw, mcGrawSequence); } //Jannet if (jannet.GetState <RelationshipState>().PlayerOpinion >= 0) { var jannetSequence = new ActionSequence("Jannet Party Positive"); jannetSequence.Add(new TeleportAction(Locations.StandPoint2())); jannetSequence.Add(cheeringStartPoint); jannetSequence.Add(new SetReactiveConversationAction(new JannetPartyPositive(), jannet)); jannetSequence.Add(new PauseAction(1.2f)); jannetSequence.Add(CheerLoop(3)); jannetSequence.Add(new GetWaypointAction(Goal.Sit, true, true)); jannetSequence.Add(new GoToWaypointAction()); jannetSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(jannet, jannetSequence); } else { var jannetSequence = new ActionSequence("Jannet Party Negative"); jannetSequence.Add(new TeleportAction(Locations.SitDownPoint2())); jannetSequence.Add(cheeringStartPoint); jannetSequence.Add(new SetReactiveConversationAction(new JannetPartyNegative(), jannet)); jannetSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(jannet, jannetSequence); } //Tolstoy if (tolstoy.GetState <RelationshipState>().PlayerOpinion >= 0) { var tolstoySequence = new ActionSequence("Tolstoy Party Positive"); tolstoySequence.Add(new TeleportAction(Locations.StandPoint4())); tolstoySequence.Add(cheeringStartPoint); tolstoySequence.Add(new SetReactiveConversationAction(new TolstoyPartyPositive(), tolstoy)); tolstoySequence.Add(new PauseAction(1f)); tolstoySequence.Add(CheerLoop(2)); tolstoySequence.Add(new GetWaypointAction(Goal.Sit, true, true)); tolstoySequence.Add(new GoToWaypointAction()); tolstoySequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(tolstoy, tolstoySequence); } else { var tolstoySequence = new ActionSequence("Tolstoy Party Negative"); tolstoySequence.Add(new TeleportAction(Locations.SitDownPoint3())); tolstoySequence.Add(cheeringStartPoint); tolstoySequence.Add(new SetReactiveConversationAction(new TolstoyPartyNegative(), tolstoy)); tolstoySequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(tolstoy, tolstoySequence); } //Ellies if (ellie.GetState <RelationshipState>().PlayerOpinion >= 0) { var ellieSequence = new ActionSequence("Ellie Party"); ellieSequence.Add(new TeleportAction(Locations.StandPoint5())); ellieSequence.Add(cheeringStartPoint); ellieSequence.Add(new SetReactiveConversationAction(new ElliePartyPositive(), ellie)); ellieSequence.Add(CheerLoop(3)); ellieSequence.Add(new GetWaypointAction(Goal.Sit, true, true)); ellieSequence.Add(new GoToWaypointAction()); ellieSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(ellie, ellieSequence); } else { var ellieSequence = new ActionSequence("Ellie Party Negative"); ellieSequence.Add(new TeleportAction(Locations.SitDownPoint4())); ellieSequence.Add(cheeringStartPoint); ellieSequence.Add(new SetReactiveConversationAction(new ElliePartyNegative(), ellie)); ellieSequence.Add(CommonActions.SitDownLoop()); ActionManagerSystem.Instance.QueueAction(ellie, ellieSequence); } }