Ejemplo n.º 1
0
        /// <summary>
        /// DYB 进入游戏上报玩家数据
        /// </summary>
        public void reportDYBUserData()
        {
            WWWForm form     = new WWWForm();
            string  userID   = Account.Instance.AccountId.ToString();
            string  playerID = PlayerData.Instance.RoleID.ToString();
            string  serverID = Account.Instance.ServerId.ToString();
            string  key      = "a0c6739105a24ce9c2c8a3109d6d6c33";

            //md5 key值
            string md5 = Md5Util.MD5Encrypt(serverID + userID + playerID + key);

            form.AddField("serverid", serverID);
            form.AddField("userID", userID);
            form.AddField("playerID", playerID);

            form.AddField("token", md5);

            Dictionary <string, string> data = new Dictionary <string, string>();

            data["userID"]     = userID;
            data["playerID"]   = playerID;
            data["serverid"]   = serverID;
            data["servername"] = Account.Instance.ServerName.ToString();
            string serverInfo = JsonMapper.ToJson(data);

            form.AddField("data", serverInfo);

            Debug.Log("上报信息token: serverID : " + serverID + " userID:" + userID + " playerID:" + playerID + " key:" + key);

            //进入游戏上报
            int sdkType    = ClientSetting.Instance.GetIntValue("thirdPartyComponent");
            int subChannel = ClientSetting.Instance.GetIntValue("SubChannel");

            MonoInstance.Instance.StartCoroutine(PostPhp(GetLoggedUrl(sdkType, subChannel), form));
        }
Ejemplo n.º 2
0
    /// <summary>
    /// 获取37玩服务器列表
    /// </summary>
    /// <returns></returns>
    private IEnumerator GetSQWServerList()
    {
        if (SQWSDK.isLogin)
        {
            int isfail = 0;
            //获取历史和推荐服务器
            WWWForm form = new WWWForm();
            form.AddField("userID", SQWSDK.Instance.userID);
            //token加密
            string md5 = Md5Util.MD5Encrypt(SQWSDK.Instance.userID + "6842c6012614bd474f75d1067f3e805f");
            form.AddField("token", md5);
            Debug.Log("发送参数:" + "userID: " + SQWSDK.Instance.userID + "key; " + "6842c6012614bd474f75d1067f3e805f");
            Debug.Log("加密后:" + form.data.BytesToString());

            form.AddField("package", Application.bundleIdentifier);
            Debug.Log("package:" + Application.bundleIdentifier);

            int    sdkType         = ClientSetting.Instance.GetIntValue("thirdPartyComponent");
            int    subChannel      = ClientSetting.Instance.GetIntValue("SubChannel");
            string strLoginListUrl = SDKMgr.Instance.GetDefaultServersURL(sdkType, subChannel); //

            WWW history = new WWW(strLoginListUrl, form);
            yield return(history);

            if (history.isDone)
            {
                SQWSDK.Instance.sdkDefalutList = history.text;
                Debug.Log("LoginListUrl:" + strLoginListUrl + "  推荐服务器列表:" + SQWSDK.Instance.sdkDefalutList);
                //获取公共服务器列表
                WWWForm formServers = new WWWForm();
                formServers.AddField("userID", SQWSDK.Instance.userID);
                formServers.AddField("package", Application.bundleIdentifier);
                formServers.AddField("version", ClientSetting.Instance.GetIntValue("PackageVersion"));

                string key   = "7ada175d3828b656db7eda80dc7d58b3";
                string token = Md5Util.MD5Encrypt(key + SQWSDK.Instance.userID + Application.bundleIdentifier + ClientSetting.Instance.GetIntValue("PackageVersion"));
                formServers.AddField("token", token);
                string strServerListUrl = SDKMgr.Instance.GetServersURL(sdkType, subChannel);
                Debug.Log("ServerListUrl:" + strServerListUrl + "  发送服务器列表参数:" + "userID: " + SQWSDK.Instance.userID + "package: " + Application.bundleIdentifier + "version: " + ClientSetting.Instance.GetIntValue("PackageVersion"));
                WWW ser = new WWW(strServerListUrl, formServers);
                yield return(ser);

                if (ser.isDone)
                {
                    Debug.Log("服务器列表: " + ser.text);
                    SQWSDK.Instance.sdkServerList = ser.text;
                }
                else if (!string.IsNullOrEmpty(ser.error))
                {
                    isfail = 1;
                    Debug.Log("获取服务器列表失败:" + ser.error);
                }
            }
            else if (!string.IsNullOrEmpty(history.error))
            {
                isfail = 1;
                Debug.Log("获取推荐服务器列表失败:" + history.error);
            }

            //根据状态发送消息
            EventParameter ev = EventParameter.Get();
            ev.intParameter = isfail;//获取状态 0成功 1失败
            Debug.Log("服务器列表:" + isfail);
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_SQW_SERVERLIST, ev);
            if (1 == isfail)
            {
                UITips.ShowTips("重新刷新服务器列表");
                StartCoroutine(GetSQWServerList());
            }
        }
    }