예제 #1
0
        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);
            MyObjectBuilder_SoundCategoryDefinition definition = builder as MyObjectBuilder_SoundCategoryDefinition;

            this.Sounds = new List <SoundDescription>();
            if (definition.Sounds != null)
            {
                foreach (MyObjectBuilder_SoundCategoryDefinition.SoundDesc desc in definition.Sounds)
                {
                    MyStringId orCompute = MyStringId.GetOrCompute(desc.SoundName);
                    if (MyTexts.Exists(orCompute))
                    {
                        this.Sounds.Add(new SoundDescription(desc.Id, desc.SoundName, new MyStringId?(orCompute)));
                    }
                    else
                    {
                        MyStringId?soundNameEnum = null;
                        this.Sounds.Add(new SoundDescription(desc.Id, desc.SoundName, soundNameEnum));
                    }
                }
            }
        }
        protected override void Init(MyObjectBuilder_DefinitionBase builder)
        {
            base.Init(builder);

            var soundCategoryBuilder = builder as MyObjectBuilder_SoundCategoryDefinition;

            Sounds = new List <SoundDescription>();

            if (soundCategoryBuilder.Sounds != null)
            {
                foreach (var soundDesc in soundCategoryBuilder.Sounds)
                {
                    MyStringId tmp = MyStringId.GetOrCompute(soundDesc.SoundName);
                    if (MyTexts.Exists(tmp))
                    {
                        Sounds.Add(new SoundDescription(soundDesc.Id, soundDesc.SoundName, tmp));
                    }
                    else
                    {
                        Sounds.Add(new SoundDescription(soundDesc.Id, soundDesc.SoundName, null));
                    }
                }
            }
        }