【Bug】IAP没有恢复购买、去掉UI相机适配脚本

iOS_release
zhangaotian 2024-07-30 14:48:40 +08:00
parent 12146441c1
commit bd27ea089c
5 changed files with 23 additions and 22 deletions

View File

@ -134,7 +134,6 @@ GameObject:
- component: {fileID: 123179489} - component: {fileID: 123179489}
- component: {fileID: 123179488} - component: {fileID: 123179488}
- component: {fileID: 123179486} - component: {fileID: 123179486}
- component: {fileID: 123179490}
m_Layer: 0 m_Layer: 0
m_Name: UICamera m_Name: UICamera
m_TagString: Untagged m_TagString: Untagged
@ -252,18 +251,6 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 2081420527} m_Father: {fileID: 2081420527}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &123179490
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 123179485}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fff49514adc6448d0a4cbea3ff37308b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &158007422 --- !u!1 &158007422
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -45,6 +45,7 @@ public abstract class GuideStepBase
/// </summary> /// </summary>
public async void StartGuide() public async void StartGuide()
{ {
GuideMananger.Instance.IsGuiding = true;
await UniTask.Delay(500); // 延迟时间开始 await UniTask.Delay(500); // 延迟时间开始
DoBeforeGuide(); DoBeforeGuide();
SubStartGuide(); SubStartGuide();
@ -116,6 +117,5 @@ internal sealed class WinLevel : GuideStepBase
protected override void SubStartGuide() protected override void SubStartGuide()
{ {
GuideMananger.Instance.IsGuiding = true;
} }
} }

View File

@ -12,7 +12,6 @@ public class IAPHandle : IStoreListener
private const string Environment = "production"; private const string Environment = "production";
public Action<string> SendReceiptAction; public Action<string> SendReceiptAction;
public Action<string> SetApplicationUseId; public Action<string> SetApplicationUseId;
public Action<string> OnBreakPurchase;
public bool ClientVerify; public bool ClientVerify;
public List<string> ConsumableGoods; public List<string> ConsumableGoods;
public List<string> NonConsumableGoods; public List<string> NonConsumableGoods;
@ -24,6 +23,7 @@ public class IAPHandle : IStoreListener
private IGooglePlayStoreExtensions _googlePlayStoreExtensions; private IGooglePlayStoreExtensions _googlePlayStoreExtensions;
private Action<string> _onPurchaseSuccess; private Action<string> _onPurchaseSuccess;
private Action _onPurchaseFail; private Action _onPurchaseFail;
public Action<string> OnRestorePurchase;
private bool _isInitialized; private bool _isInitialized;
/// <summary> /// <summary>
@ -198,7 +198,14 @@ public class IAPHandle : IStoreListener
} }
else else
{ {
_onPurchaseSuccess?.Invoke(_curProduct); if (_onPurchaseSuccess != null)
{
_onPurchaseSuccess.Invoke(_curProduct);
}
else
{
OnRestorePurchase?.Invoke(_curProduct);
}
} }
} }
@ -220,7 +227,14 @@ public class IAPHandle : IStoreListener
} }
else else
{ {
_onPurchaseSuccess?.Invoke(_curProduct); if (_onPurchaseSuccess != null)
{
_onPurchaseSuccess.Invoke(_curProduct);
}
else
{
OnRestorePurchase?.Invoke(_curProduct);
}
} }
} }
} }

View File

@ -15,11 +15,11 @@ public class IAPManager : Singlenton<IAPManager>
/// 添加商品并初始化IAP /// 添加商品并初始化IAP
/// </summary> /// </summary>
public void AddGoods(List<string> consumableGoods, List<string> nonConsumableGoods, public void AddGoods(List<string> consumableGoods, List<string> nonConsumableGoods,
Action<string> onBreakPurchase = null) Action<string> onRestorePurchase = null)
{ {
_helper.ConsumableGoods = consumableGoods; _helper.ConsumableGoods = consumableGoods;
_helper.NonConsumableGoods = nonConsumableGoods; _helper.NonConsumableGoods = nonConsumableGoods;
_helper.OnBreakPurchase = onBreakPurchase; _helper.OnRestorePurchase = onRestorePurchase;
try try
{ {

View File

@ -103,10 +103,10 @@ namespace Gameplay.LoadingExecutor
await UIManager.Instance.OpenWindow(UIConstants.UIStartMain); await UIManager.Instance.OpenWindow(UIConstants.UIStartMain);
//用户协议 -> 登录 -> 数据同步 //用户协议 -> 登录 -> 数据同步
if (AppInfoManager.Instance.UpdateConfirm) if (AppInfoManager.Instance.UpdateConfirm && !GuideMananger.Instance.IsGuiding)
await UIManager.Instance.OpenWindow(UIConstants.UISyncTip); await UIManager.Instance.OpenWindow(UIConstants.UISyncTip);
if (!AppInfoManager.Instance.CheckIfLogin() && !LoginManager.Instance.ShowLogin) if (!AppInfoManager.Instance.CheckIfLogin() && !LoginManager.Instance.ShowLogin && !GuideMananger.Instance.IsGuiding)
await UIManager.Instance.OpenWindow(UIConstants.UILogin); await UIManager.Instance.OpenWindow(UIConstants.UILogin);
if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch)) if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch))