Exemplo n.º 1
0
        internal ConfigStore(Platform platform = Platform.Windows)
        {
            Platform     = platform;
            ConfigValues = new Dictionary <ConfigKey, float>();
            var configText       = Templates.ResourceManager.GetString("config");
            var contractResolver = new PrivatePropertyResolver();
            var settings         = new JsonSerializerSettings
            {
                ContractResolver = contractResolver
            };

            ConfigValues = JsonConvert.DeserializeObject <Dictionary <ConfigKey, float> >(configText, settings);
            foreach (var key in (ConfigKey[])Enum.GetValues(typeof(ConfigKey)))
            {
                if (!ConfigValues.ContainsKey(key))
                {
                    throw new Exception("Config key " + key + " not included in config!");
                }
            }
            BoatTypes = new Dictionary <string, List <Position> >();
            var boatText = Templates.ResourceManager.GetString("boat_config");

            BoatTypes     = JsonConvert.DeserializeObject <Dictionary <string, List <Position> > >(boatText);
            GameConfig    = new GameConfig().GetConfig();
            NameConfig    = new NameConfig().GetConfig();
            Avatar.Config = new AvatarGeneratorConfig().GetConfig();

            AssetManager.Instance.Bridge = new TemplateBridge();
            RolePlayCharacter            = RolePlayCharacterAsset.LoadFromFile("template_rpc");
            EmotionalAppraisal           = EmotionalAppraisalAsset.LoadFromFile("template_ea");
            EmotionalDecisionMaking      = EmotionalDecisionMakingAsset.LoadFromFile("template_edm");
            SocialImportance             = SocialImportanceAsset.LoadFromFile("template_si");
            IntegratedAuthoringTool      = IntegratedAuthoringToolAsset.LoadFromFile("template_iat");

            switch (Platform)
            {
            case Platform.Android:
                AssetManager.Instance.Bridge = new AndroidBaseBridge();
                break;

            case Platform.iOS:
                AssetManager.Instance.Bridge = new IOSBaseBridge();
                break;

            case Platform.Windows:
                AssetManager.Instance.Bridge = new BaseBridge();
                break;
            }
        }
Exemplo n.º 2
0
        //This is a small console program to exemplify the main functionality of the Social Importance Asset
        static void Main(string[] args)
        {
            var siTarget = "Player";

            //First, we load the asset from an existing profile
            var siAsset = SocialImportanceAsset.LoadFromFile("../../../Examples/SI-Tutorial/SITest.si");

            var rules = siAsset.GetAttributionRules();
            //We then register a knowledge base
            var kb = new KB((Name)"John");

            kb.Tell((Name)"IsFriend(Player)", (Name)"False");
            siAsset.RegisterKnowledgeBase(kb);

            Console.WriteLine("The SI attributed to " + siTarget + " is:" + siAsset.GetSocialImportance(siTarget));

            Console.ReadKey();
        }
Exemplo n.º 3
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;
        }