hch
5 天以前 e8d63e91d80cc59d7947ad026149c2b752ce9364
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package com.secondworld.sdk;
 
import android.Manifest;
import android.content.Context;
import android.widget.Toast;
 
import com.bytedance.applog.AppLog;
import com.bytedance.applog.InitConfig;
import com.bytedance.applog.game.GameReportHelper;
import com.bytedance.applog.util.UriConstants;
import com.bytedance.hume.readapk.HumeSDK;
import com.quicksdk.User;
import com.secondworld.sdk.utils.LogUtil;
 
import org.json.JSONException;
import org.json.JSONObject;
 
import java.util.Arrays;
 
public class BtGamePlatform extends PlatformDiff {
 
    @Override
    public String platformName() {
        return "hygame";
    }
 
    @Override
    public  String platformProductCode()  {
        return "84324345567485956654600331002691";
    }
 
    @Override
    public  String platformProductKey() {
        return "12355811";
    }
 
    @Override
    public void CreateRoleEvent(String roleID)
    {
        GameReportHelper.onEventCreateGameRole(roleID);
    }
 
    //mount单位为分
    @Override
    public void PayEvent(String title, String goodsID, double mount)
    {
        //内置事件 “支付”,属性:商品类型,商品名称,商品ID,商品数量,支付渠道,币种,是否成功(必传),金额(必传)
        // 付费金额单位为元
        //mount为元,0.1折 需除以100获得真实金额,但抖音必须传元 向上取整,则充6分钱上报是1元 造成数据偏差
        int reportMoney = (int)Math.ceil(mount/100);
        LogUtil.i("unity", "reportMoney " + title + " " + reportMoney);
        GameReportHelper.onEventPurchase("gift", title, goodsID,1, "youxitu","¥", true, reportMoney);
 
    }
 
    @Override
    public void PrePayEvent(String title, String goodsID, double mount)
    {
        //关键行为
        JSONObject paramsObj = new JSONObject();
        try {
            paramsObj.put("origin_event", "prepay"); // 添加原始事件名称参数
        } catch (JSONException e) {
            e.printStackTrace();
        }
        AppLog.onEventV3("game_addiction", paramsObj);
    }
 
    @Override
    public void OnCreate(Context var0)
    {
        String channel = "dy";
 
        /* 初始化SDK开始 */
        // 第一个参数APPID: 参考2.1节获取
        // 第二个参数CHANNEL: 填写渠道信息,请注意不能为空
        final InitConfig config = new InitConfig("520784", channel);
        // 设置数据上送地址
        config.setUriConfig(UriConstants.DEFAULT);
        config.setImeiEnable(false);//建议关停获取IMEI(出于合规考虑)
        config.setAutoTrackEnabled(true); // 全埋点开关,true开启,false关闭
        config.setLogEnable(false); // true:开启日志,参考4.3节设置logger,false:关闭日志
        AppLog.setEncryptAndCompress(true); // 加密开关,true开启,false关闭
        config.setMacEnable(false);
        config.setOperatorInfoEnabled(false);
        config.setEnablePlay(true);
        config.setAutoStart(false);
        //AppLog.init(var0, config, GameActivityProxy.I.activity);
        AppLog.init(var0, config);
        /* 初始化SDK结束 */
 
 
    }
 
 
    @Override
    public String[] platformPermission()
    {
        //return new String[] { Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE};
        return new String[] {};
    }
 
 
    @Override
    public void LoginSuccess()
    {
        LogUtil.i("unity", "LoginSuccess");
        GameReportHelper.onEventRegister("youxitu",true);
    }
 
    @Override
    public void StartRequestPermission()
    {
        //获取渠道名称 context为宿主的context
        String channel = HumeSDK.getChannel(GameAppProxy.app.getApplicationContext());
        if (channel == null || channel.isEmpty())
        {
            channel = "dy";
        }
        //获取humeSDK版本号
        String version = HumeSDK.getVersion();
 
        LogUtil.i("HumeSDK", "DYStart " + channel + " "+ version);
        AppLog.getInitConfig().setChannel(channel);
        AppLog.start();
    }
 
}