public override void Optimze(int level, IEnumerable <StoryboardObject> Storyboard_objects) { if (level >= 3) { int effect_count = 0; using (StopwatchRun.Count(() => "TrimHoldingStatusCommand() optimze count:" + effect_count)) TrimHoldingStatusCommand(Storyboard_objects, ref effect_count); } }
public static List <StoryboardObject> GetStoryboardObjects(string file_path) { using (StopwatchRun.Count($"Parse&Optimze Storyboard Objects/Commands from {file_path}")) { if (Path.GetExtension(file_path).ToLower() == ".osbin") { return(GetStoryboardObjectsFromOsbin(file_path)); } return(GetStoryboardObjectsFromOsb(file_path)); } }
public override void Optimze(int level, IEnumerable <StoryboardObject> Storyboard_objects) { if (level >= 1) { int effect_count = 0; using (StopwatchRun.Count(() => "TrimFrameTime() optimze count:" + effect_count)) TrimFrameTime(Storyboard_objects, ref effect_count); effect_count = 0; using (StopwatchRun.Count(() => "TrimInitalEffect() optimze count:" + effect_count)) TrimInitalEffect(Storyboard_objects, ref effect_count); } }
public override void Optimze(int level, IEnumerable <StoryboardObject> Storyboard_objects) { if (level >= 3) { int effect_count = 0; using (StopwatchRun.Count(() => "RemoveUnusedCommand() optimze count:" + effect_count)) RemoveUnusedCommand(Storyboard_objects, ref effect_count); } if (level >= 4) { int effect_count = 0; using (StopwatchRun.Count(() => "CombineCommands() optimze count:" + effect_count)) CombineCommands(Storyboard_objects, ref effect_count); } }
private static void BuildResource(StoryboardInstance instance) { if (instance.Resource != null) { try { instance.Resource.Dispose(); instance.Resource = null; } catch {} } using (StopwatchRun.Count("Loaded image resouces and sprite instances.")) { var resource = StoryboardResource.BuildDefaultResource(instance.Updater.StoryboardObjectList, instance.Info.folder_path); instance.Resource = resource; } }
public static StoryboardInstance Load(BeatmapFolderInfoEx info) { StoryboardInstance instance = new StoryboardInstance(); instance.Info = info; using (StopwatchRun.Count("Load and Parse osb/osu file")) { List <StoryboardObject> temp_objs_list = new List <StoryboardObject>(), parse_osb_Storyboard_objs = new List <StoryboardObject>(); //get objs from osu file List <StoryboardObject> parse_osu_Storyboard_objs = string.IsNullOrWhiteSpace(info.osu_file_path) ? new List <StoryboardObject>() : StoryboardParserHelper.GetStoryboardObjects(info.osu_file_path); AdjustZ(parse_osu_Storyboard_objs); if ((!string.IsNullOrWhiteSpace(info.osb_file_path)) && File.Exists(info.osb_file_path)) { parse_osb_Storyboard_objs = StoryboardParserHelper.GetStoryboardObjects(info.osb_file_path); AdjustZ(parse_osb_Storyboard_objs); } temp_objs_list = CombineStoryboardObjects(parse_osb_Storyboard_objs, parse_osu_Storyboard_objs); void AdjustZ(List <StoryboardObject> list) { list.Sort((a, b) => (int)(a.FileLine - b.FileLine)); } List <StoryboardObject> CombineStoryboardObjects(List <StoryboardObject> osb_list, List <StoryboardObject> osu_list) { List <StoryboardObject> result = new List <StoryboardObject>(); Add(Layer.Background); Add(Layer.Fail); Add(Layer.Pass); Add(Layer.Foreground); Add(Layer.Overlay); int z = 0; foreach (var obj in result) { obj.Z = z++; } return(result); void Add(Layer layout) { result.AddRange(osu_list.Where(x => x.layer == layout));//先加osu result.AddRange(osb_list.Where(x => x.layer == layout).Select(x => { x.FromOsbFile = true; return(x); }));//后加osb覆盖 } } instance.Updater = new StoryboardUpdater(temp_objs_list); } return(instance); }