Skip to content

Commit 9d611c9

Browse files
committed
added application utils
1 parent 23005a3 commit 9d611c9

22 files changed

+356
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using UnityEngine;
3+
4+
5+
6+
namespace Signals.Utils.Engine
7+
{
8+
[Serializable]
9+
public class ApplicationSettings : ISettings
10+
{
11+
[SerializeField] int _targetFrameRate = -1;
12+
[SerializeField] bool _runInBackground;
13+
[SerializeField] ThreadPriority _backgroundLoadingPriority = ThreadPriority.BelowNormal;
14+
15+
public int TargetFrameRate
16+
{
17+
get
18+
{
19+
return _targetFrameRate;
20+
}
21+
22+
set
23+
{
24+
_targetFrameRate = value;
25+
}
26+
}
27+
28+
public bool RunInBackground
29+
{
30+
get
31+
{
32+
return _runInBackground;
33+
}
34+
35+
set
36+
{
37+
_runInBackground = value;
38+
}
39+
}
40+
41+
public ThreadPriority BackgroundLoadingPriority
42+
{
43+
get
44+
{
45+
return _backgroundLoadingPriority;
46+
}
47+
48+
set
49+
{
50+
_backgroundLoadingPriority = value;
51+
}
52+
}
53+
54+
public void Apply()
55+
{
56+
Application.targetFrameRate = _targetFrameRate;
57+
Application.runInBackground = _runInBackground;
58+
Application.backgroundLoadingPriority = _backgroundLoadingPriority;
59+
}
60+
61+
public void SetToCurrent()
62+
{
63+
_targetFrameRate = Application.targetFrameRate;
64+
_runInBackground = Application.runInBackground;
65+
_backgroundLoadingPriority = Application.backgroundLoadingPriority;
66+
}
67+
}
68+
}

Code/Utils/Engine/ApplicationSettings.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using UnityEngine.Events;
3+
4+
5+
6+
namespace Signals.Utils.Engine
7+
{
8+
[Serializable]
9+
public class ApplicationSettingsEvent : UnityEvent<ApplicationSettings> { }
10+
}

Code/Utils/Engine/ApplicationSettingsEvent.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEngine;
2+
3+
4+
5+
namespace Signals.Utils.Engine
6+
{
7+
[CreateAssetMenu(menuName = "Signals/Utils/Engine/ApplicationSettingsSignal")]
8+
public class ApplicationSettingsSignal : SettingsSignal<ApplicationSettings, ApplicationSettingsEvent> { }
9+
}

Code/Utils/Engine/ApplicationSettingsSignal.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
4+
5+
namespace Signals.Utils.Engine
6+
{
7+
[Serializable]
8+
public class ApplicationSettingsValueReference : ValueReference<ApplicationSettings, ApplicationSettingsEvent, ApplicationSettingsSignal> { }
9+
}

Code/Utils/Engine/ApplicationSettingsValueReference.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using UnityEngine;
2+
3+
4+
5+
namespace Signals.Utils.Engine
6+
{
7+
[AddComponentMenu("Signals/Utils/Engine/ApplicationSetup")]
8+
public class ApplicationSetup : Setup<ApplicationSettings, ApplicationSettingsEvent, ApplicationSettingsSignal, ApplicationSettingsValueReference> { }
9+
}

Code/Utils/Engine/ApplicationSetup.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)