iap
This commit is contained in:
parent
819d3d3a34
commit
13e12481e5
@ -77,6 +77,12 @@ public class IAPManager : /* MonoBehaviour, */ IStoreListener {
|
|||||||
IAPDebug($"init fail: {er}");
|
IAPDebug($"init fail: {er}");
|
||||||
initCallback?.Invoke(false, null, er);
|
initCallback?.Invoke(false, null, er);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnInitializeFailed(InitializationFailureReason error, string message) {
|
||||||
|
string er = error.ToString("G");
|
||||||
|
IAPDebug($"init fail2: {er}");
|
||||||
|
initCallback?.Invoke(false, null, er);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ================================================== 购买 ==================================================
|
#region ================================================== 购买 ==================================================
|
||||||
|
|||||||
@ -160,7 +160,9 @@ namespace XLua.CSObjectWrap
|
|||||||
IAPManager gen_to_be_invoked = (IAPManager)translator.FastGetCSObj(L, 1);
|
IAPManager gen_to_be_invoked = (IAPManager)translator.FastGetCSObj(L, 1);
|
||||||
|
|
||||||
|
|
||||||
|
int gen_param_count = LuaAPI.lua_gettop(L);
|
||||||
|
|
||||||
|
if(gen_param_count == 2&& translator.Assignable<UnityEngine.Purchasing.InitializationFailureReason>(L, 2))
|
||||||
{
|
{
|
||||||
UnityEngine.Purchasing.InitializationFailureReason _error;translator.Get(L, 2, out _error);
|
UnityEngine.Purchasing.InitializationFailureReason _error;translator.Get(L, 2, out _error);
|
||||||
|
|
||||||
@ -168,6 +170,17 @@ namespace XLua.CSObjectWrap
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(gen_param_count == 3&& translator.Assignable<UnityEngine.Purchasing.InitializationFailureReason>(L, 2)&& (LuaAPI.lua_isnil(L, 3) || LuaAPI.lua_type(L, 3) == LuaTypes.LUA_TSTRING))
|
||||||
|
{
|
||||||
|
UnityEngine.Purchasing.InitializationFailureReason _error;translator.Get(L, 2, out _error);
|
||||||
|
string _message = LuaAPI.lua_tostring(L, 3);
|
||||||
|
|
||||||
|
gen_to_be_invoked.OnInitializeFailed( _error, _message );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,6 +188,8 @@ namespace XLua.CSObjectWrap
|
|||||||
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return LuaAPI.luaL_error(L, "invalid arguments to IAPManager.OnInitializeFailed!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||||
|
|||||||
@ -65,6 +65,15 @@ namespace XLua.CSObjectWrap
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if(LuaAPI.lua_gettop(L) == 2 && translator.Assignable<UnityEngine.Purchasing.ProductMetadata>(L, 2))
|
||||||
|
{
|
||||||
|
UnityEngine.Purchasing.ProductMetadata _productMetadata = (UnityEngine.Purchasing.ProductMetadata)translator.GetObject(L, 2, typeof(UnityEngine.Purchasing.ProductMetadata));
|
||||||
|
|
||||||
|
var gen_ret = new UnityEngine.Purchasing.ProductMetadata(_productMetadata);
|
||||||
|
translator.Push(L, gen_ret);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if(LuaAPI.lua_gettop(L) == 1)
|
if(LuaAPI.lua_gettop(L) == 1)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace XLua.CSObjectWrap
|
|||||||
{
|
{
|
||||||
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
||||||
System.Type type = typeof(UnityEngine.Purchasing.Product);
|
System.Type type = typeof(UnityEngine.Purchasing.Product);
|
||||||
Utils.BeginObjectRegister(type, L, translator, 0, 2, 6, 0);
|
Utils.BeginObjectRegister(type, L, translator, 0, 2, 8, 0);
|
||||||
|
|
||||||
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "Equals", _m_Equals);
|
||||||
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode);
|
Utils.RegisterFunc(L, Utils.METHOD_IDX, "GetHashCode", _m_GetHashCode);
|
||||||
@ -31,6 +31,8 @@ namespace XLua.CSObjectWrap
|
|||||||
Utils.RegisterFunc(L, Utils.GETTER_IDX, "metadata", _g_get_metadata);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "metadata", _g_get_metadata);
|
||||||
Utils.RegisterFunc(L, Utils.GETTER_IDX, "availableToPurchase", _g_get_availableToPurchase);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "availableToPurchase", _g_get_availableToPurchase);
|
||||||
Utils.RegisterFunc(L, Utils.GETTER_IDX, "transactionID", _g_get_transactionID);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "transactionID", _g_get_transactionID);
|
||||||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "appleOriginalTransactionID", _g_get_appleOriginalTransactionID);
|
||||||
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "appleProductIsRestored", _g_get_appleProductIsRestored);
|
||||||
Utils.RegisterFunc(L, Utils.GETTER_IDX, "hasReceipt", _g_get_hasReceipt);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "hasReceipt", _g_get_hasReceipt);
|
||||||
Utils.RegisterFunc(L, Utils.GETTER_IDX, "receipt", _g_get_receipt);
|
Utils.RegisterFunc(L, Utils.GETTER_IDX, "receipt", _g_get_receipt);
|
||||||
|
|
||||||
@ -178,6 +180,34 @@ namespace XLua.CSObjectWrap
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||||
|
static int _g_get_appleOriginalTransactionID(RealStatePtr L)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
||||||
|
|
||||||
|
UnityEngine.Purchasing.Product gen_to_be_invoked = (UnityEngine.Purchasing.Product)translator.FastGetCSObj(L, 1);
|
||||||
|
LuaAPI.lua_pushstring(L, gen_to_be_invoked.appleOriginalTransactionID);
|
||||||
|
} catch(System.Exception gen_e) {
|
||||||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||||
|
static int _g_get_appleProductIsRestored(RealStatePtr L)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
|
||||||
|
|
||||||
|
UnityEngine.Purchasing.Product gen_to_be_invoked = (UnityEngine.Purchasing.Product)translator.FastGetCSObj(L, 1);
|
||||||
|
LuaAPI.lua_pushboolean(L, gen_to_be_invoked.appleProductIsRestored);
|
||||||
|
} catch(System.Exception gen_e) {
|
||||||
|
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
|
||||||
static int _g_get_hasReceipt(RealStatePtr L)
|
static int _g_get_hasReceipt(RealStatePtr L)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"com.unity.ide.vscode": "1.2.5",
|
"com.unity.ide.vscode": "1.2.5",
|
||||||
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||||
"com.unity.postprocessing": "3.2.2",
|
"com.unity.postprocessing": "3.2.2",
|
||||||
"com.unity.purchasing": "4.1.5",
|
"com.unity.purchasing": "4.9.2",
|
||||||
"com.unity.quicksearch": "2.0.2",
|
"com.unity.quicksearch": "2.0.2",
|
||||||
"com.unity.recorder": "2.5.7",
|
"com.unity.recorder": "2.5.7",
|
||||||
"com.unity.test-framework": "1.1.31",
|
"com.unity.test-framework": "1.1.31",
|
||||||
|
|||||||
@ -71,7 +71,7 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.purchasing": {
|
"com.unity.purchasing": {
|
||||||
"version": "4.1.5",
|
"version": "4.9.2",
|
||||||
"depth": 0,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -80,7 +80,7 @@
|
|||||||
"com.unity.modules.unitywebrequest": "1.0.0",
|
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||||
"com.unity.modules.jsonserialize": "1.0.0",
|
"com.unity.modules.jsonserialize": "1.0.0",
|
||||||
"com.unity.modules.androidjni": "1.0.0",
|
"com.unity.modules.androidjni": "1.0.0",
|
||||||
"com.unity.services.core": "1.0.1"
|
"com.unity.services.core": "1.8.1"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
@ -101,11 +101,13 @@
|
|||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
"com.unity.services.core": {
|
"com.unity.services.core": {
|
||||||
"version": "1.0.1",
|
"version": "1.8.1",
|
||||||
"depth": 1,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.modules.unitywebrequest": "1.0.0"
|
"com.unity.modules.unitywebrequest": "1.0.0",
|
||||||
|
"com.unity.nuget.newtonsoft-json": "3.0.2",
|
||||||
|
"com.unity.modules.androidjni": "1.0.0"
|
||||||
},
|
},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user