public EffectResourceBuilder(EffectResourceBuilder original, bool cloneEffects) : base(0, null) { int i, count = original.mEffectSectionList.Count; // Initialize Effect Sections this.mEffectSectionList = new EffectResource.EffectSectionList(this.OnResourceChanged); EffectResource.EffectSection eSection; for (i = 0; i < count; i++) { eSection = original.mEffectSectionList[i]; this.mEffectSectionList.Add((int)eSection.Type, (int)eSection.Version); } this.InitEffectSectionIndices(); // Initialize Resource Sections count = original.mResourceSectionList.Count; this.mResourceSectionList = new EffectResource.ResourceSectionList(this.OnResourceChanged); EffectResource.ResourceSection rSection; for (i = 0; i < count; i++) { rSection = original.mResourceSectionList[i]; this.mResourceSectionList.Add((int)rSection.Type, (int)rSection.Version); } this.InitResourceSectionIndices(); // Initialize Visual Effect Builders this.mVisualEffectSection = new EffectResource.VisualEffectSection(0, this.OnResourceChanged, 2); //this.mVisualEffectBuilders = new SectionDataList<VisualEffectBuilder>(this.OnResourceChanged, null); // Initialize Reserved this.mReserved = new byte[] { 0xff, 0xff, 0xff, 0xff }; // Initialize Handle List this.mVisualEffectHandleList = new VisualEffectHandleList(this.OnResourceChanged); }
public static void CloneVisualEffect(VisualEffectName handle, EffectResourceBuilder source, EffectResourceBuilder dest) { VisualEffectBuilder builder = source.mVisualEffectSection.Items[(int)handle.Index] as VisualEffectBuilder; dest.mVisualEffectSection.Items.Add(item: builder.Clone(dest.OnResourceChanged, dest)); }
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]); } }
public VisualEffectBuilder(VisualEffectName handle, VisualEffect basis, EffectResourceBuilder builder) : base(0, null, basis) { this.mEffectName = handle.EffectName; this.CastIndices(); this.CreateEffectBuilders(builder); }
public void CreateEffectBuilders(EffectResourceBuilder resBuilder) { // 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 = resBuilder.GetEffect(eType, iBldr.ComponentIndex); 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 static void CloneVisualEffect(string name, EffectResourceBuilder source, EffectResourceBuilder dest) { name = EffectHelper.CreateSafeEffectName(name, true); int index = source.mVisualEffectHandleList.BinarySearch(name); if (index >= 0) { CloneVisualEffect(source.mVisualEffectHandleList[index], source, dest); } }
private VisualEffectBuilder Clone(string name, EventHandler handler, EffectResourceBuilder dest, bool safe) { MemoryStream s = new MemoryStream(); this.UnParse(s); s.Position = 0L; VisualEffectBuilder builder; if (dest == null) { builder = new VisualEffectBuilder(0, handler, base.mSection, s); } else { builder = new VisualEffectBuilder(0, handler, dest.VisualEffects, s); } //builder.mEffectName = new VisualEffectHandle(0, handler, this.mEffectName); builder.mEffectName = safe ? EffectHelper.CreateSafeEffectName(name, true) : name; builder.CloneEffectBuilders(this.mEffectBuilders, handler, dest); return(builder); }
public void Merge(EffectResourceBuilder builder) { throw new NotImplementedException(); }
public VisualEffectBuilder Clone(string name, EventHandler handler, EffectResourceBuilder dest) { return(Clone(name, handler, dest, true)); }
public VisualEffectBuilder Clone(EventHandler handler, EffectResourceBuilder dest) { return(Clone(this.mEffectName, handler, dest, false)); }