Exemple #1
0
        private void CloneEffectBuilders(List <EffectBuilder> eBuilders,
                                         EventHandler handler, EffectResourceBuilder dest)
        {
            int i, index, count = eBuilders.Count;

            this.mEffectBuilders = new List <EffectBuilder>(count);
            if (dest == null)
            {
                for (i = 0; i < count; i++)
                {
                    this.mEffectBuilders.Add(eBuilders[i].Clone(handler));
                }
            }
            else
            {
                EffectResource.EffectSection eSection;
                for (i = 0; i < count; i++)
                {
                    eSection = dest.GetEffectSection(eBuilders[i].EffectType);
                    this.mEffectBuilders.Add(eBuilders[i].Clone(handler, eSection));
                }
            }
            IndexBuilder  iBuilder;
            EffectBuilder eBuilder;

            count = this.mIndexBuilders.Count;
            for (i = 0; i < count; i++)
            {
                iBuilder = this.mIndexBuilders[i] as IndexBuilder;
                eBuilder = new EffectBuilder(iBuilder.EffectType, iBuilder.ComponentIndex);
                index    = this.mEffectBuilders.IndexOf(eBuilder);
                iBuilder.SetEffectBuilder(this.mEffectBuilders[index]);
            }
        }
Exemple #2
0
        public void CreateEffectBuilders(EffectResource resource)
        {
            // Find and Clone Individual Effects
            IndexBuilder     iBldr;
            EffectBuilder    eBldr;
            VisualEffectType eType;
            int i, index, count = this.mIndexBuilders.Count;

            this.mEffectBuilders = new List <EffectBuilder>(count);
            for (i = 0; i < count; i++)
            {
                iBldr = this.mIndexBuilders[i] as IndexBuilder;
                eType = iBldr.EffectType;
                if (eType == (VisualEffectType)0)
                {
                    string header = "Effect: " + this.mEffectName + "; Index: " + i.ToString("X2")
                                    + "; BlockIndex: " + iBldr.ComponentIndex.ToString("X4");
                    System.Diagnostics.Debug.WriteLine(header + "; Unrecognized VisualEffectType (0); Assuming Particle (1)");
                    eType = VisualEffectType.Particle;
                }
                eBldr = new EffectBuilder(eType, iBldr.ComponentIndex);
                index = this.mEffectBuilders.IndexOf(eBldr);
                if (index >= 0)
                {
                    iBldr.SetEffectBuilder(this.mEffectBuilders[index]);
                }
                else
                {
                    eBldr.Effect = EffectHelper.FindEffect(eType, iBldr.ComponentIndex, resource);
                    this.mEffectBuilders.Add(eBldr);
                    iBldr.SetEffectBuilder(eBldr);
                }
            }
        }
 public void SetEffectBuilder(EffectResourceBuilder source)
 {
     if (this.mEffectBuilder != null)
     {
         this.mEffectBuilder.RemoveIndex(this);
     }
     this.mEffectBuilder        = new EffectBuilder(this.EffectType, this.ComponentIndex);
     this.mEffectBuilder.Effect = source.GetEffect(this.EffectType, this.ComponentIndex);
     this.mEffectBuilder.AddIndex(this);
 }
 public void SetEffectBuilder(EffectBuilder builder)
 {
     if (builder == null)
     {
         throw new ArgumentNullException("builder");
     }
     if (this.mEffectBuilder != null)
     {
         this.mEffectBuilder.RemoveIndex(this);
     }
     this.mEffectBuilder = builder;
     this.mEffectBuilder.AddIndex(this);
     this.ComponentType  = (byte)this.mEffectBuilder.EffectType;
     this.ComponentIndex = this.mEffectBuilder.EffectIndex;
 }