Dictionary <string, object> changeBaseDataToHttpPostData(U3DTypeBaseData _in_data) { Dictionary <string, object> attMap = _in_data.attMap(); string outString = ""; // foreach (string key in attMap.Keys) // { // if ("data_ins_key" == key) // continue; // // outString += "&"+key+"="+attMap[key].ToString(); // } // outString = "?" + outString.Substring (1)+"&sign=sign" ; attMap.Add("sign", "sign"); return(attMap); }
public string changeBaseDataToHttpData(U3DTypeBaseData _in_data) { Dictionary <string, object> attMap = _in_data.attMap(); string outString = ""; foreach (string key in attMap.Keys) { if ("data_ins_key" == key) { continue; } outString += "&" + key + "=" + attMap[key].ToString(); } outString = "?" + outString.Substring(1); return(outString); }
// /////server logic/////// /// ; void ServerCBK_login(string data, UnityEngine.Object crossData) { U3DTypeBaseData result = new U3DTypeBaseData(); result.StringToData(data); if (null == result.attMap()) { Debug.Log("error string to data in server cbk login"); } if (null != result && "" != result.GetData("uid")) { U3DTypeBaseData userinfo = U3DTypeSDK.Instance.GetUserData(); userinfo.SetData(U3DTypeAttName.USER_ID, result.GetData("uid")); userinfo.SetData(U3DTypeAttName.USER_TOKEN, result.GetData("token")); ActionGetAccount(); } current_ui_model = UI_MENU; // go to menu messageStr = data; }
void ServerCBK_getAccount(string data, UnityEngine.Object crossData) { Debug.Log("ServerCBK_getAccount is :" + data); U3DTypeBaseData result = new U3DTypeBaseData(); result.StringToData(data); if (null != result) { Debug.Log("null != result :"); if (0 != result.GetInt("code")) { Debug.Log("AcitonCreatAccount:"); AcitonCreatAccount(); } else { Debug.Log("localUserData is ///////:" + U3DTypeSDK.Instance.GetUserData().DataToString()); if (null == localUserData) { localUserData = U3DTypeSDK.Instance.GetUserData(); } localUserData.SetData(U3DTypeAttName.USER_ID, result.GetData("uid")); localUserData.SetData(U3DTypeAttName.USER_TOKEN, result.GetData("token")); //以下内容请开发者如实填写实际内容,demo仅供参考 //如果没有该内容,请填"0" localUserData.SetData(U3DTypeAttName.ROLE_TYPE, "createRole"); localUserData.SetData(U3DTypeAttName.SAVED_BALANCE, "0"); localUserData.SetData(U3DTypeAttName.USER_NAME, "qudaoyonghu_001"); localUserData.SetData(U3DTypeAttName.USER_HEAD_ID, "head_001"); localUserData.SetData(U3DTypeAttName.USER_HEAD_URL, "head_url_001"); localUserData.SetData(U3DTypeAttName.VIP_LEVEL, "v10"); localUserData.SetData(U3DTypeAttName.PARTY_NAME, "gonghui"); localUserData.SetData(U3DTypeAttName.ROLE_ID, "role_001"); localUserData.SetData(U3DTypeAttName.ROLE_NAME, "role_name_001"); localUserData.SetData(U3DTypeAttName.ROLE_LEVEL, "99"); localUserData.SetData(U3DTypeAttName.ROLE_CREATE_TIME, "1234567890"); localUserData.SetData(U3DTypeAttName.ROLE_LEVELUP_TIME, "2345678901"); localUserData.SetData(U3DTypeAttName.ZONE_ID, "zone_1"); localUserData.SetData(U3DTypeAttName.SERVER_ID, "1"); localUserData.SetData(U3DTypeAttName.SERVER_NAME, "server_name"); localUserData.SetData(U3DTypeAttName.EXTRA, "1"); //end U3DTypeSDK.Instance.UpdatePlayerInfo(); Debug.Log("UpdatePlayerInfo is ///////:" + U3DTypeSDK.Instance.GetUserData().DataToString()); localUserData.attMap()["data"] = result.attMap()["data"]; int tempBalance = getUserBalance(); if (userBalance != tempBalance) { StopRepeatRequestIntoAccount(); userBalance = tempBalance; } messageStr = "id " + result.GetData("uid") + "update余额 " + userBalance; // U3DTypeSDK.Instance.GetUserData() ; // U3DTypeSDK.Instance.UpdatePlayerInfo(); Debug.Log("U3DTypeSDK.Instance.GetUserData() is :" + U3DTypeSDK.Instance.GetUserData().DataToString()); } } }
Dictionary <string, object> getUserDataMap() { Dictionary <string, object> dataMap = (Dictionary <string, object>)localUserData.attMap()["data"]; return(dataMap); }