Skip to content

Commit c68cf22

Browse files
committed
make some load tasks not display a progress
1 parent 213f4a7 commit c68cf22

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

fluXis/FluXisGame.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void load()
167167
}
168168

169169
MapStore.DownloadBundledMaps(c);
170-
}));
170+
}, false));
171171

172172
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolume);
173173

fluXis/FluXisGameBase.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ public class LoadInfo
523523
public void Push(LoadTask task)
524524
{
525525
queue.Enqueue(task);
526-
TasksTotal = queue.Count;
526+
TasksTotal = queue.Count(x => x.ShowProgress);
527527
}
528528

529529
public LoadTask PerformNext(Action then)
@@ -538,29 +538,27 @@ public LoadTask PerformNext(Action then)
538538
TaskStarted?.Invoke(task);
539539
task.Perform?.Invoke(() =>
540540
{
541-
TasksFinished++;
541+
if (task.ShowProgress)
542+
TasksFinished++;
543+
542544
then?.Invoke();
543545
});
544546

545547
return task;
546548
}
547-
548-
public override string ToString()
549-
{
550-
var finished = TasksTotal - queue.Count;
551-
return $"{finished / TasksTotal * 100:00.00}% ({finished}/{TasksTotal})";
552-
}
553549
}
554550

555551
public class LoadTask
556552
{
557553
public string Name { get; }
558554
public Action<Action> Perform { get; }
555+
public bool ShowProgress { get; }
559556

560-
public LoadTask(string name, Action<Action> perform)
557+
public LoadTask(string name, Action<Action> perform, bool showProgress = true)
561558
{
562559
Name = name;
563560
Perform = perform;
561+
ShowProgress = showProgress;
564562
}
565563

566564
public override string ToString() => Name;

fluXis/Screens/Loading/LoadingScreen.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ protected override void LoadComplete()
103103

104104
loadInfo.TaskStarted += task =>
105105
{
106-
loadingText.Text = $"{task.Name} ({loadInfo.TasksFinished + 1}/{loadInfo.TasksTotal})";
106+
var str = $"{task.Name}";
107+
108+
if (task.ShowProgress)
109+
str += $" ({loadInfo.TasksFinished + 1}/{loadInfo.TasksTotal})";
110+
111+
loadingText.Text = str;
107112
bar.ResizeWidthTo((loadInfo.TasksFinished + 1) / (float)loadInfo.TasksTotal, 300, Easing.OutQuint);
108113
};
109114

0 commit comments

Comments
 (0)