-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<dependencies> | ||
<!-- Android maven dependencies -->Ï | ||
<androidPackages> | ||
<repositories> | ||
<repository>https://repo.maven.apache.org/maven2</repository> | ||
</repositories> | ||
<androidPackage spec="com.taptap.sdk:tap-license:4.3.10"/> | ||
</androidPackages> | ||
|
||
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. --> | ||
|
||
</dependencies> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using UnityEditor.Build.Reporting; | ||
using TapSDK.Core.Editor; | ||
|
||
namespace TapSDK.License.Mobile.Editor { | ||
public class TapLicenseMobileProcessBuild : SDKLinkProcessBuild { | ||
public override int callbackOrder => 0; | ||
|
||
public override string LinkPath => "TapSDK/License/link.xml"; | ||
|
||
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] { | ||
new LinkedAssembly { Fullname = "TapSDK.License.Runtime" }, | ||
new LinkedAssembly { Fullname = "TapSDK.License.Mobile.Runtime" } | ||
}; | ||
|
||
public override Func<BuildReport, bool> IsTargetPlatform => (report) => { | ||
return BuildTargetUtils.IsSupportMobile(report.summary.platform); | ||
}; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "TapSDK.License.Mobile.Editor", | ||
"references": [ | ||
"GUID:56f3da7a178484843974054bafe77e73" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
using System.Collections.Generic; | ||
using TapSDK.License.Internal; | ||
using TapSDK.Core; | ||
|
||
namespace TapSDK.License.Mobile | ||
{ | ||
public class TapLicenseMobile : ITapLicenseBridge | ||
{ | ||
public static string TAP_LICENSE_SERVICE = "BridgeLicenseService"; | ||
|
||
public static string TDS_LICENSE_SERVICE_CLZ = "com.taptap.sdk.license.internal.enginebridge.BridgeLicenseService"; | ||
|
||
public static string TDS_LICENSE_SERVICE_IMPL = "com.taptap.sdk.license.internal.enginebridge.BridgeLicenseServiceImpl"; | ||
|
||
public TapLicenseMobile() | ||
{ | ||
EngineBridge.GetInstance().Register(TDS_LICENSE_SERVICE_CLZ, TDS_LICENSE_SERVICE_IMPL); | ||
} | ||
|
||
public void RegisterLicencesCallback(ITapLicenseCallback callback) | ||
{ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("registerLicenseCallback") | ||
.Callback(true) | ||
.OnceTime(false) | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command, (result) => | ||
{ | ||
if (result.code != Result.RESULT_SUCCESS) | ||
{ | ||
return; | ||
} | ||
if (string.IsNullOrEmpty(result.content)) | ||
{ | ||
return; | ||
} | ||
var dic = Json.Deserialize(result.content) as Dictionary<string, object>; | ||
var success = SafeDictionary.GetValue<string>(dic, "login") as string; | ||
if (success.Equals("success")) | ||
{ | ||
callback.OnLicenseSuccess(); | ||
} | ||
}); | ||
} | ||
|
||
public void RegisterDLCCallback(ITapDlcCallback callback) | ||
{ | ||
var command = new Command.Builder(); | ||
command.Service(TAP_LICENSE_SERVICE); | ||
command.Method("registerDLCCallback") | ||
.Callback(true) | ||
.OnceTime(false); | ||
|
||
EngineBridge.GetInstance().CallHandler(command.CommandBuilder(), (result) => | ||
{ | ||
if (result.code != Result.RESULT_SUCCESS) | ||
{ | ||
return; | ||
} | ||
if (string.IsNullOrEmpty(result.content)) | ||
{ | ||
return; | ||
} | ||
var dic = Json.Deserialize(result.content) as Dictionary<string, object>; | ||
var dlc = SafeDictionary.GetValue<string>(dic, "orderDLC"); | ||
if (!string.IsNullOrEmpty(dlc)) | ||
{ | ||
var statusCode = SafeDictionary.GetValue<int>(dic, "orderStatus"); | ||
callback.OnOrderCallBack(dlc, HandlePurchasedCode(statusCode)); | ||
return; | ||
} | ||
var code = SafeDictionary.GetValue<int>(dic, "queryCode"); | ||
var queryListJson = SafeDictionary.GetValue<string>(dic, "queryResult"); | ||
var queryListDic = Json.Deserialize(queryListJson) as Dictionary<string, object>; | ||
callback.OnQueryCallBack(HandleQueryCode(code), queryListDic); | ||
}); | ||
} | ||
|
||
private static TapLicenseQueryCode HandleQueryCode(int code) | ||
{ | ||
switch (code) | ||
{ | ||
case 0: | ||
return TapLicenseQueryCode.QUERY_RESULT_OK; | ||
case 1: | ||
return TapLicenseQueryCode.QUERY_RESULT_NOT_INSTALL_TAPTAP; | ||
case 2: | ||
return TapLicenseQueryCode.QUERY_RESULT_ERR; | ||
default: | ||
return TapLicenseQueryCode.ERROR_CODE_UNDEFINED; | ||
} | ||
} | ||
|
||
private static TapLicensePurchasedCode HandlePurchasedCode(int code) | ||
{ | ||
switch (code) | ||
{ | ||
case 0: | ||
return TapLicensePurchasedCode.DLC_NOT_PURCHASED; | ||
case 1: | ||
return TapLicensePurchasedCode.DLC_PURCHASED; | ||
case -1: | ||
return TapLicensePurchasedCode.DLC_RETURN_ERROR; | ||
default: | ||
return TapLicensePurchasedCode.ERROR_CODE_UNDEFINED; | ||
} | ||
} | ||
|
||
public void CheckLicense() | ||
{ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("checkLicense") | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command); | ||
} | ||
|
||
public void CheckLicenseForcibly(){ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("checkLicenseForcibly") | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command); | ||
} | ||
|
||
public void QueryDLC(string[] skus) | ||
{ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("queryDLC") | ||
.Args("skuList", skus) | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command); | ||
} | ||
|
||
public void PurchaseDLC(string sku) | ||
{ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("purchaseDLC") | ||
.Args("skuId", sku) | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command); | ||
} | ||
|
||
public void SetTestEnvironment(bool isTest){ | ||
var command = new Command.Builder() | ||
.Service(TAP_LICENSE_SERVICE) | ||
.Method("setTestEnvironment") | ||
.Args("testEnv", isTest) | ||
.CommandBuilder(); | ||
EngineBridge.GetInstance().CallHandler(command); | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "TapSDK.License.Mobile.Runtime", | ||
"references": [ | ||
"GUID:6f31234cd7bae42d2ae6f8b300cad891", | ||
"GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7", | ||
"GUID:10560023d8780423cb943c7a324b69f2" | ||
], | ||
"includePlatforms": [ | ||
"Android", | ||
"iOS" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
| ||
namespace TapSDK.License.Internal { | ||
public interface ITapLicenseBridge { | ||
void RegisterLicencesCallback(ITapLicenseCallback callback); | ||
|
||
void RegisterDLCCallback(ITapDlcCallback callback); | ||
|
||
void CheckLicense(); | ||
|
||
void CheckLicenseForcibly(); | ||
|
||
void QueryDLC(string[] skus); | ||
|
||
void PurchaseDLC(string sku); | ||
|
||
void SetTestEnvironment(bool isTest); | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace TapSDK.License { | ||
public interface ITapDlcCallback { | ||
void OnQueryCallBack(TapLicenseQueryCode code, Dictionary<string, object> queryList); | ||
void OnOrderCallBack(string sku, TapLicensePurchasedCode status); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace TapSDK.License { | ||
public interface ITapLicenseCallback { | ||
void OnLicenseSuccess(); | ||
} | ||
} |