using UnityEngine; using System.Collections; using System.Collections.Generic; using Engine.Http; using System; /// 消息工具类 public class HttpStaticMessage { //httpRequest.Code 是用来返回请求的时候区别是哪个消息返回的数据 /// 发送Http请求获取玩家信息 public static void SendHttpLogin(string user_name, string pwd, string code, Action callback) { HttpRequest req = HttpRequest.OnCreateRequest(); req.URL = GameEnum.ServerHttpURL + "login/"; req.Code = MsgConst.HTTP_MSG_LOGIN; req.AddParam("user_name", user_name); req.AddParam("password", pwd); req.AddParam("code", code);//验证码 req.AddParam("deviceId", CStaticMethod.SerialId()); req.AddParam("deviceType", CStaticMethod.DeviceType()); HttpManager.GetInstance().SendMessage(req, callback); } public static void HttpVisitorLogin(string vistor_name, Action callback) { HttpRequest req = HttpRequest.OnCreateRequest(); req.URL = GameEnum.ServerHttpURL + "login/"; req.Code = MsgConst.HTTP_MSG_AUTO_LOGIN; req.AddParam("user_name", CStaticMethod.SerialId()); req.AddParam("password", ""); req.AddParam("deviceId", CStaticMethod.SerialId()); req.AddParam("deviceType", CStaticMethod.DeviceType()); //httpRequest.AddParam("vistor_name", vistor_name); HttpManager.GetInstance().SendMessage(req, callback); } /// 获取题库 public static void SendHttpQuestion(int user_id, short course_id) { HttpRequest req = HttpRequest.OnCreateRequest(); req.URL = GameEnum.ServerHttpURL + "enter/"; req.Code = MsgConst.HTTP_MSG_GET_QUESTION; req.AddParam("user_id", user_id.ToString()); req.AddParam("course_id", course_id.ToString()); HttpManager.GetInstance().SendMessage(req); } public static void AutoSendHttpVerson(string ver, bool isDebug = false) { HttpRequest httpRequest = HttpRequest.OnCreateRequest(); httpRequest.URL = GameEnum.ServerHttpURL + "checkVer/"; httpRequest.Code = MsgConst.HTTP_MSG_VERSION; httpRequest.AddParam("ver", ver); httpRequest.AddParam("debug", (isDebug ? 1 : 0).ToString()); HttpManager.GetInstance().SendMessage(httpRequest); } public static string GetUniqueId() { return SystemInfo.deviceUniqueIdentifier;//设备唯一标识符 MD5加密的 } }