Exemplo n.º 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]);
            }
        }
Exemplo n.º 2
0
        public void CreateEffectBuilders(EffectResourceBuilder resBuilder, EffectResource resource)
        {
            // Find and Clone Individual Effects
            IndexBuilder     iBldr;
            EffectBuilder    eBldr;
            VisualEffectType eType;

            s3piwrappers.Effects.Effect effect;
            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
                {
                    effect = EffectHelper.FindEffect(eType, iBldr.ComponentIndex, resource);
                    if (effect != null)
                    {
                        EffectResource.EffectSection eSection = null;
                        if (resBuilder != null)
                        {
                            eSection = resBuilder.GetEffectSection(eType);
                        }
                        eBldr.Effect = EffectHelper.CloneSectionData(effect, null, eSection)
                                       as s3piwrappers.Effects.Effect;
                        this.mEffectBuilders.Add(eBldr);
                        iBldr.SetEffectBuilder(eBldr);
                    }
                }
            }
        }