public void SaveSequenceFile(SequenceYaml sequenceYaml, string saveFile) { var combo = sequenceYaml.AttractSequences .Select(x => x.Combo); var move = sequenceYaml.AttractSequences .Select(x => x.MoveLayer); var grouped = sequenceYaml.AttractSequences .Select(x => x.GroupLayer); var markup = sequenceYaml.AttractSequences .Select(x => x.MarkupLayer); var scripted = sequenceYaml.AttractSequences .Select(x => x.ScriptedText); var randomtxt = sequenceYaml.AttractSequences .Select(x => x.RandomText); foreach (var group in grouped.Where(x => x != null)) { foreach (var item in group.Contents.Where(x => x.markup_layer != null)) { item.markup_layer.TextList.Clear(); if (item.markup_layer.TextList != null) { item.markup_layer.TextList.Clear(); } item.markup_layer.duration = null; item.markup_layer.TextList = item.markup_layer.TextEntries.Select(x => x.TextLine).ToList(); } foreach (var item in group.Contents.Where(x => x.combo_layer != null)) { if (item.combo_layer.TextList != null) { item.combo_layer.TextList.Clear(); } item.combo_layer.duration = null; item.combo_layer.TextList = item.combo_layer.TextEntries.Select(x => x.TextLine).ToList(); } foreach (var item in group.Contents.Where(x => x.scripted_text_layer != null)) { foreach (var item2 in item.scripted_text_layer.TextOptions) { item2.TextList = item2.TextEntries.Select(x => x.TextLine).ToList(); } } //foreach (var item in group.Contents.Where(x => x.move_layer != null)) //{ // if (item.move_layer.TextList != null) // item.move_layer.TextList.Clear(); // item.move_layer.duration = null; // item.move_layer.TextList = item.move_layer.TextEntries.Select(x => x.TextLine).ToList(); //} } var yamlFile = Path.Combine(GameFolder, YamlFiles[2]); //Assign markup text lists foreach (var item in markup.Where(x => x != null)) { if (item.TextList != null) { item.TextList.Clear(); } item.TextList = item.TextEntries.Select(x => x.TextLine).ToList(); } //Assign scripted text lists foreach (var item in scripted.Where(x => x != null)) { foreach (var item2 in item.TextOptions) { item2.TextList = item2.TextEntries.Select(x => x.TextLine).ToList(); } } //Assign random text lists foreach (var item in randomtxt.Where(x => x != null)) { foreach (var item2 in item.TextOptions) { item2.TextList = item2.TextEntries.Select(x => x.TextLine).ToList(); } } foreach (var item in combo.Where(x => x != null)) { if (item.TextList != null) { item.TextList.Clear(); } item.TextList = item.TextEntries.Select(x => x.TextLine).ToList(); } //foreach (var item in move.Where(x => x != null)) //{ // if (item.TextList != null) // item.TextList.Clear(); // item.TextList = item.TextEntries.Select(x => x.TextLine).ToList(); //} //AttractConfig.Sequences _skeletonGameSerializer.SerializeYaml(saveFile, sequenceYaml); }
public SequenceYamlItemViewModel(string fileName, SequenceYaml sequenceYaml) { Filename = fileName; SequenceYaml = sequenceYaml; }
/// <summary> /// Gets the available sequences. A sequence contains all types, but only one type is set at a time. Get the sequence base value where not null in lists. /// </summary> /// <param name="attractYaml"></param> public void GetAvailableSequences(SequenceYaml attractYaml) { attractYaml.Sequences.Clear(); try { foreach (var seq in attractYaml.AttractSequences) { var notNullSequence = (SequenceBase)typeof(Sequence) .GetProperties().Select(prop => prop.GetValue(seq, null)) .Where(val => val != null).FirstOrDefault(); if (notNullSequence != null) { //Apply group layer if (notNullSequence.GetType() == typeof(GroupLayer)) { var group = notNullSequence as GroupLayer; foreach (var item in group.Contents) { //notNullSequence.SeqType = item.SeqType; if (item.markup_layer != null) { item.SeqType = item.markup_layer.SeqType; } else if (item.animation_layer != null) { item.SeqType = item.animation_layer.SeqType; } else if (item.text_layer != null) { item.SeqType = item.text_layer.SeqType; } else if (item.combo_layer != null) { item.SeqType = item.combo_layer.SeqType; } else if (item.move_layer != null) { item.SeqType = item.move_layer.SeqType; } else if (item.scripted_text_layer != null) { item.SeqType = item.scripted_text_layer.SeqType; } else if (item.particle_layer != null) { item.SeqType = item.particle_layer.SeqType; } //Assign style name item.SequenceName = item.SeqType + "SequenceStyle"; } } notNullSequence.SequenceName = notNullSequence.GetType().Name; attractYaml.Sequences.Add(notNullSequence); } } } catch (System.Exception) { throw; } }