//
        /// <summary>
        /// Get and return values for avatar configs
        /// </summary>
        internal AvatarGeneratorConfig GetConfig()
        {
            var configText       = Templates.ResourceManager.GetString("avatar_config");
            var contractResolver = new PrivatePropertyResolver();
            var settings         = new JsonSerializerSettings
            {
                ContractResolver = contractResolver
            };
            var config = JsonConvert.DeserializeObject <AvatarGeneratorConfig>(configText, settings);

            return(config);
        }
Exemplo n.º 2
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;
            }
        }