private void AddToGlobalAlign(DifData dd, DifData pardelta) { if (!string.IsNullOrEmpty(dd.Parent)) { // get child storage items var storageitem = ImageStorage.Where(x => x.Name == dd.Name).FirstOrDefault(); if (storageitem != null) { // check if default align for that parent is not already assigned var oldalign = storageitem.Parents.Where(x => x.Parent == dd.Parent && x.Tag == dd.Tag).FirstOrDefault(); if (oldalign == null) { // Get parent image align via default align and delta seIm parIm = new seIm(); var pardefaultalgn = ImageStorage.Where(x => x.Name == dd.Parent).FirstOrDefault().DefaultAlign; parIm.AssignFrom(pardefaultalgn); // default and delta parIm.AssignFrom(pardelta); // Get child image align via default align and delta seIm childIm = new seIm(); var childdefaultalgn = storageitem.DefaultAlign; childIm.AssignFrom(childdefaultalgn); // default and delta childIm.AssignFrom(dd); // add align for that parent ImageRelDifVec newalign = new ImageRelDifVec(); newalign.Tag = dd.Tag; newalign.Parent = dd.Parent; newalign.CreateDifProportions(parIm, childIm); storageitem.Parents.Add(newalign); } } } }
public AlignData(string name, string parent, string tag, DifData im) { Parent = parent; Name = name; Tag = tag; Im = im; }
public void AssignFrom(DifData dd) { if (dd == null) { return; } if (dd.X.HasValue) { this.X = dd.X.Value; } if (dd.Y.HasValue) { this.Y = dd.Y.Value; } if (dd.Sy.HasValue) { this.Sy = dd.Sy.Value; } if (dd.Sx.HasValue) { this.Sx = dd.Sx.Value; } if (dd.R.HasValue) { this.R = dd.R.Value; } if (dd.F.HasValue) { this.F = dd.F.Value; } if (dd.O.HasValue) { this.O = dd.O.Value; } //if (dd.Z.HasValue) this. = dd.O.Value; this.Animations.Clear(); this.Animations.AddRange(dd.AL); if (!string.IsNullOrEmpty(dd.T)) { this.T = dd.T; } }
//public List<OpEf> CurrTransitions = new List<OpEf>(); public CadreData CreateCadreData(string text, List <DifData> difdata, List <Info_Scene> infodata, int?indexToInsert = null) { List <DifData> cdata = new List <DifData>(); foreach (var item in difdata) { var ndd = new DifData(item.Name); ndd.AssingFrom(item); cdata.Add(ndd); } this.ClearSound(false, true, true); seTe textData = new seTe(this.DefaultSceneText); textData.Text = text; var result = Add(new string[] { currentGr }, cdata.ToArray(), textData, this.CurrentSounds, false, indexToInsert); // save it to futher modifications result.OriginalInfo.AddRange(infodata); return(result); }
internal void AssingFrom(DifData value, bool withnames = false) { if (value == null) { return; } if (value.Z.HasValue) { this.Z = value.Z; } if (value.F.HasValue) { this.F = value.F; } if (value.X.HasValue) { this.X = value.X; } if (value.Y.HasValue) { this.Y = value.Y; } if (value.R.HasValue) { this.R = value.R; } if (value.S.HasValue) { this.S = value.S; } if (value.O.HasValue) { this.O = value.O; } if (value.Rd.HasValue) { this.Rd = value.Rd; } if (value.Od.HasValue) { this.Od = value.Od; } if (value.Xd.HasValue) { this.Xd = value.Xd; } if (value.Yd.HasValue) { this.Yd = value.Yd; } if (value.AL.Any()) { this.AL.Clear(); this.AL.AddRange(value.AL); } if (!string.IsNullOrEmpty(value.T)) { this.T = value.T; } if (withnames) { this.Name = value.Name; this.Parent = value.Parent; } }
//! new!!!! internal void ApplyTo(seIm target, seIm actualParent, DifData delta) { float dSx = ((float)cSx / (float)pSx); float dSy = ((float)cSy / (float)pSy); if (delta != null) { if (delta.Sx.HasValue) { dSx = ((float)delta.Sx / (float)pSx); } if (delta.Sy.HasValue) { dSy = ((float)delta.Sy / (float)pSy); } } target.Sx = Convert.ToInt32(dSx * actualParent.Sx); target.Sy = Convert.ToInt32(dSy * actualParent.Sy); // Parent flip { target.ParentFlips.Clear(); if (actualParent.ParentFlips != null) { target.ParentFlips.AddRange(actualParent.ParentFlips); } if (this.pF != actualParent.F) { target.ParentFlips.Add(actualParent.Name); } } { // X,Y coord target.X = this.Xd; target.Y = this.Yd; if (delta.Xd.HasValue) { target.X = target.X + delta.Xd.Value; } if (delta.Yd.HasValue) { target.Y = target.Y + delta.Yd.Value; } target.X = (int)(target.X * ((float)actualParent.Sx / pSx)); target.Y = (int)(target.Y * ((float)actualParent.Sy / pSy)); target.X = target.X + actualParent.X; target.Y = target.Y + actualParent.Y; //if (delta != null && delta.Xd.HasValue) // target.X = target.X + delta.X.Value; //if (delta != null && delta.Y.HasValue) // target.Y = delta.Y.Value; } target.R = this.R; if (delta.Rd.HasValue) { target.R = target.R + delta.Rd.Value; } if (delta.R.HasValue) { target.R = delta.R.Value; } target.F = this.F; // transition target.T = this.pT; //default target.T = actualParent.T; // parent if (delta.T != null) //delta { target.T = delta.T; } // opacity if (this.cO > -1) { target.O = this.cO; } //if (delta.Od.HasValue) target.O = target.O + delta.Od.Value; }
public void CadreData(string mark, DifData dif) { Add(new string[] { mark }, new DifData[] { dif }, null, null, false); }
private CadreData DoCadreByGroup(List <Info_Scene> group, int?indexToInsert) { int i = 1; // picture index to correct add transitions // sound this.VOLUME_M = 100; var sounds = group.Where(x => x.Kind == 6); foreach (var item in sounds) { Info_Scene rez = Info_Scene.GenerateCopy(item); if (!string.IsNullOrEmpty(rez.File) && rez.File.StartsWith(@".\") && !string.IsNullOrEmpty(Story.GamePath)) { rez.File = rez.File.Replace(@".\", $@"{Story.GamePath}\"); } this.AddMusic(rez.File); } Dictionary <string, DifData> Pictures = new Dictionary <string, DifData>(); string story = string.Empty; string path = string.Empty; Info_Scene title = group.Where(x => x.Kind == 1).FirstOrDefault(); Info_Scene copytitle = null; if (title != null) { copytitle = Info_Scene.GenerateCopy(title); // try to get text from kind 1 if (copytitle.Story == "$$DESCRIPTION$$") { story = copytitle.Description; } else { story = copytitle.Story; } if (string.IsNullOrEmpty(copytitle.File) && !string.IsNullOrEmpty(Story.DefTextBck)) { copytitle.File = Story.DefTextBck; } if (copytitle.File == "$$WHITE$$") // white background { AddToGlobalImage("$$WHITE$$", "$$WHITE$$", string.Empty); Pictures.Add("$$WHITE$$", new DifData("$$WHITE$$") { }); ++i; } if (!string.IsNullOrEmpty(copytitle.T)) { this.DefaultSceneText.T = copytitle.T; } if (!string.IsNullOrEmpty(copytitle.O)) { this.DefaultSceneText.Opacity = int.Parse(copytitle.O); } if (!string.IsNullOrEmpty(copytitle.Z)) { this.DefaultSceneText.FontColor = copytitle.Z; } if (!string.IsNullOrEmpty(copytitle.R)) { this.DefaultSceneText.FontStyle = int.Parse(copytitle.R); } if (!string.IsNullOrEmpty(copytitle.F)) { this.DefaultSceneText.FontSize = int.Parse(copytitle.F); } if (!string.IsNullOrEmpty(copytitle.S)) { this.DefaultSceneText.Shift = int.Parse(copytitle.S); } if (!string.IsNullOrEmpty(copytitle.X)) { this.DefaultSceneText.Width = int.Parse(copytitle.X); } if (!string.IsNullOrEmpty(copytitle.Y)) { this.DefaultSceneText.Size = int.Parse(copytitle.Y); } if (!string.IsNullOrEmpty(copytitle.Speed)) { this.DefaultSceneText.FontName = copytitle.Speed; } } // try to get text from kind 4 if (string.IsNullOrEmpty(story)) { title = group.Where(x => x.Kind == 4).FirstOrDefault(); if (title != null) { story = title.Story; } } // try to get text from kind 0 if (string.IsNullOrEmpty(story)) { title = group.Where(x => x.Kind == 0).FirstOrDefault(); if (title != null) { story = title.Story; } } // try to get text from kind 8 if (string.IsNullOrEmpty(story)) { title = group.Where(x => x.Kind == 8).FirstOrDefault(); if (title != null) { story = title.Story; } } // try to get text from file if (!string.IsNullOrEmpty(story)) { // text should have filename@section if (story.Contains("@")) { string[] vals = story.Split('@'); string filename = vals[0]; string section = vals[1]; story = string.Empty; if (File.Exists(filename)) { List <string> textlist = new List <string>(File.ReadAllLines(filename)); bool gotcha = false; List <string> storylines = new List <string>(); foreach (string line in textlist) { // get text from section within a file if (line.StartsWith($"@{section}")) { gotcha = true; continue; //story = line.Replace($"@{section}", string.Empty).Trim(); } else if (line.StartsWith($"@")) { gotcha = false; } if (gotcha) { storylines.Add(line); } } story = string.Join("~", storylines.ToArray()); } } } //// PICTURES- kind 5 (transform) //List<OpEf> trans = new List<OpEf>(); //var prevtranpictures = group.Where(x => x.Kind == 5); //foreach (var item in prevtranpictures) //{ // int z = 1; // int opacity = 100; // if (!string.IsNullOrEmpty(item.O)) // { // opacity = Convert.ToInt32(item.O); // } // if (!string.IsNullOrEmpty(item.Z)) // { // z = Convert.ToInt32(item.Z); // } // if (!string.IsNullOrEmpty(item.T)) // { // trans.Add(new OpEf(z, true, opacity, item.T)); // //trans.Add(OpEf.HidePrev(1)); // } //} // PICTURES and Clips- kind 0,2,4,8 var visuals = group.Where(x => x.Kind == 0 || x.Kind == 2 || x.Kind == 4 || x.Kind == 8 || x.Kind == 9); List <Info_Scene> visualsCopy = new List <Info_Scene>(); foreach (var item in visuals) { if (item.Kind == 9) // set current background { CurrentBackground = item; } else { var it = GetVisualByDefaultAndCurrent(item); visualsCopy.Add(it); if (!string.IsNullOrEmpty(it.File)) { AddToGlobalImage(it.File, it.File); } } } if (CurrentBackground != null)// add Current Background { var it = Info_Scene.GenerateCopy(CurrentBackground); CurrentBackground.T = null; // after 1st adding, remove transition CurrentBackground.O = "100"; // after 1st adding, set visible it.File = GetAbsolutePath(it.File); it.Group = group.First().Group; it.Queue = group.First().Queue; it.Z = "0"; it.X = "0"; it.X = "0"; it.S = "-2"; visualsCopy.Add(it); if (!string.IsNullOrEmpty(it.File)) { AddToGlobalImage(it.File, it.File); } } List <DifData> itl = new List <DifData>(); foreach (var item in visualsCopy) { if (string.IsNullOrEmpty(item.File)) { continue; } if (item.Kind == 8) //Clip { int volume = 0; var anim = new AP(item.File) { APS = Convert.ToDouble(item.PositionStart), APE = Convert.ToDouble(item.PositionEnd), ALM = Convert.ToInt32(item.LoopMode), ALC = Convert.ToInt32(item.LoopCount), AR = Convert.ToInt32(item.Speed), AV = volume }; //if (string.IsNullOrEmpty(item.S) || item.S == "0") item.S = "800"; DifData size = new DifData() { S = Convert.ToInt32(item.S) }; size.Name = anim.File; if (!string.IsNullOrEmpty(item.X)) { size.X = Convert.ToInt32(item.X); } if (!string.IsNullOrEmpty(item.Y)) { size.Y = Convert.ToInt32(item.Y); } if (!string.IsNullOrEmpty(item.O)) { size.O = Convert.ToInt32(item.O); } if (!string.IsNullOrEmpty(item.R)) { size.R = Convert.ToInt32(item.R); } if (!string.IsNullOrEmpty(item.Z)) { size.Z = Convert.ToInt32(item.Z); } //else // size.Z = 2; size.AL.Add(anim); var dd = new List <DifData>(); itl.AddRange(dd); itl.Insert(0, size); //DoC2($"{story}", itl, null); //AddAnim(anim.File, item.Story, itl, anim); } else { int opacity = 100; string key = item.File; Pictures.Add(key, new DifData(item.File) { }); if (!string.IsNullOrEmpty(item.X)) { Pictures[key].X = Convert.ToInt32(item.X); } if (!string.IsNullOrEmpty(item.Y)) { Pictures[key].Y = Convert.ToInt32(item.Y); } if (!string.IsNullOrEmpty(item.O)) { Pictures[key].O = Convert.ToInt32(item.O); opacity = Pictures[key].O.Value; } if (!string.IsNullOrEmpty(item.S)) { Pictures[key].S = Convert.ToInt32(item.S); } if (!string.IsNullOrEmpty(item.F)) { Pictures[key].F = Convert.ToInt32(item.F); } if (!string.IsNullOrEmpty(item.Z)) { Pictures[key].Z = Convert.ToInt32(item.Z); } else { Pictures[key].Z = 2; } if (!string.IsNullOrEmpty(item.R)) { Pictures[key].R = Convert.ToInt32(item.R); } if (!string.IsNullOrEmpty(item.T)) { // if apper, dont forget to set Opacity to 0, as initially figure is invisible //"W..0>O.B.400.100" //--appear //"W..0>O.B.400.100*W..0>X.B.400.300"--appear+move from left Pictures[key].T = item.T; } i++; } } itl.AddRange(Pictures.Values.ToList()); return(CreateCadreData($"{story}", itl, group, indexToInsert)); }
public AlignData(string name, string parent, DifData im) : this(name, parent, null, im) { }
public AlignData(string name, DifData im) : this(name, null, null, im) { }