void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult"); U3DTypeBaseData data = evt.evtData; //string userName = data.GetData(U3DTypeAttName.USER_NAME); string userID = data.GetData(U3DTypeAttName.USER_ID); string userToken = data.GetData(U3DTypeAttName.USER_TOKEN); // Dictionary<string,string> dataArr = new Dictionary<string,string> (); U3DTypeBaseData platform = U3DTypeSDK.Instance.GetPlatformData(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("id", userID); baseData.SetData("token", userToken); baseData.SetData("data", ""); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); // baseData.SetData ("sign", userID + "|" + userToken + "|" + ""+"|"+platform.GetData(U3DTypeAttName.CHANNEL_ID)); // string dataArr = changeBaseDataToHttpData (baseData); // Debug.Log ("login sent to server data " + dataArr); DataProxy.Ins.ServerLogic.RequestLogin(this, baseData, ServerCBK_login, null); //send user info to server and exchange playerinfo; }
void ActionCreatePayOrder(string _in_item_id, string _in_item_price) { U3DTypeBaseData data = DataProxy.Ins.LocalLogic.userInfo(); // string userName = data.GetData(U3DTypeAttName.USER_NAME); string userID = data.GetData(U3DTypeAttName.USER_ID); // string userToken = data.GetData(U3DTypeAttName.USER_TOKEN); U3DTypeBaseData platform = DataProxy.Ins.LocalLogic.platform(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("uid", userID); baseData.SetData("pid", _in_item_id); baseData.SetData("sid", "1"); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); // baseData.freshSign(); // string dataArr = changeBaseDataToHttpData (baseData); localPayData.SetData(U3DTypeAttName.USER_ID, userID); localPayData.SetData(U3DTypeAttName.ITEM_SERVER_ID, _in_item_id); localPayData.SetData(U3DTypeAttName.REAL_PRICE, _in_item_price); Debug.Log("local pay data change to " + localPayData.DataToString()); Debug.Log("login sent to server data " + baseData.DataToString()); DataProxy.Ins.ServerLogic.RequestCreateOrder(this, baseData, ServerCBK_createOrder, null); }
public override void ShowLogin(string loginType) { Debug.Log("CallYSDKLogin"); U3DTypeBaseData data = new U3DTypeBaseData (); data.SetData(U3DTypeAttName.USER_ID,"testUserID"); data.SetData(U3DTypeAttName.USER_TOKEN,"testUserToken"); U3DTypeSDK.Instance.NotifyLogin (data.DataToString ()); }
public override string PayItem(U3DTypeBaseData _in_pay) { Debug.Log("CallPayItem" + "data: " + _in_pay.DataToString()); U3DTypeBaseData data = new U3DTypeBaseData (); data.SetData(U3DTypeAttName.PAY_RESULT,"1"); data.SetData(U3DTypeAttName.PAY_RESULT_DATA,"testSuccess"); U3DTypeSDK.Instance.NotifyPayResult (data.DataToString ()); return "test return billno"; }
public override U3DTypeBaseData GetPlatformData() { Debug.Log("CallPlatformData"); if (null == _win_plaform) { _win_plaform = new U3DTypeBaseData(); _win_plaform.SetData(U3DTypeAttName.SDK_NAME, "test"); _win_plaform.SetData(U3DTypeAttName.CHANNEL_ID, "1234567"); _win_plaform.SetData(U3DTypeAttName.CP_ID, "123"); } return(_win_plaform); }
public override U3DTypeBaseData GetUserData() { Debug.Log("CallUserData"); if (_win_userInfo == null) { _win_userInfo = new U3DTypeBaseData(); _win_userInfo.SetData(U3DTypeAttName.SDK_NAME, "test"); _win_userInfo.SetData(U3DTypeAttName.USER_ID, "testUserID_default"); _win_userInfo.SetData(U3DTypeAttName.USER_TOKEN, "testUserToken_default"); } return(_win_userInfo); }
void AcitonCreatAccount() { U3DTypeBaseData userInfo = DataProxy.Ins.LocalLogic.userInfo(); string userID = userInfo.GetData(U3DTypeAttName.USER_ID); U3DTypeBaseData platform = DataProxy.Ins.LocalLogic.platform(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("uid", userID); baseData.SetData("sid", "1"); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); // baseData.freshSign(); // string dataArr = changeBaseDataToHttpData (baseData); DataProxy.Ins.ServerLogic.RequestCreateAccount(this, baseData, ServerCBK_createAccount, null); }
public void SetLocalPush(string key, string message, double timeInterval) { U3DTypeBaseData pushData = new U3DTypeBaseData(); pushData.SetData(U3DTypeAttName.PUSH_ID, key); pushData.SetData(U3DTypeAttName.PUSH_TYPE, "0"); pushData.SetData(U3DTypeAttName.PUSH_TYPE_DATA, "打开"); pushData.SetData(U3DTypeAttName.PUSH_TITLE, "通知"); pushData.SetData(U3DTypeAttName.PUSH_INFO, message); pushData.SetData(U3DTypeAttName.PUSH_REPEAT_INTERVAL, "kMONTH"); var dateTime = DateTime.Now.AddSeconds(timeInterval); var date = dateTime.ToString("dd HH:mm"); pushData.SetData(U3DTypeAttName.PUSH_ALERT_DATE, date); pushData.SetData(U3DTypeAttName.PUSH_NEED_NOTIFY, "0"); pushData.SetData(U3DTypeAttName.PUSH_RECEIVE_TYPE, "type_001"); pushData.SetData(U3DTypeAttName.PUSH_RECEIVE_INFO, "nouse"); U3DTypeSDK.Instance.AddLocalPush(pushData); }
void LoginResult(U3DTypeEvent evt) { Debug.Log("LoginResult"); U3DTypeBaseData data = evt.evtData; string userID = data.GetData(U3DTypeAttName.USER_ID); string userToken = data.GetData(U3DTypeAttName.USER_TOKEN); U3DTypeBaseData platform = U3DTypeSDK.Instance.GetPlatformData(); U3DTypeBaseData baseData = new U3DTypeBaseData(); baseData.SetData("id", userID); baseData.SetData("token", userToken); baseData.SetData("data", ""); baseData.SetData("cid", platform.GetData(U3DTypeAttName.CHANNEL_ID)); DataProxy.Ins.ServerLogic.RequestLogin(this, baseData, ServerCBK_login, null); }
// /////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 ActionPayCurrentOrder() { // if (0 != datalock_pay_progress) // { // Debug.Log("wait pay finish");en // return; // } U3DTypeBaseData userInfo = U3DTypeSDK.Instance.GetUserData(); U3DTypeBaseData payData = localPayData; //用户ID,渠道返回,没有填空 //商品支付价格(单位:分) //商品名称 payData.SetData(U3DTypeAttName.ITEM_NAME, "TwinkleItem"); //商品数量 payData.SetData(U3DTypeAttName.ITEM_COUNT, "1"); //所在服务器id(如果没有填“0”) //所在服务器名字(如果没有填“sever_name”) payData.SetData(U3DTypeAttName.SERVER_NAME, "安卓一区"); //所在服务器数字标记(如果没有填“1”) payData.SetData(U3DTypeAttName.SERVER_ID, "1"); //内部订单号(如果没有填“0”) //商品在渠道上的id(如果没有填“0”)如果大于0 认为是购买商品 //has setted by function:ActionCreate ActionCreatePayOrder //商品描述 payData.SetData(U3DTypeAttName.ITEM_DESC, "desc"); //玩家在游戏中的角色ID payData.SetData(U3DTypeAttName.ROLE_ID, "role_1234"); //玩家在游戏中的角色名字 payData.SetData(U3DTypeAttName.ROLE_NAME, "玩家编号001"); //传递的额外参数(建议传入需要用来做订单标识的信息) payData.SetData(U3DTypeAttName.EXTRA, "extra"); payData.SetData(U3DTypeAttName.USER_ID, userInfo.GetData(U3DTypeAttName.USER_ID)); U3DTypeSDK.Instance.PayItem(payData); // datalock_pay_progress = 1; }
public void PayItem(string json) { var jsonobj = JsonMapper.ToObject(json); var amount = (string)jsonobj["goodsPrice"]; var roleid = (string)jsonobj["roleID"]; var rolename = (string)jsonobj["roleName"]; var oid = (string)jsonobj["oid"]; var goodsName = (string)jsonobj["goodsName"]; var level = (string)jsonobj["roleLevel"]; var serverId = (string)jsonobj["serverId"]; var serverName = (string)jsonobj["serverName"]; var goodDesc = (string)jsonobj["goodsDesc"]; var price = int.Parse(amount) * 100; var payData = new U3DTypeBaseData(); var userData = U3DTypeSDK.Instance.GetUserData(); // payData.SetData(U3DTypeAttName.USER_ID, userData.GetData(U3DTypeAttName.USER_ID)); payData.SetData(U3DTypeAttName.USER_TOKEN, userData.GetData(U3DTypeAttName.USER_TOKEN)); // payData.SetData(U3DTypeAttName.USER_ID, userIdforPay); // payData.SetData(U3DTypeAttName.USER_TOKEN, tokenforPay); //商品支付价格(单位:分) payData.SetData(U3DTypeAttName.REAL_PRICE, price.ToString()); payData.SetData(U3DTypeAttName.ITEM_NAME, goodsName); payData.SetData(U3DTypeAttName.ITEM_COUNT, "1"); payData.SetData(U3DTypeAttName.SERVER_ID, serverId); payData.SetData(U3DTypeAttName.SERVER_NAME, serverName); payData.SetData(U3DTypeAttName.ZONE_NAME, serverName); payData.SetData(U3DTypeAttName.BILL_NUMBER, oid); payData.SetData(U3DTypeAttName.EXTRA, "nouse"); payData.SetData(U3DTypeAttName.ITEM_DESC, goodDesc); payData.SetData(U3DTypeAttName.ROLE_ID, roleid); payData.SetData(U3DTypeAttName.ROLE_NAME, rolename); U3DTypeSDK.Instance.PayItem(payData); }
/** * eg: * payData.SetData(U3DTypeAttName.REAL_PRICE,"100"); * payData.SetData(U3DTypeAttName.ITEM_NAME,"sk bi"); * payData.SetData(U3DTypeAttName.ITEM_DESC,"desc"); * payData.SetData(U3DTypeAttName.ITEM_COUNT,"1"); * payData.SetData(U3DTypeAttName.ITEM_SEVER_ID,"id"); * payData.SetData(U3DTypeAttName.SEVER_ID,"1"); * payData.SetData(U3DTypeAttName.EXTRA,"extra"); * * 支付函数 * @param _in_pay pay object 支付对象的结构体 若至少传入 一个 价格 * 参数1:商品信息 参数2:订单id(由服务器生成) * @return bill number */ public string PayItem(SDKData.PayOrderData orderData, string orderId) { #if YaoLing Debug.LogWarning("调用曜灵116sdk 支付!"); #region 2018年8月17日14:18:09 qiubin添加 曜灵 116 聚合 SDK var payModel = new YaoLingSDKCallBackManager.YX116PayParamsModel() { userid = Id, username = UserName, amount = double.Parse(string.Format("{0:F2}", orderData.amount)), orderid = orderId, rolenid = orderData.roleID.ToString(), rolename = orderData.roleName, gameServerId = orderData.zoneID.ToString(), gameServerName = orderData.zoneName, productname = orderData.productName, productDesc = orderData.productDesc, orderTime = orderId.Substring(orderId.Length - 10, 10),//116 22222 22222 => 22222 22222 extra = orderData.roleID + "|" + orderData.zoneID, }; YaoLingSDKCallBackManager.Instance.CallAndroidFunc(YaoLingSDKCallBackManager.YaoLinAndroidSDKNameType.StartSDKPay, LitJson.JsonMapper.ToJson(payModel)); return(null); #endregion #else //创建一个订单信息 U3DTypeBaseData payData = new U3DTypeBaseData(); //用户ID,渠道返回,没有填空字符串 payData.SetData(U3DTypeAttName.USER_ID, Id); //用户token,登录验签完成后由游戏服务端返回,没有填空字符串 payData.SetData(U3DTypeAttName.USER_TOKEN, Token); //商品支付价格(单位:分) payData.SetData(U3DTypeAttName.REAL_PRICE, (orderData.amount * 100).ToString()); //商品名称,不要出现空格和特殊字符。 payData.SetData(U3DTypeAttName.ITEM_NAME, orderData.productName); //商品数量 payData.SetData(U3DTypeAttName.ITEM_COUNT, orderData.productCount); //所在服务器id(如果没有填“0”) payData.SetData(U3DTypeAttName.SERVER_ID, "0"); //所在服务器名字(如果没有填“server_name”) payData.SetData(U3DTypeAttName.SERVER_NAME, "server_name"); //所在大区id(如果没有填“0”),注意应用宝要求:账户分区ID_角色ID。每个应用都有一个分区ID为1的默认分区,分区可以在cpay.qq.com/mpay上自助配置。如果应用选择支持角色,则角色ID接在分区ID号后用"_"连接,角色ID需要进行urlencode。 payData.SetData(U3DTypeAttName.ZONE_ID, orderData.zoneID.ToString()); //所在大区名字(如果没有填“server_name”) payData.SetData(U3DTypeAttName.ZONE_NAME, orderData.zoneName); //TODO 内部订单号(必须填写,并保证多区情况下,订单号唯一) //string orderId = string.Format("{0}{1}{2}", Channelid, orderData.productId, SDKData.PayOrderData.GetCurrentTimeMiss()); payData.SetData(U3DTypeAttName.BILL_NUMBER, orderId); //商品id(需和TypeSDK Server商品列表保持一致) payData.SetData(U3DTypeAttName.ITEM_SERVER_ID, orderData.productId); //传递的额外参数(建议传入需要用来做订单标识的信息) payData.SetData(U3DTypeAttName.EXTRA, orderData.roleID + "|" + orderData.zoneID); //商品描述,不要出现空格和特殊字符串 payData.SetData(U3DTypeAttName.ITEM_DESC, orderData.productDesc); //玩家在游戏中的角色ID payData.SetData(U3DTypeAttName.ROLE_ID, orderData.roleID.ToString()); //玩家在游戏中的角色名字 payData.SetData(U3DTypeAttName.ROLE_NAME, orderData.roleName); // selfInit (); Debug.Log("U3D_Type sdk buy item"); string billNo = bonjour.PayItem(payData); return(billNo); #endif }
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()); } } }