Exemplo n.º 1
0
 public AppraisalRule(Name eventName, ConditionSet conditions = null)
 {
     AM.AssertEventNameValidity(eventName);
     EventName    = eventName;
     Conditions   = conditions ?? new ConditionSet();
     Desirability = Praiseworthiness = 0;
 }
Exemplo n.º 2
0
        private void buttonTest_Click(object sender, System.EventArgs e)
        {
            var rpcAsset = CloneHelper.Clone(iat.Characters.Where(c => c.CharacterName == (Name)rpcName).First());

            rpcAsset.LoadAssociatedAssets(storage);
            iat.BindToRegistry(rpcAsset.DynamicPropertiesRegistry);

            string[] eventStrings = this.textBoxEvents.Text.Split(
                new[] { Environment.NewLine },
                StringSplitOptions.None).Select(s => s.Trim()).ToArray();

            foreach (var s in eventStrings)
            {
                if (string.IsNullOrWhiteSpace(s))
                {
                    continue;
                }

                if (s.StartsWith("-"))
                {
                    var count = s.Count(c => c == '-');
                    for (int i = 0; i < count; i++)
                    {
                        rpcAsset.Update();
                    }
                }
                else
                {
                    try
                    {
                        var evt = WellFormedNames.Name.BuildName(s);
                        AM.AssertEventNameValidity(evt);
                        rpcAsset.Perceive(evt);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + " " + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            textBoxMood.Text    = rpcAsset.Mood.ToString();
            textBoxTick.Text    = rpcAsset.Tick.ToString();
            emotions.DataSource = rpcAsset.GetAllActiveEmotions().ToList();
            actions.DataSource  = rpcAsset.Decide(wfNameActionLayer.Value).ToList();
        }