using System.Collections; using System.Collections.Generic; using UnityEngine; public class WebRequestBackgroundData { //体验流水数据 public static string flowData = WebRequestBackgroundPrefix.WebRequestPrefixData + "/api/product-data-access/evaluate-flow-data/add"; //软件编码 public static string softwareCode = "ZWN_SW_UNITY_LLK_001"; //token public static string tokenData = ""; //public static string tokenData = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ6ZWV3YWluIiwidXNlcklkIjoyNzUwMDUyNDUzMDA5ODE4MywidXNlckNvZGUiOiJ6d25fMjc1MDA1MjQ1MzAwOTgxODQiLCJleHBpcmVUaW1lIjoxNjQzODYwNTYzNTYwLCJleHAiOjE2NDM4NjA1NjN9.OBj7a5AxqtGThiaKOzez78pRsgUPeObdZMt1ESwkr4c"; //Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ6ZWV3YWluIiwidXNlcklkIjoyNzUwMDUyNDUzMDA5ODE4MywidXNlckNvZGUiOiJ6d25fMjc1MDA1MjQ1MzAwOTgxODQiLCJleHBpcmVUaW1lIjoxNjQzODYwNTYzNTYwLCJleHAiOjE2NDM4NjA1NjN9.OBj7a5AxqtGThiaKOzez78pRsgUPeObdZMt1ESwkr4c // todo: For Project LinkGame 需要移出去 /// /// 发送服务器数据和接收游戏总时长 /// /// 准确率 /// 体验时长,单位(秒) /// 专注评价 /// 课件关卡 /// 反应评价 /// 运动评价 /// public static int GetFlowData(string correctRate, int experienceTime, string focusResult, int gameLevel,string reactionResult, string sportResult) { string stateUrl = flowData; string softwareCode = WebRequestBackgroundData.softwareCode; string heraddata = tokenData; int gameTotalduration = 0; string requestJson = string.Format(@"{{""correctRate"":""{0}"",""experienceTime"":{1},""focusResult"":""{2}"",""gameLevel"":{3},""reactionResult"":""{4}"",""softwareCode"":""{5}"",""sportResult"":""{6}""}}", correctRate, experienceTime, focusResult, gameLevel, reactionResult, softwareCode, sportResult); if (string.IsNullOrEmpty(heraddata)) { } else { HttpWebRequsetManger.SendHttpData(heraddata, stateUrl, requestJson, (string data) => { JsonBackgroundFlowData jsonEmpowerData = ReadJosn.LoadJson(data); if (jsonEmpowerData.code == 0) { gameTotalduration = jsonEmpowerData.data.evaluateTime / 60; } else { Debug.Log("code不为0 message" + jsonEmpowerData.message); } }); } return gameTotalduration; } }