private void Poly_MouseDown(object sender, MouseButtonEventArgs e) { if (sender is Polygon poly) { Thing t = (Thing)poly.GetValue(AttentionObjectProperty); ModuleAttention parent = (ModuleAttention)base.ParentModule; parent.SetAttention(t); } }
//fill this method in with code which will execute //once for each cycle of the engine public override void Fire() { Init(); //be sure to leave this here ModuleView naSource = theNeuronArray.FindModuleByLabel("UKS"); if (naSource == null) { return; } uks = (ModuleUKS)naSource.TheModule; ModuleView attnSource = theNeuronArray.FindModuleByLabel("Attention"); if (attnSource == null) { return; } ModuleAttention m = (ModuleAttention)attnSource.TheModule; Thing mentalModelParent = uks.GetOrAddThing("MentalModel", "Visual"); Thing wordParent = uks.GetOrAddThing("Word", "Audible"); Thing attn = uks.GetOrAddThing("ATTN", "Thing"); if (words.Count > 0) { if (currentWord != "") { attn.RemoveReferencesWithAncestor(wordParent); } currentWord = words[0]; //is this a reference to a visible object? does it contain a digit? if (words[0].IndexOfAny(new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }) != -1) { Thing t = uks.Labeled(words[0], mentalModelParent.Children); if (t != null) { if (naSource != null) { m.SetAttention(t, -1); } } } else { //process a single word & add it to the current phrase currentWord = char.ToUpper(currentWord[0]) + currentWord.Substring(1); Thing theWord = uks.GetOrAddThing("w" + currentWord, wordParent); attn.AddReference(theWord); } //delete the word from the top of the list words.RemoveAt(0); } else { if (attn.HasReferenceWithParent(wordParent) != null) { attn.RemoveReferencesWithAncestor(wordParent); m.SetAttention(null, 0); } } InnerMonologue(); //if you want the dlg to update, use the following code whenever any parameter changes UpdateDialog(); }