当前位置: 首页>>代码示例>>C#>>正文


C# JSONObject.Print方法代码示例

本文整理汇总了C#中JSONObject.Print方法的典型用法代码示例。如果您正苦于以下问题:C# JSONObject.Print方法的具体用法?C# JSONObject.Print怎么用?C# JSONObject.Print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSONObject的用法示例。


在下文中一共展示了JSONObject.Print方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CustomLogin

        public KnetikApiResponse CustomLogin(
            string serviceEndpoint,
            string usernameOrEmail,
            string password,
            bool isEmail,
            Action<KnetikApiResponse> cb = null
            )
        {
            JSONObject json = new JSONObject (JSONObject.Type.OBJECT);
            if (isEmail)
            {
                json.AddField("email", usernameOrEmail);
            } else
            {
                json.AddField("username", usernameOrEmail);
            }
            json.AddField("password", password);
            json.AddField ("serial", KnetikApiUtil.getDeviceSerial());
            json.AddField ("mac_address", KnetikApiUtil.getMacAddress ());
            // Device Type is currently limited to 3 characters in the DB
            json.AddField ("device_type", KnetikApiUtil.getDeviceType());
            json.AddField ("signature", KnetikApiUtil.getDeviceSignature());
            string body = json.Print ();

            KnetikRequest req = CreateRequest(serviceEndpoint, body, "POST", -1, "");
            KnetikApiResponse res = new KnetikLoginResponse(this, req, cb);
            return res;
        }
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:28,代码来源:Extensions.cs

示例2: Register

        public KnetikApiResponse Register(
			string username,
			string password,
			string email,
			string fullname,
			Action<KnetikApiResponse> cb = null
		)
        {
            // Login as a guest
            KnetikApiResponse loginResponse = GuestLogin ();

            if (loginResponse.Status != KnetikApiResponse.StatusType.Success) {
                Debug.LogError("Guest login failed");
                return loginResponse;
            }
            Debug.Log ("Guest login successful");

            // Then register the new user
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("username", username);
            j.AddField ("password", password);
            j.AddField ("email", email);
            j.AddField ("fullname", fullname);

            String body = j.Print ();

            KnetikRequest req = CreateRequest(RegisterEndpoint, body);

            KnetikApiResponse registerResponse = new KnetikApiResponse(this, req, cb);
            return  registerResponse;
        }
开发者ID:knetikmedia,项目名称:UnitySDK,代码行数:31,代码来源:Registration.cs

示例3: ParseToJsonResult

    //Creates a JSON from a resultModel and parses it to the POSTFacade
    public void ParseToJsonResult(ResultModel resultModel, string command)
    {
        JSONObject json = new JSONObject (JSONObject.Type.OBJECT);

            json.AddField("UserID", resultModel.UserID);
            json.AddField("UserType", resultModel.UserType);

            JSONObject arr = new JSONObject(JSONObject.Type.ARRAY);
            json.AddField("Answers",arr);
            foreach(QuizOptionModel qm in resultModel.Options){
            JSONObject ans = new JSONObject(JSONObject.Type.OBJECT);
                ans.AddField("ID",qm.Id);
                ans.AddField("Title",qm.Title);
                ans.AddField("Selected",qm.Selected);

            arr.Add(ans);
            }
        switch(command){
        case "SaveToServer":
        POSTFacade facade = gameObject.GetComponent<POSTFacade> ();
            facade.SaveQuizAnswers (json,resultModel.UserID.ToString());
            break;
        case "SaveLocal":
            PlayerPrefs.SetString("TestToSave_"+resultModel.UserID, json.Print());
            break;
        }
    }
开发者ID:oervald,项目名称:MentorDanmark,代码行数:28,代码来源:POSTResultCalculator.cs

示例4: Serialize

        public static void Serialize(this Template template)
        {
            // Template
            var tplJs = new JSONObject(JSONObject.Type.OBJECT);

            // Operators
            var opsJs = new JSONObject(JSONObject.Type.ARRAY);
            tplJs.AddField("Operators", opsJs);

            foreach (KeyValuePair<string, Operator> kvp in template.Operators) {
                opsJs.Add(kvp.Value.Serialize());
            }

            // Connections
            var connsJs = new JSONObject(JSONObject.Type.ARRAY);
            tplJs.AddField("Connections", connsJs);

            foreach (IOConnection conn in template.Connections) {
                connsJs.Add(conn.Serialize());
            }

            template.JSON = tplJs.Print(true);

            #if UNITY_EDITOR
            EditorUtility.SetDirty(template);
            #endif
        }
开发者ID:BrettRToomey,项目名称:forge,代码行数:27,代码来源:TemplateSerializer.cs

示例5: ListStorePage

        public KnetikApiResponse ListStorePage(
            int page = 1,
            int limit = 10,
            List<string> terms = null,
            List<string> related = null,
            bool useCatalog = true,
            Action<KnetikApiResponse> cb = null
        )
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("page", page);
            j.AddField ("limit", limit);
            if (terms != null) {
                j.AddField ("terms", JSONObject.Create(terms));
            }
            if (related != null) {
                j.AddField ("related", JSONObject.Create(related));
            }
            j.AddField("useCatalog", useCatalog);

            String body = j.Print ();

            KnetikRequest req = CreateRequest(ListStorePageEndpoint, body);

            KnetikApiResponse response = new KnetikApiResponse(this, req, cb);
            return  response;
        }
开发者ID:knetikmedia,项目名称:UnitySDK,代码行数:27,代码来源:Store.cs

示例6: SaveLevel

	public void SaveLevel( Level level )
	{
		JSONObject root = new JSONObject(JSONObject.Type.OBJECT);

		level.Save(root);
		string filePath = Application.dataPath + "/Resources/level_" + level.Number + ".json";
		
		File.WriteAllBytes(filePath, System.Text.Encoding.UTF8.GetBytes (root.Print(true)));
	}
开发者ID:mahnovsky,项目名称:PT,代码行数:9,代码来源:LevelSaver.cs

示例7: Register

        public KnetikApiResponse Register(
			string username,
			string password,
			string email,
			string fullname,
			Action<KnetikApiResponse> cb = null
		)
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("username", username);
            j.AddField ("password", password);
            j.AddField ("email", email);
            j.AddField ("fullname", fullname);

            String body = j.Print ();

            KnetikRequest req = CreateRequest(RegisterEndpoint, body);

            KnetikApiResponse res;
            if(cb != null)
            {
                res = new KnetikApiResponse(this, req, (resp) =>
                {
                    Debug.Log(resp.Body);
                    if(resp.Status == KnetikApiResponse.StatusType.Success)
                    {
                        Login(username, password, cb);
                    }
                    else
                    {
                        if (OnRegisterFailed != null)
                        {
                            OnRegisterFailed(resp.ErrorMessage);
                        }
                    }
                    cb(resp);
                });
            }
            else
            {
                res = new KnetikApiResponse(this, req, null);
                Debug.Log(res.Body);
                if(res.Status == KnetikApiResponse.StatusType.Success)
                {
                    Debug.Log(res.Body);
                    res = Login(username, password, null);
                }
                else
                {
                    if (OnRegisterFailed != null)
                    {
                        OnRegisterFailed(res.ErrorMessage);
                    }
                }
            }
            return  res;
        }
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:57,代码来源:Registration.cs

示例8: GetUserInfoWithProduct

        public KnetikApiResponse GetUserInfoWithProduct(string productIdentifier, Action<KnetikApiResponse> cb = null)
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("productId", productIdentifier);
            String body = j.Print ();

            KnetikRequest req = CreateRequest(GetUserInfoWithProductEndpoint, body);
            KnetikApiResponse res = new KnetikApiResponse(this, req, cb);
            return res;
        }
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:10,代码来源:UserInfo.cs

示例9: SaveQuizAnswers

 public WWW SaveQuizAnswers(JSONObject json, string UserID)
 {
     needToSendJSON = json;
     byte [] bytes = Encoding.ASCII.GetBytes(json.Print());
     string serverFunction = "SaveQuizAnswers";
     callMethod = "POSTAnswers";
     www = new WWW (baseUrl+serverFunction, bytes,CreateHeader());
     StartCoroutine (WaitForRequest (www, UserID));
     return www;
 }
开发者ID:oervald,项目名称:MentorDanmark,代码行数:10,代码来源:POSTFacade.cs

示例10: ShowSplashScreen

        private static void ShowSplashScreen(JSONObject data, string url)
        {
            Debug.Log("Opening URL: " + url + " With data: " + data.Print(false));

            SpilUnityEditorImplementation.fireSplashScreenOpen();

            GameObject overlayObject = GameObject.CreatePrimitive (PrimitiveType.Cube);
            WebOverlay overlay = overlayObject.AddComponent<WebOverlay> ();
            overlay.overlayType = "splashScreen";
        }
开发者ID:spilgames,项目名称:spil_event_unity_plugin,代码行数:10,代码来源:OverlayResponse.cs

示例11: verifyGooglePayment

        public KnetikApiResponse verifyGooglePayment(JSONObject j,Action<KnetikApiResponse> cb = null
			)
        {
            String body = j.Print ();

            KnetikRequest req = CreateRequest(GooglePaymentEndpoint, body);

            KnetikApiResponse response = new KnetikApiResponse(this, req, cb);
            return  response;
        }
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:10,代码来源:GooglePayment.cs

示例12: entitlementCheck

		public KnetikApiResponse entitlementCheck(JSONObject j,Action<KnetikApiResponse> cb = null
			) {

			String body = j.Print ();
			
			KnetikRequest req = CreateRequest(EntitlementEndpoint, body);
			
			KnetikApiResponse response = new KnetikApiResponse(this, req, cb);
			return  response;
		}
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:10,代码来源:Entitlement.cs

示例13: PutUserInfo

        public KnetikApiResponse PutUserInfo(string name, string value, Action<KnetikApiResponse> cb = null)
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("configName", name);
            j.AddField ("configValue", value);
            String body = j.Print ();

            KnetikRequest req = CreateRequest(PutUserInfoEndpoint, body);
            KnetikApiResponse res = new KnetikApiResponse(this, req, cb);
            return res;
        }
开发者ID:knetikmedia,项目名称:UnitySDK,代码行数:11,代码来源:UserInfo.cs

示例14: CartCountries

        public KnetikApiResponse CartCountries(
            Action<KnetikApiResponse> cb = null
        )
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            String body = j.Print ();

            KnetikRequest req = CreateRequest(CartCountriesEndpoint, body);

            KnetikApiResponse response = new KnetikApiResponse(this, req, cb);
            return  response;
        }
开发者ID:knetikmedia,项目名称:UnitySDK,代码行数:12,代码来源:Cart.cs

示例15: GetRelationships

        public KnetikApiResponse GetRelationships(int ancestorDepth, int descendantDepth, bool includeSiblings, Action<KnetikApiResponse> cb = null)
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("ancestorDepth", ancestorDepth);
            j.AddField ("descendantDepth", descendantDepth);
            j.AddField ("includeSiblings", includeSiblings);
            String body = j.Print ();

            KnetikRequest req = CreateRequest(UserGetRelationshipsEndpoint, body);
            KnetikApiResponse res = new KnetikApiResponse(this, req, cb);
            return res;
        }
开发者ID:brizee,项目名称:KnetikUnitySDK,代码行数:12,代码来源:UserInfo.cs


注:本文中的JSONObject.Print方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。