private SFJSONObject readObject() { SFJSONObject result = new SFJSONObject(); /* Peek to see if this is the empty object. */ int first = nextCleanInternal(); if (first == '}') { return(null); } else if (first != -1) { pos--; } while (true) { Object 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. */ int 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"); } } }
/// <summary> /// 创建角色. /// </summary> /// <param name="iKey">Key.</param> /// <param name="iRoleInfo">角色信息.</param> private void SetData( string iKey, OneSDKRoleInfo iRoleInfo) { AndroidJavaClass _unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); if (null == _unityPlayer) { this.Error("SetData():The unity player is invalid!!!"); return; } AndroidJavaObject _curActivity = _unityPlayer.GetStatic <AndroidJavaObject> ("currentActivity"); if (null == _curActivity) { this.Error("SetData():The current activity is invalid!!!"); return; } this.Info("SetData()::Key:{0} RoleInfo:{1}", iKey, iRoleInfo.ToString()); SFJSONObject _roleInfo = new SFJSONObject(); if (null == _roleInfo) { this.Error("CreateRole():Memory New Error(SFJSONObject)!!!"); return; } _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); this.Info("SetData()::RoleInfo:{0}", _roleInfo.toString()); // 设定信息 setData(_curActivity.GetRawObject(), iKey, _roleInfo.toString()); }