123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using Engine.Http;
- using System;
- /// <summary>消息工具类</summary>
- public class HttpStaticMessage
- {
- //httpRequest.Code 是用来返回请求的时候区别是哪个消息返回的数据
- /// <summary>发送Http请求获取玩家信息</summary>
- public static void SendHttpLogin(string user_name, string pwd, string code, Action<HttpResponse> 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<HttpResponse> 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);
- }
- /// <summary>获取题库</summary>
- 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加密的
- }
- }
|