Init
This commit is contained in:
1 parent
a73338916a
commit
fbc1cc8d3e
207 files changed
+10327
-2
No files matched your search
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Code.Infrastructure.Loadings
|
||||
{
|
||||
public class Loading
|
||||
{
|
||||
private int _progress;
|
||||
public bool Completed { get; private set; }
|
||||
private Action _completed;
|
||||
private Action<Loading> _loadProgress;
|
||||
|
||||
public Loading(int maxProgress, Action completed, Action<Loading> loadProgress = null)
|
||||
{
|
||||
_progress = maxProgress;
|
||||
MaxProgress = maxProgress;
|
||||
|
||||
_completed = completed;
|
||||
_loadProgress = loadProgress;
|
||||
}
|
||||
public int CurrentProgress => _progress;
|
||||
public int MaxProgress { get; }
|
||||
|
||||
public void DoProgress()
|
||||
{
|
||||
_progress--;
|
||||
_loadProgress?.Invoke(this);
|
||||
|
||||
if(_progress <= 0) // Зачем инвертировать, если так читается лучше, райдер соси
|
||||
{
|
||||
Completed = true;
|
||||
_completed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1707a55b78d4218b1557d42adb7d961
|
||||
timeCreated: 1766483205
|
||||
Reference in new issue
Block a user