public AspectDelegate Build() { AspectDelegate next = async context => { var returnValue = context.Method.Invoke(context.Instance, context.Parameters); var returnType = context.Method.ReturnType; if (returnType == typeof(void)) { context.ReturnValue = null; return; } await AwaitReturnAsync(returnValue); context.ReturnValue = returnValue; }; for (int i = Aspects.Count - 1; i >= 0; i--) { next = Aspects[i](next); } return(next); }
public AspectDelegate Build() { AspectDelegate next = context => { context.ReturnValue = context.Method.Invoke(context.Instance, context.Parameters); return(Task.CompletedTask); }; for (int i = Aspects.Count - 1; i >= 0; i--) { next = Aspects[i](next); } return(next); }
public void showInfo(Vector3 location, Aspects.Primary primary, Aspects.Secondary secondary) { panel.transform.position = new Vector3(location.x, location.y, panel.transform.position.z); this.primary.sprite = Aspects.instance().getNormalSprite(primary); this.secondary.sprite = Aspects.instance().getNormalSprite(secondary); panel.SetActive(true); }
public void BuildNPCFromEmbed(Embed embed) { foreach (var aspectField in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.Aspect)) { Aspects.Add(aspectField.Value); } foreach (var dispositionField in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.Disposition)) { Dispositions.Add(dispositionField.Value); } foreach (var firstLook in embed.Fields.Where(fld => fld.Name == StarforgedNPCResources.FirstLook)) { FirstLooks.Add(firstLook.Value); } foreach (var goal in embed.Fields.Where(fld => fld.Name == NPCResources.Goal)) { Goals.Add(goal.Value); } foreach (var role in embed.Fields.Where(fld => fld.Name == NPCResources.Role)) { Roles.Add(role.Value); } Name = embed.Fields.FirstOrDefault(fld => fld.Name == NPCResources.Name).Value; IconUrl = embed.Thumbnail.HasValue ? embed.Thumbnail.Value.Url : null; EmbedDesc = embed.Description; }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); var version = writer.SetVersion(3); switch (version) { case 3: case 2: { writer.WriteFlag(_Level); Aspects.Serialize(writer); } goto case 1; case 1: _EnrageStatBuff.Serialize(writer); goto case 0; case 0: break; } }
private void Delete() { foreach (var item in SelectedItems) { Aspects.Remove(item); } }
private Effect getEffectForAspect(Aspects.Secondary aspect) { switch (aspect) { case Aspects.Secondary.NONE: return EffectNone; case Aspects.Secondary.VOID: return EffectVoid; case Aspects.Secondary.SEDUCTIVE: return EffectSeductive; case Aspects.Secondary.FIRE: return EffectFire; case Aspects.Secondary.WATER: return EffectWater; case Aspects.Secondary.SLIME: return EffectSlime; case Aspects.Secondary.DECAY: return EffectDecay; case Aspects.Secondary.BEAST: return EffectBeastly; case Aspects.Secondary.UNKNOWN: return null; default: throw new ArgumentException("Unrecognized Secondary aspect enum value: " + aspect); } }
public static List <Relation> RelationsOn(DateTimeOffset date, PlanetId refStar) { List <Relation> allRelations = new List <Relation>(); Position refPos = CurrentEphemeris[date, refStar]; Position anotherPos; Angle distance; Aspects aspect; for (PlanetId anotherId = PlanetId.SE_SUN; anotherId <= PlanetId.SE_CHIRON; anotherId++) { if (anotherId == refStar || !Masters.Contains(anotherId)) { continue; } anotherPos = CurrentEphemeris[date, anotherId]; distance = refPos.Longitude - anotherPos.Longitude; aspect = Aspects.CurrentAspectOf(distance); if (aspect != null) { allRelations.Add(new Relation(date, anotherPos, refPos)); } } return(allRelations); //List<Relation> allRelations = RelationsOn(around); //return (from relation in allRelations // where relation.Inferior == refStar || relation.Superior == refStar // select relation).ToList(); }
public void setBodyParts(BodyPart[] parts, Aspects.Secondary type) { foreach (BodyPart part in parts) { setBodyPart(part, type); } }
public static List <Relation> RelationsOn(DateTimeOffset date) { List <Position> positions = CurrentEphemeris[date]; List <Relation> allRelations = new List <Relation>(); Position superiorPos, inferiorPos; Angle distance; Aspects aspect; for (int i = Masters.Count - 1; i > 0; i--) { PlanetId superiorId = Masters[i]; superiorPos = CurrentEphemeris.PositionOf(positions, superiorId); for (int j = i - 1; j >= 0; j--) { PlanetId inferiorId = Masters[j]; inferiorPos = CurrentEphemeris.PositionOf(positions, inferiorId); distance = inferiorPos.Longitude - superiorPos.Longitude; aspect = Aspects.CurrentAspectOf(distance); if (aspect != null) { allRelations.Add(new Relation(date, superiorPos, inferiorPos)); } } } return(allRelations); }
public Rule(Tag tag, Aspects aspectRule, Vector2Int pos) { _tag = tag; _tagRule = 0; _aspectRule = aspectRule; _pos = pos; }
public static void Run() { IBankAccount account = Aspects.AddAspects <IBankAccount>(new BankAccount()); account.Deposit(1000); account.Withdraw(500); }
public StoryGraph(ISceneNode root, IReadOnlyList <Pair <int> > edges, bool sameLayout) { SameLayout = sameLayout; var aspectsUnsorted = root.GetComponent <IStoryComponent>().EnumerateStoryAspectsDeep(SameLayout).ToArray(); var maxId = aspectsUnsorted.Max(x => x.Node.Id); EnoughIntegers = Enumerable.Range(0, maxId + 1).ToArray(); Aspects = aspectsUnsorted.ToDictionary(x => x.Node.Id, x => x); NodeObjects = aspectsUnsorted.ToDictionary(x => x.Node.Id, x => x.Node); NodeIds = aspectsUnsorted.Select(x => x.Node.Id).ToArray(); IsUsed = EnoughIntegers.Select(x => NodeObjects.ContainsKey(x)).ToArray(); Indices = NodeObjects.ToDictionary(x => x.Value, x => x.Key); Children = Aspects.ToDictionary(x => x.Key, x => (IReadOnlyList <int>)x.Value.EnumerateImmediateStoryChildren(SameLayout).Select(y => y.Node.Id).ToArray()); Root = root.Id; Parents = NodeObjects.ToDictionary(x => x.Key, x => x.Value.ParentNode?.Id ?? -1); Depths = NodeIds.ToDictionary(x => x, CalculateNodeDepth); Depth = CalculateDepth(Root); Leaves = EnumerateLeaves(Root).ToArray(); NonLeaves = EnumerateNonLeaves(Root).ToArray(); BuildPrevNext(edges, out var next, out var previous, out var goodEdges); Next = next; Previous = previous; Neighbors = Leaves.ToDictionary(x => x, x => (IReadOnlyList <int>)Next[x].Concat(Previous[x]).ToArray()); Edges = goodEdges; LeveledEdges = BuildLeveledEdges(); BuildLeveledPrevNext(out var leveledNext, out var leveledPrev); LeveledNext = leveledNext; LeveledPrevious = leveledPrev; LeveledNeighbors = NodeIds.ToDictionary(x => x, x => (IReadOnlyList <int>)LeveledNext[x].Concat(LeveledPrevious[x]).ToArray()); ExternalConnections = BuildExternal(); NodesInBfsOrder = BreadthFirstSearch().ToArray(); }
public ReplicationServiceSettings() { var connectionStrings = ConnectionStrings.For(ErmConnectionStringIdentity.Instance, AmsConnectionStringIdentity.Instance, RulesetConnectionStringIdentity.Instance, FactsConnectionStringIdentity.Instance, AggregatesConnectionStringIdentity.Instance, MessagesConnectionStringIdentity.Instance, ServiceBusConnectionStringIdentity.Instance, InfrastructureConnectionStringIdentity.Instance, LoggingConnectionStringIdentity.Instance); var connectionStringSettings = new ConnectionStringSettingsAspect(connectionStrings); var quartzProperties = (NameValueCollection)ConfigurationManager.GetSection(StdSchedulerFactory.ConfigurationSectionName); Aspects.Use(connectionStringSettings) .Use <BusinessModelSettingsAspect>() .Use <ServiceBusMessageLockRenewalSettings>() .Use <EnvironmentSettingsAspect>() .Use(new QuartzSettingsAspect(connectionStringSettings.GetConnectionString(InfrastructureConnectionStringIdentity.Instance))) .Use(new ServiceBusReceiverSettingsAspect(connectionStringSettings.GetConnectionString(ServiceBusConnectionStringIdentity.Instance))) .Use <ArchiveVersionsSettings>() .Use <LogstashSettingsAspect>() .Use <IdentityServiceClientSettingsAspect>() .Use(new TaskServiceRemoteControlSettings(quartzProperties)); }
/// <summary> /// <see cref="ISearchAgent"/> ProcessVariables event handler. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <inheritdoc /> protected override void OnProcessVariables(object sender, ProcessVariablesEventArgs e) { ISudokuPuzzle candidate = new SudokuPuzzle(); // In this case we know that there is a Single Aspect. var aspect = Aspects.SingleOrDefault(); Assert.NotNull(aspect); for (var row = MinimumValue; row < MaximumValue; row++) { for (var col = MinimumValue; col < MaximumValue; col++) { // ReSharper disable once PossibleNullReferenceException candidate[row, col] = (int)aspect.Cells[row, col].Value(); } } /* If we're here processing variables, it should be because we are processing the next * solution. However, in the event we still do not have a solution, then simply return. */ // TODO: TBD: we really should never land here I don't think... if (candidate.IsSolved) { Solution = candidate; // False is the default, so only mark whether ShouldBreak when we have one. e.ShouldBreak = true; } base.OnProcessVariables(sender, e); }
public GuessState getGuessState(Aspects.Primary aspect) { if (primaryGuesses.ContainsKey(aspect)) { return primaryGuesses[aspect]; } else { return GuessState.UNKNOWN; } }
public GuessState getGuessState(Aspects.Secondary aspect) { if (secondaryGuesses.ContainsKey(aspect)) { return secondaryGuesses[aspect]; } else { return GuessState.UNKNOWN; } }
public AudioClip[] getClips(Aspects.Secondary type) { if (clips.ContainsKey(type)) { return clips[type]; } else { return new AudioClip[0]; } }
public T GetAspect <T>() where T : class, INestedAspect, new() { if (!Aspects.TryGetValue(typeof(T), out var result)) { result = SetAspect(new T()); } return((T)result); }
protected override void InitializeConnection(IRemoteConnection connection) { var remoteExecutor = connection.RemoteExecutor; var twoWayCallback = Aspects.WithTimeMeasure(remoteExecutor.Create <IClientCallback>(ReturnPolicy.TwoWay), ConsoleColor.DarkCyan); var oneWayCallback = Aspects.WithTimeMeasure(remoteExecutor.Create <IClientCallback>(ReturnPolicy.OneWay), ConsoleColor.DarkCyan); var longRunningOperation = Aspects.WithTimeMeasure <ILongRunningOperation>(new LongRunningOperation(twoWayCallback, oneWayCallback)); connection.OperationDispatcher.RegisterHandler(longRunningOperation); }
public async Task <ActionResult> DeleteConfirmed(string id) { Aspects aspects = await db.Aspects.FindAsync(id); db.Aspects.Remove(aspects); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
private void RemoveAspect(object obj) { var aspect = SelectedAspect; SelectedConfiguration.Aspects.Remove(aspect); Aspects.Remove(aspect); NotifyOfPropertyChange(nameof(Aspects)); }
public Sprite getSprite(Aspects.Secondary type, BodyPart bodyPart) { if (sprites.ContainsKey(type)) { return sprites[type][bodyPart]; } else { Debug.Log("No sprites for player type " + type); return sprites[Aspects.Secondary.NONE][bodyPart]; } }
public string MethodWithAspect() { return(Aspects.LogException(() => { var dummy = new string('a', 10); Console.WriteLine(dummy); return dummy; })); }
public Potion(Aspects.Primary primary1, Aspects.Primary primary2, Aspects.Primary primary3, HashSet<Aspects.Secondary> secondaries) { primaries = new HashSet<Aspects.Primary>(); primaries.Add(primary1); primaries.Add(primary2); primaries.Add(primary3); this.secondaries = secondaries; }
public IngredientData(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary) { this.type = type; this.primary = primary; this.secondary = secondary; primaryGuesses = new Dictionary<Aspects.Primary, GuessState>(); secondaryGuesses = new Dictionary<Aspects.Secondary, GuessState>(); }
public static Relation FirstRelationSince(PlanetId SuperiorId, PlanetId InferiorId, Double sinceJulian) { reorder(ref SuperiorId, ref InferiorId); double orbToNext, speed, step = 100.0, time = sinceJulian; Position superiorPos, inferiorPos; int tries = 0; Angle angle; Aspects next = null; do { superiorPos = Ephemeris.Geocentric[time, SuperiorId]; inferiorPos = Ephemeris.Geocentric[time, InferiorId]; angle = inferiorPos.Longitude - superiorPos.Longitude; speed = inferiorPos.LongitudeVelocity - superiorPos.LongitudeVelocity; if (next == null) { next = Aspects.NextAspect(angle, speed > 0); double temp = next.OrbOf(angle); step = -temp / speed; if (time + step < sinceJulian) { next = Aspects.NextAspect(angle, speed < 0); } } orbToNext = next.OrbOf(angle); if (Math.Abs(orbToNext) < Negligible) { return(new Relation(Ephemeris.UtcFromJulianDay(time), superiorPos, inferiorPos)); } step = -orbToNext / speed; if (step > MaxStep) { step = MaxStep; } else if (step < -MaxStep) { step = -MaxStep; } time += step; tries++; } while (tries < maxTry); return(null); }
public void SetModifiers(Dictionary <int, float> newModifiers) { foreach (KeyValuePair <int, float> modifier in newModifiers) { if (Aspects.ContainsKey(modifier.Key)) { Aspects[modifier.Key].Modifier = modifier.Value < INE.Char.MinModifier ? INE.Char.MinModifier : modifier.Value; } } }
public void SetTargetDistribution(int key, float value) { if (Aspects != null) { if (Aspects.ContainsKey(key)) { Aspects[key].TargetDistribution = value <0 ? 0 : value> INE.Char.MaxDistribution ? INE.Char.MaxDistribution : value; } } }
public QueryingServiceSettings() { var connectionString = ConnectionStrings.For(ErmConnectionStringIdentity.Instance, AmsConnectionStringIdentity.Instance, ValidationRulesConnectionStringIdentity.Instance, LoggingConnectionStringIdentity.Instance); Aspects.Use(new ConnectionStringSettingsAspect(connectionString)) .Use <EnvironmentSettingsAspect>(); }
public static List <int> GetList(Aspects asp) { var data = Contexts.Default.GetUnique <DataComp>().data; if (!data.GetAspPool().TryGetValue((int)asp, out var list)) { list = new List <int>(); data.GetAspPool().Add((int)asp, list); } return(list); }
/// <summary> /// Creates an object of the specified base type, registering the type if necessary /// </summary> /// <param name="BaseType">The base type</param> /// <returns>Returns an object of the specified base type</returns> public virtual object Create(Type BaseType) { if (!Classes.ContainsKey(BaseType)) { Setup(BaseType); } object ReturnObject = Classes[BaseType].Assembly.CreateInstance(Classes[BaseType].FullName); Aspects.ForEach(x => x.Setup(ReturnObject)); return(ReturnObject); }
public IReadOnlyList <int> GetEntitiesByAspect(Aspects aspects) { //var tagList = Helper.RuleToTagList(aspects); //var result = new List<int>(); //foreach (var tag in tagList) //{ // result.AddRange(Helper.GetList(tag)); //} //return result; return(Helper.GetList(aspects)); }
public bool CheckTagHasAspect(Tag tag, Aspects aspects) { foreach (var r in _rule) { if (r.GetTag() == tag && r.GetAspectRule() == aspects) { return(true); } } return(false); }
public async Task <ActionResult> Edit([Bind(Include = "Name,Score,Category,IsWatched")] Aspects aspects) { if (ModelState.IsValid) { db.Entry(aspects).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(aspects)); }
private void AddNewAspect(object obj) { var newAspect = new AspectConfiguration { PluginName = SelectedNewAspect }; SelectedConfiguration.Aspects.Add(newAspect); Aspects.Add(newAspect); NotifyOfPropertyChange(nameof(Aspects)); }
public ReplicationServiceSettings() { var quartzProperties = (NameValueCollection)ConfigurationManager.GetSection(StdSchedulerFactory.ConfigurationSectionName); Aspects.Use <TenantConnectionStringSettings>() .Use <ServiceBusMessageLockRenewalSettings>() .Use <EnvironmentSettingsAspect>() .Use <QuartzSettingsAspect>() .Use <ArchiveVersionsSettings>() .Use <LogstashSettingsAspect>() .Use(new TaskServiceRemoteControlSettings(quartzProperties)); }
public async Task <ActionResult> Create([Bind(Include = "Name,Score,Category,IsWatched")] Aspects aspects) { if (ModelState.IsValid) { db.Aspects.Add(aspects); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(aspects)); }
public void add(Aspects.Primary primary1, Aspects.Primary primary2, Aspects.Primary primary3, MultiSet<Aspects.Secondary> secondaries, PotionSlot slot, Aspects.Secondary type, Effect effect) { Potion potion = new Potion(primary1, primary2, primary3, secondaries, slot, type, effect); MultiSet<Aspects.Primary> primaries = new MultiSet<Aspects.Primary>(); primaries.Add(primary1); primaries.Add(primary2); primaries.Add(primary3); if (!potions.ContainsKey(primaries)) { potions.Add(primaries, new List<Potion>()); } potions[primaries].Add(potion); }
public Potion(Aspects.Primary primary1, Aspects.Primary primary2, Aspects.Primary primary3, MultiSet<Aspects.Secondary> secondaries, PotionSlot slot, Aspects.Secondary type, Effect effect) { primaries = new MultiSet<Aspects.Primary>(); primaries.Add(primary1); primaries.Add(primary2); primaries.Add(primary3); this.secondaries = new MultiSet<Aspects.Secondary>(secondaries); _slot = slot; _type = type; _effect = effect; }
private void initAspect(IngredientType ingredient, GameObject lineItemInstance, String childName, Aspects.Secondary aspect) { GameObject iconButton = lineItemInstance.transform.Find(childName).gameObject; iconButton.GetComponent<Image>().sprite = Aspects.instance().getGreyedSprite(aspect); IngredientData.GuessState currentGuess = Ingredients.instance().getIngredient(ingredient).getGuessState(aspect); switch (currentGuess) { case IngredientData.GuessState.UNKNOWN: iconButton.GetComponent<Image>().sprite = Aspects.instance().getGreyedSprite(aspect); break; case IngredientData.GuessState.HAS: iconButton.GetComponent<Image>().sprite = Aspects.instance().getNormalSprite(aspect); break; case IngredientData.GuessState.NOT_HAS: iconButton.GetComponent<Image>().sprite = Aspects.instance().getDisabledSprite(aspect); break; } iconButton.GetComponent<Button>().onClick.AddListener(() => { IngredientData data = Ingredients.instance().getIngredient(ingredient); IngredientData.GuessState guess = data.getGuessState(aspect); IngredientData.GuessState next = IngredientData.GuessState.UNKNOWN; Image icon = iconButton.GetComponent<Image>(); switch (guess) { case IngredientData.GuessState.UNKNOWN: next = IngredientData.GuessState.HAS; icon.sprite = Aspects.instance().getNormalSprite(aspect); break; case IngredientData.GuessState.HAS: next = IngredientData.GuessState.NOT_HAS; icon.sprite = Aspects.instance().getDisabledSprite(aspect); break; case IngredientData.GuessState.NOT_HAS: next = IngredientData.GuessState.UNKNOWN; icon.sprite = Aspects.instance().getGreyedSprite(aspect); break; } data.setGuessState(aspect, next); updateWarningIcon(data, lineItemInstance); }); }
private Potion getBestMatch(Aspects.Primary primary1, Aspects.Primary primary2, Aspects.Primary primary3, MultiSet<Aspects.Secondary> secondaries) { MultiSet<Aspects.Primary> primaries = new MultiSet<Aspects.Primary>(); primaries.Add(primary1); primaries.Add(primary2); primaries.Add(primary3); if (!potions.ContainsKey(primaries)) { return defaultPotion; } List<Potion> primaryMatches = potions[primaries]; Potion bestMatch = null; foreach (Potion primaryMatch in primaryMatches) { bool match = (primaryMatch.getSecondaries().Except(secondaries).Count == 0); if (match && (bestMatch == null || bestMatch.getSecondaries().Count() < primaryMatch.getSecondaries().Count())) { bestMatch = primaryMatch; } } return bestMatch; }
private void add(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary) { ingredients.Add(type, new IngredientData(type, primary, secondary)); }
public void playSound(Aspects.Secondary type) { AudioClip[] sounds = PlayerSoundEffects.instance().getClips(type); player.playSound(sounds); }
public IngredientData(IngredientType type, Aspects.Primary primary, Aspects.Secondary secondary) { this.type = type; this.primary = primary; this.secondary = secondary; }
public void setBodyPart(BodyPart part, Aspects.Secondary type) { Transform partTransform = bodyPartToTransform(part); partTransform.GetComponent<SpriteRenderer>().sprite = PlayerSprites.instance().getSprite(type, part); }
public void setGuessState(Aspects.Primary aspect, GuessState state) { primaryGuesses[aspect] = state; }
public void setGuessState(Aspects.Secondary aspect, GuessState state) { secondaryGuesses[aspect] = state; }