Exemplo n.º 1
0
    //IEnumerator PostRequest(string eventId, UpLoadBuryData upLoadBuryData)
    //{
    //    var uwr = new UnityWebRequest(Config.UpLoadBuryUrl, "POST");

    //    string data = upLoadBuryData.getJson();

    //    byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes(data);
    //    uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend);
    //    uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
    //    uwr.SetRequestHeader("Content-Type", "application/json");

    //    //Send the request then wait here until it returns
    //    yield return uwr.SendWebRequest();

    //    if (uwr.isNetworkError)
    //    {
    //        Debug.Log("Error While Sending: " + uwr.error);
    //    }
    //    else
    //    {
    //        Debug.Log("Received: " + uwr.downloadHandler.text);
    //    }
    //}
    #endregion

    public void Test()
    {
        UpLoadBuryStateData upLoadBuryStateData = new UpLoadBuryStateData();

        upLoadBuryStateData.action = "testUploadStart";
        UpLoad(upLoadBuryStateData);

        TestBuryData testBuryData = new TestBuryData();

        testBuryData.action = "test";
        UpLoad(testBuryData);

        LevelStartBuryData levelBuryData = new LevelStartBuryData();

        levelBuryData.action = "testStartLevel";
        UpLoad(levelBuryData);

        ButtonBuryData buttonBuryData = new ButtonBuryData();

        buttonBuryData.action = "testButtonTrigger";
        UpLoad(buttonBuryData);

        ServerIPABuryData serverIPABuryData = new ServerIPABuryData();

        serverIPABuryData.action = "testServerIPA";
        UpLoad(serverIPABuryData);

        ADBuryData aDBuryData = new ADBuryData();

        aDBuryData.action = "testAdPlay";
        UpLoad(aDBuryData);
        // StartCoroutine(PostRequest(test,testBuryData));
    }
Exemplo n.º 2
0
    /// <summary>
    /// 广告播放开始埋点(此方法必须与Event_Ad_End函数成对使用,否则不会发送到友盟)
    /// </summary>
    /// <param name="_adTeam">广告商</param>
    /// <param name="_AdPlayType">广告类型</param>
    public void Event_Ad_Start(string _adTeam, AdPlayType _AdPlayType, bool _clear)
    {
        if (_clear)
        {
            if (_AdPlayType == AdPlayType.Banner)
            {
                if (adBuryData_Banner != null && adBuryData_Banner.adTeam.Count > 0)
                {
                    UpLoad(adBuryData_Banner);
                }
                adBuryData_Banner        = new ADBuryData_Banner();
                adBuryData_Banner.action = AdPlay;
            }
            else
            {
                adBuryData        = new ADBuryData();
                adBuryData.action = AdPlay;
            }
        }
        if (_AdPlayType == AdPlayType.Banner)
        {
            adBuryData_Banner.playTime.Add(System.DateTime.Now + "");
        }
        else
        {
            adBuryData.playTime.Add(System.DateTime.Now + "");
        }
        //是否清空缓存
        //if (_clear)
        //{
        //    if (_AdPlayType == AdPlayType.Banner)
        //        adBuryData_Banner = new ADBuryData_Banner();
        //    else
        //        adBuryData = new ADBuryData();

        //    adBuryData.action = AdPlay;

        //}

        //if (_AdPlayType == AdPlayType.Banner)
        //{
        //    adBuryData_Banner.playTime.Add(System.DateTime.Now + "");
        //}
        //else
        //{
        //    adBuryData.playTime.Add(System.DateTime.Now + "");
        //    adBuryData.adTeam.Add(_adTeam);
        //    adBuryData.adPlayType.Add(_AdPlayType.ToString());
        //}
    }