/// <summary> /// 创建角色. /// </summary> /// <param name="iKey">Key.</param> /// <param name="iRoleInfo">角色信息.</param> private void SetData( string iKey, OneSdkRoleInfo iRoleInfo) { var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); var curActivity = unityPlayer.GetStatic <AndroidJavaObject> ("currentActivity"); if (null == curActivity) { Error("SetData():The current activity is invalid!!!"); return; } Info("SetData()::Key:{0} RoleInfo:{1}", iKey, iRoleInfo.ToString()); var roleInfo = new SfjsonObject(); roleInfo.put("roleId", iRoleInfo.id); roleInfo.put("roleName", iRoleInfo.name); roleInfo.put("roleLevel", iRoleInfo.level); roleInfo.put("zoneId", iRoleInfo.zoneId); roleInfo.put("zoneName", iRoleInfo.zoneName); roleInfo.put("balance", iRoleInfo.balance); roleInfo.put("vip", iRoleInfo.vip); roleInfo.put("partyName", iRoleInfo.partyName); roleInfo.put("roleCTime", iRoleInfo.cTime); roleInfo.put("roleLevelMTime", iRoleInfo.roleLevelMTime); Info("SetData()::RoleInfo:{0}", roleInfo.toString()); // 设定信息 setData(curActivity.GetRawObject(), iKey, roleInfo.toString()); }
private SfjsonObject readObject() { var result = new SfjsonObject(); /* Peek to see if this is the empty object. */ var first = nextCleanInternal(); if (first == '}') { return(null); } if (first != -1) { _pos--; } while (true) { var name = nextValue(); //APaymentHelperDemo.toAndroidLog(tag, "readObject name:" + name); /* * Expect the name/value separator to be either a colon ':', an * equals sign '=', or an arrow "=>". The last two are bogus but we * include them because that's what the original implementation did. */ var separator = nextCleanInternal(); if (separator != ':' && separator != '=') { //throw syntaxError("Expected ':' after " + name); // APaymentHelperDemo.toAndroidLog(tag, "Expected ':' after " + name); return(null); } if (_pos < _ins.Length && _ins.Substring(_pos, 1).ToCharArray()[0] == '>') { _pos++; } result.put((string)name, nextValue()); switch (nextCleanInternal()) { case '}': return(result); case ';': case ',': continue; default: // APaymentHelperDemo.toAndroidLog(tag, "Unterminated object"); return(null); // throw syntaxError("Unterminated object"); } } }