Example #1
0
        public AddSocialExchange(CommeillFautAsset asset, SocialExchangeDTO dto)
        {
            InitializeComponent();

            this.dto   = dto;
            this.asset = asset;

            //Validators
            EditorTools.AllowOnlyGroundedLiteral(nameTextBox);
            EditorTools.AllowOnlyVariable(wfNameTarget);

            nameTextBox.Value       = dto.Name;
            textBoxDescription.Text = dto.Description;
            wfNameTarget.Value      = dto.Target;

            if (dto.Steps.Count > 0)
            {
                foreach (var s in dto.Steps)
                {
                    stepsTextBox.Text += s.ToString() + ", ";
                }

                stepsTextBox.Text = stepsTextBox.Text.ToString().Remove(stepsTextBox.Text.Length - 2);
            }
            buttonAdd.Text = (dto.Id == Guid.Empty) ? "Add" : "Update";
        }
Example #2
0
        protected override void OnAssetDataLoaded(CommeillFautAsset asset)
        {
            this._socialExchangeList       = new BindingListView <SocialExchangeDTO>((IList)null);
            gridSocialExchanges.DataSource = this._socialExchangeList;

            conditions = new ConditionSetView();
            conditionSetEditorControl.View = conditions;
            conditions.OnDataChanged      += ConditionSetView_OnDataChanged;


            this._socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();

            EditorTools.HideColumns(gridSocialExchanges, new[] {
                PropertyUtil.GetPropertyName <SocialExchangeDTO>(dto => dto.Id),
                PropertyUtil.GetPropertyName <SocialExchangeDTO>(dto => dto.StartingConditions)
            });



            if (this._socialExchangeList.Any())
            {
                var ra = LoadedAsset.GetSocialExchange(this._socialExchangeList.First().Id);
                UpdateConditions(ra);
            }
        }
Example #3
0
        /// <summary>
        /// Loads the associated assets from the defined sources and prevents further authoring of the asset
        /// </summary>
        public void LoadAssociatedAssets()
        {
            var charName = CharacterName.ToString();

            EmotionalAppraisalAsset ea = Loader(m_emotionalAppraisalAssetSource, () => new EmotionalAppraisalAsset());

            EmotionalDecisionMakingAsset edm = Loader(m_emotionalDecisionMakingAssetSource, () => new EmotionalDecisionMakingAsset());
            SocialImportanceAsset        si  = Loader(m_socialImportanceAssetSource, () => new SocialImportanceAsset());
            CommeillFautAsset            cfa = Loader(m_commeillFautAssetSource, () => new CommeillFautAsset());

            m_emotionalAppraisalAsset      = ea;
            m_emotionalDecisionMakingAsset = edm;
            m_socialImportanceAsset        = si;
            m_commeillFautAsset            = cfa;

            MCTSAsset mcts = new MCTSAsset();

            //Dynamic properties
            BindToRegistry(m_kb);
            edm.RegisterKnowledgeBase(m_kb);
            si.RegisterKnowledgeBase(m_kb);
            cfa.RegisterKnowledgeBase(m_kb);
            mcts.RegisterKnowledgeBase(m_kb);
            m_allowAuthoring = false;
        }
Example #4
0
 public MainForm()
 {
     InitializeComponent();
     _storage     = new AssetStorage();
     _loadedAsset = CommeillFautAsset.CreateInstance(_storage);
     OnAssetDataLoaded();
 }
Example #5
0
        public void LoadAssociatedAssets(AssetStorage storage)
        {
            var charName = CharacterName.ToString();

            m_emotionalAppraisalAsset      = EmotionalAppraisalAsset.CreateInstance(storage);
            m_emotionalDecisionMakingAsset = EmotionalDecisionMakingAsset.CreateInstance(storage);
            m_socialImportanceAsset        = SocialImportanceAsset.CreateInstance(storage);
            m_commeillFautAsset            = CommeillFautAsset.CreateInstance(storage);

            //Dynamic properties
            BindToRegistry(m_kb);
            m_emotionalDecisionMakingAsset.RegisterKnowledgeBase(m_kb);
            m_commeillFautAsset.RegisterKnowledgeBase(m_kb);
            m_socialImportanceAsset.RegisterKnowledgeBase(m_kb);
        }
        protected override void OnAssetDataLoaded(CommeillFautAsset asset)
        {
            this.SocialExchangeBox.Items.Clear();
            this.ExchangeList1.Text = "";

            if (asset?.m_SocialExchanges != null)
            {
                this.ExchangeList1.Text = "Number of Social Exchanges: " + asset.m_SocialExchanges.Count;

                foreach (var move in asset.m_SocialExchanges)
                {
                    if(move != null)
                        if(move.ActionName!=null)
                        this.SocialExchangeBox.Items.Add(move.ActionName);
                }
            }
        }
Example #7
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var aux = EditorTools.OpenFileDialog("Asset Storage File (*.json)|*.json|All Files|*.*");

            if (aux != null)
            {
                try
                {
                    _currentFilePath = aux;
                    _storage         = AssetStorage.FromJson(File.ReadAllText(_currentFilePath));
                    _loadedAsset     = CommeillFautAsset.CreateInstance(_storage);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public InfluenceRuleInspector(CommeillFautAsset asset, SocialExchange dto)
        {
            InitializeComponent();

            this._influenceRuleList       = new BindingListView <InfluenceRuleDTO>((IList)null);
            gridInfluenceRules.DataSource = this._influenceRuleList;


            this.dto   = dto;
            this.asset = asset;



            this._influenceRuleList.DataSource = dto.InfluenceRules.Select(x => x.ToDTO()).ToList();

            EditorTools.HideColumns(gridInfluenceRules, new string[] { "Id" });

            label3.Text = dto.Name.ToString();
        }
Example #9
0
        private static RolePlayCharacterAsset BuildEmotionalRPCAsset()
        {
            var kb = new KB((Name)"Matt");


            var ea = new EmotionalAppraisalAsset();

            var appraisalRule = new EmotionalAppraisal.DTOs.AppraisalRuleDTO()
            {
                Conditions            = new Conditions.DTOs.ConditionSetDTO(),
                EventMatchingTemplate = (Name)"Event(*, *,*, *)",
                Desirability          = Name.BuildName(2),
                Praiseworthiness      = Name.BuildName(2)
            };

            ea.AddOrUpdateAppraisalRule(appraisalRule);


            var rpc = new RolePlayCharacterAsset
            {
                BodyName      = "Male",
                VoiceName     = "Male",
                CharacterName = (Name)"Matt",
                m_kb          = kb,
            };

            rpc.m_emotionalAppraisalAsset = ea;

            rpc.BindToRegistry(rpc.m_kb);



            EmotionalDecisionMakingAsset edm = new EmotionalDecisionMakingAsset();
            SocialImportanceAsset        si  = new SocialImportanceAsset();
            CommeillFautAsset            cfa = new CommeillFautAsset();

            rpc.m_emotionalAppraisalAsset      = ea;
            rpc.m_emotionalDecisionMakingAsset = edm;
            rpc.m_socialImportanceAsset        = si;
            rpc.m_commeillFautAsset            = cfa;
            return(rpc);
        }
        public AddSocialExchange(CommeillFautAsset asset, SocialExchangeDTO dto)
        {
            InitializeComponent();

            this.dto   = dto;
            this.asset = asset;

            //Validators
            EditorTools.AllowOnlyGroundedLiteral(nameTextBox);
            EditorTools.AllowOnlyVariable(wfNameTarget);

            nameTextBox.Value       = dto.Name;
            textBoxDescription.Text = dto.Description;
            wfNameTarget.Value      = dto.Target;


            stepsTextBox.Text = dto.Steps;


            buttonAdd.Text = (dto.Id == Guid.Empty) ? "Add" : "Update";
        }
Example #11
0
        static void Main(string[] args)
        {
            AssetManager.Instance.Bridge = new BasicIOBridge();

            var flirt = new SocialExchangeDTO {Action = "Flirt", Instantiation = "You are so beautiful"};
            var compliment = new SocialExchangeDTO { Action = "Compliment", Instantiation = "You are pretty cool" };

            CommeillFautAsset n = new CommeillFautAsset();
            n.AddExchange(flirt);
            n.AddExchange(compliment);

            RolePlayCharacterAsset npc = RolePlayCharacterAsset.LoadFromFile("../../../Examples/john.rpc");
            Console.WriteLine(npc.CharacterName);

               //     CommeillFautAsset cif;
               //     var flirt_id = cif.AddSocialExchange(flirt);
            //   var compliment_id = cif.AddSocialExchange(compliment);

             //   cif.GetSocialMove(Name.BuildName("Player"));
            Console.ReadLine();
        }
Example #12
0
        private static RolePlayCharacterAsset BuildEmotionalRPCAsset(int eaSet = -1)
        {
            var kb = new KB((Name)"Matt");


            var ea = new EmotionalAppraisalAsset();


            if (eaSet == -1)
            {
                var appraisalRule = new EmotionalAppraisal.DTOs.AppraisalRuleDTO()
                {
                    Conditions            = new Conditions.DTOs.ConditionSetDTO(),
                    EventMatchingTemplate = (Name)"Event(*, *,*, *)",
                    AppraisalVariables    = new AppraisalVariables(new List <AppraisalVariableDTO>()
                    {
                        new AppraisalVariableDTO()
                        {
                            Name  = OCCAppraisalVariables.DESIRABILITY,
                            Value = (Name)"2"
                        },
                        new AppraisalVariableDTO()
                        {
                            Name  = OCCAppraisalVariables.PRAISEWORTHINESS,
                            Value = (Name)"2"
                        }
                    })
                };

                ea.AddOrUpdateAppraisalRule(appraisalRule);
            }

            else
            {
                PopulateAppraisalRuleSet();
                ea.AddOrUpdateAppraisalRule(appraisalRuleSet[eaSet]);
            }

            ea.AddOrUpdateGoal(new GoalDTO()
            {
                Name         = "Goal",
                Significance = 5,
                Likelihood   = 0.5f
            });

            ea.AddOrUpdateGoal(new GoalDTO()
            {
                Name         = "GoalNegative",
                Significance = 5,
                Likelihood   = 0.2f
            });

            ea.AddOrUpdateGoal(new GoalDTO()
            {
                Name         = "GoalPositive",
                Significance = 5,
                Likelihood   = 0.8f
            });

            var rpc = new RolePlayCharacterAsset
            {
                BodyName      = "Male",
                VoiceName     = "Male",
                CharacterName = (Name)"Matt",
                m_kb          = kb,
            };

            rpc.m_emotionalAppraisalAsset = ea;

            rpc.BindToRegistry(rpc.m_kb);



            EmotionalDecisionMakingAsset edm = new EmotionalDecisionMakingAsset();
            SocialImportanceAsset        si  = new SocialImportanceAsset();
            CommeillFautAsset            cfa = new CommeillFautAsset();

            rpc.m_emotionalAppraisalAsset      = ea;
            rpc.m_emotionalDecisionMakingAsset = edm;
            rpc.m_socialImportanceAsset        = si;
            rpc.m_commeillFautAsset            = cfa;
            return(rpc);
        }
Example #13
0
        private static CommeillFautAsset BuildCIFAsset()
        {
            var seDTO = new SocialExchangeDTO()
            {
                Name        = Name.BuildName("Flirt"),
                Description = "When I'm atracted to...",


                Target             = Name.BuildName("[t]"),
                StartingConditions = new Conditions.DTOs.ConditionSetDTO()
                {
                    ConditionSet = new string[] { "Has(Floor) = SELF" }
                },
                Steps = new List <Name>()
                {
                    (Name)"Start", (Name)"Answer", (Name)"Finish"
                },
                InfluenceRules = new List <InfluenceRuleDTO>()
                {
                    new InfluenceRuleDTO()
                    {
                        Value = 5,
                        Mode  = (Name)"General",
                        Rule  = new Conditions.DTOs.ConditionSetDTO()

                        {
                            ConditionSet = new string[] { "Likes([t]) = True" }
                        }
                    },

                    new InfluenceRuleDTO()
                    {
                        Value = 10,
                        Mode  = (Name)"Love",
                        Rule  = new Conditions.DTOs.ConditionSetDTO()

                        {
                            ConditionSet = new string[] { "Likes([t]) = True", "EventId(Action-End, [i], Speak(*, *, *, *), [t])>0" }
                        }
                    }
                }
            };

            var cif1 = new CommeillFautAsset();

            cif1.AddOrUpdateExchange(seDTO);



            var seDTO2 = new SocialExchangeDTO()
            {
                Name        = Name.BuildName("Insult"),
                Description = "I hate you ",


                Target             = Name.BuildName("[t]"),
                StartingConditions = new Conditions.DTOs.ConditionSetDTO()
                {
                    ConditionSet = new string[] { "IsAgent(SELF) = True" }
                },
                Steps = new List <Name>()
                {
                    (Name)"Start"
                },
                InfluenceRules = new List <InfluenceRuleDTO>()
                {
                    new InfluenceRuleDTO()
                    {
                        Value = 4,
                        Rule  = new Conditions.DTOs.ConditionSetDTO()

                        {
                            ConditionSet = new string[] { "Likes([t]) = False" }
                        }
                    }
                }
            };

            cif1.AddOrUpdateExchange(seDTO2);

            return(cif1);
        }
Example #14
0
 protected override void OnWillSaveAsset(CommeillFautAsset asset)
 {
     Refresh();
 }
Example #15
0
        protected override void OnAssetDataLoaded(RolePlayCharacterAsset asset)
        {
            textBoxCharacterName.Text  = asset.CharacterName == null ? string.Empty : asset.CharacterName.ToString();
            textBoxCharacterBody.Text  = asset.BodyName;
            textBoxCharacterVoice.Text = asset.VoiceName;

            _emotionalStateVM         = new EmotionalStateVM(this);
            _autobiographicalMemoryVM = new AutobiographicalMemoryVM(this);

            this.moodValueLabel.Text             = Math.Round(_emotionalStateVM.Mood).ToString(MOOD_FORMAT);
            this.moodTrackBar.Value              = (int)float.Parse(this.moodValueLabel.Text);
            this.StartTickField.Value            = _emotionalStateVM.Start;
            this.emotionsDataGridView.DataSource = _emotionalStateVM.Emotions;
            this.dataGridViewAM.DataSource       = _autobiographicalMemoryVM.Events;

            //EA ASSET
            if (string.IsNullOrEmpty(asset.EmotionalAppraisalAssetSource))
            {
                _eaForm.Hide();
            }
            else
            {
                this.pathTextBoxEA.Text = LoadableAsset <EmotionalDecisionMakingAsset> .ToRelativePath(LoadedAsset.AssetFilePath, asset.EmotionalAppraisalAssetSource);

                var ea = EmotionalAppraisalAsset.LoadFromFile(asset.EmotionalAppraisalAssetSource);
                _eaForm.LoadedAsset = ea;
                FormHelper.ShowFormInContainerControl(this.panelEA, _eaForm);
            }

            //EDM ASSET
            if (string.IsNullOrEmpty(asset.EmotionalDecisionMakingSource))
            {
                _edmForm.Hide();
            }
            else
            {
                this.textBoxPathEDM.Text = LoadableAsset <EmotionalDecisionMakingAsset> .ToRelativePath(LoadedAsset.AssetFilePath, asset.EmotionalDecisionMakingSource);

                var edm = EmotionalDecisionMakingAsset.LoadFromFile(asset.EmotionalDecisionMakingSource);
                _edmForm.LoadedAsset = edm;
                FormHelper.ShowFormInContainerControl(this.panelEDM, _edmForm);
            }

            //SI ASSET
            if (string.IsNullOrEmpty(asset.SocialImportanceAssetSource))
            {
                _siForm.Hide();
            }
            else
            {
                this.textBoxPathSI.Text = LoadableAsset <EmotionalDecisionMakingAsset> .ToRelativePath(LoadedAsset.AssetFilePath, asset.SocialImportanceAssetSource);

                var si = SocialImportanceAsset.LoadFromFile(asset.SocialImportanceAssetSource);
                _siForm.LoadedAsset = si;
                FormHelper.ShowFormInContainerControl(this.panelSI, _siForm);
            }

            //CIF ASSET
            if (string.IsNullOrEmpty(asset.CommeillFautAssetSource))
            {
                _cifForm.Hide();
            }
            else
            {
                this.textBoxPathCIF.Text = LoadableAsset <EmotionalDecisionMakingAsset> .ToRelativePath(LoadedAsset.AssetFilePath, asset.CommeillFautAssetSource);

                var cif = CommeillFautAsset.LoadFromFile(asset.CommeillFautAssetSource);
                _cifForm.LoadedAsset = cif;
                FormHelper.ShowFormInContainerControl(this.panelCIF, _cifForm);
            }

            //KB
            _knowledgeBaseVM = new KnowledgeBaseVM(this);
            dataGridViewBeliefs.DataSource = _knowledgeBaseVM.Beliefs;
        }
Example #16
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _currentFilePath = null;
     _storage         = new AssetStorage();
     _loadedAsset     = CommeillFautAsset.CreateInstance(_storage);
 }