com.puzzlescapegames.services 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/DefineSymbols/DefineSymbolsInstaller.cs +1 -0
- package/Editor/XCodePostProcess.cs +41 -0
- package/Editor/XCodePostProcess.cs.meta +11 -0
- package/README.md +1 -0
- package/Runtime/PuzzlescapeGames.Services.asmdef +3 -1
- package/Runtime/Services/UITransitionService/LoadingSettings.cs +19 -0
- package/Runtime/Services/UITransitionService/LoadingSettings.cs.meta +3 -0
- package/Runtime/Services/UITransitionService/TransitionSettings.cs +12 -0
- package/Runtime/Services/UITransitionService/TransitionSettings.cs.meta +3 -0
- package/Runtime/Services/UITransitionService/UIInfinityBlank.cs +73 -0
- package/Runtime/Services/UITransitionService/UIInfinityBlank.cs.meta +3 -0
- package/Runtime/Services/UITransitionService/UITransitionService.cs +39 -0
- package/Runtime/Services/UITransitionService/UITransitionService.cs.meta +3 -0
- package/Runtime/Services/UITransitionService/UITransitionServiceInstaller.cs +17 -0
- package/Runtime/Services/UITransitionService/UITransitionServiceInstaller.cs.meta +3 -0
- package/Runtime/Services/UITransitionService.meta +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#if (UNITY_IPHONE || UNITY_IOS) && ENABLED_XCODE_INFO_PLIST
|
|
2
|
+
using System.IO;
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEditor.Callbacks;
|
|
5
|
+
using UnityEditor.iOS.Xcode;
|
|
6
|
+
using UnityEngine;
|
|
7
|
+
|
|
8
|
+
namespace PuzzlescapeGames.Services.Editor
|
|
9
|
+
{
|
|
10
|
+
public static class XCodePostProcess
|
|
11
|
+
{
|
|
12
|
+
// Set the IDFA request description:
|
|
13
|
+
private const string k_TrackingDescription = "Your data will be used to provide you a better and personalized ad experience.";
|
|
14
|
+
|
|
15
|
+
[ PostProcessBuild ]
|
|
16
|
+
public static void ChangeXcodePlist( BuildTarget buildTarget, string path )
|
|
17
|
+
{
|
|
18
|
+
if ( buildTarget == BuildTarget.iOS )
|
|
19
|
+
{
|
|
20
|
+
string plistPath = path + "/Info.plist";
|
|
21
|
+
PlistDocument plist = new PlistDocument();
|
|
22
|
+
plist.ReadFromFile( plistPath );
|
|
23
|
+
|
|
24
|
+
PlistElementDict rootDict = plist.root;
|
|
25
|
+
|
|
26
|
+
Debug.Log( "[iOS] Change plist file" );
|
|
27
|
+
|
|
28
|
+
//Default Encrypt
|
|
29
|
+
rootDict.SetBoolean( "ITSAppUsesNonExemptEncryption", false );
|
|
30
|
+
//ATT
|
|
31
|
+
rootDict.SetString( "NSUserTrackingUsageDescription", k_TrackingDescription );
|
|
32
|
+
//AppsFlyer SKAN end point
|
|
33
|
+
//https://dev.appsflyer.com/hc/docs/integrate-ios-sdk#sending-skan-postback-copies-to-appsflyer
|
|
34
|
+
rootDict.SetString( "NSAdvertisingAttributionReportEndpoint ", "https://appsflyer-skadnetwork.com/" );
|
|
35
|
+
|
|
36
|
+
File.WriteAllText( plistPath, plist.WriteToString() );
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
#endif
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Common services.
|
|
|
4
4
|
Install from npm by "com.puzzlescapegames.services".<br>
|
|
5
5
|
>Required ```com.puzzlescapegames.extensions```<br>
|
|
6
6
|
>Required ```com.puzzlescapegames.ioc_zenject```<br>
|
|
7
|
+
>Required ```com.puzzlescapegames.dotween```<br>
|
|
7
8
|
>Required [UniTask]<br>
|
|
8
9
|
```
|
|
9
10
|
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
"GUID:9e5f34ba0cc07fc4184cb3bf9d5c4b7e",
|
|
7
7
|
"GUID:0d8beb7f090555447a6cf5ce9e54dbb4",
|
|
8
8
|
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
|
9
|
-
"GUID:0c0c8357443d62a4c9e55fe39d3a3e51"
|
|
9
|
+
"GUID:0c0c8357443d62a4c9e55fe39d3a3e51",
|
|
10
|
+
"GUID:57c43d7b8262a5840908defee553447f",
|
|
11
|
+
"GUID:029c1c1b674aaae47a6841a0b89ad80e"
|
|
10
12
|
],
|
|
11
13
|
"includePlatforms": [],
|
|
12
14
|
"excludePlatforms": [],
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
using PuzzlescapeGames.Extensions;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace PuzzlescapeGames.Services.UITransitionService
|
|
5
|
+
{
|
|
6
|
+
[ System.Serializable ]
|
|
7
|
+
public sealed class LoadingSettings
|
|
8
|
+
{
|
|
9
|
+
[ field: SerializeField ] public string UID { get; private set; } = "default";
|
|
10
|
+
[ field: Space ]
|
|
11
|
+
[ field: SerializeField ] public float InDuration { get; private set; } = 0.33f;
|
|
12
|
+
[ field: SerializeField ] public AnimationCurve InCurve { get; private set; } = AnimationCurveUtils.Default();
|
|
13
|
+
[ field: Space ]
|
|
14
|
+
[ field: SerializeField ] public float LoadingTime { get; private set; } = 1f;
|
|
15
|
+
[ field: Space ]
|
|
16
|
+
[ field: SerializeField ] public float OutDuration { get; private set; } = 0.16f;
|
|
17
|
+
[ field: SerializeField ] public AnimationCurve OutCurve { get; private set; } = AnimationCurveUtils.Default();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace PuzzlescapeGames.Services.UITransitionService
|
|
5
|
+
{
|
|
6
|
+
[ System.Serializable ]
|
|
7
|
+
public sealed class TransitionSettings
|
|
8
|
+
{
|
|
9
|
+
[ field: SerializeField ] public List< LoadingSettings > LoadingSettings { get; private set; } = new();
|
|
10
|
+
[ field: SerializeField ] public UIInfinityBlank InfinityBlankPrefab { get; private set; }
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
using Cysharp.Threading.Tasks;
|
|
2
|
+
using DG.Tweening;
|
|
3
|
+
using PuzzlescapeGames.Extensions;
|
|
4
|
+
using System;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace PuzzlescapeGames.Services.UITransitionService
|
|
8
|
+
{
|
|
9
|
+
public sealed class UIInfinityBlank : MonoBehaviour
|
|
10
|
+
{
|
|
11
|
+
public event Action OnShowingChanged;
|
|
12
|
+
public event Action OnProcessCompleted;
|
|
13
|
+
|
|
14
|
+
[ field: SerializeField ] public CanvasGroup CanvasGroup { get; private set; }
|
|
15
|
+
|
|
16
|
+
public bool IsShowing
|
|
17
|
+
{
|
|
18
|
+
get => _isShowing;
|
|
19
|
+
set
|
|
20
|
+
{
|
|
21
|
+
_isShowing = value;
|
|
22
|
+
OnShowingChanged?.Invoke();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
private bool _isShowing = false;
|
|
26
|
+
|
|
27
|
+
public bool IsInProcess
|
|
28
|
+
{
|
|
29
|
+
get => _isInProcess;
|
|
30
|
+
protected set
|
|
31
|
+
{
|
|
32
|
+
if (_isInProcess != value && value == false)
|
|
33
|
+
{
|
|
34
|
+
OnProcessCompleted?.Invoke();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_isInProcess = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
private bool _isInProcess = false;
|
|
41
|
+
|
|
42
|
+
public async UniTask ShowAsync( float duration, AnimationCurve easing, Action callback = null )
|
|
43
|
+
{
|
|
44
|
+
IsInProcess = true;
|
|
45
|
+
CanvasGroup.alpha = 0f;
|
|
46
|
+
CanvasGroup.Enable( true, false );
|
|
47
|
+
IsShowing = true;
|
|
48
|
+
|
|
49
|
+
CanvasGroup.DOKill( true );
|
|
50
|
+
|
|
51
|
+
await CanvasGroup.DOFade( 1f, duration ).SetEase( easing ).ToUniTask();
|
|
52
|
+
|
|
53
|
+
IsInProcess = false;
|
|
54
|
+
|
|
55
|
+
callback?.Invoke();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public async UniTask HideAsync( float duration, AnimationCurve easing, Action callback = null )
|
|
59
|
+
{
|
|
60
|
+
IsInProcess = true;
|
|
61
|
+
CanvasGroup.Enable( false, false );
|
|
62
|
+
IsShowing = false;
|
|
63
|
+
|
|
64
|
+
CanvasGroup.DOKill( true );
|
|
65
|
+
|
|
66
|
+
await CanvasGroup.DOFade( 0f, duration ).SetEase( easing ).ToUniTask();
|
|
67
|
+
|
|
68
|
+
IsInProcess = false;
|
|
69
|
+
|
|
70
|
+
callback?.Invoke();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
using Cysharp.Threading.Tasks;
|
|
2
|
+
using System;
|
|
3
|
+
using System.Linq;
|
|
4
|
+
using Object = UnityEngine.Object;
|
|
5
|
+
|
|
6
|
+
namespace PuzzlescapeGames.Services.UITransitionService
|
|
7
|
+
{
|
|
8
|
+
public sealed class UITransitionService
|
|
9
|
+
{
|
|
10
|
+
private UIInfinityBlank _blank;
|
|
11
|
+
|
|
12
|
+
private readonly TransitionSettings _settings;
|
|
13
|
+
|
|
14
|
+
public UITransitionService( TransitionSettings settings )
|
|
15
|
+
{
|
|
16
|
+
_settings = settings ?? throw new ArgumentNullException( nameof(settings) );
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public async UniTask LoadThroughBlank( string uid, Action onShowed = null, Action onLoaded = null, Action onHided = null )
|
|
20
|
+
{
|
|
21
|
+
var loading = _settings.LoadingSettings.FirstOrDefault( ( x ) => string.Equals( x.UID, uid, StringComparison.InvariantCultureIgnoreCase ) );
|
|
22
|
+
await LoadThroughBlank( loading, onShowed, onLoaded, onHided );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public async UniTask LoadThroughBlank( LoadingSettings loading, Action onShowed = null, Action onLoaded = null , Action onHided = null )
|
|
26
|
+
{
|
|
27
|
+
if ( _blank == null )
|
|
28
|
+
{
|
|
29
|
+
_blank = Object.Instantiate( _settings.InfinityBlankPrefab );
|
|
30
|
+
Object.DontDestroyOnLoad( _blank );
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
await _blank.ShowAsync( loading.InDuration, loading.InCurve, onShowed );
|
|
34
|
+
await UniTask.WaitForSeconds( loading.LoadingTime );
|
|
35
|
+
onLoaded?.Invoke();
|
|
36
|
+
await _blank.HideAsync( loading.OutDuration, loading.OutCurve, onHided );
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using Zenject;
|
|
3
|
+
|
|
4
|
+
namespace PuzzlescapeGames.Services.UITransitionService
|
|
5
|
+
{
|
|
6
|
+
[ CreateAssetMenu( fileName = "UITransitionServiceInstaller", menuName = "Installers/UITransitionServiceInstaller" ) ]
|
|
7
|
+
public sealed class UITransitionServiceInstaller : ScriptableObjectInstaller< UITransitionServiceInstaller >
|
|
8
|
+
{
|
|
9
|
+
[ SerializeField ] private TransitionSettings _settings;
|
|
10
|
+
|
|
11
|
+
public override void InstallBindings()
|
|
12
|
+
{
|
|
13
|
+
Container.BindInstance( _settings );
|
|
14
|
+
Container.Bind< UITransitionService >().AsSingle();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|