Skip to content

Commit

Permalink
sakuya
Browse files Browse the repository at this point in the history
上传编译后的aar
  • Loading branch information
SakuyaCN committed Jan 15, 2024
1 parent 63402f8 commit 90223b6
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 2 deletions.
2 changes: 0 additions & 2 deletions plugin/demo/addons/.gitignore

This file was deleted.

84 changes: 84 additions & 0 deletions plugin/demo/addons/GodotTapTapSDK/GodotTapTap.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
extends Node

var singleton #插件实例

signal onLoginResult(code,json)
signal onAntiAddictionCallback(code)
signal onTapMomentCallBack(code)
signal onRewardVideoAdCallBack(code)

func _ready():
#初始化
if Engine.has_singleton("GodotTapTapSDK"):
singleton = Engine.get_singleton("GodotTapTapSDK")
singleton.init("lwccao5wbryv5jvhfc","bSVA3KuDPr1eMvAcC4igiy4Ew8rUIlmffcDZmOon","https://sakuyaapi.zhangyongzhao.site")
singleton.onLoginResult.connect(self._onLoginResult)
singleton.onAntiAddictionCallback.connect(self._onAntiAddictionCallback)
singleton.onTapMomentCallBack.connect(self._onTapMomentCallBack)
singleton.onRewardVideoAdCallBack.connect(self._onRewardVideoAdCallBack)

#登录回调
func _onLoginResult(code,json):
emit_signal("onLoginResult",code,json)

#防沉迷回调
func _onAntiAddictionCallback(code):
emit_signal("onAntiAddictionCallback",code)

#内嵌动态回调
func _onTapMomentCallBack(code):
emit_signal("onTapMomentCallBack",code)

#激励广告回调
func _onRewardVideoAdCallBack(code):
emit_signal("onRewardVideoAdCallBack",code)

#调用登录接口
func tap_login():
singleton.login()

#是否登录
func isLogin():
return singleton.isLogin()

#获取当前登录信息
func getCurrentProfile():
return singleton.getCurrentProfile()

#退出登录
func logOut():
singleton.logOut()

#快速防沉迷认证
func quickCheck(id = null):
if id == null:
id = OS.get_unique_id()
singleton.quickCheck(id)

#退出当前用户的防沉迷认证
func antiExit():
singleton.antiExit()

#切换防沉迷环境
func setTestEnvironment(enable:bool):
singleton.setTestEnvironment(enable)

#是否打开悬浮窗
func setEntryVisible(enable:bool):
singleton.setEntryVisible(enable)

#打开内嵌动态
func momentOpen(ori = -1):
singleton.momentOpen(ori)

#初始化广告sdk
func initAd(mediaId,mediaName,mediaKey):
singleton.adnInit(mediaId,mediaName,mediaKey)

#加载激励广告
func initRewardVideoAd(spaceId,rewardName,extraInfo,userId):
singleton.initRewardVideoAd(spaceId,rewardName,extraInfo,userId)

#展示激励广告
func showRewardVideoAd():
singleton.showRewardVideoAd()
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
54 changes: 54 additions & 0 deletions plugin/demo/addons/GodotTapTapSDK/export_plugin.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
@tool
extends EditorPlugin

# A class member to hold the editor export plugin during its lifecycle.
var export_plugin : AndroidExportPlugin

func _enter_tree():
# Initialization of the plugin goes here.
export_plugin = AndroidExportPlugin.new()
add_export_plugin(export_plugin)
add_autoload_singleton("GodotTapTap","res://addons/GodotTapTapSDK/GodotTapTap.gd")


func _exit_tree():
# Clean-up of the plugin goes here.
remove_export_plugin(export_plugin)
export_plugin = null


class AndroidExportPlugin extends EditorExportPlugin:
# TODO: Update to your plugin's name.
var _plugin_name = "GodotTapTapSDK"

var local_aar = [
_plugin_name + "/bin/TapBootstrap_3.27.0.aar",
_plugin_name + "/bin/TapCommon_3.27.0.aar",
_plugin_name + "/bin/TapLogin_3.27.0.aar",
_plugin_name + "/bin/AntiAddiction_3.27.0.aar",
_plugin_name + "/bin/AntiAddictionUI_3.27.0.aar",
_plugin_name + "/bin/TapConnect_3.27.0.aar",
_plugin_name + "/bin/TapMoment_3.27.0.aar",
_plugin_name + "/bin/TapAD_3.16.3.25h1.aar"
]

func _supports_platform(platform):
if platform is EditorExportPlatformAndroid:
return true
return false

func _get_android_libraries(platform, debug):
var array = []
if debug:
array.append(_plugin_name + "/bin/debug/" + _plugin_name + "-debug.aar",)
else:
array.append(_plugin_name + "/bin/release/" + _plugin_name + "-release.aar")
array.append_array(local_aar)
return PackedStringArray(array)

func _get_android_dependencies(platform: EditorExportPlatform, debug: bool) -> PackedStringArray:
return PackedStringArray(["cn.leancloud:storage-android:8.2.19","cn.leancloud:realtime-android:8.2.19",
"com.squareup.okhttp3:okhttp:3.12.1","com.android.support:support-annotations:28.0.0","com.github.bumptech.glide:glide:4.9.0","com.android.support:appcompat-v7:28.0.0","com.android.support:support-v4:28.0.0","com.android.support:recyclerview-v7:28.0.0"])

func _get_name():
return _plugin_name
7 changes: 7 additions & 0 deletions plugin/demo/addons/GodotTapTapSDK/plugin.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[plugin]

name="GodotTapTapSDK"
description="适用于Godot 4.2+的TapTap SDK"
author="sakuya"
version="1.0"
script="export_plugin.gd"

0 comments on commit 90223b6

Please sign in to comment.