当前位置: 首页>>代码示例>>C#>>正文


C# ConfigurationSection.GetString方法代码示例

本文整理汇总了C#中ConfigurationSection.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationSection.GetString方法的具体用法?C# ConfigurationSection.GetString怎么用?C# ConfigurationSection.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigurationSection的用法示例。


在下文中一共展示了ConfigurationSection.GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MapSceneObject

 public MapSceneObject(ConfigurationSection sect)
 {
     Radius = sect.GetSingle("Radius", 0);
     IsForest = sect.GetBool("IsForest", false);
     Amount = sect.GetSingle("Amount", 0);
     Model = sect.GetString("Model", string.Empty);
 }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:7,代码来源:MapObject.cs

示例2: SoundEffectGame

        public SoundEffectGame(AudioListener listener, SoundManager sm, ConfigurationSection sect)
        {
            this.contentManager = sm.Content;
            this.listener = listener;


            string[] control = sect.GetStringArray("Control");
            for (int i = 0; i < control.Length; i++)
            {
                control[i] = control[i].ToLowerInvariant();
                switch (control[i])
                {
                    case "loop":
                        Control |= SoundControl.Loop;
                        break;
                    case "random":
                        Control |= SoundControl.Random;
                        break;
                    case "ambient":
                        Control |= SoundControl.Ambient;
                        break;
                }
            }
            Probability = sect.GetSingle("Probability", 1);
            Volume = sect.GetSingle("Volume", 1);
            Type = (SoundType)Enum.Parse(typeof(SoundType), sect.GetString("Type", SoundType.Normal.ToString()), true);
            //this.soundEffect = contentManager.Load<SoundEffect>(sect.Name);
            soundEffects = new SoundEffect[3][];

            if ((Control & SoundControl.Loop) == SoundControl.Loop)
            {
                string[] fadein = sect.GetStringArray("Fadein");
                soundEffects[(int)SoundEffectPart.Fadein] = new SoundEffect[fadein.Length];
                for (int index = 0; index < fadein.Length; index++)
                {
                    soundEffects[(int)SoundEffectPart.Fadein][0] = contentManager.Load<SoundEffect>(fadein[index]);
                }

                string[] mediumstring = sect.GetStringArray("Medium");
                soundEffects[(int)SoundEffectPart.Medium] = new SoundEffect[mediumstring.Length];
                for (int index = 0; index < mediumstring.Length; index++)
                {
                    soundEffects[(int)SoundEffectPart.Medium][index] = contentManager.Load<SoundEffect>(mediumstring[index]);
                }

                string[] fadeout = sect.GetStringArray("Fadeout");
                soundEffects[(int)SoundEffectPart.Fadeout] = new SoundEffect[fadeout.Length];
                for (int index = 0; index < fadein.Length; index++)
                {
                    soundEffects[(int)SoundEffectPart.Fadeout][0] = contentManager.Load<SoundEffect>(fadeout[index]);
                }
            }
            else
            {
                string[] sounds = sect.GetStringArray("Sounds");
                soundEffects[(int)SoundEffectPart.Fadein] = new SoundEffect[sounds.Length];
                for (int i = 0; i < sounds.Length; i++)
                {
                    soundEffects[0][i] = contentManager.Load<SoundEffect>(sounds[i]);
                }
                soundEffects[1] = soundEffects[0];
                soundEffects[2] = soundEffects[0];
            }
        }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:64,代码来源:SoundEffectGame.cs

示例3: MapSoundObject

 public MapSoundObject(ConfigurationSection sect)
 {
     Radius = sect.GetSingle("Radius", 0);
     SFXName = sect.GetString("SFX", string.Empty);
 }
开发者ID:yuri410,项目名称:lrvbsvnicg,代码行数:5,代码来源:MapObject.cs


注:本文中的ConfigurationSection.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。