-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGodotTapTap.gd
81 lines (62 loc) · 2.08 KB
/
GodotTapTap.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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.connect("onLoginResult",self,"_onLoginResult")
singleton.connect("onAntiAddictionCallback",self,"_onAntiAddictionCallback")
singleton.connect("onTapMomentCallBack",self,"_onTapMomentCallBack")
singleton.connect("onRewardVideoAdCallBack",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)
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()