protected override void Awake() { base.Awake(); m_runningProcessors = new Dictionary <string, ScriptProcessor>(); m_scriptFolders = new SetDictionary <string, string>(); }
public TaskManager() { AutoAcceptTask = true; m_assignments = new Dictionary <string, AssignmentDriver>(); m_drivers = new Dictionary <string, IPlayerTaskDriver>(); m_outcomeDrivers = new SetDictionary <string, IPlayerTaskDriver>(); ScriptManager.Instance.ScriptsReset += Instance_ScriptsReset; m_completedObjectives = new Dictionary <string, CompleteObjectiveState>(); m_activatedObjectives = new HashSet <string>(); m_fileAgent = StorageManager.GetGameStorageAgent("taskManager.json"); var state = JsonHelper.Deserialize <TaskManagerState>(m_fileAgent); if (state != null) { if (state.CompletedObjectives != null) { foreach (var o in state.CompletedObjectives) { m_completedObjectives[o.Objective.Id] = o; } } if (state.ActivatedObjectives != null) { foreach (var objId in state.ActivatedObjectives) { m_activatedObjectives.Add(objId); } } } }
public ActivatedRecipeManager() { m_recipesByCollectible = new SetDictionary <string, Recipe>(); m_recipesById = new Dictionary <string, Recipe>(); m_fileAgent = StorageManager.GetGameStorageAgent("ActivatedRecipeManager.json"); var state = JsonHelper.Deserialize <ActivatedRecipeStateList>(m_fileAgent); if (state != null && state.Items != null) { foreach (var recInfo in state.Items) { if (recInfo.Recipe == null) { continue; } AddRecipe(recInfo.Recipe); // Check to see if this recipe is in the directory. If it is, use the // item in the directory. Otherwise use the item we saved. var recipe = RecipeDirectory.Instance.GetItem(recInfo.Recipe.Id) ?? recInfo.Recipe; AddRecipe(recipe); } Save(); } ScriptManager.Instance.ScriptsReset += Instance_ScriptsReset; }
protected void Awake() { m_logger = new Logger(this); g_instance = this; m_spawnedObjects = new SetDictionary <ARMarkerObject, VisualMarkerObject>(); m_trackingMarkerObjects = new SetDictionary <string, ARMarkerObject>(); m_trackingHold = new List <ARMarkerObject>(); m_activeResourceMedia = new SetDictionary <string, MarkerMedia>(); m_activeResourceAssets = new SetDictionary <string, MarkerAsset>(); m_activeResourceObjects = new Dictionary <string, ActiveObject>(); TrackingConditionMonitor = new ARMarkerTrackingConditionMonitor(); if (Activated == null) { Activated = new UnityEvent(); } if (Deactivated == null) { Deactivated = new UnityEvent(); } }
protected override void Awake() { base.Awake(); g_instance = this; m_trackingVuMarkers = new SetDictionary <VuMarkIdentifier, VuforiaTrackableEventHandler>(); m_trackingHold = new List <VuforiaTrackableEventHandler>(); m_activeResourceMedia = new SetDictionary <VuMarkIdentifier, MarkerMedia>(); m_activeResourceAssets = new SetDictionary <VuMarkIdentifier, MarkerAsset>(); m_activeResourceObjects = new Dictionary <string, ActiveObject>(); m_loadedDatabases = new HashSet <string>(); m_toLoad = new HashSet <MarkerDatabase>(); TrackingConditionMonitor = new VuforiaMarkerTrackingConditionMonitor(); VuforiaARController.Instance.RegisterVuforiaStartedCallback(VuforiaStarted); if (Activated == null) { Activated = new UnityEvent(); } if (Deactivated == null) { Deactivated = new UnityEvent(); } // Disable the ARCamera so that the AR controller doesn't start Vuforia on us ARCamera.enabled = false; // Need to review: the code below errors out when trying to destroy // the trackables. // AppManager.Instance.Reloading += App_Reloading; }
public void MultiSetDictionary() { var set = new SetDictionary <int, int>(new Dictionary <int, int> { { 5, 0 }, { 6, 1 }, { 7, 2 }, { 8, 3 }, { 9, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 }, { 4, 8 }, }, true); set.Add(5, 9); set.Add(1, 10); set.Add(2, 11); set.Add(3, 12); set.ToArray().Should().Equal(new KeyValuePair <int, int>[] { KeyValuePair.Create(1, 5), KeyValuePair.Create(1, 10), KeyValuePair.Create(2, 6), KeyValuePair.Create(2, 11), KeyValuePair.Create(3, 7), KeyValuePair.Create(3, 12), KeyValuePair.Create(4, 8), KeyValuePair.Create(5, 0), KeyValuePair.Create(5, 9), KeyValuePair.Create(6, 1), KeyValuePair.Create(7, 2), KeyValuePair.Create(8, 3), KeyValuePair.Create(9, 4), }); set.Remove(5); set.ToArray().Should().Equal(new KeyValuePair <int, int>[] { KeyValuePair.Create(1, 5), KeyValuePair.Create(1, 10), KeyValuePair.Create(2, 6), KeyValuePair.Create(2, 11), KeyValuePair.Create(3, 7), KeyValuePair.Create(3, 12), KeyValuePair.Create(4, 8), KeyValuePair.Create(5, 9), KeyValuePair.Create(6, 1), KeyValuePair.Create(7, 2), KeyValuePair.Create(8, 3), KeyValuePair.Create(9, 4), }); set.FindNodeLowerBound(4).Pair.Should().Be(KeyValuePair.Create(4, 8)); set.FindNodeUpperBound(4).Pair.Should().Be(KeyValuePair.Create(5, 9)); set.FindNodeLowerBound(5).Pair.Should().Be(KeyValuePair.Create(5, 9)); set.FindNodeUpperBound(5).Pair.Should().Be(KeyValuePair.Create(6, 1)); set.FindNodeLowerBound(10).Should().BeNull(); set.FindNodeUpperBound(10).Should().BeNull(); }
public WorldObjectManager() { m_objectsByName = new Dictionary <string, WorldObjectBehaviour>(); m_objectsById = new Dictionary <string, WorldObjectBehaviour>(); m_worldObjects = new SetDictionary <string, WorldObjectBehaviour>(); m_pendingEffects = new SetDictionary <string, ActiveResourceContainer <WorldObjectEffectPlayer> >(); m_effects = new SetDictionary <string, MonoBehaviour>(); }
protected override void Awake() { m_inspectors = new ListDictionary <string, ResourceActivationContext>(); m_availableObjects = new HashSet <string>(); m_objectActions = new SetDictionary <string, string>(); base.Awake(); }
public LocationSpawnItemDriver() { //m_logger = new Logger(this); //m_perfCounters = new PerfCounters(); m_locationComputedItems = new Dictionary <string, ComputedLocationSpawnItems>(); m_itemLocations = new SetDictionary <string, Location>(); m_spawnItems = new Dictionary <string, T>(); m_itemLocations = new SetDictionary <string, Location>(); //m_usedLocations = new Dictionary<string, Location>(); }
public LocationValuablesCollectionManager() { m_valuablesByLocation = new SetDictionary <string, LocationValuablesInstance>(); m_valuablesByType = new SetDictionary <string, LocationValuablesInstance>(); m_valuablesByTag = new SetDictionary <string, LocationValuablesInstance>(); m_contexts = new Dictionary <string, ResourceActivationContext>(); m_addedLocations = new Dictionary <string, Location>(); m_removedLocations = new Dictionary <string, Location>(); m_addedValuables = new Dictionary <string, LocationValuablesCollectionItemContainer>(); m_removedValuables = new Dictionary <string, LocationValuablesCollectionItemContainer>(); m_allValuables = new Dictionary <string, LocationValuablesCollectionItemContainer>(); }
public void ReverseComparer() { var set = new SetDictionary <int, int, ReverseComparerStruct <int> >(new Dictionary <int, int> { { 5, 0 }, { 6, 1 }, { 7, 2 }, { 8, 3 }, { 9, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 }, { 4, 8 }, }); set.Add(5, 9); set.Add(1, 10); set.Add(2, 11); set.Add(3, 12); set.ToArray().Should().Equal(new Dictionary <int, int> { { 9, 4 }, { 8, 3 }, { 7, 2 }, { 6, 1 }, { 5, 0 }, { 4, 8 }, { 3, 7 }, { 2, 6 }, { 1, 5 }, }); set.Remove(5); set.ToArray().Should().Equal(new Dictionary <int, int> { { 9, 4 }, { 8, 3 }, { 7, 2 }, { 6, 1 }, { 4, 8 }, { 3, 7 }, { 2, 6 }, { 1, 5 }, }); set.FindNodeLowerBound(6).Pair.Should().Be(KeyValuePair.Create(6, 1)); set.FindNodeUpperBound(6).Pair.Should().Be(KeyValuePair.Create(4, 8)); set.FindNodeLowerBound(5).Pair.Should().Be(KeyValuePair.Create(4, 8)); set.FindNodeUpperBound(5).Pair.Should().Be(KeyValuePair.Create(4, 8)); set.FindNodeLowerBound(0).Should().BeNull(); set.FindNodeUpperBound(0).Should().BeNull(); }
public WorldObjectManager() { m_logger = new Logger(this); m_effectHandlers = new Dictionary <string, IWorldObjectEffectHandler>(); m_objectsByName = new Dictionary <string, WorldObjectBehaviour>(); m_worldObjects = new SetDictionary <string, WorldObjectBehaviour>(); m_pendingEffects = new ListDictionary <string, ActiveResourceContainer <WorldObjectEffectPlayer> >(); m_appliedEffects = new SetDictionary <string, AppliedEffect>(); m_effectHandlers["motive.unity.animation"] = new UnityAnimationEffectHandler(); m_effectHandlers["motive.3d.embeddedAnimation"] = new EmbeddedAnimationEffectHandler(); m_effectHandlers["motive.3d.scriptedAnimation"] = new ScriptedAnimationHandler(); m_effectHandlers["motive.3d.scriptedParticleEffect"] = new ScriptedParticleEffectHandler(); }
protected override void Awake() { m_atrractionActivators = new Dictionary <string, ActivatedAttractionContext>(); // Item handlers per attraction m_attractionItemHandlers = new SetDictionary <string, IAttractionItemHandler>(); m_itemHandlers = new Dictionary <string, IAttractionItemHandler>(); m_fencePool = new LocationFencePool(); m_triggerPool = new LocationTriggerPool(); AppManager.Instance.Initialized += App_Initialized; if (OnUpdated == null) { OnUpdated = new UnityEvent(); } base.Awake(); }
protected override void Awake() { base.Awake(); m_locationAnnotations = new SetDictionary <string, MapAnnotation>(); m_overlays = new SetDictionary <string, IOverlay>(); m_toAdd = new HashSet <MapAnnotation>(); m_toRemove = new HashSet <MapAnnotation>(); if (OnHold == null) { OnHold = new MapControllerEvent(); } if (Ready == null) { Ready = new MapControllerEvent(); } SetScreenBounds(); }
protected override void Awake() { base.Awake(); m_searchLocations = new Dictionary <string, MapAnnotation>(); m_storyTagMarkers = new Dictionary <string, MediaElement>(); m_locationTypeMarkers = new Dictionary <string, MediaElement>(); m_locationAnnotations = new SetDictionary <string, MapAnnotation>(); m_toAdd = new HashSet <MapAnnotation>(); m_toRemove = new HashSet <MapAnnotation>(); if (OnHold == null) { OnHold = new MapControllerEvent(); } if (Ready == null) { Ready = new MapControllerEvent(); } SetScreenBounds(); }
public LocationTreasureChestManager() { m_locationTypeChests = new SetDictionary <string, WeightedValuablesCollection>(); m_storyTagChests = new SetDictionary <string, WeightedValuablesCollection>(); }
protected override void Awake() { m_taskAnnotations = new SetDictionary <string, MapAnnotation <D> >(); base.Awake(); }
public FastTypeSafeDictionary() { _implementation = new SetDictionary <TValue>(1); }
public FastTypeSafeDictionary(uint size) { _implementation = new SetDictionary <TValue>(size); }
void ProcessValuables(IEnumerable <LocationValuablesCollectionItemContainer> locationValuables) { m_perf = new PerfCounters(); m_perf.Start("v"); // Group items by the sets of locations they reference. // The goal here is to reduce the number of locations we visit, ideally as close to 1 // visit per location as possible. SetDictionary <IEnumerable <Location>, LocationValuablesCollectionItemContainer> fixedSets = new SetDictionary <IEnumerable <Location>, LocationValuablesCollectionItemContainer>(); // Location sets per story tag Dictionary <string, IEnumerable <Location> > tagSets = new Dictionary <string, IEnumerable <Location> >(); // Location sets per location type Dictionary <string, IEnumerable <Location> > typeSets = new Dictionary <string, IEnumerable <Location> >(); SetDictionary <string, LocationValuablesCollectionItemContainer> tagLvcs = new SetDictionary <string, LocationValuablesCollectionItemContainer>(); SetDictionary <string, LocationValuablesCollectionItemContainer> typeLvcs = new SetDictionary <string, LocationValuablesCollectionItemContainer>(); foreach (var lvc in locationValuables) { if (lvc.SpawnItem.Locations != null) { fixedSets.Add(lvc.SpawnItem.Locations, lvc); } if (lvc.SpawnItem.LocationTypes != null) { foreach (var type in lvc.SpawnItem.LocationTypes) { if (!typeSets.ContainsKey(type)) { typeSets[type] = LocationCache.Instance.GetLocationsWithType(type); } typeLvcs.Add(type, lvc); } } if (lvc.SpawnItem.StoryTags != null) { foreach (var tag in lvc.SpawnItem.StoryTags) { if (!tagSets.ContainsKey(tag)) { tagSets[tag] = LocationCache.Instance.GetLocationsWithStoryTag(tag); } tagLvcs.Add(tag, lvc); } } } Dictionary <string, Location> processedLocations = new Dictionary <string, Location>(); // Processes the set of locations, optionally creating a union with an existing set Action <IEnumerable <Location>, IEnumerable <LocationValuablesCollectionItemContainer> > processLocations = (locs, lvcsIn) => { m_perf.Start("l"); m_perf.Start("u"); HashSet <LocationValuablesCollectionItemContainer> lvcs = new HashSet <LocationValuablesCollectionItemContainer>(); if (lvcsIn != null) { lvcs.UnionWith(lvcsIn); } m_perf.Stop("u"); m_perf.Start("locs"); if (locs != null) { foreach (var location in locs) { if (!processedLocations.ContainsKey(location.Id)) { processedLocations.Add(location.Id, location); if (location.LocationTypes != null) { foreach (var type in location.LocationTypes) { var tl = typeLvcs[type]; if (tl != null) { lvcs.UnionWith(tl); } } } if (location.StoryTags != null) { foreach (var tag in location.StoryTags) { var tl = tagLvcs[tag]; if (tl != null) { lvcs.UnionWith(tl); } } } m_perf.Start("c"); // Can be smarter here: if LVCs haven't changed, only locations, then // any location that's been checked can be skipped foreach (var lvc in lvcs) { // Have we processed this lvc/location combo recently?? // Note: this currently persists until the resource is deactivated. LocationSpawnItemResults <LocationValuablesCollection> results = null; lock (m_locationComputedItems) { results = GetResults(lvc.ActivationContext.InstanceId, location); if (results != null) { continue; } results = new LocationSpawnItemResults <LocationValuablesCollection>(lvc.ActivationContext.InstanceId, location, lvc.SpawnItem); var prob = lvc.SpawnItem.Probability.GetValueOrDefault(1); var rnd = Tools.RandomDouble(0, 1); if (rnd < prob) { // Tada! results.DidSpawn = true; } AddComputedResult(location, lvc.InstanceId, results); } if (results.DidSpawn) { OnItemsSpawned(lvc.InstanceId, results); } } m_perf.Stop("c"); } else { // TODO: locations re-used } } } m_perf.Stop("locs"); m_perf.Stop("l"); }; foreach (var set in fixedSets.Keys) { processLocations(set, fixedSets[set]); } foreach (var set in tagSets.Values) { processLocations(set, null); } foreach (var set in typeSets.Values) { processLocations(set, null); } /* * m_activationContexts.Add(e.ActivationContext.InstanceId, e.ActivationContext); */ //if (IsRunning) { //AddSpawnItems(e.LocationValuables, null/*e.ActivationContext.GetStorageAgent()*/); } m_perf.Stop("v"); m_logger.Debug("ProcessValuables perf={0}", m_perf.ToShortString()); }
protected override void Awake() { m_markerAnnotations = new SetDictionary <string, MapAnnotation <LocationMarker> >(); base.Awake(); }
public RecipeDirectory() { m_recipesByCollectible = new SetDictionary <string, Recipe>(); }
public SetDictionaryKeyValueEnumerator(SetDictionary <TValue> dic) : this() { _dic = dic; _index = -1; _count = (int)dic.count; }
public CollectibleDirectory() : base() { m_itemsByAttr = new SetDictionary <string, Collectible>(); m_itemsByEmitAction = new SetDictionary <string, Collectible>(); m_itemsByReceivedAction = new SetDictionary <string, Collectible>(); }
public ActiveObject() { PendingLoads = new HashSet <string>(); TrackingMarkerObjects = new Dictionary <GameObject, VisualMarkerWorldObject>(); HoldingMarkerObjects = new SetDictionary <string, VisualMarkerWorldObject>(); }