diff --git a/Assets/Configs.meta b/Assets/Configs.meta
new file mode 100644
index 00000000..03f725a9
--- /dev/null
+++ b/Assets/Configs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3ce648fc8bf664d56bcf72c9d5be76e6
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/CN.meta b/Assets/Configs/CN.meta
new file mode 100644
index 00000000..55432a04
--- /dev/null
+++ b/Assets/Configs/CN.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 24df658e83b09495585fa9cf08156d07
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/CN/tkg_config.plist b/Assets/Configs/CN/tkg_config.plist
new file mode 100644
index 00000000..6376a9fb
--- /dev/null
+++ b/Assets/Configs/CN/tkg_config.plist
@@ -0,0 +1,150 @@
+
+
+
+
+ lock_screen
+ on
+ tenjin_api_key
+ PYOTVKJ4XZJHSMZW2V6GBQRCNXAFKWU2
+ rn_app_key
+
+ file
+
+ tka_theme
+
+ ad_sk_interstital_id
+
+ fb_client_token
+
+ package_name
+ com.toukagames.drawarmy
+ updatetime
+ 2022/06/23 15:00:52
+ usb
+ on
+ adjust_id
+
+ fb_download_url
+
+ td_channel_id
+ default
+ firebase_name
+ GoogleService-Info.plist
+ game_screen_orientation
+ 0
+ main_activity
+ com.u8.sdk.U8UnityContext
+ admob_id
+ ca-app-pub-3916046151571724~7731238444
+ channel
+ AppStore_CN
+ tka_url_privacy
+ https://www.mooncakegame.com/privacy.html
+ um_app_key
+ 60890fe2f00c2e19b93e6155
+ tw_txt
+ {"m-native_sdk":"","lock_screen":"on","fs":"3","m-interaction_sdk":"","wifi_interval":"30","td_app_id":"","m-banner":"b779308d2f67c37d","usb":"on","unlock":"on","citys":"北京,上海,广州,深圳,东莞,香港,澳门,武汉,阿里云,腾讯云,华为云","td_channel_id":"default","m-splash_sdk":"","unlock_next":"1","wifi":"on","pp":"30","m-splash":"","m-interaction":"babddc80a2651057","m-app_key":"QVt-ZBOR44Frm2Ub8gEfbPo-K8SeKHvyzoq-TJ3op08cFx29THV9DviWinxrQBxNePGKU14gHOkClTrNOi_1a9","unlock_style":"2","unlock_interval":"2","m-reward":"ddb2dd36ec0f5a85","m-app_id":"","m-native":"","bg_pop":"on"}
+ unlock_next
+ 1
+ ad_banner_id
+ b6083a3a129482
+ platform
+ ios
+ copyright_id
+
+ copyright_holder
+
+ publisher_url_scheme
+
+ app_name
+ TKGSDKDemo
+ bugly_appid
+
+ offer_id
+
+ ga_secretkey
+ 6a2dd6d6189994e7af755efe6944e4a08e0929a7
+ unlock_interval
+ 2
+ fb_appid
+
+ ad_interstital_half_id
+
+ ad_native_banner_id
+
+ tk_app_id
+ a607fe29de4363
+ ad_native_splash_id
+
+ bg_pop
+ on
+ bugly_appkey
+
+ firebase_path
+ https://my-report.oss-cn-beijing.aliyuncs.com/icon/2022/06/23/5c91a28aac0543d1afcb1f1e92946cce.plist
+ fs
+ 3
+ ad_appkey
+ c13e4357e57d78e76e472899eb182e98
+ wifi_interval
+ 30
+ tka_url_agreement
+ https://www.mooncakegame.com/agreements.html
+ ad_templete_natvie_id
+
+ td_app_id
+
+ tka_age
+ 12
+ ad_full_reward_id
+
+ tka_type
+
+ splash_img
+
+ channel_appkey
+
+ unlock
+ on
+ ad_interstital_id
+ b607ae9b4529ed
+ citys
+ 北京,上海,广州,深圳,东莞,香港,澳门,武汉,阿里云,腾讯云,华为云
+ publisher_appid
+
+ ad_splash_id
+
+ baidumobad_app_id
+
+ channel_appsecret
+
+ ad_appid
+ a607acb6913054
+ ad_sk_native1_id
+
+ publish_account
+ Mooncake Games Limited
+ channel_appid
+
+ ad_render_native_id
+ b608251153978a
+ wifi
+ on
+ pp
+ 30
+ ad_reward_id
+ b608250f4ec04a
+ ad_sk_native_id
+
+ tka_url_moregame
+ https://apps.apple.com/developer/id1521253916
+ unlock_style
+ 2
+ ga_key
+ 000f968b863b47fc95ef55473ce955b1
+ ad_sk_splash_id
+
+ ad_platform
+ topon
+
+
diff --git a/Assets/Configs/CN/tkg_config.plist.meta b/Assets/Configs/CN/tkg_config.plist.meta
new file mode 100644
index 00000000..84f1ece3
--- /dev/null
+++ b/Assets/Configs/CN/tkg_config.plist.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: eb64a089a31554aa5bffdb0e52149a14
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/CN/tkg_config.properties b/Assets/Configs/CN/tkg_config.properties
new file mode 100644
index 00000000..3f9898e1
--- /dev/null
+++ b/Assets/Configs/CN/tkg_config.properties
@@ -0,0 +1,156 @@
+
+#=================基础配置=============================
+#游戏名称
+app_name=太空潜行者
+#包名
+package_name=com.autumnant.alienkill
+#闪屏图(&健康提示),值:图片名字,没有填"",详见需求文档(- 新增splash图 部分):https://pic6ktmsyi.feishu.cn/docs/doccnRdYblZyPN2HpIK6nsJmqSb#
+splash_img=
+#游戏横竖屏,根据游戏横竖屏取值 值: 0 竖屏, 1 横屏
+game_screen_orientation=0
+#发行主体
+publish_account=北京慕恩凯克网络科技有限公司
+
+#渠道
+channel=DY012
+#子渠道
+sub_channel=""
+#客户端协议上报u8 appid
+tk_app_id=8110
+
+#外部测试使用facebook id
+fb_appid=
+fb_client_token=
+#adjust_id{}
+adjust_id=
+#巨量app id
+rangers_applog_id={rangers_applog_id}
+#发行人app id
+publisher_appid=
+publisher_url_scheme=
+#游戏软著著作人
+copyright_holder=北京慕恩凯克网络科技有限公司
+#游戏软著登记号
+copyright_id=2022SR0713177
+
+#调试模式(写死不动,仅供调试使用)
+#debug_mode=false
+
+
+#=================用户协议(弹窗)配置=============================
+#游戏类型
+TkA_Type=休闲益智
+#游戏题材
+TkA_Theme=冒险闯关
+#适龄,取值:8|12|16|18
+TkA_Age=12
+#隐私政策url
+TkA_Url_Privacy=https://www.mooncakegame.com/privacy.html
+#用户协议url
+TkA_Url_Agreement=https://www.mooncakegame.com/agreements.html
+
+#=================广告通用配置=============================
+#广告平台,max|topon|xiaomi
+ad_platform=topon
+
+#广告appid (包括max applovin.sdk.key)
+ad_appid=a1dt3hgr196p3q
+#广告appkey
+ad_appkey=c13e4357e57d78e76e472899eb182e98
+#admob id
+admob_id=
+
+
+#开屏广告位id
+ad_splash_id=b6297221b599ae
+ad_native_splash_id=
+#插屏广告位id
+ad_interstital_id=b1dt3hgr9pocks
+#半屏插屏广告位id(小米广告区分全/半屏)
+ad_interstital_half_id=
+#激励视频广告位id
+ad_reward_id=b1dt3hgrarr5pi
+#banner广告位id
+ad_banner_id=
+ad_native_banner_id=
+# 原生模板广告位id [增加]
+ad_templete_natvie_id=
+
+# 原生自渲染广告位id [增加]
+ad_render_native_id=
+
+
+#=================TW配置=============================
+#[TODO][meta-data]百度 APPID
+BaiduMobAd_APP_ID=
+
+#副包下载链接
+FB_DOWNLOAD_URL=
+FB_POP_CONFIG_DAT_URL=https://my-report.oss-cn-beijing.aliyuncs.com/config/pops-com.autumnant.alienkill.dat
+#更多游戏链接
+tka_url_moregame=
+
+#TW广告位
+#SDK插屏
+ad_sk_interstital_id=
+#SDK开屏
+ad_sk_splash_id=
+#SDK信息流
+ad_sk_native_id=
+#SDK信息流1
+ad_sk_native1_id=
+
+#[TODO][meta-data]游戏主 Activity:
+#取值 Unity游戏: com.u8.sdk.U8UnityContext
+#flash游戏: com.u8.sdk.ane.U8ANEActivity
+#Cocos游戏: com.u8.sdk.U8CocosActivity
+MAIN_ACTIVITY=com.u8.sdk.U8UnityContext
+
+#极光 AppKey,默认空
+JPUSH_APPKEY=""
+
+
+#客服邮箱
+tkg_custom=dev@mooncakegame.com
+channel_appid=
+channel_appkey=
+channel_appsecret=
+
+
+#=================Bugly=============================
+Bugly_AppID=17f7b7efc7
+Bugly_AppKey=1d989fdb-526e-49a7-b23b-94d12185e934
+
+
+#=================YSDK实名认证=============================
+#[TODO][ysdkconf.ini]腾讯AppID
+OFFER_ID=1112212474
+
+
+#=================Umeng配置=============================
+#UM Appkey
+UM_APP_KEY=6297415788ccdf4b7e838779
+#json 参数 key
+JSON_PARAM_KEY=""
+#[TODO][文件类型参数]默认 (在线) 参数配置
+UMENG_DEFAULT_ONLINE_CONFIG=""
+
+#=================GA配置=============================
+#GA AppKey
+GA_KEY=
+#GA AppSecret
+GA_SECRETKEY=
+
+#=================热云配置=============================
+#AppKey
+RN_APP_KEY=
+
+#=================Tenjin配置=============================
+#Tenjin ApiKey
+TENJIN_API_KEY=PYOTVKJ4XZJHSMZW2V6GBQRCNXAFKWU2
+
+#=================Firebase配置=============================
+#[TODO][文件类型参数]google-services.json文件
+google_services_json=""
+
+{remark}
\ No newline at end of file
diff --git a/Assets/Configs/CN/tkg_config.properties.meta b/Assets/Configs/CN/tkg_config.properties.meta
new file mode 100644
index 00000000..7ac715c4
--- /dev/null
+++ b/Assets/Configs/CN/tkg_config.properties.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 65fdf291ed5a645e5a155b7eac5b25c2
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/CN/tkg_sdk_config.ini b/Assets/Configs/CN/tkg_sdk_config.ini
new file mode 100644
index 00000000..5c16fddd
--- /dev/null
+++ b/Assets/Configs/CN/tkg_sdk_config.ini
@@ -0,0 +1,70 @@
+TKG_ENABLE_LOG = false
+
+
+#***********副包配置***********
+#副包下载地址,目前所有游戏使用同一个副包,此链接不需要修改
+FB_DOWNLOAD_URL = http://p2-yx.adkwai.com/udata/pkg/DSP-EFFECT/apk/36e063f5-9473-4064-b99f-8686bcc427e6.apk
+#是否在wifi状态下提前预下载副包apk
+FB_PREDOWNLOAD_IN_WIFI = false
+
+#云控弹窗配置链接(* 每个游戏需要单独配置),留空则使用留包配置
+#FB_POP_CONFIG_DAT_URL = https://my-report.oss-cn-beijing.aliyuncs.com/config/pops-com.zlsz.basketdash.global.dat
+
+#锁屏广告类型 0:信息流 1:百度资讯 此处设置会被弹窗配置文件(pop-包名.dat)设置覆盖
+DEFAULT_LOCK_SCREEN_TYPE = 0
+#弹窗库日志打印开关
+POPLIB_LOG_ENABLE = false
+
+#延迟多久弹出副包悬浮按钮,单位毫秒(可根据游戏加载时长设置,一般进入游戏正式画面再显示)
+SHOW_FB_UI_DELAY = 5000
+#自动弹出副包安装提示弹窗时,延迟多久弹出,单位毫秒(可根据游戏加载时长设置,一般进入游戏正式画面再显示)
+AUTO_SHOW_FB_DIALOG_DELAY = 10000
+
+
+#激活上报比例,取值0-100
+ANALYTICS_RATIO = 100
+
+#统计激活(初始化)时机
+# 打开游戏时 :0
+# 实名认证之后 :1
+# 展示了一次插屏广告 :3
+# 广告展示收入达标 :5 (设置这个值需要同时设置ANALYTICS_INIT_REVENUE的取值)
+ANALYTICS_INIT_TIME = 0
+#广告收入达到多少才初始化,值: 0.005
+ANALYTICS_INIT_REVENUE = 0
+#展示广告x次数之后初始化统计SDK
+ANALYTICS_SHOW_AD_NUMBER = 1
+
+#插屏广告弹出规则 值json: [{"type":0,"overLevel":0,"interval":30,"skipLevel":1},{"type":1,"overLevel":0,"interval":30,"skipLevel":1}]
+INTER_AD_RULES = [{"type":"0","overLevel":"0","interval":"10","skipLevel":"1"}]
+#自动插屏规则 值json: SDK默认值: {"open":false,"interval":30,"skipLevel":1}
+AUTO_INTER_AD_RULES= {"open":false,"interval":"30","skipLevel":"-1"}
+
+#新增当天游戏通关数,一个用户上报一次,X支持在线参数配置,默认值15
+NewUserPassLevel = 15
+#新增当天视频广告播放次数超过X次,则上报,一个用户上报一次,X支持在线参数配置,默认值15
+NewUserAdsCount = 15
+
+#用户任意类型广告(包括游戏内及TW所有广告类型)ecpm达到X则上报
+NewUserEcpm = 3
+#当插屏ecpm达到X则上报,包括TW插屏
+NewUserIvEcpm = 3
+#当激励视频ecpm达到X则上报
+NewUserRvEcpm = 4
+#插屏+激励视频(包括TW),成功展示X次则上报。
+NewUserPvCount = 18
+
+#用户任意类型广告ecpm达到X且用户时长达到Y则上报。时长(NewUserTime)是当日多次登陆累计时间
+NewUserTimeEcpm = 3
+#时间,单位秒
+NewUserTime = 600
+
+#用户收益达到X则上报
+NewUserAdsArpu = 0.05
+
+nativeStatus = 0
+bannerStatus = 0
+tkgshowauthview = 1
+nativeTemplatesType = 3
+
+{remark}
\ No newline at end of file
diff --git a/Assets/Configs/CN/tkg_sdk_config.ini.meta b/Assets/Configs/CN/tkg_sdk_config.ini.meta
new file mode 100644
index 00000000..b5f23d44
--- /dev/null
+++ b/Assets/Configs/CN/tkg_sdk_config.ini.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 47e36f69986b64faca5bcd86c28c569f
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/CN/tkg_sdk_config.plist b/Assets/Configs/CN/tkg_sdk_config.plist
new file mode 100644
index 00000000..51553fd0
--- /dev/null
+++ b/Assets/Configs/CN/tkg_sdk_config.plist
@@ -0,0 +1,62 @@
+
+
+
+
+ auto_inter_ad_rules
+ {"open":false,"interval":"30","skipLevel":"-1"}
+ analytics_init_time
+ 0
+ show_fb_ui_delay
+ 5000
+ analytics_ratio
+ 100
+ skiplevel
+ -1
+ newusertime
+ 600
+ newuseradscount
+ 15
+ config_id
+ 77
+ analytics_show_ad_number
+ 1
+ tkg_enable_log
+ false
+ inter_ad_rules
+ [{"type":"0","overLevel":"0","interval":"10","skipLevel":"1"}]
+ poplib_log_enable
+ false
+ newuseradsarpu
+ 0.05
+ newuserecpm
+ 3
+ newuserrvecpm
+ 4
+ nativestatus
+ 1
+ type
+ 0
+ newuserpvcount
+ 2
+ overlevel
+ 0
+ interval
+ 30
+ default_lock_screen_type
+ 0
+ newuserpasslevel
+ 2
+ newuserivecpm
+ 3
+ analytics_init_revenue
+ 0
+ newusertimeecpm
+ 3
+ auto_show_fb_dialog_delay
+ 10000
+ bannerstatus
+ 1
+ fb_predownload_in_wifi
+ false
+
+
diff --git a/Assets/Configs/CN/tkg_sdk_config.plist.meta b/Assets/Configs/CN/tkg_sdk_config.plist.meta
new file mode 100644
index 00000000..0677b1a8
--- /dev/null
+++ b/Assets/Configs/CN/tkg_sdk_config.plist.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ba8674841547f40f3b4b19848e3538c6
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB.meta b/Assets/Configs/GB.meta
new file mode 100644
index 00000000..6db17ec8
--- /dev/null
+++ b/Assets/Configs/GB.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 32ab70ae334024cb1adf42ad214c2e0e
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/GoogleService-Info.plist b/Assets/Configs/GB/GoogleService-Info.plist
new file mode 100644
index 00000000..f21c2ea9
--- /dev/null
+++ b/Assets/Configs/GB/GoogleService-Info.plist
@@ -0,0 +1,34 @@
+
+
+
+
+ CLIENT_ID
+ 550052975381-e0rjfq35fj8lhvs9707robckba6rl5ck.apps.googleusercontent.com
+ REVERSED_CLIENT_ID
+ com.googleusercontent.apps.550052975381-e0rjfq35fj8lhvs9707robckba6rl5ck
+ API_KEY
+ AIzaSyDeCg8CaAcWNVXeTLG88PK36x2ddfI2IMY
+ GCM_SENDER_ID
+ 550052975381
+ PLIST_VERSION
+ 1
+ BUNDLE_ID
+ com.toukagames.drawmonster.global
+ PROJECT_ID
+ draw-monster-gp
+ STORAGE_BUCKET
+ draw-monster-gp.appspot.com
+ IS_ADS_ENABLED
+
+ IS_ANALYTICS_ENABLED
+
+ IS_APPINVITE_ENABLED
+
+ IS_GCM_ENABLED
+
+ IS_SIGNIN_ENABLED
+
+ GOOGLE_APP_ID
+ 1:550052975381:ios:953d8682ba9591a21ccf1c
+
+
\ No newline at end of file
diff --git a/Assets/Configs/GB/GoogleService-Info.plist.meta b/Assets/Configs/GB/GoogleService-Info.plist.meta
new file mode 100644
index 00000000..f5f4bdb4
--- /dev/null
+++ b/Assets/Configs/GB/GoogleService-Info.plist.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ffbe7a922389948798d5db8836d43e81
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/google-services.json b/Assets/Configs/GB/google-services.json
new file mode 100644
index 00000000..f799e550
--- /dev/null
+++ b/Assets/Configs/GB/google-services.json
@@ -0,0 +1,46 @@
+{
+ "project_info": {
+ "project_number": "928037420955",
+ "project_id": "color-picker-aa5af",
+ "storage_bucket": "color-picker-aa5af.appspot.com"
+ },
+ "client": [
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:928037420955:android:3e76e423015d16eb092b3e",
+ "android_client_info": {
+ "package_name": "com.hotpotgames.colorpicker.global"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "928037420955-qdl2k3kroi8ob6jof00eb48gee1b72uc.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyBqL7EH2e7aiizE_b209e4L2O4lzpEkTGs"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "928037420955-qdl2k3kroi8ob6jof00eb48gee1b72uc.apps.googleusercontent.com",
+ "client_type": 3
+ },
+ {
+ "client_id": "928037420955-muritipbg7cqk6t5n9pvf8pc38u6o9qt.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "com.hotpotgames.colorpicker.global"
+ }
+ }
+ ]
+ }
+ }
+ }
+ ],
+ "configuration_version": "1"
+}
\ No newline at end of file
diff --git a/Assets/Configs/GB/google-services.json.meta b/Assets/Configs/GB/google-services.json.meta
new file mode 100644
index 00000000..ce3b7c55
--- /dev/null
+++ b/Assets/Configs/GB/google-services.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1fb6bdfbd377c49a0850fcf743aaced1
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/tkg_config.plist b/Assets/Configs/GB/tkg_config.plist
new file mode 100644
index 00000000..8059b308
--- /dev/null
+++ b/Assets/Configs/GB/tkg_config.plist
@@ -0,0 +1,150 @@
+
+
+
+
+ lock_screen
+ on
+ tenjin_api_key
+ PYOTVKJ4XZJHSMZW2V6GBQRCNXAFKWU2
+ rn_app_key
+
+ file
+
+ tka_theme
+
+ ad_sk_interstital_id
+
+ fb_client_token
+
+ package_name
+ com.toukagames.drawmonster.global
+ updatetime
+ 2022/06/23 15:00:52
+ usb
+ on
+ adjust_id
+
+ fb_download_url
+
+ td_channel_id
+ default
+ firebase_name
+ GoogleService-Info.plist
+ game_screen_orientation
+ 0
+ main_activity
+ com.u8.sdk.U8UnityContext
+ admob_id
+ ca-app-pub-3916046151571724~7731238444
+ channel
+ AppStore_GB
+ tka_url_privacy
+ https://www.mooncakegame.com/privacy.html
+ um_app_key
+ 6192079de014255fcb7975f6
+ tw_txt
+ {"m-native_sdk":"","lock_screen":"on","fs":"3","m-interaction_sdk":"","wifi_interval":"30","td_app_id":"","m-banner":"b779308d2f67c37d","usb":"on","unlock":"on","citys":"北京,上海,广州,深圳,东莞,香港,澳门,武汉,阿里云,腾讯云,华为云","td_channel_id":"default","m-splash_sdk":"","unlock_next":"1","wifi":"on","pp":"30","m-splash":"","m-interaction":"babddc80a2651057","m-app_key":"QVt-ZBOR44Frm2Ub8gEfbPo-K8SeKHvyzoq-TJ3op08cFx29THV9DviWinxrQBxNePGKU14gHOkClTrNOi_1a9","unlock_style":"2","unlock_interval":"2","m-reward":"ddb2dd36ec0f5a85","m-app_id":"","m-native":"","bg_pop":"on"}
+ unlock_next
+ 1
+ ad_banner_id
+ e40df8ef364c384a
+ platform
+ ios
+ copyright_id
+
+ copyright_holder
+
+ publisher_url_scheme
+
+ app_name
+ TKGSDKDemo
+ bugly_appid
+
+ offer_id
+
+ ga_secretkey
+ 4b77151cfd17032cfbe13c6c7287d7a86b5c32f9
+ unlock_interval
+ 2
+ fb_appid
+
+ ad_interstital_half_id
+
+ ad_native_banner_id
+
+ tk_app_id
+
+ ad_native_splash_id
+
+ bg_pop
+ on
+ bugly_appkey
+
+ firebase_path
+ https://my-report.oss-cn-beijing.aliyuncs.com/icon/2022/06/23/5c91a28aac0543d1afcb1f1e92946cce.plist
+ fs
+ 3
+ ad_appkey
+ QVt-ZBOR44Frm2Ub8gEfbPo-K8SeKHvyzoq-TJ3op08cFx29THV9DviWinxrQBxNePGKU14gHOkClTrNOi_1a9
+ wifi_interval
+ 30
+ tka_url_agreement
+ https://www.mooncakegame.com/agreements.html
+ ad_templete_natvie_id
+
+ td_app_id
+
+ tka_age
+ 12
+ ad_full_reward_id
+
+ tka_type
+
+ splash_img
+
+ channel_appkey
+
+ unlock
+ on
+ ad_interstital_id
+ 8eb8a28145e1be9b
+ citys
+ 北京,上海,广州,深圳,东莞,香港,澳门,武汉,阿里云,腾讯云,华为云
+ publisher_appid
+
+ ad_splash_id
+ b62b1434a10b0f
+ baidumobad_app_id
+
+ channel_appsecret
+
+ ad_appid
+ a62b1432a7272e@c13e4357e57d78e76e472899eb182e98
+ ad_sk_native1_id
+
+ publish_account
+ Mooncake Games Limited
+ channel_appid
+
+ ad_render_native_id
+ 18dd15e1c2504e58
+ wifi
+ on
+ pp
+ 30
+ ad_reward_id
+ 4e99071ebf834bdd
+ ad_sk_native_id
+
+ tka_url_moregame
+ https://apps.apple.com/developer/id1521253916
+ unlock_style
+ 2
+ ga_key
+ c21c63a29900d500b4490ad307a041be
+ ad_sk_splash_id
+
+ ad_platform
+ max
+
+
diff --git a/Assets/Configs/GB/tkg_config.plist.meta b/Assets/Configs/GB/tkg_config.plist.meta
new file mode 100644
index 00000000..354e4991
--- /dev/null
+++ b/Assets/Configs/GB/tkg_config.plist.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: d1f5e5143e4534ac8be4868699969557
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/tkg_config.properties b/Assets/Configs/GB/tkg_config.properties
new file mode 100644
index 00000000..851901e3
--- /dev/null
+++ b/Assets/Configs/GB/tkg_config.properties
@@ -0,0 +1,156 @@
+
+#=================基础配置=============================
+#游戏名称
+app_name=Color Picker
+#包名
+package_name=com.hotpotgames.colorpicker.global
+#闪屏图(&健康提示),值:图片名字,没有填"",详见需求文档(- 新增splash图 部分):https://pic6ktmsyi.feishu.cn/docs/doccnRdYblZyPN2HpIK6nsJmqSb#
+splash_img=
+#游戏横竖屏,根据游戏横竖屏取值 值: 0 竖屏, 1 横屏
+game_screen_orientation=0
+#发行主体
+publish_account=Hotpotgames
+
+#渠道
+channel=GooglePlay
+#子渠道
+sub_channel=""
+#客户端协议上报u8 appid
+tk_app_id=8145
+
+#外部测试使用facebook id
+fb_appid=
+fb_client_token=
+#adjust_id{}
+adjust_id=
+#巨量app id
+rangers_applog_id={rangers_applog_id}
+#发行人app id
+publisher_appid=
+publisher_url_scheme=
+#游戏软著著作人
+copyright_holder=
+#游戏软著登记号
+copyright_id=
+
+#调试模式(写死不动,仅供调试使用)
+#debug_mode=false
+
+
+#=================用户协议(弹窗)配置=============================
+#游戏类型
+TkA_Type=
+#游戏题材
+TkA_Theme=
+#适龄,取值:8|12|16|18
+TkA_Age=8
+#隐私政策url
+TkA_Url_Privacy=https://www.hotpotgame.com/privacy.html
+#用户协议url
+TkA_Url_Agreement=
+
+#=================广告通用配置=============================
+#广告平台,max|topon|xiaomi
+ad_platform=max
+
+#广告appid (包括max applovin.sdk.key)
+ad_appid=
+#广告appkey
+ad_appkey=QVt-ZBOR44Frm2Ub8gEfbPo-K8SeKHvyzoq-TJ3op08cFx29THV9DviWinxrQBxNePGKU14gHOkClTrNOi_1a9
+#admob id
+admob_id=ca-app-pub-3916046151571724~8722834992
+
+
+#开屏广告位id
+ad_splash_id=
+ad_native_splash_id=
+#插屏广告位id
+ad_interstital_id=152b72ba25982c79
+#半屏插屏广告位id(小米广告区分全/半屏)
+ad_interstital_half_id=
+#激励视频广告位id
+ad_reward_id=f8d4cdbd7aa2cc51
+#banner广告位id
+ad_banner_id=6cb3712e367507ee
+ad_native_banner_id=
+# 原生模板广告位id [增加]
+ad_templete_natvie_id=
+
+# 原生自渲染广告位id [增加]
+ad_render_native_id=
+
+
+#=================TW配置=============================
+#[TODO][meta-data]百度 APPID
+BaiduMobAd_APP_ID=
+
+#副包下载链接
+FB_DOWNLOAD_URL=
+FB_POP_CONFIG_DAT_URL=
+#更多游戏链接
+tka_url_moregame=https://play.google.com/store/apps/developer?id=Hotpot+Games
+
+#TW广告位
+#SDK插屏
+ad_sk_interstital_id=
+#SDK开屏
+ad_sk_splash_id=
+#SDK信息流
+ad_sk_native_id=
+#SDK信息流1
+ad_sk_native1_id=
+
+#[TODO][meta-data]游戏主 Activity:
+#取值 Unity游戏: com.u8.sdk.U8UnityContext
+#flash游戏: com.u8.sdk.ane.U8ANEActivity
+#Cocos游戏: com.u8.sdk.U8CocosActivity
+MAIN_ACTIVITY=com.u8.sdk.U8UnityContext
+
+#极光 AppKey,默认空
+JPUSH_APPKEY=""
+
+
+#客服邮箱
+tkg_custom=dev@hotpotgame.com
+channel_appid=
+channel_appkey=
+channel_appsecret=
+
+
+#=================Bugly=============================
+Bugly_AppID=
+Bugly_AppKey=
+
+
+#=================YSDK实名认证=============================
+#[TODO][ysdkconf.ini]腾讯AppID
+OFFER_ID=
+
+
+#=================Umeng配置=============================
+#UM Appkey
+UM_APP_KEY=62c3f8b088ccdf4b7ebc5f74
+#json 参数 key
+JSON_PARAM_KEY=""
+#[TODO][文件类型参数]默认 (在线) 参数配置
+UMENG_DEFAULT_ONLINE_CONFIG=""
+
+#=================GA配置=============================
+#GA AppKey
+GA_KEY=5342eefde8d625ce060d9ec732c5bad9
+#GA AppSecret
+GA_SECRETKEY=0525bec7657873780b90f028910e773a8bbdbc24
+
+#=================热云配置=============================
+#AppKey
+RN_APP_KEY=
+
+#=================Tenjin配置=============================
+#Tenjin ApiKey
+TENJIN_API_KEY=PYOTVKJ4XZJHSMZW2V6GBQRCNXAFKWU2
+
+#=================Firebase配置=============================
+#[TODO][文件类型参数]google-services.json文件
+google_services_json=""
+
+{remark}
\ No newline at end of file
diff --git a/Assets/Configs/GB/tkg_config.properties.meta b/Assets/Configs/GB/tkg_config.properties.meta
new file mode 100644
index 00000000..b6280368
--- /dev/null
+++ b/Assets/Configs/GB/tkg_config.properties.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a34958c8e642f462f8d9c6f3e8808232
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/tkg_sdk_config.ini b/Assets/Configs/GB/tkg_sdk_config.ini
new file mode 100644
index 00000000..57c956f4
--- /dev/null
+++ b/Assets/Configs/GB/tkg_sdk_config.ini
@@ -0,0 +1,70 @@
+TKG_ENABLE_LOG = false
+
+
+#***********副包配置***********
+#副包下载地址,目前所有游戏使用同一个副包,此链接不需要修改
+FB_DOWNLOAD_URL = http://p2-yx.adkwai.com/udata/pkg/DSP-EFFECT/apk/36e063f5-9473-4064-b99f-8686bcc427e6.apk
+#是否在wifi状态下提前预下载副包apk
+FB_PREDOWNLOAD_IN_WIFI = false
+
+#云控弹窗配置链接(* 每个游戏需要单独配置),留空则使用留包配置
+#FB_POP_CONFIG_DAT_URL = https://my-report.oss-cn-beijing.aliyuncs.com/config/pops-com.zlsz.basketdash.global.dat
+
+#锁屏广告类型 0:信息流 1:百度资讯 此处设置会被弹窗配置文件(pop-包名.dat)设置覆盖
+DEFAULT_LOCK_SCREEN_TYPE = 0
+#弹窗库日志打印开关
+POPLIB_LOG_ENABLE = false
+
+#延迟多久弹出副包悬浮按钮,单位毫秒(可根据游戏加载时长设置,一般进入游戏正式画面再显示)
+SHOW_FB_UI_DELAY = 5000
+#自动弹出副包安装提示弹窗时,延迟多久弹出,单位毫秒(可根据游戏加载时长设置,一般进入游戏正式画面再显示)
+AUTO_SHOW_FB_DIALOG_DELAY = 10000
+
+
+#激活上报比例,取值0-100
+ANALYTICS_RATIO = 100
+
+#统计激活(初始化)时机
+# 打开游戏时 :0
+# 实名认证之后 :1
+# 展示了一次插屏广告 :3
+# 广告展示收入达标 :5 (设置这个值需要同时设置ANALYTICS_INIT_REVENUE的取值)
+ANALYTICS_INIT_TIME = 0
+#广告收入达到多少才初始化,值: 0.005
+ANALYTICS_INIT_REVENUE = 0
+#展示广告x次数之后初始化统计SDK
+ANALYTICS_SHOW_AD_NUMBER = 1
+
+#插屏广告弹出规则 值json: [{"type":0,"overLevel":0,"interval":30,"skipLevel":1},{"type":1,"overLevel":0,"interval":30,"skipLevel":1}]
+INTER_AD_RULES = [{"type":"0","overLevel":"0","interval":"10","skipLevel":"1"}]
+#自动插屏规则 值json: SDK默认值: {"open":false,"interval":30,"skipLevel":1}
+AUTO_INTER_AD_RULES= {"open":false,"interval":"30","skipLevel":"-1"}
+
+#新增当天游戏通关数,一个用户上报一次,X支持在线参数配置,默认值15
+NewUserPassLevel = 15
+#新增当天视频广告播放次数超过X次,则上报,一个用户上报一次,X支持在线参数配置,默认值15
+NewUserAdsCount = 15
+
+#用户任意类型广告(包括游戏内及TW所有广告类型)ecpm达到X则上报
+NewUserEcpm = 3
+#当插屏ecpm达到X则上报,包括TW插屏
+NewUserIvEcpm = 3
+#当激励视频ecpm达到X则上报
+NewUserRvEcpm = 4
+#插屏+激励视频(包括TW),成功展示X次则上报。
+NewUserPvCount = 18
+
+#用户任意类型广告ecpm达到X且用户时长达到Y则上报。时长(NewUserTime)是当日多次登陆累计时间
+NewUserTimeEcpm = 3
+#时间,单位秒
+NewUserTime = 600
+
+#用户收益达到X则上报
+NewUserAdsArpu = 0.05
+
+nativeStatus = 0
+bannerStatus = 1
+tkgshowauthview = 0
+nativeTemplatesType = 3
+
+{remark}
\ No newline at end of file
diff --git a/Assets/Configs/GB/tkg_sdk_config.ini.meta b/Assets/Configs/GB/tkg_sdk_config.ini.meta
new file mode 100644
index 00000000..de2f3b13
--- /dev/null
+++ b/Assets/Configs/GB/tkg_sdk_config.ini.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c3855640365d742e1a7af4a90cfb0aae
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Configs/GB/tkg_sdk_config.plist b/Assets/Configs/GB/tkg_sdk_config.plist
new file mode 100644
index 00000000..51553fd0
--- /dev/null
+++ b/Assets/Configs/GB/tkg_sdk_config.plist
@@ -0,0 +1,62 @@
+
+
+
+
+ auto_inter_ad_rules
+ {"open":false,"interval":"30","skipLevel":"-1"}
+ analytics_init_time
+ 0
+ show_fb_ui_delay
+ 5000
+ analytics_ratio
+ 100
+ skiplevel
+ -1
+ newusertime
+ 600
+ newuseradscount
+ 15
+ config_id
+ 77
+ analytics_show_ad_number
+ 1
+ tkg_enable_log
+ false
+ inter_ad_rules
+ [{"type":"0","overLevel":"0","interval":"10","skipLevel":"1"}]
+ poplib_log_enable
+ false
+ newuseradsarpu
+ 0.05
+ newuserecpm
+ 3
+ newuserrvecpm
+ 4
+ nativestatus
+ 1
+ type
+ 0
+ newuserpvcount
+ 2
+ overlevel
+ 0
+ interval
+ 30
+ default_lock_screen_type
+ 0
+ newuserpasslevel
+ 2
+ newuserivecpm
+ 3
+ analytics_init_revenue
+ 0
+ newusertimeecpm
+ 3
+ auto_show_fb_dialog_delay
+ 10000
+ bannerstatus
+ 1
+ fb_predownload_in_wifi
+ false
+
+
diff --git a/Assets/Configs/GB/tkg_sdk_config.plist.meta b/Assets/Configs/GB/tkg_sdk_config.plist.meta
new file mode 100644
index 00000000..4703a725
--- /dev/null
+++ b/Assets/Configs/GB/tkg_sdk_config.plist.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 542de8af1871448e8b21feae752cab29
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/Resources/BillingMode.json b/Assets/Resources/BillingMode.json
new file mode 100644
index 00000000..6f4bfb71
--- /dev/null
+++ b/Assets/Resources/BillingMode.json
@@ -0,0 +1 @@
+{"androidStore":"GooglePlay"}
\ No newline at end of file
diff --git a/Assets/Resources/BillingMode.json.meta b/Assets/Resources/BillingMode.json.meta
new file mode 100644
index 00000000..da85b565
--- /dev/null
+++ b/Assets/Resources/BillingMode.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0fad6ce3e5a5840a79c4ecabc5ec0ad8
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK.meta b/Assets/TKGSDK.meta
new file mode 100644
index 00000000..6da95845
--- /dev/null
+++ b/Assets/TKGSDK.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 280bc1f07de0b47dca18f2c1ae47b020
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common.meta b/Assets/TKGSDK/Common.meta
new file mode 100644
index 00000000..e1d35bdd
--- /dev/null
+++ b/Assets/TKGSDK/Common.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d593d4318dbe74bc596a591549ee75d5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/GameInterface.meta b/Assets/TKGSDK/Common/GameInterface.meta
new file mode 100644
index 00000000..722c0937
--- /dev/null
+++ b/Assets/TKGSDK/Common/GameInterface.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 0382ea99170c4407c9567e7943eeb050
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs
new file mode 100644
index 00000000..2cac3aa4
--- /dev/null
+++ b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs
@@ -0,0 +1,602 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Touka;
+
+public class TKGSDKManager : TKGSingleton
+{
+ public bool IsNoAllAD
+ {
+ get => mIsNoAllAD;
+ set
+ {
+ mIsNoAllAD = value;
+ if (mIsNoAllAD)
+ {
+ PurchasedRemoveAds();
+ HideBanner();
+ }
+ }
+ }
+ private bool mIsNoAllAD = false;
+
+ public bool IsRemoveAds
+ {
+ get => mIsRemoveAds;
+ set
+ {
+ mIsRemoveAds = value;
+ if (mIsRemoveAds)
+ {
+ PurchasedRemoveAds();
+ HideBanner();
+ }
+ }
+ }
+ private bool mIsRemoveAds = false;
+
+ public bool IsIAPEnabled
+ {
+ get
+ {
+ AppChannel tChannel = GetChannel();
+ return (tChannel == AppChannel.AppStore_GB || tChannel == AppChannel.GooglePlay);
+ }
+ }
+
+ private int mLoginCount
+ {
+ get => PlayerPrefs.GetInt(nameof(mLoginCount), 0);
+ set => PlayerPrefs.SetInt(nameof(mLoginCount), value);
+ }
+
+ private int mPassCount
+ {
+ get => PlayerPrefs.GetInt(nameof(mPassCount), 0);
+ set => PlayerPrefs.SetInt(nameof(mPassCount), value);
+ }
+
+ private bool mHasPoppedReview
+ {
+ get => PlayerPrefs.GetInt(nameof(mHasPoppedReview), 0) == 1;
+ set => PlayerPrefs.SetInt(nameof(mHasPoppedReview), value ? 1 : 0);
+ }
+
+ private bool isInit = false;
+
+ private ITKGSDK m_sdkInterface;
+
+ protected override void OnInstanceCreate()
+ {
+ base.OnInstanceCreate();
+
+ m_sdkInterface = new TKGSDKNative();
+ }
+
+ ///
+ /// init sdk
+ ///
+ ///
+ public void InitSDK(Action _initCallback = null)
+ {
+ if (isInit) return;
+
+ m_sdkInterface.InitSDK(_initCallback);
+ isInit = true;
+ mLoginCount++;
+
+ if (IsIAPEnabled)
+ {
+#if USE_IAP
+ IAPTool.Instance.Initialize();
+#endif
+ }
+ }
+
+ ///
+ /// Set game focus
+ ///
+ ///
+ public void SetGameFocusListener(Action _gameFocusAction)
+ {
+ m_sdkInterface.SetGameFocusListener(_gameFocusAction);
+ }
+
+ // reward click callback
+ public void SetRewardClickListener(Action _clickCallback = null)
+ {
+ m_sdkInterface.SetRewardClickListener(_clickCallback);
+ }
+
+ ///
+ /// Get channel
+ ///
+ ///
+ public AppChannel GetChannel()
+ {
+ return m_sdkInterface.GetChannel();
+ }
+
+ ///
+ /// Set log enable
+ ///
+ public void SetLogEnable(bool _enable)
+ {
+ StaticOtherConfig.IsDebugLog = _enable;
+ m_sdkInterface.SetLogEnable(_enable);
+ }
+
+ #region Ads
+ // 去广告接口调用
+ public void PurchasedRemoveAds()
+ {
+ m_sdkInterface.PurchasedRemoveAds();
+ }
+ ///
+ /// Show Interstitial Ad
+ ///
+ /// Name of interstitial ad placement.
+ /// Callback of interstitial ad close and show interstitial failed
+ /// IVADType for distinguish interstitial ads frequency, default use iv1
+ public void ShowInterstitialAd(TKGIVAdPositionName _adPos, Action _callback = null, IVADType _IvType = IVADType.IV1)
+ {
+#if UNITY_EDITOR || NO_AD
+ if (null != _callback)
+ {
+ Debug.Log("Need Show IV, in editor directly invoke callback.");
+ _callback.Invoke();
+ }
+ return;
+
+#endif
+ if (IsNoAllAD || IsRemoveAds)
+ {
+ _callback?.Invoke();
+ }
+ else
+ {
+ m_sdkInterface.ShowInterstitialAd(_adPos, _callback, _IvType);
+ }
+ }
+
+ ///
+ /// Show Reward Ad
+ ///
+ /// Name of reward ad placement
+ /// true:reward succ, false: reward failed
+ /// Callback of reward ad show fail
+ public void ShowRewardAd(TKGRVPositionName _adPos, Action _rewardCallback = null, Action _showFailedCallback = null)
+ {
+#if UNITY_EDITOR || NO_AD
+ if (null != _rewardCallback)
+ {
+ _rewardCallback.Invoke(true);
+ }
+ return;
+#endif
+
+ if (IsNoAllAD)
+ {
+ _rewardCallback?.Invoke(true);
+ }
+ else
+ {
+ m_sdkInterface.ShowRewardAd(_adPos, _rewardCallback, _showFailedCallback);
+ }
+ }
+
+ public void ShowNative(RectTransform pRect, Camera pCam = null, string pAdPos = "")
+ {
+#if !NO_AD
+ if (!IsNoAllAD && !IsRemoveAds)
+ {
+ m_sdkInterface.ShowNativeAd(pRect, pCam, pAdPos);
+ }
+#endif
+ }
+
+ ///
+ /// Is Ready Interstitial
+ ///
+ ///
+ public bool IsReadyInterstitialAd()
+ {
+
+ return m_sdkInterface.IsReadyInterstitialAd();
+
+ }
+
+ ///
+ /// Is Ready Reward
+ ///
+ ///
+ public bool IsReadyRewardAd()
+ {
+ return m_sdkInterface.IsReadyRewardAd();
+ }
+
+ ///
+ /// Is Ready Native Ad
+ ///
+ ///
+ public bool IsReadyNativeAd()
+ {
+#if NO_AD
+ return false;
+#else
+ return m_sdkInterface.IsReadyNativeAd();
+#endif
+ }
+
+ ///
+ /// Show banner
+ ///
+ /// bannerAlign
+ public void ShowBanner(TKGBannerAlign _bannerAlign)
+ {
+#if !NO_AD
+ if (!IsNoAllAD && !IsRemoveAds)
+ {
+ m_sdkInterface.ShowBanner(_bannerAlign);
+ }
+#endif
+ }
+
+ ///
+ /// Hide banner
+ ///
+ public void HideBanner()
+ {
+ m_sdkInterface.HideBanner();
+ }
+
+
+ ///
+ /// Remove Native
+ ///
+ public void RemoveNative()
+ {
+ m_sdkInterface.RemoveNativeAd();
+ }
+
+#endregion
+
+#region Log Event
+
+#region Normal
+
+ ///
+ /// Log Event
+ ///
+ ///
+ public void LogEvent(string _eventSort)
+ {
+ m_sdkInterface.LogEvent(_eventSort);
+
+ }
+
+ ///
+ /// Log Event
+ ///
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, string _key, string _value)
+ {
+ m_sdkInterface.LogEvent(_eventSort, _key, _value);
+ }
+
+ ///
+ /// Log Event
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, string _key01, string _value01, string _key02, string _value02)
+ {
+ m_sdkInterface.LogEvent(_eventSort, _key01, _value01, _key02, _value02);
+ }
+
+ ///
+ /// Log Event
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, Dictionary _eventDic = null)
+ {
+ m_sdkInterface.LogEvent(_eventSort, _eventDic);
+ }
+
+#endregion
+
+#region Level Event
+
+ ///
+ /// Level start
+ ///
+ ///
+ public void LevelStart(int _level)
+ {
+ LevelStart(_level.ToString());
+ }
+
+ ///
+ /// Level start
+ ///
+ ///
+ public void LevelStart(string _level)
+ {
+ m_sdkInterface.LevelStart(_level);
+ }
+
+ ///
+ /// Level end
+ ///
+ ///
+ ///
+ public bool LevelEnd(int _level, StageResult _stageResult)
+ {
+ return LevelEnd(_level.ToString(), _stageResult);
+ }
+
+ ///
+ /// Level end,if return false, it means review pops up.
+ ///
+ ///
+ ///
+ public bool LevelEnd(string _level, StageResult _stageResult)
+ {
+ m_sdkInterface.LevelEnd(_level, _stageResult);
+
+ if (_stageResult == StageResult.StageSucc)
+ {
+ mPassCount++;
+#if UNITY_IOS//only ios has review popup
+ return !CheckReviewPop(mPassCount);
+#endif
+ }
+
+ return true;
+ }
+
+ private bool CheckReviewPop(int pLevel)
+ {
+ if (mHasPoppedReview)
+ return false;
+
+ if (mLoginCount == 1 && pLevel == StaticOtherConfig.FirstLoginPopLevel)
+ {
+ Debug.Log("pop first review");
+ mHasPoppedReview = true;
+ Review();
+
+ return true;
+ }
+ else if (mLoginCount > 1 && pLevel == StaticOtherConfig.OtherLoginPopLevel)
+ {
+ Debug.Log("pop other review");
+ mHasPoppedReview = true;
+ Review();
+
+ return true;
+ }
+
+ return false;
+ }
+#endregion
+
+#region Reward Ad Button Show
+
+ ///
+ /// Log Reward ad button show
+ ///
+ ///
+ public void LogRewardAdBtnShow(string _pos)
+ {
+ m_sdkInterface.LogRewardAdBtnShow(_pos);
+ }
+
+#endregion
+
+#region Tracking Event
+
+ ///
+ /// Log Tracking Event
+ ///
+ ///
+ private void LogTrackingEvent(TrackingEventType _eventType)
+ {
+ //m_sdkInterface.LogTrackingEvent(_eventType);
+ }
+
+#endregion
+
+#endregion
+
+#region Online Config
+
+ ///
+ /// get config - string
+ ///
+ ///
+ ///
+ public string GetConfigStr(TKGParamKey _key)
+ {
+
+ return m_sdkInterface.GetConfigStr(_key.ToString());
+ }
+
+ ///
+ /// get config - int
+ ///
+ ///
+ ///
+ public int GetConfigInt(TKGParamKey _key)
+ {
+
+ return m_sdkInterface.GetConfigInt(_key.ToString());
+ }
+
+
+ ///
+ /// get config - bool
+ ///
+ ///
+ ///
+ public bool GetConfigBool(TKGParamKey _key)
+ {
+ return m_sdkInterface.GetConfigBool(_key.ToString());
+ }
+
+#endregion
+
+#region Others (common)
+
+ ///
+ /// review
+ ///
+ public void Review()
+ {
+ m_sdkInterface.Review();
+ }
+
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+ ///
+ /// open privacy url
+ ///
+ //public void OpenPrivacyURL()
+ //{
+ // m_sdkInterface.OpenPrivacyURL();
+ //}
+
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+ /// 使用 OpenPolicyPop 接口 === Use OpenPolicyPop
+
+ ///
+ /// open user agreement url
+ ///
+ //public void OpenUserTermURL()
+ //{
+ // m_sdkInterface.OpenUserTermURL();
+ //}
+
+ ///
+ /// open more game
+ ///
+ public void OpenMoreGame()
+ {
+ m_sdkInterface.OpenMoreGame();
+ }
+
+ ///
+ /// open url by browser
+ ///
+ ///
+ public void OpenUrlByBrowser(string _url)
+ {
+ m_sdkInterface.OpenUrlByBrowser(_url);
+ }
+
+ public void OpenPolicyPop()
+ {
+ m_sdkInterface.OpenPolicyPop();
+ }
+
+ ///
+ /// shake
+ ///
+ /// 0 light,1 medium,2 heavy
+ /// ios 0~1, android any num
+ public void Shake(int _shakeType, float _intensity = 1)
+ {
+ m_sdkInterface.Shake(_shakeType, _intensity);
+ }
+
+ ///
+ /// share txt
+ ///
+ ///
+ public void Share(string shareText)
+ {
+ m_sdkInterface.ShareTxt(shareText);
+ }
+
+ ///
+ /// regist APNS
+ ///
+ public void RegistAPNS()
+ {
+
+ m_sdkInterface.RegistAPNS();
+ }
+
+ ///
+ /// shake
+ ///
+ /// notification identifier
+ /// The body of the notification.
+ /// notify after the time interval. format:yyyy-MM-dd HH:mm:ss
+ /// The application badge number.
+ /// The title of the notification.
+ /// The subtitle of the notification.
+ public void RegistNotification(string notiId, string body, string fireDate, int badge = 1, string title = "", string subTitle = "")
+ {
+
+ m_sdkInterface.RegistNotification(notiId,body,fireDate,badge,title,subTitle);
+ }
+
+ ///
+ /// remove all notification
+ ///
+ public void RemoveAllNotifications()
+ {
+
+ m_sdkInterface.RemoveAllNotifications();
+ }
+
+ ///
+ /// remove notification by notification identifier
+ ///
+ /// notification identifier
+ public void RemoveNotification(string notiId)
+ {
+
+ m_sdkInterface.RemoveNotification(notiId);
+ }
+ #endregion
+
+ #region others
+
+ ///
+ /// Set user source listener
+ /// only call first can back source
+ ///
+ /// true : origin user,false : not origin user
+ public void SetUserSourceListener(Action _userSourceAction)
+ {
+ m_sdkInterface.SetUserSourceListener(_userSourceAction);
+ }
+
+ ///
+ /// set common callback
+ ///
+ ///
+ public void SetTKGCommonCallback(Action _commonCallbackAction)
+ {
+ m_sdkInterface.SetTKGCommonCallback(_commonCallbackAction);
+ }
+
+ #endregion
+
+ #region h5
+
+
+
+ #endregion
+}
\ No newline at end of file
diff --git a/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs.meta b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs.meta
new file mode 100644
index 00000000..d3198b9c
--- /dev/null
+++ b/Assets/TKGSDK/Common/GameInterface/TKGSDKManager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 76c8624dacb844b03bb8a32a7305348b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs b/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs
new file mode 100644
index 00000000..ecf31dcf
--- /dev/null
+++ b/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs
@@ -0,0 +1,164 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using Touka;
+
+public class TKGUtils
+{
+ ///
+ /// 是否首次触达某个事件
+ ///
+ ///
+ ///
+ public static bool IfFirstCheckPlayerPrefs(string _key)
+ {
+ var isFirstClick = GetPlayerPrefsIntByKey(_key) == 0;
+ SavePlayerPrefsIntByKeyValue(_key, 1);
+
+ return isFirstClick;
+ }
+
+ ///
+ /// 本地存int
+ ///
+ /// key 内部拼接了前缀:Touka_
+ ///
+ ///
+ ///
+ ///
+ public static int GetPlayerPrefsIntByKey(string _key, int _defaultValue = 0)
+ {
+ int value = PlayerPrefs.GetInt(string.Format("{0}{1}", TKGStringPlayerPrefs.TOUKA_PREFIX, _key), _defaultValue);
+ return value;
+ }
+
+ ///
+ /// 本地取int
+ ///
+ /// key 内部拼接了前缀:Touka_
+ ///
+ ///
+ ///
+ public static void SavePlayerPrefsIntByKeyValue(string _key, int _newValue)
+ {
+ PlayerPrefs.SetInt(string.Format("{0}{1}", TKGStringPlayerPrefs.TOUKA_PREFIX, _key), _newValue);
+ PlayerPrefs.Save();
+ }
+
+ ///
+ /// 本地存string
+ ///
+ /// key 内部拼接了前缀:Touka_
+ ///
+ ///
+ ///
+ ///
+ public static string GetPlayerPrefsStringByKey(string _key, string _defaultValue = "")
+ {
+ string value = PlayerPrefs.GetString(string.Format("{0}{1}", TKGStringPlayerPrefs.TOUKA_PREFIX, _key), _defaultValue);
+ return value;
+ }
+
+ ///
+ /// 本地取string
+ ///
+ /// key 内部拼接了前缀:Touka_
+ ///
+ ///
+ ///
+ public static void SavePlayerPrefsStringByKeyValue(string _key, string _newValue)
+ {
+ PlayerPrefs.SetString(string.Format("{0}{1}", TKGStringPlayerPrefs.TOUKA_PREFIX, _key), _newValue);
+ PlayerPrefs.Save();
+ }
+
+ ///
+ /// 缓存当前时间
+ ///
+ ///
+ public static void SaveCurrTime2PlayerPrefs(string _key)
+ {
+ DateTime date1 = DateTime.Now;
+ string s1 = date1.ToString();
+ SavePlayerPrefsStringByKeyValue(_key, s1);
+ }
+
+ ///
+ /// 缓存本地时间为string
+ ///
+ ///
+ ///
+ public static void SaveCurrTime2PlayerPrefsWithStringDate(string _key, string _dateStr)
+ {
+ SavePlayerPrefsStringByKeyValue(_key, _dateStr);
+ }
+
+ ///
+ /// 取出缓存string时间为 DateTime
+ ///
+ ///
+ ///
+ public static DateTime GetDateTimeFromPlayerPrefs(string _key)
+ {
+ string firstDateValue = GetPlayerPrefsStringByKey(_key);
+ if (string.IsNullOrEmpty(firstDateValue))
+ {
+ return new DateTime(1990, 1, 1, 0, 0, 0);
+ }
+ DateTime dateOld = Convert.ToDateTime(firstDateValue);
+ return dateOld;
+ }
+
+ ///
+ /// equal double
+ ///
+ ///
+ ///
+ ///
+ public static bool equalDouble(double a, double b)
+ {
+ if ((a - b > -0.000001) && (a - b) < 0.000001)
+ return true;
+ else
+ return false;
+ }
+
+ ///
+ /// Floats the equal.
+ ///
+ /// true, if equal was floated, false otherwise.
+ /// The alpha component.
+ /// The blue component.
+ public static bool FloatEqual(float a, float b)
+ {
+ if ((a - b > -0.000001) && (a - b) < 0.000001)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Get Today data str
+ ///
+ ///
+ public static string GetTodayDataStr()
+ {
+ string timeStr = DateTime.Now.ToString("yyyy-MM-dd");
+ return timeStr;
+ }
+
+ ///
+ /// Open Browser Url
+ ///
+ ///
+ public static void OpenBrowserUrl(string _url)
+ {
+ Application.OpenURL(_url);
+ }
+
+}
\ No newline at end of file
diff --git a/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs.meta b/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs.meta
new file mode 100644
index 00000000..f456b350
--- /dev/null
+++ b/Assets/TKGSDK/Common/GameInterface/TKGUtils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0c6bb316782354791a6df23332a4ee5e
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/SDKTools.meta b/Assets/TKGSDK/Common/SDKTools.meta
new file mode 100644
index 00000000..9597abdf
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6b84514263d4b4a8497e36e44442b7f5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/SDKTools/IAPTool.cs b/Assets/TKGSDK/Common/SDKTools/IAPTool.cs
new file mode 100644
index 00000000..0baf0bfa
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/IAPTool.cs
@@ -0,0 +1,365 @@
+#if USE_IAP
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Purchasing;
+using Touka;
+
+public class IAPTool : NormalSingleton, IStoreListener
+{
+ public event Action OnPurchaseBegin;
+ public event Action OnPurchaseDone;
+ public event Action OnRestoreDone;
+
+ public bool IsRestoring => mIsRestoring;
+ private bool mIsRestoring = false;
+
+ private static IStoreController m_StoreController; // 存储商品信息;
+ private static IExtensionProvider m_StoreExtensionProvider; // IAP扩展工具;
+ private bool m_PurchaseInProgress = false; // 是否处于付费中;
+
+ private Dictionary mInitProductDic;
+ private SubscriptionInfo mSubsInfo = null;
+
+ public void Initialize()
+ {
+ if (m_StoreController == null && m_StoreExtensionProvider == null)
+ InitUnityPurchase();
+ }
+
+ private bool IsInitialized()
+ {
+ return m_StoreController != null && m_StoreExtensionProvider != null;
+ }
+
+ public void AddProducts(Dictionary pInitProductDic)
+ {
+ mInitProductDic = pInitProductDic;
+ }
+
+ // 初始化IAP;
+ private void InitUnityPurchase()
+ {
+ if (IsInitialized()) return;
+
+ // 标准采购模块;
+ StandardPurchasingModule module = StandardPurchasingModule.Instance();
+
+ // 配置模式;
+ ConfigurationBuilder builder = ConfigurationBuilder.Instance(module);
+
+ // 注意ProductType的类型,Consumable是可以无限购买(比如水晶),NonConsumable是只能购买一次(比如关卡),Subscription是每月订阅(比如VIP);
+ // 这里初始化没有添加平台信息,因为平台信息有的时候还存在bug,如果必须添加,也可以添加,没有问题,确保平台信息添加正确就行了。
+
+ foreach (string tID in IAPProducts.ProductDic.Keys)
+ {
+ builder.AddProduct(tID, IAPProducts.ProductDic[tID]);
+ }
+
+ if (mInitProductDic != null && mInitProductDic.Count > 0)
+ {
+ foreach (string tID in mInitProductDic.Keys)
+ {
+ builder.AddProduct(tID, mInitProductDic[tID]);
+ }
+ }
+
+ //初始化;
+ UnityPurchasing.Initialize(this, builder);
+ }
+
+#region Public Func
+ // 根据ID给购买商品;
+ public void BuyProductByID(string productId)
+ {
+ if (IsInitialized())
+ {
+ if (m_PurchaseInProgress == true) return;
+
+ Product product = m_StoreController.products.WithID(productId);
+ if (product != null && product.availableToPurchase)
+ {
+ OnPurchaseBegin?.Invoke();
+ m_PurchaseInProgress = true;
+ TKGDebugger.LogDebug(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
+ m_StoreController.InitiatePurchase(product);
+ }
+ else
+ {
+ TKGDebugger.LogDebug("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
+ }
+ }
+ else
+ {
+ TKGDebugger.LogDebug("BuyProductID FAIL. Not initialized.");
+ }
+ }
+
+ // 确认购买产品成功;
+ public void DoConfirmPendingPurchaseByID(string productId)
+ {
+ Product product = m_StoreController.products.WithID(productId);
+ if (product != null && product.availableToPurchase)
+ {
+ if (m_PurchaseInProgress)
+ {
+ m_StoreController.ConfirmPendingPurchase(product);
+ m_PurchaseInProgress = false;
+ }
+ }
+ }
+
+ // 恢复购买;
+ public void RestorePurchases()
+ {
+ if (!IsInitialized())
+ {
+ OnRestoreDone?.Invoke(false);
+ TKGDebugger.LogDebug("RestorePurchases FAIL. Not initialized.");
+ return;
+ }
+ if (Application.platform == RuntimePlatform.IPhonePlayer ||
+ Application.platform == RuntimePlatform.OSXPlayer)
+ {
+ TKGDebugger.LogDebug("RestorePurchases started ...");
+ mIsRestoring = true;
+ var apple = m_StoreExtensionProvider.GetExtension();
+ apple.RestoreTransactions((result) => {
+ mIsRestoring = false;
+ OnRestoreDone?.Invoke(result);
+ // 返回一个bool值,如果成功,则会多次调用支付回调,然后根据支付回调中的参数得到商品id,最后做处理(ProcessPurchase);
+ TKGDebugger.LogDebug("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
+ });
+ }
+ else
+ {
+ TKGDebugger.LogDebug("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
+ }
+ }
+#endregion
+
+#region IStoreListener Callback
+ // IAP初始化成功回掉函数;
+ public void OnInitialized(IStoreController controller, IExtensionProvider extensions)
+ {
+ TKGDebugger.LogDebug("IAP initialize Succeed!");
+
+ m_StoreController = controller;
+ m_StoreExtensionProvider = extensions;
+
+ // 这里可以获取您在AppStore和Google Play 上配置的商品;
+ ProductCollection products = m_StoreController.products;
+ Product[] all = products.all;
+ for (int i = 0; i < all.Length; i++)
+ {
+ TKGDebugger.LogDebug(all[i].metadata.localizedTitle + "|" + all[i].metadata.localizedPriceString + "|" + all[i].metadata.localizedDescription + "|" + all[i].metadata.isoCurrencyCode);
+ }
+
+#if UNITY_IOS
+ m_StoreExtensionProvider.GetExtension().RegisterPurchaseDeferredListener(OnDeferred);
+#endif
+
+/*
+ Dictionary introductory_info_dict = null;
+
+#if UNITY_IOS
+ introductory_info_dict = m_StoreExtensionProvider.GetExtension().GetIntroductoryPriceDictionary();
+#endif
+
+ TKGDebugger.LogDebug("IAP - Available items:");
+ foreach (var item in controller.products.all)
+ {
+ if (item.availableToPurchase)
+ {
+ TKGDebugger.LogDebug("IAP - " + string.Join(" - ",
+ new[]
+ {
+ item.metadata.localizedTitle,
+ item.metadata.localizedDescription,
+ item.metadata.isoCurrencyCode,
+ item.metadata.localizedPrice.ToString(),
+ item.metadata.localizedPriceString,
+ item.transactionID,
+ item.receipt
+ }));
+
+ // this is the usage of SubscriptionManager class
+ if (item.receipt != null)
+ {
+ if (item.definition.type == ProductType.Subscription)
+ {
+ if (CheckIfProductIsAvailableForSubscriptionManagerC(item.receipt))
+ {
+ string intro_json = (introductory_info_dict == null || !introductory_info_dict.ContainsKey(item.definition.storeSpecificId)) ? null : introductory_info_dict[item.definition.storeSpecificId];
+ SubscriptionManager p = new SubscriptionManager(item, intro_json);
+ SubscriptionInfo info = p.getSubscriptionInfo();
+ mSubsInfo = info;
+ TKGDebugger.LogDebug("product id is: " + info.getProductId());
+ TKGDebugger.LogDebug("purchase date is: " + info.getPurchaseDate());
+ TKGDebugger.LogDebug("subscription next billing date is: " + info.getExpireDate());
+ TKGDebugger.LogDebug("is subscribed? " + info.isSubscribed().ToString());
+ TKGDebugger.LogDebug("is expired? " + info.isExpired().ToString());
+ TKGDebugger.LogDebug("is cancelled? " + info.isCancelled());
+ TKGDebugger.LogDebug("product is in free trial peroid? " + info.isFreeTrial());
+ TKGDebugger.LogDebug("product is auto renewing? " + info.isAutoRenewing());
+ TKGDebugger.LogDebug("subscription remaining valid time until next billing date is: " + info.getRemainingTime());
+ TKGDebugger.LogDebug("is this product in introductory price period? " + info.isIntroductoryPricePeriod());
+ TKGDebugger.LogDebug("the product introductory localized price is: " + info.getIntroductoryPrice());
+ TKGDebugger.LogDebug("the product introductory price period is: " + info.getIntroductoryPricePeriod());
+ TKGDebugger.LogDebug("the number of product introductory price period cycles is: " + info.getIntroductoryPricePeriodCycles());
+ }
+ else
+ {
+ TKGDebugger.LogDebug("This product is not available for SubscriptionManager class, only products that are purchase by 1.19+ SDK can use this class.");
+ }
+ }
+ else
+ {
+ TKGDebugger.LogDebug("the product is not a subscription product");
+ }
+ }
+ else
+ {
+ TKGDebugger.LogDebug("the product should have a valid receipt");
+ }
+ }
+ }
+*/
+ }
+
+ // IAP初始化失败回掉函数(没有网络的情况下并不会调起,而是一直等到有网络连接再尝试初始化);
+ public void OnInitializeFailed(InitializationFailureReason error)
+ {
+ switch (error)
+ {
+ case InitializationFailureReason.AppNotKnown:
+ TKGDebugger.LogError("Is your App correctly uploaded on the relevant publisher console?");
+ break;
+ case InitializationFailureReason.PurchasingUnavailable:
+ TKGDebugger.LogDebug("Billing disabled! Ask the user if billing is disabled in device settings.");
+ break;
+ case InitializationFailureReason.NoProductsAvailable:
+ TKGDebugger.LogDebug("No products available for purchase! Developer configuration error; check product metadata!");
+ break;
+ }
+ }
+
+ private bool CheckIfProductIsAvailableForSubscriptionManagerC(string receipt)
+ {
+ var receipt_wrapper = (Dictionary)MiniJson.JsonDecode(receipt);
+ if (!receipt_wrapper.ContainsKey("Store") || !receipt_wrapper.ContainsKey("Payload"))
+ {
+ TKGDebugger.LogDebug("The product receipt does not contain enough information");
+ return false;
+ }
+ var store = (string)receipt_wrapper ["Store"];
+ var payload = (string)receipt_wrapper ["Payload"];
+
+ if (payload != null )
+ {
+ switch (store)
+ {
+ case GooglePlay.Name:
+ {
+ var payload_wrapper = (Dictionary)MiniJson.JsonDecode(payload);
+ if (!payload_wrapper.ContainsKey("json")) {
+ TKGDebugger.LogDebug("The product receipt does not contain enough information, the 'json' field is missing");
+ return false;
+ }
+ var original_json_payload_wrapper = (Dictionary)MiniJson.JsonDecode((string)payload_wrapper["json"]);
+ if (original_json_payload_wrapper == null || !original_json_payload_wrapper.ContainsKey("developerPayload")) {
+ TKGDebugger.LogDebug("The product receipt does not contain enough information, the 'developerPayload' field is missing");
+ return false;
+ }
+ var developerPayloadJSON = (string)original_json_payload_wrapper["developerPayload"];
+ var developerPayload_wrapper = (Dictionary)MiniJson.JsonDecode(developerPayloadJSON);
+ if (developerPayload_wrapper == null || !developerPayload_wrapper.ContainsKey("is_free_trial") || !developerPayload_wrapper.ContainsKey("has_introductory_price_trial")) {
+ TKGDebugger.LogDebug("The product receipt does not contain enough information, the product is not purchased using 1.19 or later");
+ return false;
+ }
+ return true;
+ }
+ case AppleAppStore.Name:
+ case AmazonApps.Name:
+ case MacAppStore.Name:
+ {
+ return true;
+ }
+ default:
+ {
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+ // 支付成功处理函数;
+ public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
+ {
+ m_PurchaseInProgress = false;
+
+ TKGDebugger.LogDebug("Purchase OK: " + e.purchasedProduct.definition.id);
+
+ // 消息结构 : Receipt: {"Store":"fake","TransactionID":"9c5c16a5-1ae4-468f-806d-bc709440448a","Payload":"{ \"this\" : \"is a fake receipt\" }"};
+ TKGDebugger.LogDebug("Receipt: " + e.purchasedProduct.receipt);
+
+ OnPurchaseDone?.Invoke(e.purchasedProduct.definition.id, true);
+
+ // 我们自己后台完毕的话,通过代码设置成功(如果是不需要后台设置直接设置完毕,不要设置Pending);
+ return PurchaseProcessingResult.Complete;
+ }
+
+ // 支付失败回掉函数;
+ public void OnPurchaseFailed(Product item, PurchaseFailureReason r)
+ {
+ TKGDebugger.LogDebug("Purchase OK: " + item.definition.id);
+ m_PurchaseInProgress = false;
+ OnPurchaseDone?.Invoke(item.definition.id, false);
+ }
+
+ // 购买延迟提示(这个看自己项目情况是否处理);
+ public void OnDeferred(Product item)
+ {
+ TKGDebugger.LogDebug("Purchase deferred: " + item.definition.id);
+ OnPurchaseDone?.Invoke(item.definition.id, false);
+ }
+
+ // 恢复购买功能执行回掉函数;
+ public void OnTransactionsRestored(bool success)
+ {
+ TKGDebugger.LogDebug("Transactions restored : " + success);
+ }
+#endregion
+
+#region custom functions
+ public string GetPriceByID(string pID)
+ {
+ if (m_StoreController == null && m_StoreExtensionProvider == null)
+ return "";
+
+ Product[] tProducts = m_StoreController.products.all;
+ for (int i = 0; i < tProducts.Length; i++)
+ {
+ TKGDebugger.LogDebug(tProducts[i].metadata.localizedTitle + "|" + tProducts[i].metadata.localizedPriceString + "|" + tProducts[i].metadata.localizedDescription + "|" + tProducts[i].metadata.isoCurrencyCode);
+ Product tItem = tProducts[i];
+ if (tItem.definition.id.Equals(pID))
+ {
+#if UNITY_ANDROID
+ return tItem.metadata.GetGoogleProductMetadata().localizedPriceString;
+#else
+ return tItem.metadata.localizedPriceString;
+#endif
+ }
+ }
+
+ return "";
+ }
+
+ public SubscriptionInfo GetSubscriptionInfo()
+ {
+ return mSubsInfo;
+ }
+#endregion
+}
+#endif
\ No newline at end of file
diff --git a/Assets/TKGSDK/Common/SDKTools/IAPTool.cs.meta b/Assets/TKGSDK/Common/SDKTools/IAPTool.cs.meta
new file mode 100644
index 00000000..e468745e
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/IAPTool.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 491772b3b6ab14cc9ad93ca3372753d2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs b/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs
new file mode 100644
index 00000000..fb56a23c
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs
@@ -0,0 +1,18 @@
+using System;
+
+public abstract class NormalSingleton where T : NormalSingleton, new()
+{
+ private static T mInstance = null;
+ public static T Instance
+ {
+ get
+ {
+ if (mInstance == null)
+ {
+ mInstance = new T();
+ }
+
+ return mInstance;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs.meta b/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs.meta
new file mode 100644
index 00000000..9b796e68
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/NormalSingleton.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5f879dddbadcb47c59a66e24e018e1b4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs b/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs
new file mode 100644
index 00000000..5f2294fd
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs
@@ -0,0 +1,20 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class TKGAndroidCNHide : MonoBehaviour
+{
+ private void Awake()
+ {
+#if UNITY_ANDROID
+ if (TKGSDKManager.Instance.GetChannel() == Touka.AppChannel.GooglePlay)
+ {
+ gameObject.SetActive(true);
+ }
+ else
+ {
+ gameObject.SetActive(false);
+ }
+#endif
+ }
+}
diff --git a/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs.meta b/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs.meta
new file mode 100644
index 00000000..f154fe61
--- /dev/null
+++ b/Assets/TKGSDK/Common/SDKTools/TKGAndroidCNHide.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7d2f5b9bcc64b44b3a86f7c065e3de8a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal.meta b/Assets/TKGSDK/Common/internal.meta
new file mode 100644
index 00000000..49929231
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: e07f9cec6bb0d421da6895e9b6326e41
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/ITKGSDK.cs b/Assets/TKGSDK/Common/internal/ITKGSDK.cs
new file mode 100644
index 00000000..9c688d12
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/ITKGSDK.cs
@@ -0,0 +1,398 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Touka
+{
+ public interface ITKGSDK
+ {
+ ///
+ /// init sdk
+ ///
+ void InitSDK(Action _initCallback = null);
+
+ ///
+ /// Set game focus
+ ///
+ ///
+ void SetGameFocusListener(Action _gameFocusAction);
+
+ ///
+ /// Set reward click listener
+ ///
+ void SetRewardClickListener(Action _rewardClickAction);
+ ///
+ /// Get channel
+ ///
+ ///
+ AppChannel GetChannel();
+
+ #region Ads
+
+ // remove all ads
+ void PurchasedRemoveAds();
+
+ ///
+ /// Remove Native Ad
+ ///
+ void RemoveNativeAd();
+
+ ///
+ /// Is Ready Native Ad
+ ///
+ ///
+ bool IsReadyNativeAd();
+
+ ///
+ /// Show Native Ad
+ ///
+ /// position
+ void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "");
+
+ ///
+ /// Show banner
+ ///
+ /// 1:top,2:bottom
+ void ShowBanner(TKGBannerAlign _bannerAlign);
+
+ ///
+ /// Hide banner
+ ///
+ void HideBanner();
+
+ ///
+ /// Show Interstitial Ad
+ ///
+ /// Name of interstitial ad placement.
+ /// Callback of interstitial ad close and show interstitial failed
+ /// IVADType for distinguish interstitial ads frequency, default use iv1
+ void ShowInterstitialAd(TKGIVAdPositionName _adPos, Action _callback = null, IVADType _IvType = IVADType.IV1);
+
+ ///
+ /// Show Reward Ad
+ ///
+ /// Name of reward ad placement
+ /// true:reward succ, false: reward failed
+ /// Callback of reward ad show fail
+ void ShowRewardAd(TKGRVPositionName _adPos, Action _rewardCallback = null, Action _showFailedCallback = null);
+
+ ///
+ /// Is Ready Reward
+ ///
+ ///
+ bool IsReadyRewardAd();
+
+ ///
+ /// Is Ready Interstitial
+ ///
+ ///
+ bool IsReadyInterstitialAd();
+
+ #endregion
+
+ #region Log Event
+
+ #region Normal
+
+ ///
+ /// log event
+ ///
+ ///
+ void LogEvent(string _eventSort);
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ ///
+ void LogEvent(string _eventSort, string _key, string _value);
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ void LogEvent(string _eventSort, string _key01, string _value01, string _key02, string _value02);
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ void LogEvent(string _eventSort, Dictionary _eventDic = null);
+
+ #endregion
+
+ #region Level Event
+
+ ///
+ /// Notify game start
+ ///
+ ///
+ void LevelStart(int _level);
+
+ ///
+ /// Notify game start
+ ///
+ ///
+ void LevelStart(string _level);
+
+ ///
+ /// Notify game end
+ ///
+ ///
+ ///
+ bool LevelEnd(int _level, StageResult _stageResult);
+
+ ///
+ /// Notify game end
+ ///
+ ///
+ ///
+ bool LevelEnd(string _level, StageResult _stageResult);
+
+ #endregion
+
+ #region Reward Ad Button Show
+
+ ///
+ /// Log Reward ad button show
+ ///
+ ///
+ void LogRewardAdBtnShow(string _pos);
+
+ #endregion
+
+ #region Tracking Event
+
+ /////
+ ///// Log Tracking Event
+ /////
+ /////
+ //void LogTrackingEvent(TrackingEventType _eventType);
+
+ #endregion
+
+ #endregion
+
+ #region Online Config
+
+ ///
+ /// get config - string
+ ///
+ ///
+ ///
+ string GetConfigStr(string _key);
+
+ ///
+ /// get config - int
+ ///
+ ///
+ ///
+ int GetConfigInt(string _key);
+
+ ///
+ /// get config - bool
+ ///
+ ///
+ ///
+ bool GetConfigBool(string _key);
+
+ #endregion
+
+ #region Others(common)
+
+ ///
+ /// review
+ ///
+ void Review();
+
+ ///
+ /// open privacy url
+ ///
+ void OpenPrivacyURL();
+
+ ///
+ /// open user term url
+ ///
+ void OpenUserTermURL();
+
+ ///
+ /// open more game
+ ///
+ void OpenMoreGame();
+
+ ///
+ /// open browser url
+ ///
+ ///
+ void OpenUrlByBrowser(string _url);
+
+ void OpenPolicyPop();
+
+ ///
+ /// shake
+ ///
+ /// 0 light,1 medium,2 heavy
+ /// ios 0~1, android any num
+ void Shake(int _shakeType, float _intensity = 1);
+
+ #endregion
+
+ #region Others (unCommon)
+
+ ///
+ /// Set game focus
+ ///
+ ///
+ void SetUserSourceListener(Action _userSourceAction);
+
+ ///
+ /// common callback
+ ///
+ ///
+ void SetTKGCommonCallback(Action _commonCallback);
+
+ ///
+ /// set log enable
+ ///
+ ///
+ void SetLogEnable(bool _enable);
+
+ ///
+ /// share txt
+ ///
+ ///
+ void ShareTxt(string _shareTxt);
+
+ ///
+ /// regist APNS
+ ///
+ void RegistAPNS();
+
+
+ ///
+ /// shake
+ ///
+ /// notification identifier
+ /// The body of the notification.
+ /// notify after the time interval. format: yyyy-MM-dd HH:mm:ss
+ /// The application badge number.
+ /// The title of the notification.
+ /// The subtitle of the notification.
+ void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle);
+
+
+ ///
+ /// remove all notification
+ ///
+ void RemoveAllNotifications();
+
+ ///
+ /// remove notification by notification identifier
+ ///
+ /// notification identifier
+ void RemoveNotification(string notiId);
+
+ #endregion
+ }
+
+ ///
+ /// IV Ad Type
+ /// Control different frequency interstitial Ads
+ ///
+ public enum IVADType
+ {
+ IV1 = 0,
+ IV2,
+ IV3,
+ IV4,
+ IV5,
+ IV6,
+ IV7,
+ iv8,
+
+ MAX,
+ }
+
+ ///
+ /// Tracking Event Type
+ ///
+ public enum TrackingEventType
+ {
+ GuildStart = 0, // guide start show
+ GuildEnd = 1, // guild end
+ FirstOperateGame = 2, // user operates the game for the first time
+
+ Max,
+ }
+
+ ///
+ /// ad show failed code type
+ ///
+ public enum AdShowFailCodeType
+ {
+ AdShowFailReal = 57, // ad real show failed
+ AdIsNotReady = 58, // The ad component is displayed and found not ready
+ AdIsReadyCannotShow = 59, // When the ad component is displayed, the ad is ready, but the rule that cannot display the ad is triggered
+ }
+
+ ///
+ /// banner align
+ ///
+ public enum TKGBannerAlign : int
+ {
+ BannerCenterBottomAlign = 34,
+ BannerCenterTopAlign = 10,
+ }
+
+ ///
+ /// tkg common callback code
+ ///
+ public enum CommonCallbackCode
+ {
+ FirebaseOnlineParamGet_Succ = 990001,
+ FirebaseOnlineParamGet_Failed = 990002,
+ }
+
+ ///
+ /// stage result
+ ///
+ public enum StageResult
+ {
+ StageSucc = 0,
+ StageFail = 1,
+ StageRetry = 2,
+ StageBack = 3,
+ }
+
+ ///
+ /// app channel
+ ///
+ public enum AppChannel
+ {
+ None,
+ AppStore_GB,
+ AppStore_CN,
+ GooglePlay,
+ DY012,
+ GW002,
+ HY003,
+ OP004,
+ VO005,
+ XM006,
+ HW007,
+ TX008,
+ TP009,
+ MM010,
+ ZX011,
+ KS012,
+ PJ000,
+
+ AndroidRoot = 10000
+ }
+}
diff --git a/Assets/TKGSDK/Common/internal/ITKGSDK.cs.meta b/Assets/TKGSDK/Common/internal/ITKGSDK.cs.meta
new file mode 100644
index 00000000..6151c713
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/ITKGSDK.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 622e60b39ae0b411f9b149c5f416bebe
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/TKGDebugger.cs b/Assets/TKGSDK/Common/internal/TKGDebugger.cs
new file mode 100644
index 00000000..5b470063
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGDebugger.cs
@@ -0,0 +1,40 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Touka
+{
+ public class TKGDebugger
+ {
+ public static void LogDebug(string content)
+ {
+ if (StaticOtherConfig.IsDebugLog)
+ {
+ Debug.Log(content);
+ }
+ }
+
+ public static void LogWarning(string content)
+ {
+ if (StaticOtherConfig.IsDebugLog)
+ {
+ Debug.LogWarning(content);
+ }
+ }
+
+ public static void LogError(string content)
+ {
+ //if (StaticOtherConfig.IsDebugLog)
+ {
+ Debug.LogError("[Error] " + content);
+ }
+ }
+
+ public static void SetUnityLogger(bool _logEnable)
+ {
+ Debug.unityLogger.logEnabled = _logEnable;
+ }
+
+ }
+}
+
diff --git a/Assets/TKGSDK/Common/internal/TKGDebugger.cs.meta b/Assets/TKGSDK/Common/internal/TKGDebugger.cs.meta
new file mode 100644
index 00000000..aca0ae8b
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGDebugger.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 169fefdadb00d497889c1805955ce461
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/TKGSDKNative.cs b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs
new file mode 100644
index 00000000..b78e5681
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs
@@ -0,0 +1,662 @@
+using System;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Touka
+{
+ public class TKGSDKNative : ITKGSDK
+ {
+ private Dictionary mDefaultDic = new Dictionary();
+ ///
+ /// init sdk
+ ///
+ ///
+ public void InitSDK(Action _initCallback = null)
+ {
+ TKGNativeInterface.Instance.Init(_initCallback);
+ SetOnlineConfigInit();
+ }
+
+ private void SetOnlineConfigInit()
+ {
+ //加入自定义参数列表
+ foreach (string tKey in TKGParams.OnlineParamDic.Keys)
+ {
+ mDefaultDic.Add(tKey, TKGParams.OnlineParamDic[tKey]);
+ }
+ }
+
+ ///
+ /// Set game focus
+ ///
+ ///
+ public void SetGameFocusListener(Action _gameFocusAction)
+ {
+ TKGNativeInterface.Instance.SetGameFocusListener(_gameFocusAction);
+ }
+
+ public void SetRewardClickListener(Action _rewardClickAction)
+ {
+ TKGNativeInterface.Instance.SetRewardClickListener(_rewardClickAction);
+ }
+
+ ///
+ /// Get channel
+ ///
+ ///
+ public AppChannel GetChannel()
+ {
+ Debug.Log("android back getchannel : " + TKGNativeInterface.Instance.GetChannel());
+ string channelStr = TKGNativeInterface.Instance.GetChannel();
+
+ channelStr = channelStr.Equals("default") ? AppChannel.AndroidRoot.ToString() : channelStr;
+ AppChannel tChannel = AppChannel.None;
+ if (Enum.TryParse(channelStr, out tChannel))
+ {
+ return tChannel;
+ }
+
+ return AppChannel.None;
+ }
+
+ #region Ads
+
+ public void SetUnitySDKVersion(string sdkVersion)
+ {
+ TKGNativeInterface.Instance.SetUnitySDKVersion(sdkVersion);
+ }
+
+ public void PurchasedRemoveAds()
+ {
+ TKGNativeInterface.Instance.PurchasedRemoveAds();
+ }
+
+ public void RemoveNativeAd()
+ {
+ TKGNativeInterface.Instance.RemoveNativeAd();
+ }
+
+ public bool IsReadyNativeAd()
+ {
+ return TKGNativeInterface.Instance.IsReadyNativeAd();
+ }
+
+ public void ShowNativeAd(RectTransform pRect, Camera pCam = null, string pAdPos = "")
+ {
+
+ TKGNativeInterface.Instance.ShowNativeAd(pRect,pCam,pAdPos);
+ }
+
+ ///
+ /// Show banner
+ ///
+ /// bannerAlign
+ public void ShowBanner(TKGBannerAlign _pos)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.showBannerAd(_pos);
+ }
+
+ ///
+ /// Hide banner
+ ///
+ public void HideBanner()
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.hideBannerAd();
+ }
+
+ ///
+ /// Show Interstitial Ad
+ ///
+ /// Name of interstitial ad placement.
+ /// Callback of interstitial ad close and show interstitial failed
+ /// IVADType for distinguish interstitial ads frequency, default use iv1
+ public void ShowInterstitialAd(TKGIVAdPositionName _adPos, Action _callback = null, IVADType _IvType = IVADType.IV1)
+ {
+#if UNITY_EDITOR
+ TKGDebugger.LogDebug("[TKGSDKNative] Show Interstitial call, _adPos : " + _adPos);
+ if (_callback != null) _callback();
+ return;
+#endif
+ TKGSDKCallback.mInterAdCallback = _callback;
+ TKGNativeInterface.Instance.showInterstitialAd(_adPos.ToString(), _IvType);
+ }
+
+ ///
+ /// Show Reward Ad
+ ///
+ /// Name of reward ad placement
+ /// true:reward succ, false: reward failed
+ /// Callback of reward ad show fail
+ public void ShowRewardAd(TKGRVPositionName _adPos, Action _rewardCallback = null, Action _showFailedCallback = null)
+ {
+#if UNITY_EDITOR
+ TKGDebugger.LogDebug("[TKGSDKNative] Show reward call, _adPos : " + _adPos);
+ if (_rewardCallback != null) _rewardCallback(true);
+ return;
+#endif
+
+ TKGSDKCallback.mRewardCallback = _rewardCallback;
+ TKGSDKCallback.mRewardShowFailedCallback = _showFailedCallback;
+
+ TKGNativeInterface.Instance.showRewardAd(_adPos.ToString(), -1);
+ }
+
+ ///
+ /// Is Ready Interstitial
+ ///
+ ///
+ public bool IsReadyInterstitialAd()
+ {
+#if UNITY_EDITOR
+ return true;
+#endif
+ return TKGNativeInterface.Instance.isInterstitialAdReady();
+ }
+
+ ///
+ /// Is Ready Reward
+ ///
+ ///
+ public bool IsReadyRewardAd()
+ {
+#if UNITY_EDITOR
+ return true;
+#endif
+ return TKGNativeInterface.Instance.isRewardAdReady();
+ }
+
+ #endregion
+
+ #region Log Event
+
+ #region Normal
+
+ ///
+ /// log event
+ ///
+ ///
+ public void LogEvent(string _eventSort)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.onEvent(_eventSort);
+ }
+
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, string _key, string _value)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _key : " + _key + " , _value : " + _value);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.onEvent(_eventSort, _key, _value);
+ }
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, string _key01, string _value01, string _key02, string _value02)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _key01 : " + _key01 + " , _value01 : " + _value01 + " , _key2 : " + _key02 + " , _value02 : " + _value02);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.onEvent(_eventSort, _key01, _value01, _key02, _value02);
+ }
+
+ ///
+ /// log event
+ ///
+ ///
+ ///
+ public void LogEvent(string _eventSort, Dictionary _eventDic = null)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] logEvent : " + _eventSort + " , _eventDic.count : " + _eventDic.Count);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.onEvent(_eventSort, _eventDic);
+ }
+
+ #endregion
+
+ #region Level Event
+
+ ///
+ /// Notify game start
+ ///
+ ///
+ public void LevelStart(int _level)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LevelStart _level : " + _level);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.LevelStart(_level.ToString());
+ }
+
+ ///
+ /// Notify game start
+ ///
+ ///
+ public void LevelStart(string _level)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LevelStart _level : " + _level);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.LevelStart(_level);
+ }
+
+ ///
+ /// Notify game end
+ ///
+ ///
+ ///
+ public bool LevelEnd(int _level, StageResult _stageResult)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LevelEnd _level : " + _level + " , _stageResult : " + _stageResult);
+#if UNITY_EDITOR
+ return true;
+#endif
+ TKGNativeInterface.Instance.LevelEnd(_level.ToString(), _stageResult);
+ return true;
+ }
+
+ ///
+ /// Notify game end
+ ///
+ ///
+ ///
+ public bool LevelEnd(string _level, StageResult _stageResult)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LevelEnd _level : " + _level + " , _win : " + _stageResult);
+#if UNITY_EDITOR
+ return true;
+#endif
+ TKGNativeInterface.Instance.LevelEnd(_level, _stageResult);
+ return true;
+ }
+
+ #endregion
+
+ #region Reward Ad Button Show
+
+ ///
+ /// Log Reward ad button show
+ ///
+ ///
+ public void LogRewardAdBtnShow(string _pos)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LogRewardAdBtnShow _pos : " + _pos);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.onEvent(TKGStringEvent.Event_Sort_TKGInner_ad_button_show, TKGStringEvent.Event_Type_TKGInner_ad_position, _pos);
+ }
+
+ #endregion
+
+ #region Tracking Event
+
+ ///
+ /// Log Tracking Event
+ ///
+ ///
+ public void LogTrackingEvent(TrackingEventType _eventType)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] LogTrackingEvent _eventType : " + _eventType);
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.LogTrackingEvent(_eventType);
+ }
+
+ #endregion
+
+ #endregion
+
+ #region Online Config
+
+ ///
+ /// get config - string
+ ///
+ ///
+ ///
+ public string GetConfigStr(string _key)
+ {
+#if UNITY_EDITOR
+ return GetConfigDefaultValue(_key);
+#endif
+ string tempOnline = TKGNativeInterface.Instance.GetConfigString(_key, GetConfigDefaultValue(_key));
+ TKGDebugger.LogDebug("[TKGSDKNative] tempOnline , _key : " + _key + " , tempOnline : " + tempOnline);
+ return tempOnline;
+ }
+
+ ///
+ /// get config - int
+ ///
+ ///
+ ///
+ public int GetConfigInt(string _key)
+ {
+ string tDefaultValue = GetConfigDefaultValue(_key);
+
+#if UNITY_EDITOR
+
+ if (int.TryParse(tDefaultValue, out int tIntVal))
+ {
+ return tIntVal;
+ }
+ TKGDebugger.LogDebug("[TKGSDKNative]");
+ return 0;
+#endif
+
+ int defaultInt = 0;
+ int.TryParse(tDefaultValue, out defaultInt);
+
+ int tempInt = TKGNativeInterface.Instance.GetConfigInt(_key, defaultInt);
+ TKGDebugger.LogDebug("[TKGSDKNative] GetConfigInt , _key : " + _key + " , tempInt : " + tempInt);
+ return tempInt;
+ }
+
+ ///
+ /// get config - bool
+ ///
+ ///
+ ///
+ public bool GetConfigBool(string _key)
+ {
+ string tDefaultValue = GetConfigDefaultValue(_key);
+#if UNITY_EDITOR
+ if (int.TryParse(tDefaultValue, out int tIntVal))
+ {
+ return tIntVal != 0;
+ }
+ TKGDebugger.LogDebug("[TKGSDKNative]");
+
+ return false;
+#endif
+
+ int defaultInt = 0;
+ int.TryParse(tDefaultValue, out defaultInt);
+
+ bool tBoolValue = TKGNativeInterface.Instance.GetConfigBool(_key, defaultInt != 0);
+ TKGDebugger.LogDebug("[TKGSDKNative] GetConfigBool , _key : " + _key + " , tBoolValue : " + tBoolValue);
+ return tBoolValue;
+ }
+
+ ///
+ /// get default config value
+ ///
+ ///
+ ///
+ private string GetConfigDefaultValue(string _key)
+ {
+ string tDefault = "";
+ if (mDefaultDic.ContainsKey(_key))
+ {
+ tDefault = mDefaultDic[_key].ToString();
+ }
+ Debug.Log("getConfigDefaultValue, _key : " + _key + " , tDefault : " + tDefault);
+ return tDefault;
+ }
+
+ #endregion
+
+ #region Others (common)
+
+ ///
+ /// review
+ ///
+ public void Review()
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] Review");
+#if UNITY_EDITOR
+#if AppStore_GB
+ TKGDebugger.LogDebug("[TKGSDKNative] Review cannot be opened in editor, please open it in real machine");
+#else
+
+ TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开评价页面,请在真机中打开");
+
+#endif
+ return;
+#endif
+ TKGNativeInterface.Instance.Review();
+ }
+
+ ///
+ /// open privacy url
+ ///
+ public void OpenPrivacyURL()
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] OpenPrivacyURL");
+#if UNITY_EDITOR
+#if AppStore_GB
+ TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
+#else
+
+ TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
+
+#endif
+ return;
+#endif
+ TKGNativeInterface.Instance.OpenPrivacyURL();
+ }
+
+ ///
+ /// open user term url
+ ///
+ public void OpenUserTermURL()
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] OpenUserTermURL");
+#if UNITY_EDITOR
+#if AppStore_GB
+ TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
+#else
+
+ TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
+
+#endif
+ return;
+#endif
+ TKGNativeInterface.Instance.OpenUserTermURL();
+ }
+
+ ///
+ /// open policy pop
+ ///
+ public void OpenPolicyPop()
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] OpenPolicyPop");
+#if UNITY_EDITOR
+#if AppStore_GB
+ TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
+#else
+
+ TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
+
+#endif
+ return;
+#endif
+ TKGNativeInterface.Instance.OpenPolicyPop();
+ }
+
+ ///
+ /// open more game
+ ///
+ public void OpenMoreGame()
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] OpenMoreGame");
+#if UNITY_EDITOR
+#if AppStore_GB
+ TKGDebugger.LogDebug("[TKGSDKNative] App Store cannot be opened in editor, please open it in real machine");
+#else
+
+ TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开App Store,请在真机中打开");
+
+#endif
+ return;
+#endif
+ TKGNativeInterface.Instance.OpenMoreGame();
+ }
+
+ ///
+ /// open url browser
+ ///
+ ///
+ public void OpenUrlByBrowser(string _url)
+ {
+ TKGDebugger.LogDebug("[TKGSDKNative] OpenUrlByBrowser");
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGUtils.OpenBrowserUrl(_url);
+ }
+
+
+ ///
+ /// shake
+ ///
+ /// 0 light,1 medium,2 heavy
+ /// ios 0~1, android any num
+ public void Shake(int _shakeType, float _intensity = 1)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.shake(_shakeType, _intensity);
+ }
+
+ #endregion
+
+ #region others(uncommon)
+
+ ///
+ /// SetUserSourceListener
+ ///
+ ///
+ public void SetUserSourceListener(Action _userSourceAction)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGSDKCallback.mTKGUserSourceCallback = _userSourceAction;
+ TKGNativeInterface.Instance.SetUserSourceCallback(new AndroidTKGUserSourceCalllback());
+ }
+
+ ///
+ /// Set TKG Common callback
+ ///
+ ///
+ public void SetTKGCommonCallback(Action _commonCallback)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGSDKCallback.mTKGCommonCallback = _commonCallback;
+ TKGNativeInterface.Instance.SetSDKCommonCallback(new AndroidTKGCommonCalllback());
+ }
+
+ ///
+ /// Set log enable
+ ///
+ public void SetLogEnable(bool _enable)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+ TKGNativeInterface.Instance.SetLogEnable(_enable);
+ }
+ ///
+ /// share txt
+ ///
+ public void ShareTxt(string _shareTxt)
+ {
+#if UNITY_EDITOR
+ return;
+#endif
+#if UNITY_ANDROID
+ TKGNativeInterface.Instance.ShareTxt(_shareTxt);
+#endif
+ }
+
+ ///
+ /// regist APNS
+ ///
+ public void RegistAPNS()
+ {
+
+#if UNITY_EDITOR
+ return;
+#else
+ TKGNativeInterface.Instance.RegistAPNS();
+#endif
+
+ }
+
+ ///
+ /// shake
+ ///
+ /// notification identifier
+ /// The body of the notification.
+ /// notify after the time interval. format: yyyy-MM-dd HH:mm:ss
+ /// The application badge number.
+ /// The title of the notification.
+ /// The subtitle of the notification.
+ public void RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle) {
+
+#if UNITY_EDITOR
+ return;
+#else
+ TKGNativeInterface.Instance.RegistNotification(notiId,body,fireDate,badge,title,subTitle);
+#endif
+ }
+
+ ///
+ /// remove all notification
+ ///
+ public void RemoveAllNotifications() {
+
+#if UNITY_EDITOR
+ return;
+#else
+ TKGNativeInterface.Instance.RemoveAllNotifications();
+#endif
+ }
+
+ ///
+ /// remove notification by notification identifier
+ ///
+ /// notification identifier
+ public void RemoveNotification(string notiId) {
+
+
+#if UNITY_EDITOR
+ return;
+#else
+ TKGNativeInterface.Instance.RemoveNotification(notiId);
+#endif
+ }
+#endregion
+ }
+}
diff --git a/Assets/TKGSDK/Common/internal/TKGSDKNative.cs.meta b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs.meta
new file mode 100644
index 00000000..ba994fe9
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGSDKNative.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1b56a352663e54b7da21c98ee4f04919
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/TKGSingleton.cs b/Assets/TKGSDK/Common/internal/TKGSingleton.cs
new file mode 100644
index 00000000..527ef73f
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGSingleton.cs
@@ -0,0 +1,45 @@
+using UnityEngine;
+using System.Collections;
+
+namespace Touka
+{
+ ///
+ /// 单例类
+ ///
+ ///
+ public class TKGSingleton : MonoBehaviour where T : MonoBehaviour
+ {
+ private static T _instance;
+
+ public static T Instance
+ {
+ get
+ {
+ if (null == _instance)
+ {
+ _instance = Object.FindObjectOfType(typeof(T)) as T;
+ if (null != _instance) return _instance;
+
+ GameObject container = new GameObject
+ {
+ name = typeof(T).ToString()
+ };
+ container.hideFlags = HideFlags.HideInHierarchy;
+ _instance = container.AddComponent(typeof(T)) as T;
+ Object.DontDestroyOnLoad(container);
+ }
+ return _instance;
+ }
+ }
+
+ private void Awake()
+ {
+ OnInstanceCreate();
+ }
+
+ protected virtual void OnInstanceCreate()
+ {
+
+ }
+ }
+}
diff --git a/Assets/TKGSDK/Common/internal/TKGSingleton.cs.meta b/Assets/TKGSDK/Common/internal/TKGSingleton.cs.meta
new file mode 100644
index 00000000..e0600027
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGSingleton.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: da622b24dd1d24cfe97ee17033dd2cb0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/TKGStringConst.cs b/Assets/TKGSDK/Common/internal/TKGStringConst.cs
new file mode 100644
index 00000000..c02852df
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGStringConst.cs
@@ -0,0 +1,24 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Touka
+{
+ public static class TKGStringConst
+ {
+
+ }
+
+
+ public static class TKGStringEvent
+ {
+ public const string Event_Sort_TKGInner_ad_button_show = "ad_button_show"; // ad button show
+ public const string Event_Type_TKGInner_ad_position = "ad_position"; // ad position
+
+ }
+
+ public static class TKGStringPlayerPrefs
+ {
+ public const string TOUKA_PREFIX = "Touka_";
+ }
+}
\ No newline at end of file
diff --git a/Assets/TKGSDK/Common/internal/TKGStringConst.cs.meta b/Assets/TKGSDK/Common/internal/TKGStringConst.cs.meta
new file mode 100644
index 00000000..899be003
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/TKGStringConst.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1c289d50c594c4d34864ee763e184865
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/iOS.meta b/Assets/TKGSDK/Common/internal/iOS.meta
new file mode 100644
index 00000000..3a03c0f0
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/iOS.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d9516873035bb45598c991827ce79e3b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs b/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs
new file mode 100644
index 00000000..6c887bfc
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs
@@ -0,0 +1,90 @@
+
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Runtime.InteropServices;
+using System;
+using UnityEngine.UI;
+
+
+public class TGUniversalFunc : MonoBehaviour {
+
+ //banner
+ public static Action onSetBannerListener_onAdLoaded;
+
+ public static Action onSetBannerListener_onAdFailedToLoad;
+
+ public static Action onSetBannerListener_onShowSuccess;
+
+ public static Action onSetBannerListener_onClick;
+
+ public static Action onSetBannerListener_onAdClosed;
+
+ //interstitial
+ public static Action onSetInterstitialListener_onAdLoaded;
+
+ public static Action onSetInterstitialListener_onAdFailedToLoad;
+
+ public static Action onSetInterstitialListener_onShowSuccess;
+
+ public static Action onSetInterstitialListener_onShowFailed;
+
+ public static Action onSetInterstitialListener_onAdClosed;
+
+ public static Action onSetInterstitialListener_onClick;
+
+ public static Action onSetIntersititalAdsEndPlaying;
+
+ public static Action onSetInterstitialListener_onFailedToPlay;
+
+ public static Action onSetInterstitialListener_onStartPlayVideo;
+
+ public static Action onSetInterstitialListener_onEndPlaying;
+
+ //Native
+ public static Action onSetNativeListener_onAdLoaded;
+
+ public static Action onSetNativeListener_onAdFailedToLoad;
+
+ public static Action onSetNativeListener_onClick;
+
+ public static Action onSetNativeListener_onShowSuccess;
+
+ //reward
+ public static Action onSetRewardListener_onRewardedVideoAdLoaded;
+
+ public static Action onSetRewardListener_onRewardedVideoAdFailedToLoad;
+
+ public static Action onSetRewardListener_onRewardedVideoStarted;
+
+ public static Action onSetRewardListener_onRewardedVideoAdClosed;
+
+ public static Action onSetRewardListener_onRewardedVideoClickAd;
+
+ public static Action onSetRewardListener_onRewardedVideoAdEnd;
+
+ public static Action onSetRewardListener_onRewardedVideoAdPlayFail;
+
+ public static Action onSetRewardListener_onRewarded;
+
+
+ //splash
+ public static Action onSetSplashListener_onAdLoaded;
+
+ public static Action onSetSplashListener_onAdLoadFail;
+
+ public static Action onSetSplashListener_onAdDidShow;
+
+ public static Action onSetSplashListener_onAdDidClick;
+
+ public static Action onSetSplashListener_onAdDidClose;
+
+ //native banner
+ public static Action onSetNativeBannerListener_onAdLoaded;
+
+ public static Action onSetNativeBannerListener_onAdLoadFail;
+
+
+ // User Source
+ public static Action onSetUserSourceListener_onSuccess;
+}
diff --git a/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs.meta b/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs.meta
new file mode 100644
index 00000000..7472b454
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/iOS/TGUniversalFunc.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7afbc8428cb074050bc3b66567a276f9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs
new file mode 100644
index 00000000..d30ee111
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs
@@ -0,0 +1,570 @@
+#if UNITY_IOS
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using System.Runtime.InteropServices;
+using System;
+using Touka;
+using System.Text;
+
+public class TGiOSAdManager : MonoBehaviour
+{
+
+ private static TGiOSAdManager s_instance;
+
+ public Action onAntiSuccessHander;
+ private System.Action m_userSourceCallback;
+
+ public static TGiOSAdManager Instance
+ {
+ get
+ {
+ if (s_instance == null)
+ {
+ GameObject TGGameObject = new GameObject
+ {
+ name = "AdObject"
+ };
+ s_instance = TGGameObject.AddComponent();
+ DontDestroyOnLoad(TGGameObject);
+ }
+ return s_instance;
+ }
+ }
+
+
+ public void InitSDK()
+ {
+ // 暂停恢复声音
+ pauseGameDelegate handler = new pauseGameDelegate(pauseGameHandle);
+ IntPtr pauseGame = Marshal.GetFunctionPointerForDelegate(handler);
+ pauseGameCallback(pauseGame);
+
+ // 初始化设置
+ initSDKDelegate inithandler = new initSDKDelegate(initSDKHandle);
+ IntPtr initSdk = Marshal.GetFunctionPointerForDelegate(inithandler);
+ initSDKCallback(initSdk);
+
+ // 用户来源设置
+ TKG_UsersourceDelegate usHandler = new TKG_UsersourceDelegate(userSourceHandle);
+ IntPtr us = Marshal.GetFunctionPointerForDelegate(usHandler);
+ userSourceCallback(us);
+
+ // rv close
+ rewardCloseDelegate rvCloseHandler = new rewardCloseDelegate(rewardAdCloseHandle);
+ IntPtr rewardClose = Marshal.GetFunctionPointerForDelegate(rvCloseHandler);
+ rewardAdCloseCallback(rewardClose);
+
+ // show fail
+ rewardShowFailDelegate rvfailHandler = new rewardShowFailDelegate(rewardAdShowFailHandle);
+ IntPtr rewardShowFail = Marshal.GetFunctionPointerForDelegate(rvfailHandler);
+ rewardAdShowFailCallback(rewardShowFail);
+
+ // iv close
+ interCloseDelegate ivCloseHandler = new interCloseDelegate(interAdCloseHandle);
+ IntPtr interClose = Marshal.GetFunctionPointerForDelegate(ivCloseHandler);
+ interAdCloseCallback(interClose);
+
+ // rv click
+ rewardClickDelegate rvClickHandler = new rewardClickDelegate(rewardAdClickHandle);
+ IntPtr rvClick = Marshal.GetFunctionPointerForDelegate(rvClickHandler);
+ rewardAdClickCallback(rvClick);
+
+ TKG_InitSDK();
+
+ }
+
+ // 通知
+ public void registAPNS()
+ {
+ TKG_RegistAPNS();
+ }
+
+ public void registNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle)
+ {
+ TKG_RegistNotification(notiId,body,fireDate,badge,title,subTitle);
+ }
+
+ public void removeNotification(string notiId)
+ {
+ TKG_RemoveNotification(notiId);
+ }
+
+ public void removeAllNotifications()
+ {
+ TKG_RemoveAllNotification();
+ }
+ // 震动
+ public void shake(int mType, float mIntensity = 1)
+ {
+ TKG_Shake(mType,mIntensity);
+ }
+
+ // ads
+
+ public void RemoveAllAds()
+ {
+ TKG_RemoveAds();
+ }
+
+ //banner
+ public void LoadBanner()
+ {
+ TKG_LoadBanner();
+ }
+
+ public bool IsReadyBanner()
+ {
+ return TKG_IsReadyBanner();
+ }
+
+ public void ShowBanner(int align)
+ {
+ TKG_ShowBanner(align);
+ }
+
+ public void HideBanner()
+ {
+ TKG_HideBanner();
+ }
+
+ // iv
+ public void LoadIntersititial()
+ {
+ TKG_LoadIntersititial();
+ }
+
+ public bool IsReadyIntersititial()
+ {
+ return TKG_IsReadyIntersititial();
+ }
+
+ public void ShowIntersititial(string _adPos, int ivType)
+ {
+ TKG_ShowIntersititial(_adPos,ivType);
+ }
+
+ // rv
+ public void LoadRewardVideo()
+ {
+ TKG_LoadRewardVideo();
+ }
+
+ public bool IsReadyRewardVideo()
+ {
+ return TKG_IsReadyRewardVideo();
+ }
+
+ public void ShowRewardVideo(string adPos)
+ {
+
+ TKG_ShowRewardVideo(adPos);
+ }
+
+ // native
+ public void LoadNative(float width, float height)
+ {
+ TKG_LoadNative(width, height);
+ }
+
+ public bool IsReadyNative()
+ {
+ return TKG_IsReadyNative();
+ }
+
+ public void ShowNative(RectTransform pRect, Camera pCam = null, string pAdPos = "")
+ {
+ TKG_TurnNativePosition(pRect, pCam, pAdPos);
+ }
+
+ public void RemoveNative()
+ {
+ TKG_RemoveNative();
+ }
+
+ // other
+ public void Review()
+ {
+ TKG_Review();
+ }
+
+ public void OpenPrivacyURL()
+ {
+ TKG_OpenPrivacyURL();
+ }
+
+ public void OpenUserTermURL()
+ {
+ TKG_OpenUserTermURL();
+ }
+
+ public void OpenPolicyPop()
+ {
+ TKG_OpenPolicyPop();
+ }
+ public void OpenMoreGame()
+ {
+ TKG_OpenMoreGame();
+ }
+
+
+ // 在线参数
+ public int GetConfigInt(string key, int defaultValue)
+ {
+ return TKG_GetConfigInt(key, defaultValue);
+ }
+
+ public string GetConfigString(string key, string defaultValue)
+ {
+ return TKG_GetConfigString(key, defaultValue);
+ }
+
+ public bool GetConfigBool(string key, bool defaultValue)
+ {
+ return TKG_GetConfigBool(key, defaultValue);
+ }
+
+ // 游戏事件上报
+ public void onEvent_GameStart(string levelId)
+ {
+ TKG_OnEvent_GameStart(levelId);
+ }
+
+ public void onEvent_GameEnd(string levelId, int result)
+ {
+ TKG_OnEvent_GameEnd(levelId,result);
+ }
+
+ // umeng 事件上报
+ public void onEvent_UMeng(string eventSort)
+ {
+ TKG_OnEvent_UMeng1(eventSort);
+ }
+
+ public void onEvent_UMeng(string eventSort, Dictionary _keyValues)
+ {
+ TKG_OnEvent_UMeng2(eventSort, TKG_DictionaryToJson(_keyValues));
+ }
+
+ public void onEvent_UMeng(string eventSort,string key,string value)
+ {
+ TKG_OnEvent_UMeng3(eventSort,key,value);
+ }
+
+ public void onEvent_UMeng(string eventSort, string key1, string value1,string key2,string value2)
+ {
+ TKG_OnEvent_UMeng4(eventSort, key1, value1,key2,value2);
+ }
+
+ // tenjin事件上报
+ public void onEvent_Tenjin(int eventType)
+ {
+ TKG_OnEvent_Tenjin(eventType);
+ }
+
+ // unity 字典转 json string
+ static string TKG_DictionaryToJson(Dictionary dict)
+ {
+
+ var builder = new StringBuilder("{");
+ foreach (KeyValuePair kv in dict)
+ {
+ builder.AppendFormat("\"{0}\":\"{1}\",", kv.Key, kv.Value);
+ }
+ builder[builder.Length - 1] = '}';
+ return builder.ToString();
+ }
+
+ // 坐标转换
+ public void TKG_TurnNativePosition(RectTransform pRect, Camera pCam = null, string pAdPos = "")
+ {
+ Vector3[] tWorldCorners = new Vector3[4];
+ pRect.GetWorldCorners(tWorldCorners);
+
+ Vector2 tTopLeft = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[1]);
+ Vector2 tBottomRight = RectTransformUtility.WorldToScreenPoint(pCam, tWorldCorners[3]);
+ float tWidth = Mathf.Abs(tBottomRight.x - tTopLeft.x);
+ float tHeight = Mathf.Abs(tBottomRight.y - tTopLeft.y);
+ //Debug.Log("x:" + tTopLeft.x + "y:" + (Screen.height - tTopLeft.y) + "width" + tWidth + "hei:" + tHeight);
+
+ TKG_ShowNative(tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight, pAdPos);
+ }
+
+ // callback
+ // iv callback
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void interCloseDelegate();
+ [AOT.MonoPInvokeCallback(typeof(interCloseDelegate))]
+ static void interAdCloseHandle()
+ {
+ if (TKGSDKCallback.mInterAdCallback != null)
+ {
+ TKGSDKCallback.mInterAdCallback.Invoke();
+ TKGSDKCallback.mInterAdCallback = null;
+ }
+ }
+
+ // rv close-reward callback
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void rewardCloseDelegate(bool isReward);
+ [AOT.MonoPInvokeCallback(typeof(rewardCloseDelegate))]
+ static void rewardAdCloseHandle(bool isReward)
+ {
+ if (isReward)
+ {
+ if (TKGSDKCallback.mRewardCallback != null)
+ {
+ TKGSDKCallback.mRewardCallback.Invoke(true);
+ TKGSDKCallback.mRewardCallback = null;
+ }
+ }
+ else
+ {
+ if (TKGSDKCallback.mRewardCallback != null)
+ {
+ TKGSDKCallback.mRewardCallback.Invoke(false);
+ TKGSDKCallback.mRewardCallback = null;
+ }
+ }
+ }
+
+ // rv show fail callback
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void rewardShowFailDelegate();
+ [AOT.MonoPInvokeCallback(typeof(rewardShowFailDelegate))]
+ static void rewardAdShowFailHandle()
+ {
+ if (TKGSDKCallback.mRewardShowFailedCallback != null)
+ {
+ TKGSDKCallback.mRewardShowFailedCallback();
+ TKGSDKCallback.mRewardShowFailedCallback = null;
+ }
+ }
+
+ // rv click callback
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void rewardClickDelegate();
+ [AOT.MonoPInvokeCallback(typeof(rewardClickDelegate))]
+ static void rewardAdClickHandle()
+ {
+ if (TKGSDKCallback.mRewardClickCallback != null)
+ {
+ TKGSDKCallback.mRewardClickCallback();
+ }
+ }
+
+ // pause game
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void pauseGameDelegate(bool m_pause);
+ [AOT.MonoPInvokeCallback(typeof(pauseGameDelegate))]
+ static void pauseGameHandle(bool m_pause)
+ {
+ TKGSDKCallback.mGameFocusCallback?.Invoke(!m_pause);
+ }
+
+ // init sdk
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void initSDKDelegate();
+ [AOT.MonoPInvokeCallback(typeof(initSDKDelegate))]
+ static void initSDKHandle()
+ {
+ if (TKGSDKCallback.mInitCallback != null)
+ {
+ TKGSDKCallback.mInitCallback();
+ TKGSDKCallback.mInitCallback = null;
+ }
+ }
+
+ // user source
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void TKG_UsersourceDelegate(bool isOrganic,string source);
+ [AOT.MonoPInvokeCallback(typeof(TKG_UsersourceDelegate))]
+ static void userSourceHandle(bool isOrganic, string source)
+ {
+ if (TKGSDKCallback.mTKGUserSourceCallback != null)
+ {
+ TKGSDKCallback.mTKGUserSourceCallback(isOrganic,source);
+ TKGSDKCallback.mTKGUserSourceCallback = null;
+ }
+ }
+
+ // dll
+ [DllImport("__Internal")]
+ private static extern void TKG_Shake(int mType, float mIntensity);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_InitSDK();
+
+ // event umeng
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_UMeng1(string s1);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_UMeng2(string s1, string s2);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_UMeng3(string s1, string key, string value);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_UMeng4(string s1, string key1, string value1, string key2, string value2);
+
+ // event tenjin
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_Tenjin(int eventType);
+
+ // event game
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_GameStart(string levelId);
+ [DllImport("__Internal")]
+ private static extern void TKG_OnEvent_GameEnd(string levelId, int result);
+
+ // other
+ [DllImport("__Internal")]
+ private static extern void TKG_Review();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OpenPrivacyURL();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OpenUserTermURL();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OpenPolicyPop();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_OpenMoreGame();
+
+ // ads
+ [DllImport("__Internal")]
+ private static extern void TKG_LoadBanner();
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_IsReadyBanner();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_ShowBanner(int align);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_HideBanner();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_LoadIntersititial();
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_IsReadyIntersititial();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_ShowIntersititial(string adPos,int ivType);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_LoadRewardVideo();
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_IsReadyRewardVideo();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_ShowRewardVideo(string adPos);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_LoadNative(float width, float height);
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_IsReadyNative();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_ShowNative(float x, float y, float w, float h, string adPos);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_RemoveNative();
+
+ // remote config
+ [DllImport("__Internal")]
+ private static extern int TKG_GetConfigInt(string key, int defaultValue);
+
+ [DllImport("__Internal")]
+ private static extern string TKG_GetConfigString(string key, string defaultValue);
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_GetConfigBool(string key, bool defaultValue);
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_SetLogged(bool enable);
+
+ [DllImport("__Internal")]
+ private static extern bool TKG_RemoveAds();
+
+ // callback
+ // iv close
+ [DllImport("__Internal")]
+ public static extern void interAdCloseCallback(
+ IntPtr interClose
+ );
+
+ // rv close
+ [DllImport("__Internal")]
+ public static extern void rewardAdCloseCallback(
+ IntPtr rewardClose
+ );
+
+ // rv click
+ [DllImport("__Internal")]
+ public static extern void rewardAdClickCallback(
+ IntPtr rewardClick
+ );
+
+ // rv show fail
+ [DllImport("__Internal")]
+ public static extern void rewardAdShowFailCallback(
+ IntPtr rewardShowFail
+ );
+
+ // pause game
+ [DllImport("__Internal")]
+ public static extern void pauseGameCallback(
+ IntPtr pauseGame
+ );
+
+ // init sdk
+ [DllImport("__Internal")]
+ public static extern void initSDKCallback(
+ IntPtr initSdk
+ );
+
+ // user source
+ [DllImport("__Internal")]
+ public static extern void userSourceCallback(
+ IntPtr userSource
+ );
+
+ // 设置unity版本
+ [DllImport("__Internal")]
+ private static extern void TKG_SetUnityVersion(string version);
+
+ // 通知
+ [DllImport("__Internal")]
+ private static extern void TKG_RegistAPNS();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_RemoveAllNotification();
+
+ [DllImport("__Internal")]
+ private static extern void TKG_RemoveNotification(string notiId);
+
+ [DllImport("__Internal")]
+ private static extern void TKG_RegistNotification(string notiId, string body, string fireDate, int badge, string title, string subTitle);
+
+ // ============================ old sdk todo ========================
+
+ //设置log开关
+ public void SetLogEnable(bool enable)
+ {
+ TKG_SetLogged(enable);
+ }
+
+ public void SetUnitySDKVersion(string version)
+ {
+ TKG_SetUnityVersion(version);
+ }
+}
+
+#endif
diff --git a/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs.meta b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs.meta
new file mode 100644
index 00000000..f538460a
--- /dev/null
+++ b/Assets/TKGSDK/Common/internal/iOS/TGiOSAdmanager.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c4796c003fbf746869238b54b37eab3b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config.meta b/Assets/TKGSDK/Config.meta
new file mode 100644
index 00000000..164c1f5e
--- /dev/null
+++ b/Assets/TKGSDK/Config.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 6fb27b1d36bb84b9784a282b702a3ce0
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigKeys.cs b/Assets/TKGSDK/Config/ConfigKeys.cs
new file mode 100644
index 00000000..8a7a7058
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigKeys.cs
@@ -0,0 +1,79 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Touka
+{
+ public class ConfigKeys
+ {
+ #region App info
+
+ // app name
+ public const string KEY_AppName = "app_name";
+ // bundle id
+ public const string KEY_BunldId = "package_name";
+
+ #endregion
+
+ #region Analytics
+ // umeng
+ public const string KEY_UMENG_APPKEY = "um_app_key";
+ public const string KEY_UMENG_CHANNELID = "channel";
+
+ // ga
+ public const string KEY_GA_gameKey = "ga_key";
+ public const string KEY_GA_secretKey = "ga_secretkey";
+
+ // tenjin
+ public const string KEY_TENJIN_KEY = "tenjin_api_key";
+
+ #endregion
+
+ #region Ads
+
+ // admob id
+ public const string KEY_Admob_AppID = "admob_id";
+
+ // app id
+ public const string KEY_TOUKA_SDK_APPID = "ad_appid";
+ // app key
+ public const string KEY_TOUKA_SDK_APPKEY = "ad_appkey";
+
+ // iv id
+ public const string KEY_TOUKA_SDK_INTERID = "ad_interstital_id";
+ // rv id
+ public const string KEY_TOUKA_SDK_REWARDID = "ad_reward_id";
+ // splash id
+ public const string KEY_TOUKA_SDK_SPLASHID = "ad_splash_id";
+
+ // template native id // iOS use
+ public const string KEY_TOUKA_SDK_NATIVEID = "ad_templete_natvie_id";
+ // render native id
+ public const string KEY_TOUKA_SDK_RENDERNATIVEID = "ad_render_native_id";
+ // banner id
+ public const string KEY_TOUKA_SDK_BANNERID = "ad_banner_id";
+ // native banner id
+ public const string KEY_TOUKA_SDK_NATIVEBANNERID = "ad_native_banner_id";
+ // native splash id
+ public const string KEY_TOUKA_SDK_NATIVESPLASHID = "ad_native_splash_id";
+
+
+ #endregion
+
+ #region Basic Config
+ // PlayerAge
+ public const string KEY_PlayerAge = "tka_age";
+ // GameTheme
+ public const string KEY_GameTheme = "tka_theme";
+ // privacy url
+ public const string KEY_PrivacyURL = "tka_url_privacy";
+ // agreement url
+ public const string KEY_AgreementURL = "tka_url_agreement";
+ // more game url
+ public const string KEY_MoreGameURL = "tka_url_moregame";
+
+ #endregion
+
+ }
+
+}
diff --git a/Assets/TKGSDK/Config/ConfigKeys.cs.meta b/Assets/TKGSDK/Config/ConfigKeys.cs.meta
new file mode 100644
index 00000000..691602ab
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigKeys.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: f6f1983a87ac847b694ceaea128c3867
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigTools.meta b/Assets/TKGSDK/Config/ConfigTools.meta
new file mode 100644
index 00000000..70b2945f
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8dbadde55b7344be28aa3c3093247c8f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs b/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs
new file mode 100644
index 00000000..1ff7d5b8
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs
@@ -0,0 +1,58 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.Networking;
+
+namespace Touka
+{
+ public class TKGFileTools
+ {
+ ///
+ /// 通过UnityWebRequest获取本地StreamingAssets文件夹中的文件
+ ///
+ /// only for android .properties
+ ///
+ /// 文件名称
+ ///
+ public static string UnityWebRequestFile(string fileName)
+ {
+ string url = GetFileURL(fileName);
+ TKGDebugger.LogError("Warning: If an exception occurs, check whether the 「Assets/StreamingAssets/Configs/tkg_config.properties」 file exists : " + url);
+ UnityWebRequest request = UnityWebRequest.Get(url);
+ request.SendWebRequest();//读取数据
+ while (true)
+ {
+ if (request.downloadHandler.isDone)//是否读取完数据
+ {
+ return request.downloadHandler.text;
+ }
+ }
+ }
+
+ ///
+ /// get file url
+ ///
+ ///
+ ///
+ public static string GetFileURL(string fileName)
+ {
+ string url = "";
+
+ #region 分平台判断 StreamingAssets 路径
+ //如果在编译器或者单机中
+ #endregion
+
+#if UNITY_EDITOR || UNITY_STANDALONE
+ url = "file://" + Application.dataPath + "/StreamingAssets/" + fileName;
+ //否则如果在Iphone下
+#elif UNITY_IPHONE
+ url = "file://" + Application.dataPath + "/Raw/"+ fileName;
+ //否则如果在android下
+#elif UNITY_ANDROID
+ url = "jar:file://" + Application.dataPath + "!/assets/"+ fileName;
+#endif
+ return url;
+ }
+
+ }
+}
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs.meta b/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs.meta
new file mode 100644
index 00000000..f6c54732
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGFileTools.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b3f79e2611bd44fde98da03664dc68ea
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs
new file mode 100644
index 00000000..24450ba5
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs
@@ -0,0 +1,93 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Xml;
+using UnityEngine;
+
+namespace Touka
+{
+ public class TKGLoadPlistConfig
+ {
+ static string resourcePath = Application.dataPath;
+ static string extraStr = ".plist";
+
+ public static PlayerPrefPair[] GetToukaConfig( string _configFile , string region)
+ {
+ return GetAllFromPlist(resourcePath + "/Configs/"+region+"/" + _configFile + extraStr);
+ }
+
+ public static PlayerPrefPair[] GetAllFromPlist(string _configPath)
+ {
+ if (File.Exists(_configPath))
+ {
+ object plist = TKGPlist.readPlist(_configPath);
+ Dictionary parsed = plist as Dictionary;
+
+ PlayerPrefPair[] tempPlayerPrefs = new PlayerPrefPair[parsed.Count];
+ int i = 0;
+ foreach (KeyValuePair pair in parsed)
+ {
+ if (pair.Value.GetType() == typeof(double))
+ {
+ // Some float values may come back as double, so convert them back to floats
+ tempPlayerPrefs[i] = new PlayerPrefPair() { Key = pair.Key, Value = (float)(double)pair.Value };
+ }
+ else
+ {
+ tempPlayerPrefs[i] = new PlayerPrefPair() { Key = pair.Key, Value = pair.Value };
+ }
+
+ i++;
+ }
+ return tempPlayerPrefs;
+ }
+ else
+ {
+ Debug.LogError(_configPath + " Not Exist!");
+ return new PlayerPrefPair[0];
+ }
+ }
+
+ public static PlayerPrefPair[] GetAllFromXML(string _configPath)
+ {
+ if (File.Exists(resourcePath + _configPath + ".xml"))
+ {
+ TextAsset configText = (TextAsset)Resources.Load(_configPath);
+
+ object plist = TKGPlist.readPlistSource(configText.text);
+ Dictionary parsed = plist as Dictionary;
+
+ PlayerPrefPair[] tempPlayerPrefs = new PlayerPrefPair[parsed.Count];
+ int i = 0;
+ foreach (KeyValuePair pair in parsed)
+ {
+ if (pair.Value.GetType() == typeof(double))
+ {
+ // Some float values may come back as double, so convert them back to floats
+ tempPlayerPrefs[i] = new PlayerPrefPair() { Key = pair.Key, Value = (float)(double)pair.Value };
+ }
+ else
+ {
+ tempPlayerPrefs[i] = new PlayerPrefPair() { Key = pair.Key, Value = pair.Value };
+ }
+
+ i++;
+ }
+ return tempPlayerPrefs;
+ }
+ else
+ {
+ Debug.LogError(_configPath + " Not Exist!");
+ return new PlayerPrefPair[0];
+ }
+ }
+ }
+}
+
+
+public struct PlayerPrefPair
+{
+ public string Key { get; set; }
+
+ public object Value { get; set; }
+}
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs.meta b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs.meta
new file mode 100644
index 00000000..4c5d4531
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPlistConfig.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: fc8e0e50a0f134006ba379d27b5e42ea
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs
new file mode 100644
index 00000000..9ffc98ee
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs
@@ -0,0 +1,61 @@
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using UnityEngine;
+
+namespace Touka
+{
+ public class TKGLoadPropertiesConfig : MonoBehaviour
+ {
+ static string resourcePath = Application.dataPath + "/"; // + "Configs/";
+ static string toukaconfigConfigPath = "Configs/";
+ static string toukaconfigPathCN = "CN/";
+ static string toukaconfigPathGB = "GB/";
+ static string toukaConfigFileName = "tkg_config";
+
+ static string extraStr = ".properties";
+
+ public static PlayerPrefPair[] GetToukaConfig(AppChannel _appChannel)
+ {
+ string configpath = "";
+ if(_appChannel == AppChannel.GooglePlay)
+ {
+ configpath = toukaconfigPathGB;
+ }
+ else
+ {
+ configpath = toukaconfigPathCN;
+ }
+
+ return GetAllFromProperties(toukaconfigConfigPath + configpath + toukaConfigFileName + extraStr);
+ }
+
+ public static PlayerPrefPair[] GetAllFromProperties(string _configPath)
+ {
+ string path = resourcePath + _configPath;
+ TKGDebugger.LogDebug("GetAllFromProperties path : " + path + " , _configPath : " + _configPath);
+
+ Hashtable ht = TKGProperties.Load(path);
+ if(ht.Count > 0)
+ {
+ PlayerPrefPair[] tempPlayerPrefs = new PlayerPrefPair[ht.Count];
+ int i = 0;
+ foreach (string key in ht.Keys)
+ {
+ tempPlayerPrefs[i] = new PlayerPrefPair() { Key = key, Value = ht[key] };
+ i++;
+ }
+
+ return tempPlayerPrefs;
+ }
+ else
+ {
+ TKGDebugger.LogDebug("Config is null, path : " + path);
+ return new PlayerPrefPair[0];
+ }
+
+
+ }
+ }
+
+}
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs.meta b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs.meta
new file mode 100644
index 00000000..34087827
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGLoadPropertiesConfig.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1033ac15a5e2645579fa3e884ef3db23
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/TKGSDK/Config/ConfigTools/TKGPlist.cs b/Assets/TKGSDK/Config/ConfigTools/TKGPlist.cs
new file mode 100644
index 00000000..f85c0638
--- /dev/null
+++ b/Assets/TKGSDK/Config/ConfigTools/TKGPlist.cs
@@ -0,0 +1,961 @@
+//
+// PlistCS Property List (plist) serialization and parsing library.
+//
+// https://github.com/animetrics/PlistCS
+//
+// Copyright (c) 2011 Animetrics Inc. (marc@animetrics.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+
+namespace Touka
+{
+ public static class TKGPlist
+ {
+ private static List offsetTable = new List();
+ private static List objectTable = new List();
+ private static int refCount;
+ private static int objRefSize;
+ private static int offsetByteSize;
+ private static long offsetTableOffset;
+
+ #region Public Functions
+
+ public static object readPlist(string path)
+ {
+ using (FileStream f = new FileStream(path, FileMode.Open, FileAccess.Read))
+ {
+ return readPlist(f, plistType.Auto);
+ }
+ }
+
+ public static object readPlistSource(string source)
+ {
+ return readPlist(System.Text.Encoding.UTF8.GetBytes(source));
+ }
+
+ public static object readPlist(byte[] data)
+ {
+ return readPlist(new MemoryStream(data), plistType.Auto);
+ }
+
+ public static plistType getPlistType(Stream stream)
+ {
+ byte[] magicHeader = new byte[8];
+ stream.Read(magicHeader, 0, 8);
+
+ if (BitConverter.ToInt64(magicHeader, 0) == 3472403351741427810)
+ {
+ return plistType.Binary;
+ }
+ else
+ {
+ return plistType.Xml;
+ }
+ }
+
+ public static object readPlist(Stream stream, plistType type)
+ {
+ if (type == plistType.Auto)
+ {
+ type = getPlistType(stream);
+ stream.Seek(0, SeekOrigin.Begin);
+ }
+
+ if (type == plistType.Binary)
+ {
+ using (BinaryReader reader = new BinaryReader(stream))
+ {
+ byte[] data = reader.ReadBytes((int) reader.BaseStream.Length);
+ return readBinary(data);
+ }
+ }
+ else
+ {
+ XmlDocument xml = new XmlDocument();
+ xml.XmlResolver = null;
+ xml.Load(stream);
+ return readXml(xml);
+ }
+ }
+
+ public static void writeXml(object value, string path)
+ {
+ using (StreamWriter writer = new StreamWriter(path))
+ {
+ writer.Write(writeXml(value));
+ }
+ }
+
+ public static void writeXml(object value, Stream stream)
+ {
+ using (StreamWriter writer = new StreamWriter(stream))
+ {
+ writer.Write(writeXml(value));
+ }
+ }
+
+ public static string writeXml(object value)
+ {
+ using (MemoryStream ms = new MemoryStream())
+ {
+ XmlWriterSettings xmlWriterSettings = new XmlWriterSettings();
+ xmlWriterSettings.Encoding = new System.Text.UTF8Encoding(false);
+ xmlWriterSettings.ConformanceLevel = ConformanceLevel.Document;
+ xmlWriterSettings.Indent = true;
+
+ using (XmlWriter xmlWriter = XmlWriter.Create(ms, xmlWriterSettings))
+ {
+ xmlWriter.WriteStartDocument();
+ //xmlWriter.WriteComment("DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" " + "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"");
+ xmlWriter.WriteDocType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd", null);
+ xmlWriter.WriteStartElement("plist");
+ xmlWriter.WriteAttributeString("version", "1.0");
+ compose(value, xmlWriter);
+ xmlWriter.WriteEndElement();
+ xmlWriter.WriteEndDocument();
+ xmlWriter.Flush();
+ xmlWriter.Close();
+ return System.Text.Encoding.UTF8.GetString(ms.ToArray());
+ }
+ }
+ }
+
+ public static void writeBinary(object value, string path)
+ {
+ using (BinaryWriter writer = new BinaryWriter(new FileStream(path, FileMode.Create)))
+ {
+ writer.Write(writeBinary(value));
+ }
+ }
+
+ public static void writeBinary(object value, Stream stream)
+ {
+ using (BinaryWriter writer = new BinaryWriter(stream))
+ {
+ writer.Write(writeBinary(value));
+ }
+ }
+
+ public static byte[] writeBinary(object value)
+ {
+ offsetTable.Clear();
+ objectTable.Clear();
+ refCount = 0;
+ objRefSize = 0;
+ offsetByteSize = 0;
+ offsetTableOffset = 0;
+
+ //Do not count the root node, subtract by 1
+ int totalRefs = countObject(value) - 1;
+
+ refCount = totalRefs;
+
+ objRefSize = RegulateNullBytes(BitConverter.GetBytes(refCount)).Length;
+
+ composeBinary(value);
+
+ writeBinaryString("bplist00", false);
+
+ offsetTableOffset = (long)objectTable.Count;
+
+ offsetTable.Add(objectTable.Count - 8);
+
+ offsetByteSize = RegulateNullBytes(BitConverter.GetBytes(offsetTable[offsetTable.Count-1])).Length;
+
+ List offsetBytes = new List();
+
+ offsetTable.Reverse();
+
+ for (int i = 0; i < offsetTable.Count; i++)
+ {
+ offsetTable[i] = objectTable.Count - offsetTable[i];
+ byte[] buffer = RegulateNullBytes(BitConverter.GetBytes(offsetTable[i]), offsetByteSize);
+ Array.Reverse(buffer);
+ offsetBytes.AddRange(buffer);
+ }
+
+ objectTable.AddRange(offsetBytes);
+
+ objectTable.AddRange(new byte[6]);
+ objectTable.Add(Convert.ToByte(offsetByteSize));
+ objectTable.Add(Convert.ToByte(objRefSize));
+
+ var a = BitConverter.GetBytes((long) totalRefs + 1);
+ Array.Reverse(a);
+ objectTable.AddRange(a);
+
+ objectTable.AddRange(BitConverter.GetBytes((long)0));
+ a = BitConverter.GetBytes(offsetTableOffset);
+ Array.Reverse(a);
+ objectTable.AddRange(a);
+
+ return objectTable.ToArray();
+ }
+
+ #endregion
+
+ #region Private Functions
+
+ private static object readXml(XmlDocument xml)
+ {
+ XmlNode rootNode = xml.DocumentElement.ChildNodes[0];
+ return parse(rootNode);
+ }
+
+ private static object readBinary(byte[] data)
+ {
+ offsetTable.Clear();
+ List offsetTableBytes = new List();
+ objectTable.Clear();
+ refCount = 0;
+ objRefSize = 0;
+ offsetByteSize = 0;
+ offsetTableOffset = 0;
+
+ List bList = new List(data);
+
+ List trailer = bList.GetRange(bList.Count - 32, 32);
+
+ parseTrailer(trailer);
+
+ objectTable = bList.GetRange(0, (int)offsetTableOffset);
+
+ offsetTableBytes = bList.GetRange((int)offsetTableOffset, bList.Count - (int)offsetTableOffset - 32);
+
+ parseOffsetTable(offsetTableBytes);
+
+ return parseBinary(0);
+ }
+
+ private static Dictionary parseDictionary(XmlNode node)
+ {
+ XmlNodeList children = node.ChildNodes;
+ if (children.Count % 2 != 0)
+ {
+ throw new DataMisalignedException("Dictionary elements must have an even number of child nodes");
+ }
+
+ Dictionary dict = new Dictionary();
+
+ for (int i = 0; i < children.Count; i += 2)
+ {
+ XmlNode keynode = children[i];
+ XmlNode valnode = children[i + 1];
+
+ if (keynode.Name != "key")
+ {
+ throw new ApplicationException("expected a key node");
+ }
+
+ object result = parse(valnode);
+
+ if (result != null)
+ {
+ dict.Add(keynode.InnerText, result);
+ }
+ }
+
+ return dict;
+ }
+
+ private static List