Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zw_game_sdk
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
CI / CD
CI / CD
流水线
日程表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
提交
问题看板
Open sidebar
zwwl
zw_game_sdk
Commits
1d96b609
提交
1d96b609
authored
5月 15, 2026
作者:
钱宇
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify:聚合sdk文档修改:回调改为callback。
上级
8d8acf2f
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
119 行增加
和
75 行删除
+119
-75
build.gradle.kts
聚合SDK/aggregation-android-sdk-demo/app/build.gradle.kts
+2
-2
MainActivity.kt
.../main/java/com/zwgame/test/gamecenterdemo/MainActivity.kt
+117
-73
接入文档.md
聚合SDK/接入文档.md
+0
-0
没有找到文件。
聚合SDK/aggregation-android-sdk-demo/app/build.gradle.kts
浏览文件 @
1d96b609
plugi
ns {
plugi
ns {
...
@@ -10,7 +10,7 @@ android {
...
@@ -10,7 +10,7 @@ android {
defaultConfig {
defaultConfig {
applicationId = "com.zwgame.test.gamecenterdemo"
applicationId = "com.zwgame.test.gamecenterdemo"
minSdk =
30
minSdk =
24
targetSdk = 36
targetSdk = 36
versionCode = 1
versionCode = 1
versionName = "1.0"
versionName = "1.0"
...
...
聚合SDK/aggregation-android-sdk-demo/app/src/main/java/com/zwgame/test/gamecenterdemo/MainActivity.kt
浏览文件 @
1d96b609
packa
ge
com.zwgame.test.gamecenterdemo
packa
ge
com.zwgame.test.gamecenterdemo
package
com.zwgame.test.gamecenterdemo
package
com.zwgame.test.gamecenterdemo
import
android.content.res.AssetManager
import
android.content.res.Resources
import
android.os.Bundle
import
android.os.Bundle
import
android.util.Log
import
android.util.Log
import
android.widget.TextView
import
android.widget.TextView
...
@@ -18,6 +16,8 @@ class MainActivity : AppCompatActivity() {
...
@@ -18,6 +16,8 @@ class MainActivity : AppCompatActivity() {
private
lateinit
var
statusText
:
TextView
private
lateinit
var
statusText
:
TextView
private
var
busy
=
false
private
var
busy
=
false
private
val
TAG
=
"gamecenter_demo"
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
WindowCompat
.
setDecorFitsSystemWindows
(
window
,
false
)
WindowCompat
.
setDecorFitsSystemWindows
(
window
,
false
)
...
@@ -50,37 +50,49 @@ class MainActivity : AppCompatActivity() {
...
@@ -50,37 +50,49 @@ class MainActivity : AppCompatActivity() {
private
fun
onInitClick
()
=
guardBusy
{
private
fun
onInitClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_init_clicked
)
statusText
.
setText
(
R
.
string
.
status_init_clicked
)
ZySdk
.
sdkInit
(
this
)
{
result
->
ZySdk
.
sdkInit
(
this
,
true
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkInit
releaseBusy
()
Log
.
i
(
TAG
,
"sdkInit result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkInit result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
val
channelCode
=
obj
.
optString
(
"channelCode"
)
val
success
=
obj
.
optBoolean
(
"success"
)
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
if
(
success
)
{
}
else
{
val
channelCode
=
obj
.
optString
(
"channelCode"
)
Log
.
w
(
TAG
,
"init 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"init 成功,当前渠道:$channelCode"
)
}
else
{
Log
.
w
(
TAG
,
"init 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onLoginClick
()
=
guardBusy
{
private
fun
onLoginClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_login_clicked
)
statusText
.
setText
(
R
.
string
.
status_login_clicked
)
ZySdk
.
sdkLogin
(
this
)
{
result
->
ZySdk
.
sdkLogin
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkLogin
releaseBusy
()
Log
.
i
(
TAG
,
"sdkLogin result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkLogin result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
w
(
TAG
,
"login 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
Log
.
w
(
TAG
,
"login 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onReportUserClick
()
=
guardBusy
{
private
fun
onReportUserClick
()
=
guardBusy
{
...
@@ -107,28 +119,39 @@ class MainActivity : AppCompatActivity() {
...
@@ -107,28 +119,39 @@ class MainActivity : AppCompatActivity() {
put
(
"ext"
,
""
)
put
(
"ext"
,
""
)
put
(
"playerId"
,
"1"
)
put
(
"playerId"
,
"1"
)
}.
toString
()
}.
toString
()
ZySdk
.
sdkReportRole
(
this
,
roleJson
)
{
result
->
ZySdk
.
sdkReportRole
(
this
,
roleJson
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkReportRole
releaseBusy
()
Log
.
i
(
TAG
,
"sdkReportRole result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkReportRole result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
i
(
TAG
,
"reportRole 成功"
)
val
success
=
obj
.
optBoolean
(
"success"
)
}
else
{
if
(
success
)
{
Log
.
w
(
TAG
,
"reportRole 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"reportRole 成功"
)
}
else
{
Log
.
w
(
TAG
,
"reportRole 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${
obj
.
optInt
(
"errorCode"
)
}
"
)
}
}
}
}
}
)
}
}
private
fun
onUpgradeClick
()
=
guardBusy
{
private
fun
onUpgradeClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_upgrade_clicked
)
statusText
.
setText
(
R
.
string
.
status_upgrade_clicked
)
ZySdk
.
sdkUpdate
(
this
)
{
result
->
ZySdk
.
sdkUpdate
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkUpdate
releaseBusy
()
}
if
(
isFinishing
)
return
}
})
}
}
private
fun
onPayClick
()
=
guardBusy
{
private
fun
onPayClick
()
=
guardBusy
{
...
@@ -158,55 +181,76 @@ class MainActivity : AppCompatActivity() {
...
@@ -158,55 +181,76 @@ class MainActivity : AppCompatActivity() {
put
(
"attach"
,
"sdk2_mock_attach"
)
put
(
"attach"
,
"sdk2_mock_attach"
)
put
(
"callbackUrl"
,
Constant
.
Order
.
CALLBACK_OPPO
)
put
(
"callbackUrl"
,
Constant
.
Order
.
CALLBACK_OPPO
)
}.
toString
()
}.
toString
()
ZySdk
.
sdkPay
(
this
,
payJson
)
{
result
->
ZySdk
.
sdkPay
(
this
,
payJson
,
callback
=
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkPay
releaseBusy
()
Log
.
i
(
TAG
,
"sdkPay result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkPay result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
w
(
TAG
,
"pay 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
val
success
=
obj
.
optBoolean
(
"success"
)
if
(!
success
)
{
Log
.
w
(
TAG
,
"pay 失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
}
}
}
}
}
)
}
}
private
fun
onShowFloatClick
()
{
private
fun
onShowFloatClick
()
{
statusText
.
setText
(
R
.
string
.
status_show_float_clicked
)
statusText
.
setText
(
R
.
string
.
status_show_float_clicked
)
ZySdk
.
sdkShowFloat
(
this
)
{
}
ZySdk
.
sdkShowFloat
(
this
,
object
:
ZySdkCallback
{
override
fun
onResult
(
result
:
String
)
{
}
})
}
}
private
fun
onHideFloatClick
()
{
private
fun
onHideFloatClick
()
{
statusText
.
setText
(
R
.
string
.
status_hide_float_clicked
)
statusText
.
setText
(
R
.
string
.
status_hide_float_clicked
)
ZySdk
.
sdkHideFloat
(
this
)
{
}
ZySdk
.
sdkHideFloat
(
this
,
object
:
ZySdkCallback
{
override
fun
onResult
(
result
:
String
)
{
}
})
}
}
private
fun
onExitClick
()
=
guardBusy
{
private
fun
onExitClick
()
=
guardBusy
{
statusText
.
setText
(
R
.
string
.
status_exit_clicked
)
statusText
.
setText
(
R
.
string
.
status_exit_clicked
)
ZySdk
.
sdkExit
(
this
)
{
result
->
ZySdk
.
sdkExit
(
this
,
object
:
ZySdkCallback
{
releaseBusy
()
override
fun
onResult
(
result
:
String
)
{
if
(
isFinishing
)
return
@sdkExit
releaseBusy
()
Log
.
i
(
TAG
,
"sdkExit result=$result"
)
if
(
isFinishing
)
statusText
.
text
=
result
return
Log
.
i
(
TAG
,
"sdkExit result=$result"
)
val
obj
=
JSONObject
(
result
)
statusText
.
text
=
result
val
success
=
obj
.
optBoolean
(
"success"
)
if
(
success
)
{
val
obj
=
JSONObject
(
result
)
Log
.
i
(
TAG
,
"用户在联运退出引导中确认退出"
)
val
success
=
obj
.
optBoolean
(
"success"
)
save
()
if
(
success
)
{
Log
.
i
(
TAG
,
"用户在联运退出引导中确认退出"
)
save
()
// exitProcess(0)
// exitProcess(0)
}
else
{
}
else
{
Log
.
i
(
TAG
,
"退出取消或失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${obj.optInt("
errorCode
")}"
)
Log
.
i
(
TAG
,
"退出取消或失败 errorMsg=${obj.optString("
errorMsg
")} errorCode=${
obj
.
optInt
(
"errorCode"
)
}
"
)
}
}
}
}
}
)
}
}
private
fun
save
()
{
private
fun
save
()
{
//保存进度
//保存进度
}
}
private
companion
object
{
private
companion
object
{
private
const
val
TAG
=
"MainActivity"
private
const
val
TAG
=
"MainActivity"
}
}
...
...
聚合SDK/接入文档.md
浏览文件 @
1d96b609
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论