AddField() public méthode

public AddField ( string name, AddJSONConents content ) : void
name string
content AddJSONConents
Résultat void
Exemple #1
0
        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;
        }
        public static void BuildManifest()
        {
            JSONObject json = new JSONObject(JSONObject.Type.ARRAY);
            string[] levels = Directory.GetFiles(Application.dataPath + "/Levels_Exported/", "*.json");

            for (int i = 0; i < levels.Length; i++) {
                JSONObject data = new JSONObject(JSONObject.Type.OBJECT);
                string fileContents = File.ReadAllText(levels[i]);
                string hash = LevelManagementUtils.Hash(fileContents);
                data.AddField("Hash", hash);
                string url = levels[i].Replace(Application.dataPath, "http://podshot.github.io/TwoTogether" /*"http://127.0.0.1:8000/"*/);
                url = url.Replace("_Exported", "");
                data.AddField("URL", url);
                data.AddField("Name", levels[i].Replace(Application.dataPath + "/Levels_Exported/", ""));

                JSONObject thumb = new JSONObject(JSONObject.Type.OBJECT);
                thumb.AddField("URL", "http://podshot.github.io/TwoTogether/Thumbnails/" + levels[i].Replace(Application.dataPath + "/Levels_Exported/", "").Replace(".json", ".png"));
                thumb.AddField("Name", levels[i].Replace(Application.dataPath + "/Levels_Exported/", "").Replace(".json", ".png"));

                data.AddField("Thumbnail", thumb);
                json.Add(data);
            }

            TextWriter writer = new StreamWriter(Application.dataPath + "/Levels_Exported/levels_.manifest");
            writer.WriteLine(json.ToString(true));
            writer.Close();
            Debug.Log("Wrote manifest file");
        }
Exemple #3
0
    void OnCollisionEnter2D( Collision2D col )
    {
        if( col.gameObject.name == "RocketLeft" ){
            float py = HitFactor(transform.position, col.transform.position, col.collider.bounds.size.y);

            JSONObject data = new JSONObject();
            data.AddField("float", py.ToString());
            data.AddField("rocket", col.gameObject.name);
            NetworkManager.Instance.Socket.Emit("SHOOT", data );
            GetComponent<Rigidbody2D>().velocity = Vector2.zero;
            //Vector2 direction = new  Vector2(1,py).normalized;
            //GetComponent<Rigidbody2D>().velocity = direction*ballSpeed;
        }

        if( col.gameObject.name == "RocketRight" ){
            float py = HitFactor(transform.position, col.transform.position, col.collider.bounds.size.y);
            JSONObject data = new JSONObject();
            data.AddField("float", py.ToString());
            data.AddField("rocket", col.gameObject.name);
            NetworkManager.Instance.Socket.Emit("SHOOT", data );
            GetComponent<Rigidbody2D>().velocity = Vector2.zero;
            //Vector2 direction = new  Vector2(-1,py).normalized;
            //GetComponent<Rigidbody2D>().velocity = direction*ballSpeed;
        }
    }
 public JSONObject toJSONObject()
 {
     JSONObject obj = new JSONObject();
     obj.AddField(JSONConsts.SOOM_ENTITY_ID, this.ID);
     obj.AddField(PJSONConsts.UP_PROVIDER, this.Provider.ToString());
     return obj;
 }
Exemple #5
0
 public JSONObject encode()
 {
     JSONObject obj = new JSONObject();
     obj.AddField("name", name);
     obj.AddField("points", points);
     return obj;
 }
		public static JSONObject ToJSONObj(string userPayload, string rewardId = "")
		{
			JSONObject obj = new JSONObject(JSONObject.Type.OBJECT);
			obj.AddField(USER_PAYLOAD, userPayload);
			obj.AddField(REWARD_ID, rewardId);
			return obj;
		}
	/*
	 * Vector3
	 */
	public static JSONObject FromVector3(Vector3 v) {
		JSONObject vdata = new JSONObject(JSONObject.Type.OBJECT);
		if(v.x != 0)	vdata.AddField("x", v.x);
		if(v.y != 0)	vdata.AddField("y", v.y);
		if(v.z != 0)	vdata.AddField("z", v.z);
		return vdata;
	}
	void Update(){

		if (_block)return;

		int dec = 128;
		float[] waveData = new float[dec];
		int micPosition = Microphone.GetPosition(null)-(dec+1); // null means the first microphone
		audio.clip.GetData(waveData, micPosition);
		
		// Getting a peak on the last 128 samples
		float levelMax = 0;
		for (int i = 0; i < dec; i++) {
			float wavePeak = waveData[i] * waveData[i];
			if (levelMax < wavePeak) {
				levelMax = wavePeak;
			}
		}
		// levelMax equals to the highest normalized value power 2, a small number because < 1
		// use it like:
		float volume = Mathf.Sqrt(levelMax);
		if (volume > threashHold) 
		{
			_block = true;
			Invoke("unblock",cooldown);
			Debug.Log ("volume:" + volume);
			JSONObject commandJsonObject = new JSONObject();
			commandJsonObject.AddField("command","microphone");
			commandJsonObject.AddField("value",volume);
			communicationManager.SendJson (commandJsonObject);
		}
	}
Exemple #9
0
 public Json(string name1,string arg1,string name2,float arg2,string name3,float arg3)
 {
     json = new JSONObject ();
     json.AddField (name1, arg1);
     json.AddField (name2, arg2);
     json.AddField (name3, arg3);
 }
Exemple #10
0
        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;
        }
    //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;
        }
    }
        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
        }
Exemple #13
0
		public JSONObject toJSONObject() {
			JSONObject obj = new JSONObject();
			obj.AddField(PJSONConsts.UP_LEADERBOARD, this.Leaderboard.toJSONObject());
			obj.AddField(PJSONConsts.UP_USER_PROFILE, this.Player.toJSONObject());
			obj.AddField(PJSONConsts.UP_SCORE_RANK, this.Rank);
			obj.AddField(PJSONConsts.UP_SCORE_VALUE, this.Value);
			return obj;
		}
Exemple #14
0
		/// <summary>
		/// Converts the current <see cref="com.soomla.unity.VirtualItem"/> to a JSONObject.
		/// </summary>
		/// <returns>
		/// A JSONObject representation of the current <see cref="com.soomla.unity.VirtualItem"/>.
		/// </returns>
		public virtual JSONObject toJSONObject() {
			JSONObject obj = new JSONObject(JSONObject.Type.OBJECT);
			obj.AddField(JSONConsts.ITEM_NAME, this.Name);
			obj.AddField(JSONConsts.ITEM_DESCRIPTION, this.Description);
			obj.AddField(JSONConsts.ITEM_ITEMID, this.ItemId);
			
			return obj;
		}
Exemple #15
0
		public JSONObject toJSONObject() {
			JSONObject obj = new JSONObject();
			obj.AddField(PJSONConsts.UP_IDENTIFIER, this.ID);
			obj.AddField(PJSONConsts.UP_PROVIDER, this.Provider.ToString());
			obj.AddField(PJSONConsts.UP_NAME, this.Name);
			obj.AddField(PJSONConsts.UP_ICON_URL, this.IconURL);
			return obj;
		}
	void stopped(){
		JSONObject commandJsonObject = new JSONObject();
		commandJsonObject.AddField("command","move");
		commandJsonObject.AddField("x",0);
		commandJsonObject.AddField("y",0);
		
		communicationManager.SendJson (commandJsonObject);
	}
	void rotated(Vector3 vec3){
		JSONObject commandJsonObject = new JSONObject();
		commandJsonObject.AddField("command","rotate");
		commandJsonObject.AddField("x",vec3.x);
		commandJsonObject.AddField("y",-(vec3.y));
		
		communicationManager.SendJson (commandJsonObject);
	}
Exemple #18
0
		/*entitlementCheck
		 *@param String itemId  
		 *@parm skuId 
		 */

		public KnetikApiResponse entitlementCheck(String itemId,string skuId,
		       Action<KnetikApiResponse> cb = null
		     ) {
			JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
			j.AddField ("item_id", itemId);
			j.AddField ("sku_id", skuId);
			return entitlementCheck(j , cb);
		}
Exemple #19
0
	//Special serialization for unitys transform
	private static void SerializeTransform(ref JSONObject jsonObject, Id objId)
	{
		JSONObject jObject = new JSONObject(JSONObject.Type.OBJECT);
		jsonObject.AddField ("Transform", jObject);

		jObject.AddField ("Position", JSONTemplates.FromVector3(objId.transform.localPosition));
		jObject.AddField ("Rotation", JSONTemplates.FromQuaternion(objId.transform.localRotation));
		jObject.AddField ("Scale", JSONTemplates.FromVector3(objId.transform.localScale));
	}
Exemple #20
0
        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;
        }
 public void BaseHealthHasChanged(string playerID, float maxHealth, float currentHealth)
 {
     Debug.Log ("[SocketIO] Base health has changed");
     JSONObject dataJSON = new JSONObject(JSONObject.Type.OBJECT);
     dataJSON.AddField("playerID", playerID);
     dataJSON.AddField("maxHealth", maxHealth);
     dataJSON.AddField("currentHealth", currentHealth);
     socket.Emit ("gameBaseChangeHealth", dataJSON);
 }
 private static string GetAdminToken()
 {
     JSONObject request = new JSONObject();
     request.AddField("client_id", CLIENT_ID);
     request.AddField("client_secret", CLIENT_SECRET);
     string response = SendRequestSync ("/oauth2/token", "POST", "application/json", null, null, request.ToString());
     JSONObject json = new JSONObject(response);
     return json.GetField("access_token").str;
 }
 public static JSONObject Serialize(this IOConnection conn)
 {
     var connJs = new JSONObject(JSONObject.Type.OBJECT);
     connJs.AddField("From", conn.From.GUID);
     connJs.AddField("Output", conn.Output.Name);
     connJs.AddField("To", conn.To.GUID);
     connJs.AddField("Input", conn.Input.Name);
     return connJs;
 }
        /*Mark an invoice payed with Google. Verifies signature from Google and treats
         * the developerPayload field inside the json payload as the id of the invoice to pay.
         *
         *@param String receipt  A receipt will only be accepted once
         *@parm transactionId    details of the transaction must match the invoice,
         *@parm  invoiceId
         * Returns the transaction Id if successful.
         */
        public KnetikApiResponse handleGooglePayment(String  jsonPayload,string signature,
		       Action<KnetikApiResponse> cb = null
		     )
        {
            JSONObject j = new JSONObject (JSONObject.Type.OBJECT);
            j.AddField ("jsonPayload", jsonPayload);
            j.AddField ("signature", signature);
            return verifyGooglePayment(j , cb);
        }
    // Use this for initialization
    void Start()
    {
        JSONObject configJSON = new JSONObject();
        JSONObject j = new JSONObject();
        JSONObject platforms = new JSONObject(JSONObject.Type.ARRAY);
        string thisDirectory = Directory.GetCurrentDirectory();
        bool platformDirectory = false;

        browser = browserContainer.GetComponent<Browser>();

        DirectoryInfo dir = new DirectoryInfo(thisDirectory + @"\Platforms");

        try {
            if (dir.Exists) {
                platformDirectory = true;
            } else {
                dir.Create();
                platformDirectory = true;
            }
        } catch (Exception e) {
            platformDirectory = false;
            Debug.Log(e);
        }

        if (platformDirectory) {
            FileInfo[] info = dir.GetFiles("*.png");
            platformTextures = new Texture2D[info.Length];
            platformNames = new string[info.Length];
            platformIdentities = new int[info.Length][];

            configJSON.AddField("player", "Bloodyaugust");
            configJSON.AddField("platforms", platforms);

            int i = 0;
            foreach (FileInfo f in info) {
                j = new JSONObject();
                WWW currentTexture = new WWW("file:///" + f);

                platformTextures[i] = currentTexture.texture;
                platformNames[i] = Path.GetFileNameWithoutExtension(f + "");
                platformIdentities[i] = TextureToIdentity(platformTextures[i]);

                platforms.Add(j);
                j.AddField("name", platformNames[i]);
                j.AddField("value", i.ToString());

                Debug.Log(Path.GetFileNameWithoutExtension(f + ""));

                i++;
            }

            browser.CallFunction("Messaging.trigger", "platforms", configJSON.ToString());
            Debug.Log(configJSON.ToString());
        }
    }
Exemple #26
0
        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;
        }
Exemple #27
0
    public JSONObject Serialize()
    {
        var jsonObject = new JSONObject(JSONObject.Type.OBJECT);

        jsonObject.AddField("Name", Name);
        jsonObject.AddField("BestScore", BestScore);
        jsonObject.AddField("NumberOfAttempts", NumberOfAttempts);
        jsonObject.AddField("IsCompleted", IsCompleted);

        return jsonObject;
    }
    private string GetAndSetPlayerData()
    {
        // Setup the player data to send to the server.
        JSONObject objJSON_PlayerData = new JSONObject();

        objJSON_PlayerData.AddField("last_update_time", System.DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss"));
        objJSON_PlayerData.AddField("isMale", GLOBAL.Player.progress["isMale"].b);
        objJSON_PlayerData.AddField("index_BodyModel", GLOBAL.Player.progress["index_BodyModel"].i);
        objJSON_PlayerData.AddField("index_HairModel", GLOBAL.Player.progress["index_HairModel"].i);

        return objJSON_PlayerData.ToString();
    }
Exemple #29
0
        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;
        }
	// Serialize the class to JSON
	override public JSONObject Serialize ( Component input ) {
		JSONObject output = new JSONObject ( JSONObject.Type.OBJECT );
		MyClass myClass = input as MyClass;

		output.AddField ( "myInt", myClass.myInt );
		output.AddField ( "myFloat", myClass.myFloat );
		output.AddField ( "myBool", myClass.myBool );
		output.AddField ( "myObject", myClass.myObject.GetComponent < OFSerializedObject > ().id );
		output.AddField ( "myString", myClass.myString );

		return output;
	}
Exemple #31
0
    public void PostScoreToPlatform()
    {
        Debug.ClearDeveloperConsole();
        print("Posting score to platform.");
        print("result spending: " + score.resultSpending);
        print("total spend: " + score.totalSpendForTheDay);
        print("total nps: " + score.totalNPSForTheDay);
        print("Game day: " + (currentDifficultyLevel + 1).ToString());

        JSONObject currencyJson = new JSONObject();

        currencyJson.AddField("Date", System.DateTime.Now.ToString("yyyy-MM-ddThh:mm:ssZ"));
        currencyJson.AddField("Powerbar", "Currency");
        currencyJson.AddField("ContentKey", contentKey);
        currencyJson.AddField("User", userID);
        currencyJson.AddField("Level", (currentDifficultyLevel + 1).ToString(""));
        currencyJson.AddField("Score", score.resultSpending);
        StartCoroutine(PostData(currencyJson));
    }
Exemple #32
0
        private static UserProfile UserProfileFromFBJson(JSONObject fbJsonObject)
        {
            JSONObject soomlaJsonObject = new JSONObject();

            soomlaJsonObject.AddField(PJSONConsts.UP_PROVIDER, Provider.FACEBOOK.ToString());
            soomlaJsonObject.AddField(PJSONConsts.UP_PROFILEID, fbJsonObject["id"].str);
            string name = fbJsonObject ["name"].str;

            soomlaJsonObject.AddField(PJSONConsts.UP_USERNAME, name);
            string email = fbJsonObject ["email"] != null ? fbJsonObject ["email"].str : null;

            if (email == null)
            {
                email = Regex.Replace(name, @"\s+", ".") + "@facebook.com";
            }
            soomlaJsonObject.AddField(PJSONConsts.UP_EMAIL, email);
            soomlaJsonObject.AddField(PJSONConsts.UP_FIRSTNAME, fbJsonObject["first_name"].str);
            soomlaJsonObject.AddField(PJSONConsts.UP_LASTNAME, fbJsonObject["last_name"].str);
            soomlaJsonObject.AddField(PJSONConsts.UP_AVATAR, fbJsonObject["picture"]["data"]["url"].str);
            UserProfile userProfile = new UserProfile(soomlaJsonObject);

            return(userProfile);
        }
Exemple #33
0
    public JSONObject toJSONObject()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("itemId", this.ID);
        json.AddField("name", this.name);
        json.AddField("description", this.description);
        if (this.goodType == ZFGood.GoodType.SingleUsePackVG)
        {
            json.AddField("good_itemId", this.good_itemId);
            json.AddField("good_amount", this.good_amount);
        }
        if (this.typePurchase == PurchaseInfo.Market)
        {
            json.AddField("purchasableItem", marketInfo.toJSONObject());
        }
        else if (this.typePurchase == PurchaseInfo.VirtualItem)
        {
            json.AddField("purchasableItem", virtualInfo.toJSONObject());
        }

        return(json);
    }
Exemple #34
0
        void IDetectFaceSDK.DetectFace(IDFRequestParam parm, Action <IDFServerResult> getResult)
        {
            if (mIsWaiting)
            {
                return;
            }
#if SHIP_DOCK_SDK
            JSONObject json = JSONObject.Create();
            json.AddField("MaxFaceNum", parm.MaxFaceNumber);
            json.AddField("MinFaceSize", parm.MinFaceSize);
            if (parm.Image != null)
            {
                json.AddField("Image", Convert.ToBase64String(parm.Image));
            }
            if (!string.IsNullOrEmpty(parm.Url))
            {
                json.AddField("Url", parm.Url);
            }
            json.AddField("NeedFaceAttributes", parm.NeedFaceAttributes ? 1 : 0);
            json.AddField("NeedQualityDetection", parm.NeedQualityDetection ? 1 : 0);
            json.AddField("FaceModelVersion", parm.FaceModelVersion);
            onGetResult = getResult;
            mIsDone     = false;

            UpdaterNotice.SceneCallLater(WaitServerResult);

            if (!ThreadPool.QueueUserWorkItem(SendRequest, json))
            {
                mIsWaiting = false;
                throw new Exception("IDetectFaceSDK--> request server failed!");
            }
            else
            {
                mIsWaiting = true;
            }
#endif
        }
Exemple #35
0
        protected override void CopyRaw()
        {
            base.CopyRaw();

            CheckRawCopy(ref mRawRoleCopy);
            CheckRawCopy(ref mRawDebuffCopy);

            KnightBattleConfig battleConf = mDruggeryConfig.buffBattle;

            mRawCopy.AddField("potential", battleConf.potential);
            mRawCopy.AddField("hp", battleConf.hp);
            mRawCopy.AddField("mp", battleConf.mp);
            mRawCopy.AddField("selfHealing", battleConf.selfHealing);
            mRawCopy.AddField("qi", battleConf.qi);
            mRawCopy.AddField("internalForce", battleConf.internalForce);
            mRawCopy.AddField("eyesight", battleConf.eyesight);
            mRawCopy.AddField("hearing", battleConf.hearing);
            mRawCopy.AddField("swordBreath", battleConf.swordBreath);
            mRawCopy.AddField("bodilyMovement", battleConf.bodilyMovement);
            mRawCopy.AddField("charm", battleConf.charm);
            mRawCopy.AddField("fate", battleConf.fate);

            mRawRoleCopy.AddField("fingerForce", battleConf.fingerForce);
            mRawRoleCopy.AddField("tough", battleConf.tough);
            mRawRoleCopy.AddField("physique", battleConf.physique);
            mRawRoleCopy.AddField("breath", battleConf.breath);
            mRawRoleCopy.AddField("acupoint", battleConf.acupoint);
            mRawRoleCopy.AddField("concentrate", battleConf.concentrate);
            mRawRoleCopy.AddField("antitoxic", battleConf.antitoxic);

            mRawDebuffCopy.AddField("debuffTrauma", battleConf.debuffTrauma);
            mRawDebuffCopy.AddField("debuffInternalInjury", battleConf.debuffInternalInjury);
            mRawDebuffCopy.AddField("debuffVertigo", battleConf.debuffVertigo);
            mRawDebuffCopy.AddField("debuffAcupointHit", battleConf.debuffAcupointHit);
            mRawDebuffCopy.AddField("debuffHorror", battleConf.debuffHorror);
            mRawDebuffCopy.AddField("debuffToxic", battleConf.debuffToxic);
        }
Exemple #36
0
        // Update is called once per frame
        public void SendServiceMessage(JSONObject content, Functions func, bool justSymmetricKey = false)
        {
            timer = new System.Diagnostics.Stopwatch();
            seqNumber++;
            JSONObject data = new JSONObject();

            data.AddField("content", content);
            data.AddField("reply_to", client.RoutingKey);
            data.AddField("sender", playerId);
            data.AddField("seq_id", seqNumber);
            data.AddField("type", RequestType.service.ToString());
            data.AddField("function", func.ToString());
            JSONObject final = CalculateFinalSecureJson(data, justSymmetricKey);

            if (func != Functions.heartbeat)
            {
                WriteToConsole("SendMessageToServer: " + data.ToString());
            }
            timer.Start();
            client.PublishMessage(final.ToString());
        }
Exemple #37
0
            public static JSONObject Encode(Dictionary <string, object> data)
            {
                JSONObject obj = new JSONObject();

                foreach (var kvp in data)
                {
                    if (kvp.Value is bool)
                    {
                        obj.AddField(kvp.Key, (bool)kvp.Value);
                    }
                    else if (kvp.Value is int)
                    {
                        obj.AddField(kvp.Key, (int)kvp.Value);
                    }
                    else if (kvp.Value is float)
                    {
                        obj.AddField(kvp.Key, (float)kvp.Value);
                    }
                    else if (kvp.Value is double)
                    {
                        obj.AddField(kvp.Key, (double)kvp.Value);
                    }
                    else if (kvp.Value is string)
                    {
                        obj.AddField(kvp.Key, (string)kvp.Value);
                    }
                    else if (kvp.Value is Dictionary <string, object> )
                    {
                        obj.AddField(kvp.Key, Encode(kvp.Value as Dictionary <string, object>));
                    }
                    else if (kvp.Value is Array)
                    {
                    }
                    //else if (kvp.Value == null)
                    //{
                    //    obj.AddField(kvp.Key, null);
                    //}
                }
                return(obj);
            }
    public void OnConfirmHero()
    {
        if (selectedHeroes.Count >= minimumSelectedHeroes)
        {
            JSONObject data = new JSONObject();
            if (Passbot.isOn)
            {
                data.AddField("queue_with_passbot", true);
            }
            JSONObject heroes = new JSONObject(JSONObject.Type.ARRAY);
            data.AddField("heroes", heroes);
            foreach (string uuid in selectedHeroes.Keys)
            {
                heroes.Add(uuid);
            }
            //data.AddField("game_mode", "obj");
            switch (GameMode.value)
            {
            case 0:
                data.AddField("game_mode", "dm");
                break;

            case 1:
                data.AddField("game_mode", "obj");
                break;

            default:
                data.AddField("game_mode", "dm");
                break;
            }
            if (MapSelect.options[MapSelect.value] != null)
            {
                data.AddField("map_id", mapSelectPosition[MapSelect.value].ID);
            }

            socket.Emit("queue_up_heroes", data, HeroesQueue);
        }
    }
Exemple #39
0
        public string GenerateJsonString()
        {
            JSONObject json = new JSONObject();

            if (Id.HasValue)
            {
                json.AddField("Id", Id.Value);
            }

            if (Title != null)
            {
                json.AddField("Title", Title);
            }

            if (Message != null)
            {
                json.AddField("Message", Message);
            }

            if (Type.HasValue)
            {
                json.AddField("Type", Type.Value);
            }

            if (UnRead.HasValue)
            {
                json.AddField("UnRead", UnRead.Value);
            }

            if (CreateDate.HasValue)
            {
                json.AddField("CreateDate", CreateDate.ToString());
            }

            return(json.Print());
        }
        /*private static void LogImportedSquad(JSONObject squadJson)
         * {
         *  if (squadJson.HasField("faction")) Debug.Log("Faction is " + squadJson["faction"]);
         *  if (squadJson.HasField("points")) Debug.Log("Points " + squadJson["points"]);
         *
         *  if (squadJson.HasField("pilots"))
         *  {
         *      JSONObject pilotJsons = squadJson["pilots"];
         *      foreach (JSONObject pilotJson in pilotJsons.list)
         *      {
         *          Debug.Log("PilotName " + pilotJson["name"]);
         *          Debug.Log("Points " + pilotJson["points"]);
         *          Debug.Log("ShipType " + pilotJson["ship"]);
         *      }
         *  }
         * }
         *
         * public static void ExportSquadList(PlayerNo playerNo)
         * {
         *  GameObject importExportPanel = GameObject.Find("UI/Panels").transform.Find("ImportExportPanel").gameObject;
         *  MainMenu.CurrentMainMenu.ChangePanel(importExportPanel);
         *  importExportPanel.transform.Find("InputField").GetComponent<InputField>().text = GetSquadInJson(playerNo).ToString();
         * }*/

        public static JSONObject GetSquadInJson(PlayerNo playerNo)
        {
            JSONObject squadJson = new JSONObject();

            squadJson.AddField("name", GetSquadList(playerNo).Name);
            squadJson.AddField("faction", FactionToXWS(GetSquadList(playerNo).SquadFaction));
            squadJson.AddField("points", GetSquadCost(playerNo));
            squadJson.AddField("version", "0.3.0");

            List <SquadBuilderShip> playerShipConfigs = GetSquadList(playerNo).GetShips().ToList();

            JSONObject[] squadPilotsArrayJson = new JSONObject[playerShipConfigs.Count];
            for (int i = 0; i < squadPilotsArrayJson.Length; i++)
            {
                squadPilotsArrayJson[i] = GenerateSquadPilot(playerShipConfigs[i]);
            }
            JSONObject squadPilotsJson = new JSONObject(squadPilotsArrayJson);

            squadJson.AddField("pilots", squadPilotsJson);

            squadJson.AddField("description", GetDescriptionOfSquadJson(squadJson));

            return(squadJson);
        }
Exemple #41
0
    public void Play(Descriptor descriptor, Action <JSONObject> callback, Action <Message> onstream)
    {
        JSONObject jn = new JSONObject(JSONObject.Type.OBJECT);

        jn.AddField("command", "onPlay");
        jn.AddField("accessMode", 2);
        jn.AddField("applicationId", descriptor.ApplicationId());
        Application app = new Application("presence/lobby", "onPlay", jn);

        Request(app, (game) => {
            game.AddField("applicationId", descriptor.ApplicationId());
            callback(game);
            JSONObject conn;
            AddMessageListener(game.GetField("label").str, onstream);//web socket listener
            if ((conn = game.GetField("gameObject").GetField("connection")) != null)
            {
                conn.AddField("ticket", game.GetField("gameObject").GetField("ticket").str);
                conn.AddField("instanceId", game.GetField("instanceId").str);
                AddMessageListener(game.GetField("label").str + "#" + game.GetField("instanceId").str, onstream);
                initUdp(conn);
            }
            else  //stream on websocket if udp not available
            {
                JSONObject ms = new JSONObject(JSONObject.Type.OBJECT);
                ms.AddField("action", "onStream");
                ms.AddField("streaming", true);
                ms.AddField("path", "/application/instance");
                ms.AddField("instanceId", game.GetField("instanceId").str);
                ms.AddField("applicationId", game.GetField("applicationId").str);
                JSONObject dt = new JSONObject(JSONObject.Type.OBJECT);
                dt.AddField("command", "onStream");
                ms.AddField("data", dt);
                _Send(ms);
            }
        });
    }
Exemple #42
0
    public void GetTournamentLeaderboard(string statisticName, Action <Leaderboard> callback, Action <string> errorCallback, int maxResultsCount, bool useSpecificVersion = false, int version = 0)
    {
        JSONObject jSONObject = JSONObject.Create();

        jSONObject.AddField("StatisticName", statisticName);
        jSONObject.AddField("PlayFabId", "D1E872B9C9DA0648");
        jSONObject.AddField("MaxResultsCount", 1);
        jSONObject.AddField("UseSpecificVersion", useSpecificVersion);
        jSONObject.AddField("Version", version);
        Action <Leaderboard> fromLeaderboardPoint = delegate(Leaderboard lb)
        {
            int val = 0;
            if (lb.Entries[0].Position.Value > maxResultsCount)
            {
                val = UnityEngine.Random.Range(0, lb.Entries[0].Position.Value - maxResultsCount);
            }
            JSONObject jSONObject2 = JSONObject.Create();
            jSONObject2.AddField("StatisticName", statisticName);
            jSONObject2.AddField("StartPosition", val);
            jSONObject2.AddField("MaxResultsCount", maxResultsCount);
            jSONObject2.AddField("UseSpecificVersion", useSpecificVersion);
            jSONObject2.AddField("Version", version);
            jSONObject2.AddField("ProfileConstraints", GetProfileConstraints());
            PlayFabCommand cmd2 = new PlayFabCommand(PersistentSingleton <GameSettings> .Instance.PlayFabUrl + "GetLeaderboard", jSONObject2, delegate(JSONObject json2)
            {
                callback(LeaderboardFromJSON(json2));
            }, errorCallback);
            QueueCommand(cmd2);
        };
        PlayFabCommand cmd = new PlayFabCommand(PersistentSingleton <GameSettings> .Instance.PlayFabUrl + "GetLeaderboardAroundPlayer", jSONObject, delegate(JSONObject json)
        {
            fromLeaderboardPoint(LeaderboardFromJSON(json));
        }, errorCallback);

        QueueCommand(cmd);
    }
Exemple #43
0
    private static JSONObject cardPackJSONObj()
    {
        if (StaticVariables.cardData == null)
        {
            return(null);
        }
        JSONObject ret = new JSONObject(JSONObject.Type.OBJECT);

        JSONObject anyC = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject anyB = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject anyA = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject anyS = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject atkC = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject atkB = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject atkA = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject atkS = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject defC = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject defB = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject defA = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject defS = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject speC = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject speB = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject speA = new JSONObject(JSONObject.Type.ARRAY);
        JSONObject speS = new JSONObject(JSONObject.Type.ARRAY);

        foreach (JSONObject card in StaticVariables.cardData.GetField("ATK").list)
        {
            if (card.GetField("rank").str == "C")
            {
                anyC.Add(card);
                atkC.Add(card);
            }
            else if (card.GetField("rank").str == "B")
            {
                anyB.Add(card);
                atkB.Add(card);
            }
            else if (card.GetField("rank").str == "A")
            {
                anyA.Add(card);
                atkA.Add(card);
            }
            else if (card.GetField("rank").str == "S")
            {
                anyS.Add(card);
                atkS.Add(card);
            }
        }

        foreach (JSONObject card in StaticVariables.cardData.GetField("DEF").list)
        {
            if (card.GetField("rank").str == "C")
            {
                anyC.Add(card);
                defC.Add(card);
            }
            else if (card.GetField("rank").str == "B")
            {
                anyB.Add(card);
                defB.Add(card);
            }
            else if (card.GetField("rank").str == "A")
            {
                anyA.Add(card);
                defA.Add(card);
            }
            else if (card.GetField("rank").str == "S")
            {
                anyS.Add(card);
                defS.Add(card);
            }
        }

        foreach (JSONObject card in StaticVariables.cardData.GetField("SPE").list)
        {
            if (card.GetField("rank").str == "C")
            {
                anyC.Add(card);
                speC.Add(card);
            }
            else if (card.GetField("rank").str == "B")
            {
                anyB.Add(card);
                speB.Add(card);
            }
            else if (card.GetField("rank").str == "A")
            {
                anyA.Add(card);
                speA.Add(card);
            }
            else if (card.GetField("rank").str == "S")
            {
                anyS.Add(card);
                speS.Add(card);
            }
        }

        ret.AddField("anyC", anyC);
        ret.AddField("anyB", anyB);
        ret.AddField("anyA", anyA);
        ret.AddField("anyS", anyS);
        ret.AddField("atkC", atkC);
        ret.AddField("atkB", atkB);
        ret.AddField("atkA", atkA);
        ret.AddField("atkS", atkS);
        ret.AddField("defC", defC);
        ret.AddField("defB", defB);
        ret.AddField("defA", defA);
        ret.AddField("defS", defS);
        ret.AddField("speC", speC);
        ret.AddField("speB", speB);
        ret.AddField("speA", speA);
        ret.AddField("speS", speS);
        //Debug.Log (ret.ToString());
        return(ret);
    }
Exemple #44
0
        void SendTelemetry()
        {
            if (client == null)
            {
                return;
            }

            JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

            json.AddField("msg_type", "telemetry");

            json.AddField("steering_angle", car.GetSteering() / steer_to_angle);
            json.AddField("throttle", car.GetThrottle());
            json.AddField("speed", car.GetVelocity().magnitude);
            json.AddField("image", System.Convert.ToBase64String(camSensor.GetImageBytes()));

            json.AddField("hit", car.GetLastCollision());
            car.ClearLastCollision();

            Transform tm = car.GetTransform();

            json.AddField("pos_x", tm.position.x);
            json.AddField("pos_y", tm.position.y);
            json.AddField("pos_z", tm.position.z);

            json.AddField("time", Time.timeSinceLevelLoad);

            if (pm != null)
            {
                float cte = 0.0f;
                if (pm.path.GetCrossTrackErr(tm.position, ref cte))
                {
                    json.AddField("cte", cte);
                }
                else
                {
                    pm.path.ResetActiveSpan();
                    json.AddField("cte", 0.0f);
                }
            }

            client.SendMsg(json);
        }
Exemple #45
0
    IEnumerator UploadCustomReport(string stackTrace)
    {
        JSONObject jsonData = new JSONObject();

        jsonData.AddField("rowKey", Guid.NewGuid().ToString());
        jsonData.AddField("partitionKey", "CrashReport");
        jsonData.AddField("playerName", Options.NickName);
        jsonData.AddField("description", "No description");
        jsonData.AddField("p1pilot", (Selection.ThisShip != null) ? Selection.ThisShip.PilotInfo.PilotName : "None");
        jsonData.AddField("p2pilot", (Selection.AnotherShip != null) ? Selection.AnotherShip.PilotInfo.PilotName : "None");
        jsonData.AddField("stackTrace", stackTrace.Replace("\n", "NEWLINE"));
        jsonData.AddField("trigger", (Triggers.CurrentTrigger != null) ? Triggers.CurrentTrigger.Name : "None");
        jsonData.AddField("subphase", (Phases.CurrentSubPhase != null) ? Phases.CurrentSubPhase.GetType().ToString() : "None");
        jsonData.AddField("scene", UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
        jsonData.AddField("version", Global.CurrentVersion);

        try
        {
            jsonData.AddField("p1squad", SquadBuilder.SquadLists[0].SavedConfiguration.ToString().Replace("\"", "\\\""));
            jsonData.AddField("p2squad", SquadBuilder.SquadLists[1].SavedConfiguration.ToString().Replace("\"", "\\\""));
        }
        catch (Exception)
        {
            jsonData.AddField("p1squad", "None");
            jsonData.AddField("p2squad", "None");
        }

        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Battle")
        {
            jsonData.AddField("replay", ReplaysManager.GetReplayContent().Replace("\"", "\\\""));
        }
        else
        {
            jsonData.AddField("replay", "None");
        }

        var request = new UnityWebRequest("https://flycasualdataserver.azurewebsites.net/api/crashreports/create", "POST");

        Debug.Log(jsonData.ToString());
        byte[] bodyRaw = System.Text.Encoding.UTF8.GetBytes(jsonData.ToString());
        request.uploadHandler   = (UploadHandler) new UploadHandlerRaw(bodyRaw);
        request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        request.SetRequestHeader("Content-Type", "application/json");
        yield return(request.SendWebRequest());

        Debug.Log("Status Code: " + request.responseCode);
    }
Exemple #46
0
        /// <summary>
        /// Converts the <see cref="CloudConfig"/> into a <see cref="JSONObject"/>.
        /// </summary>
        /// <returns><see cref="JSONObject"/> containing the <see cref="CloudConfig"/>.</returns>
        public JSONObject ToJSONObject()
        {
            var jsonObject = new JSONObject(JSONObject.Type.Object);

            jsonObject.AddField(c_keyAchievementIDs, JsonHelper.ToJsonObject(AchievementIDs));
            jsonObject.AddField(c_keyLeaderboardIDs, JsonHelper.ToJsonObject(LeaderboardIDs));
            jsonObject.AddField(c_keyCloudVariables, JsonHelper.ToJsonObject(CloudVariables));
            jsonObject.AddField(c_keyAppleSupported, AppleSupported);
            jsonObject.AddField(c_keyGoogleSupported, GoogleSupported);
            jsonObject.AddField(c_keyAmazonSupported, AmazonSupported);
            jsonObject.AddField(c_keyAndroidPlatform, Enum.Format(typeof(AndroidBuildPlatform), AndroidPlatform, "D"));
            jsonObject.AddField(c_keyGoogleAppID, GoogleAppID);
            jsonObject.AddField(c_keyGoogleSetupRun, GoogleSetupRun);
            jsonObject.AddField(c_keyDebugModeEnabled, DebugModeEnabled);
            jsonObject.AddField(c_keyVersion, Version = PluginVersion.VersionString);
            jsonObject.AddField(c_apiKey, ApiKey);

            return(jsonObject);
        }
        /// <summary>
        /// Converts the current <c>UserProfile</c> to a JSONObject.
        /// </summary>
        /// <returns>A <c>JSONObject</c> representation of the current <c>UserProfile</c>.</returns>
        public virtual JSONObject toJSONObject()
        {
            JSONObject obj = new JSONObject(JSONObject.Type.OBJECT);

            obj.AddField(JSONConsts.SOOM_CLASSNAME, SoomlaUtils.GetClassName(this));
            obj.AddField(PJSONConsts.UP_PROVIDER, this.Provider.ToString());
            obj.AddField(PJSONConsts.UP_USERNAME, this.Username);
            obj.AddField(PJSONConsts.UP_PROFILEID, this.ProfileId);
            obj.AddField(PJSONConsts.UP_FIRSTNAME, this.FirstName);
            obj.AddField(PJSONConsts.UP_LASTNAME, this.LastName);
            obj.AddField(PJSONConsts.UP_EMAIL, this.Email);
            obj.AddField(PJSONConsts.UP_AVATAR, this.AvatarLink);
            obj.AddField(PJSONConsts.UP_LOCATION, this.Location);
            obj.AddField(PJSONConsts.UP_GENDER, this.Gender);
            obj.AddField(PJSONConsts.UP_LANGUAGE, this.Language);
            obj.AddField(PJSONConsts.UP_BIRTHDAY, this.Birthday);
            obj.AddField(PJSONConsts.UP_ACCESSTOKEN, this.AccessToken);
            obj.AddField(PJSONConsts.UP_SECRETKEY, this.SecretKey);
            return(obj);
        }
Exemple #48
0
    public JSONObject jsonify()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("weightclass", Class.ToString());

        json.AddField("age", JSONTemplates.FromVector2Int(Age));
        json.AddField("firstname", FirstName);
        json.AddField("lastname", LastName);
        json.AddField("townindex", TownIndex);
        json.AddField("weight", Weight);
        json.AddField("weeksremaining", WeeksRemaining);

        json.AddField("boxerclass", boxerClass.ToString());
        json.AddField("accuracy", accuracy);
        json.AddField("endurance", endurance);
        json.AddField("health", health);
        json.AddField("speed", speed);
        json.AddField("strength", strength);
        json.AddField("accuracygrowth", accuracyGrowth);
        json.AddField("endurancegrowth", enduranceGrowth);
        json.AddField("healthgrowth", healthGrowth);
        json.AddField("speedgrowth", speedGrowth);
        json.AddField("strengthgrowth", strengthGrowth);
        json.AddField("record", record.jsonify());
        json.AddField("retired", retired);
        json.AddField("concussions", concussions);
        json.AddField("fatigue", fatigue);
        json.AddField("maturity", maturity);
        json.AddField("stress", stress);

        json.AddField("implant", equipedImplant);
        json.AddField("arms", equipedArms);
        json.AddField("legs", equipedLegs);

        return(json);
    }
 public static JSONObject TOJSON(object obj)                 //For a generic guess
 {
     if (touched.Add(obj))
     {
         JSONObject result = JSONObject.obj;
         //Fields
         FieldInfo[] fieldinfo = obj.GetType().GetFields();
         foreach (FieldInfo fi in fieldinfo)
         {
             JSONObject val = JSONObject.nullJO;
             if (!fi.GetValue(obj).Equals(null))
             {
                 MethodInfo info = typeof(JSONTemplates).GetMethod("From" + fi.FieldType.Name);
                 if (info != null)
                 {
                     object[] parms = new object[1];
                     parms[0] = fi.GetValue(obj);
                     val      = (JSONObject)info.Invoke(null, parms);
                 }
                 else if (fi.FieldType == typeof(string))
                 {
                     val = JSONObject.CreateStringObject(fi.GetValue(obj).ToString());
                 }
                 else
                 {
                     val = JSONObject.Create(fi.GetValue(obj).ToString());
                 }
             }
             if (val)
             {
                 if (val.type != JSONObject.Type.NULL)
                 {
                     result.AddField(fi.Name, val);
                 }
                 else if (GLog.IsLogWarningEnabled)
                 {
                     GLog.LogWarning("Null for this non-null object, property " + fi.Name + " of class " + obj.GetType().Name + ". Object type is " + fi.FieldType.Name);
                 }
             }
         }
         //Properties
         PropertyInfo[] propertyInfo = obj.GetType().GetProperties();
         foreach (PropertyInfo pi in propertyInfo)
         {
             //This section should mirror part of AssetFactory.AddScripts()
             JSONObject val = JSONObject.nullJO;
             if (!pi.GetValue(obj, null).Equals(null))
             {
                 MethodInfo info = typeof(JSONTemplates).GetMethod("From" + pi.PropertyType.Name);
                 if (info != null)
                 {
                     object[] parms = new object[1];
                     parms[0] = pi.GetValue(obj, null);
                     val      = (JSONObject)info.Invoke(null, parms);
                 }
                 else if (pi.PropertyType == typeof(string))
                 {
                     val = JSONObject.CreateStringObject(pi.GetValue(obj, null).ToString());
                 }
                 else
                 {
                     val = JSONObject.Create(pi.GetValue(obj, null).ToString());
                 }
             }
             if (val)
             {
                 if (val.type != JSONObject.Type.NULL)
                 {
                     result.AddField(pi.Name, val);
                 }
                 else if (GLog.IsLogWarningEnabled)
                 {
                     GLog.LogWarning("Null for this non-null object, property " + pi.Name + " of class " + obj.GetType().Name + ". Object type is " + pi.PropertyType.Name);
                 }
             }
         }
         return(result);
     }
     if (GLog.IsLogWarningEnabled)
     {
         GLog.LogWarning("trying to save the same data twice");
     }
     return(JSONObject.nullJO);
 }
Exemple #50
0
        public JSONObject ToJson()
        {
            JSONObject data = new JSONObject();

            data.AddField("roleId", roleId);
            data.AddField("roleName", roleName);
            data.AddField("level", level);
            data.AddField("exp", exp);

            data.AddField("fixedSTR", fixedSTR);
            data.AddField("fixedDEX", fixedDEX);
            data.AddField("fixedMAG", fixedMAG);
            data.AddField("fixedCON", fixedCON);
            data.AddField("potentialSTR", potentialSTR);
            data.AddField("potentialDEX", potentialDEX);
            data.AddField("potentialMAG", potentialMAG);
            data.AddField("potentialCON", potentialCON);

            return(data);
        }
Exemple #51
0
 public static void addStateField(ref JSONObject jObj, BoardState state)
 {
     jObj.AddField(Constants.Fields.boardState, state.ToString());
 }
Exemple #52
0
//		private static AndroidJavaClass jniStoreInfo = new AndroidJavaClass("com.soomla.unity.StoreInfo");
#endif

        public static void Initialize(IStoreAssets storeAssets)
        {
#if UNITY_EDITOR
            StoreInfo.storeAssets = storeAssets;
#endif

//			StoreUtils.LogDebug(TAG, "Adding currency");
            JSONObject currencies = new JSONObject(JSONObject.Type.ARRAY);
            foreach (VirtualCurrency vi in storeAssets.GetCurrencies())
            {
                currencies.Add(vi.toJSONObject());
            }

//			StoreUtils.LogDebug(TAG, "Adding packs");
            JSONObject packs = new JSONObject(JSONObject.Type.ARRAY);
            foreach (VirtualCurrencyPack vi in storeAssets.GetCurrencyPacks())
            {
                packs.Add(vi.toJSONObject());
            }

//			StoreUtils.LogDebug(TAG, "Adding goods");
            JSONObject suGoods = new JSONObject(JSONObject.Type.ARRAY);
            JSONObject ltGoods = new JSONObject(JSONObject.Type.ARRAY);
            JSONObject eqGoods = new JSONObject(JSONObject.Type.ARRAY);
            JSONObject upGoods = new JSONObject(JSONObject.Type.ARRAY);
            JSONObject paGoods = new JSONObject(JSONObject.Type.ARRAY);
            foreach (VirtualGood g in storeAssets.GetGoods())
            {
                if (g is SingleUseVG)
                {
                    suGoods.Add(g.toJSONObject());
                }
                else if (g is EquippableVG)
                {
                    eqGoods.Add(g.toJSONObject());
                }
                else if (g is LifetimeVG)
                {
                    ltGoods.Add(g.toJSONObject());
                }
                else if (g is SingleUsePackVG)
                {
                    paGoods.Add(g.toJSONObject());
                }
                else if (g is UpgradeVG)
                {
                    upGoods.Add(g.toJSONObject());
                }
            }
            JSONObject goods = new JSONObject(JSONObject.Type.OBJECT);
            goods.AddField(JSONConsts.STORE_GOODS_SU, suGoods);
            goods.AddField(JSONConsts.STORE_GOODS_LT, ltGoods);
            goods.AddField(JSONConsts.STORE_GOODS_EQ, eqGoods);
            goods.AddField(JSONConsts.STORE_GOODS_UP, upGoods);
            goods.AddField(JSONConsts.STORE_GOODS_PA, paGoods);

//			StoreUtils.LogDebug(TAG, "Adding categories");
            JSONObject categories = new JSONObject(JSONObject.Type.ARRAY);
            foreach (VirtualCategory vi in storeAssets.GetCategories())
            {
                categories.Add(vi.toJSONObject());
            }

//			StoreUtils.LogDebug(TAG, "Adding nonConsumables");
            JSONObject nonConsumables = new JSONObject(JSONObject.Type.ARRAY);
            foreach (NonConsumableItem vi in storeAssets.GetNonConsumableItems())
            {
                nonConsumables.Add(vi.toJSONObject());
            }

//			StoreUtils.LogDebug(TAG, "Preparing StoreAssets  JSONObject");
            JSONObject storeAssetsObj = new JSONObject(JSONObject.Type.OBJECT);
            storeAssetsObj.AddField(JSONConsts.STORE_CATEGORIES, categories);
            storeAssetsObj.AddField(JSONConsts.STORE_CURRENCIES, currencies);
            storeAssetsObj.AddField(JSONConsts.STORE_CURRENCYPACKS, packs);
            storeAssetsObj.AddField(JSONConsts.STORE_GOODS, goods);
            storeAssetsObj.AddField(JSONConsts.STORE_NONCONSUMABLES, nonConsumables);

            string storeAssetsJSON = storeAssetsObj.print();

#if UNITY_ANDROID
            StoreUtils.LogDebug(TAG, "pushing data to StoreAssets on java side");
            using (AndroidJavaClass jniStoreAssets = new AndroidJavaClass("com.soomla.unity.StoreAssets")) {
                jniStoreAssets.CallStatic("prepare", storeAssets.GetVersion(), storeAssetsJSON);
            }
            StoreUtils.LogDebug(TAG, "done! (pushing data to StoreAssets on java side)");
#elif UNITY_IOS
            StoreUtils.LogDebug(TAG, "pushing data to StoreAssets on ios side");
            storeAssets_Init(storeAssets.GetVersion(), storeAssetsJSON);
            StoreUtils.LogDebug(TAG, "done! (pushing data to StoreAssets on ios side)");
#endif
        }
Exemple #53
0
        public static JSONObject Serialize(this Operator op)
        {
            var opJs = new JSONObject(JSONObject.Type.OBJECT);

            opJs.AddField("Type", op.GetType().ToString());
            opJs.AddField("GUID", op.GUID);

            var posJs = new JSONObject(JSONObject.Type.ARRAY);

            posJs.Add(op.EditorPosition.x, op.EditorPosition.y);
            opJs.AddField("EditorPosition", posJs);

            opJs.AddField("IsGeometryOutput", new JSONObject(op.IsGeometryOutput));

            var paramsJs = new JSONObject(JSONObject.Type.OBJECT);

            opJs.AddField("Params", paramsJs);

            foreach (IOOutlet outlet in op.Inputs)
            {
                // float
                if (outlet.DataType == typeof(System.Single))
                {
                    paramsJs.AddField(outlet.Name, op.GetValue <float>(outlet));
                }

                // bool
                else if (outlet.DataType == typeof(System.Boolean))
                {
                    paramsJs.AddField(outlet.Name, op.GetValue <bool>(outlet));
                }

                // int
                else if (outlet.DataType == typeof(System.Int32))
                {
                    paramsJs.AddField(outlet.Name, op.GetValue <int>(outlet));
                }

                // string
                else if (outlet.DataType == typeof(System.String))
                {
                    paramsJs.AddField(outlet.Name, op.GetValue <string>(outlet));
                }

                // Vector2
                else if (outlet.DataType == typeof(Vector2))
                {
                    var vJs = new JSONObject(JSONObject.Type.ARRAY);
                    var v   = op.GetValue <Vector2>(outlet);
                    vJs.Add(v.x, v.y);
                    paramsJs.AddField(outlet.Name, vJs);
                }

                // Vector3
                else if (outlet.DataType == typeof(Vector3))
                {
                    var vJs = new JSONObject(JSONObject.Type.ARRAY);
                    var v   = op.GetValue <Vector3>(outlet);
                    vJs.Add(v.x, v.y, v.z);
                    paramsJs.AddField(outlet.Name, vJs);
                }

                // Vector4
                else if (outlet.DataType == typeof(Vector4))
                {
                    var vJs = new JSONObject(JSONObject.Type.ARRAY);
                    var v   = op.GetValue <Vector4>(outlet);
                    vJs.Add(v.x, v.y, v.z, v.w);
                    paramsJs.AddField(outlet.Name, vJs);
                }

                // Enum
                else if (outlet.DataType.IsEnum)
                {
                    object objValue = ((System.Reflection.FieldInfo)outlet.Member).GetValue(op);
                    paramsJs.AddField(outlet.Name, objValue.ToString());
                }

                else
                {
                    paramsJs.AddField(outlet.Name, new JSONObject(JSONObject.Type.NULL));
                }
            }

            return(opJs);
        }
Exemple #54
0
    public void Show()
    {
        GameObject go = GameObject.Find("SocketIO");

        socket = go.GetComponent <SocketIOComponent>();
        int  j, i;
        Text txt = FindTextFiel.find();
        MakeRequestResponse command = new MakeRequestResponse();

        command.gameId   = LoginScript.CurrentUserGameId;
        command.playerId = LoginScript.CurrentUserGEId;
        RequestJson req = new RequestJson();

        RestClient.Post <RequestJson>("https://catan-connectivity.herokuapp.com/game/rollDice", command).Then(Response =>
        {
            req.code   = Response.code;
            req.status = Response.status;


            if (req.code == 200)
            {
                Debug.Log(Response.code);
                Debug.Log(Response.status);
                JSONObject json_message = new JSONObject();
                json_message.AddField("lobbyid", LoginScript.CurrentUserLobbyId);
                json_message.AddField("username", LoginScript.CurrentUser);
                json_message.AddField("dice_1", Response.arguments.dice_1);
                json_message.AddField("dice_2", Response.arguments.dice_2);
                json_message.AddField("player_0", Response.arguments.player_0);
                json_message.AddField("lumber_0", Response.arguments.lumber_0);
                json_message.AddField("wool_0", Response.arguments.wool_0);
                json_message.AddField("grain_0", Response.arguments.grain_0);
                json_message.AddField("brick_0", Response.arguments.brick_0);
                json_message.AddField("ore_0", Response.arguments.ore_0);
                json_message.AddField("player_1", Response.arguments.player_1);
                json_message.AddField("lumber_1", Response.arguments.lumber_1);
                json_message.AddField("wool_1", Response.arguments.wool_1);
                json_message.AddField("grain_1", Response.arguments.grain_1);
                json_message.AddField("brick_1", Response.arguments.brick_1);
                json_message.AddField("ore_1", Response.arguments.ore_1);
                json_message.AddField("player_2", Response.arguments.player_2);
                json_message.AddField("lumber_2", Response.arguments.lumber_2);
                json_message.AddField("wool_2", Response.arguments.wool_2);
                json_message.AddField("grain_2", Response.arguments.grain_2);
                json_message.AddField("brick_2", Response.arguments.brick_2);
                json_message.AddField("ore_2", Response.arguments.ore_2);
                json_message.AddField("player_3", Response.arguments.player_3);
                json_message.AddField("lumber_3", Response.arguments.lumber_3);
                json_message.AddField("wool_3", Response.arguments.wool_3);
                json_message.AddField("grain_3", Response.arguments.grain_3);
                json_message.AddField("brick_3", Response.arguments.brick_3);
                json_message.AddField("ore_3", Response.arguments.ore_3);
                socket.Emit("RollDice", json_message);

                j = Response.arguments.dice_1;
                i = Response.arguments.dice_2;

                if (LoginScript.CurrentLobby.third == LoginScript.CurrentUser)
                {
                    lumber.text = (int.Parse(lumber.text) + Response.arguments.lumber_3).ToString();
                    ore.text    = (int.Parse(ore.text) + Response.arguments.ore_3).ToString();
                    grain.text  = (int.Parse(grain.text) + Response.arguments.grain_3).ToString();
                    brick.text  = (int.Parse(brick.text) + Response.arguments.brick_3).ToString();
                    wool.text   = (int.Parse(wool.text) + Response.arguments.wool_3).ToString();
                }
                else if (LoginScript.CurrentLobby.second == LoginScript.CurrentUser)
                {
                    lumber.text = (int.Parse(lumber.text) + Response.arguments.lumber_2).ToString();
                    ore.text    = (int.Parse(ore.text) + Response.arguments.ore_2).ToString();
                    grain.text  = (int.Parse(grain.text) + Response.arguments.grain_2).ToString();
                    brick.text  = (int.Parse(brick.text) + Response.arguments.brick_2).ToString();
                    wool.text   = (int.Parse(wool.text) + Response.arguments.wool_2).ToString();
                }
                else if (LoginScript.CurrentLobby.first == LoginScript.CurrentUser)
                {
                    lumber.text = (int.Parse(lumber.text) + Response.arguments.lumber_1).ToString();
                    ore.text    = (int.Parse(ore.text) + Response.arguments.ore_1).ToString();
                    grain.text  = (int.Parse(grain.text) + Response.arguments.grain_1).ToString();
                    brick.text  = (int.Parse(brick.text) + Response.arguments.brick_1).ToString();
                    wool.text   = (int.Parse(wool.text) + Response.arguments.wool_1).ToString();
                }
                else if (LoginScript.CurrentLobby.master == LoginScript.CurrentUser)
                {
                    lumber.text = (int.Parse(lumber.text) + Response.arguments.lumber_0).ToString();
                    ore.text    = (int.Parse(ore.text) + Response.arguments.ore_0).ToString();
                    grain.text  = (int.Parse(grain.text) + Response.arguments.grain_0).ToString();
                    brick.text  = (int.Parse(brick.text) + Response.arguments.brick_0).ToString();
                    wool.text   = (int.Parse(wool.text) + Response.arguments.wool_0).ToString();
                }


                switch (j)
                {
                case 1:
                    side1.SetActive(true);
                    side2.SetActive(false);
                    side3.SetActive(false);
                    side4.SetActive(false);
                    side5.SetActive(false);
                    side6.SetActive(false);

                    break;

                case 2:
                    side1.SetActive(false);
                    side2.SetActive(true);
                    side3.SetActive(false);
                    side4.SetActive(false);
                    side5.SetActive(false);
                    side6.SetActive(false);

                    break;

                case 3:
                    side1.SetActive(false);
                    side2.SetActive(false);
                    side3.SetActive(true);
                    side4.SetActive(false);
                    side5.SetActive(false);
                    side6.SetActive(false);

                    break;

                case 4:
                    side1.SetActive(false);
                    side2.SetActive(false);
                    side3.SetActive(false);
                    side4.SetActive(true);
                    side5.SetActive(false);
                    side6.SetActive(false);

                    break;

                case 5:
                    side1.SetActive(false);
                    side2.SetActive(false);
                    side3.SetActive(false);
                    side4.SetActive(false);
                    side5.SetActive(true);
                    side6.SetActive(false);

                    break;

                case 6:
                    side1.SetActive(false);
                    side2.SetActive(false);
                    side3.SetActive(false);
                    side4.SetActive(false);
                    side5.SetActive(false);
                    side6.SetActive(true);

                    break;
                }

                switch (i)
                {
                case 1:
                    sside1.SetActive(true);
                    sside2.SetActive(false);
                    sside3.SetActive(false);
                    sside4.SetActive(false);
                    sside5.SetActive(false);
                    sside6.SetActive(false);

                    break;

                case 2:
                    sside1.SetActive(false);
                    sside2.SetActive(true);
                    sside3.SetActive(false);
                    sside4.SetActive(false);
                    sside5.SetActive(false);
                    sside6.SetActive(false);
                    break;

                case 3:
                    sside1.SetActive(false);
                    sside2.SetActive(false);
                    sside3.SetActive(true);
                    sside4.SetActive(false);
                    sside5.SetActive(false);
                    sside6.SetActive(false);
                    break;

                case 4:
                    sside1.SetActive(false);
                    sside2.SetActive(false);
                    sside3.SetActive(false);
                    sside4.SetActive(true);
                    sside5.SetActive(false);
                    sside6.SetActive(false);
                    break;

                case 5:
                    sside1.SetActive(false);
                    sside2.SetActive(false);
                    sside3.SetActive(false);
                    sside4.SetActive(false);
                    sside5.SetActive(true);
                    sside6.SetActive(false);
                    break;

                case 6:
                    sside1.SetActive(false);
                    sside2.SetActive(false);
                    sside3.SetActive(false);
                    sside4.SetActive(false);
                    sside5.SetActive(false);
                    sside6.SetActive(true);
                    break;
                }
                if (i + j == 7)
                {
                    tataHot.SetActive(true);

                    int player_0_sum = int.Parse(lumber.text) + int.Parse(brick.text) + int.Parse(ore.text) + int.Parse(wool.text) + int.Parse(grain.text);
                    if (player_0_sum > 7)
                    {
                        tataPanel.SetActive(true);
                        player_0_sum      = player_0_sum / 2;
                        DiscarAmount.text = "You have to discard " + player_0_sum.ToString() + " of your cards";
                        ibirck.text       = "";
                        iore.text         = "";
                        ilumber.text      = "";
                        igrain.text       = "";
                        iwool.text        = "";
                    }
                }
            }
            txt.text = req.status;
        }).Catch(err => { Debug.Log(err); });
    }
Exemple #55
0
    /*
     * Matrix4x4
     */
    public static JSONObject FromMatrix4x4(Matrix4x4 m)
    {
        JSONObject mdata = JSONObject.obj;

        if (m.m00 != 0)
        {
            mdata.AddField("m00", m.m00);
        }
        if (m.m01 != 0)
        {
            mdata.AddField("m01", m.m01);
        }
        if (m.m02 != 0)
        {
            mdata.AddField("m02", m.m02);
        }
        if (m.m03 != 0)
        {
            mdata.AddField("m03", m.m03);
        }
        if (m.m10 != 0)
        {
            mdata.AddField("m10", m.m10);
        }
        if (m.m11 != 0)
        {
            mdata.AddField("m11", m.m11);
        }
        if (m.m12 != 0)
        {
            mdata.AddField("m12", m.m12);
        }
        if (m.m13 != 0)
        {
            mdata.AddField("m13", m.m13);
        }
        if (m.m20 != 0)
        {
            mdata.AddField("m20", m.m20);
        }
        if (m.m21 != 0)
        {
            mdata.AddField("m21", m.m21);
        }
        if (m.m22 != 0)
        {
            mdata.AddField("m22", m.m22);
        }
        if (m.m23 != 0)
        {
            mdata.AddField("m23", m.m23);
        }
        if (m.m30 != 0)
        {
            mdata.AddField("m30", m.m30);
        }
        if (m.m31 != 0)
        {
            mdata.AddField("m31", m.m31);
        }
        if (m.m32 != 0)
        {
            mdata.AddField("m32", m.m32);
        }
        if (m.m33 != 0)
        {
            mdata.AddField("m33", m.m33);
        }
        return(mdata);
    }
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            Debug.Log("Connecting ...");
            ddpConnection.Connect();
        }

        if (Input.GetKeyDown(KeyCode.V))
        {
            ddpConnection.Close();
        }

        if (Input.GetKeyDown(KeyCode.S))
        {
            friendSub         = ddpConnection.Subscribe("friends");
            friendSub.OnReady = (Subscription obj) => {
                Debug.Log("Ready subscription: " + obj.id);
            };
        }

        if (Input.GetKeyDown(KeyCode.U))
        {
            ddpConnection.Unsubscribe(friendSub);
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            ddpConnection.Call("friends.removeAll");
        }

        if (Input.GetKeyDown(KeyCode.F))
        {
            ddpConnection.Call("friends.create", JSONObject.CreateStringObject("Coco"));
        }

        if (Input.GetKeyDown(KeyCode.D))
        {
            foreach (var entry in friendCollection.documents)
            {
                Debug.Log(entry.Key + " " + entry.Value);
            }
        }

        if (Input.GetKeyDown(KeyCode.O))
        {
            JSONObject parents = new JSONObject();
            parents.AddField("mother", "wonder woman");
            parents.AddField("father", "batman");
            JSONObject attr = new JSONObject();
            attr.AddField("age", 24);
            attr.AddField("height", 180);
            attr.AddField("parents", parents);
            ddpConnection.Call("friends.addAttributes", JSONObject.StringObject("Coco"), attr);
        }

        if (Input.GetKeyDown(KeyCode.P))
        {
            JSONObject attr = new JSONObject();
            attr.AddField("age", 1);
            attr.AddField("height", 1);
            attr.AddField("parents.mother", 1);
            ddpConnection.Call("friends.removeAttributes", JSONObject.StringObject("Coco"), attr);
        }
    }
Exemple #57
0
 public void AddConfig(string key, string value)
 {
     m_jsonCfg.AddField(key, value);
 }
Exemple #58
0
        private void AddDefaultParameters()
        {
            data.AddField("deviceId", SystemInfo.deviceUniqueIdentifier);
            data.AddField("uid", uid);
            data.AddField("locale", "en");
            data.AddField("appVersion", PlayerSettings.bundleVersion);
            data.AddField("apiVersion", SpilUnityImplementationBase.PluginVersion);
            data.AddField("osVersion", "1.0");
            data.AddField("os", platform);
            data.AddField("deviceModel", "Editor");
            data.AddField("timezoneOffset", "0");
            data.AddField("tto", "200");
            if (platform.Equals("android"))
            {
                data.AddField("packageName", bundleIdentifier);
            }
            else
            {
                data.AddField("bundleId", bundleIdentifier);
            }
            data.AddField("sessionId", "deadbeef");
            data.AddField("pluginName", Response.pluginName);
            data.AddField("pluginVersion", Response.pluginVersion);

            if (Response.provider == null || Response.externalId == null)
            {
                return;
            }
            JSONObject externalUserIdJson = new JSONObject();

            externalUserIdJson.AddField("provider", Response.provider);
            externalUserIdJson.AddField("userId", Response.externalId);

            data.AddField("externalUserId", externalUserIdJson);
        }
    /// <summary>
    /// Merge object right into left recursively
    /// </summary>
    /// <param name="left">The left (base) object</param>
    /// <param name="right">The right (new) object</param>
    static void MergeRecur(JSONObject left, JSONObject right)
    {
        if (left.type == Type.NULL)
        {
            left.Absorb(right);
        }
        else if (left.type == Type.OBJECT && right.type == Type.OBJECT)
        {
            for (int i = 0; i < right.list.Count; i++)
            {
                string key = right.keys[i];
                if (right[i].isContainer)
                {
                    if (left.HasField(key))
                    {
                        MergeRecur(left[key], right[i]);
                    }
                    else
                    {
                        left.AddField(key, right[i]);
                    }
                }
                else
                {
                    if (left.HasField(key))
                    {
                        left.SetField(key, right[i]);
                    }
                    else
                    {
                        left.AddField(key, right[i]);
                    }
                }
            }
        }
        else if (left.type == Type.ARRAY && right.type == Type.ARRAY)
        {
            if (right.Count > left.Count)
            {
#if UNITY_2 || UNITY_3 || UNITY_4 || UNITY_5
                Debug.LogError
#else
                Debug.WriteLine
#endif
                    ("Cannot merge arrays when right object has more elements");

                return;
            }
            for (int i = 0; i < right.list.Count; i++)
            {
                if (left[i].type == right[i].type)                                      //Only overwrite with the same type
                {
                    if (left[i].isContainer)
                    {
                        MergeRecur(left[i], right[i]);
                    }
                    else
                    {
                        left[i] = right[i];
                    }
                }
            }
        }
    }
        void HandleNetworkDispatcher(JSONObject content)
        {
            string     IP               = content.GetField("ip").str;
            int        Port             = (int)content.GetField("port").n;
            string     Out_exchange     = content.GetField("in_exchange").str;
            string     In_exchange      = content.GetField("out_exchange").str;
            string     In_queue         = content.GetField("in_queue").str;
            string     Uuid             = content.GetField("uuid").str;
            string     Login_Username   = content.GetField("username").str;
            string     Login_Password   = content.GetField("password").str;
            string     Username         = NetworkConfig.RabbitUsername;
            string     Password         = NetworkConfig.RabbitPassword;
            string     virtualHost      = NetworkConfig.VirtualHost;
            string     queuePrefix      = NetworkConfig.QueuePrefix;
            JSONObject newNetworkConfig = new JSONObject();

            newNetworkConfig.AddField("RabbitUsername", Username);
            newNetworkConfig.AddField("RabbitPassword", Password);
            newNetworkConfig.AddField("VirtualHost", virtualHost);
            newNetworkConfig.AddField("HostName", IP);
            newNetworkConfig.AddField("Port", Port);
            newNetworkConfig.AddField("QueuePrefix", queuePrefix);
            newNetworkConfig.AddField("OUT_Exchange", Out_exchange);
            newNetworkConfig.AddField("IN_Exchange", In_exchange);
            newNetworkConfig.AddField("ServerRoutingKey", In_queue);
            newNetworkConfig.AddField("UUID", Uuid);
            newNetworkConfig.AddField("user_id", Login_Username);
            NetworkConfig.SetupFromJson(newNetworkConfig);
            connectionType = ConnectionType.worker;
            EstablishNewConnection();
            SignUpAction(Login_Username, Login_Password);
        }