public OSRICModifierCollection(JSONObject _jo)
 {
     foreach(JSONObject obj in _jo.list)
     {
         ModifierList.Add(new OSRICCharacterModifier(obj));
     }
 }
 public void Init()
 {
     jsonDataSheet = new List<Dictionary<string, string>>();
     jsonFile = Resources.Load("TextAsset/SubWorldDefaultData/subworld_default") as TextAsset;
     subWorldJsonObj = new JSONObject(jsonFile.text);
     AccessData(subWorldJsonObj);
 }
Esempio n. 3
0
 /// <summary>
 /// see parent.
 /// </summary>
 public UpgradeVG(JSONObject jsonItem)
     : base(jsonItem)
 {
     GoodItemId = jsonItem[JSONConsts.VGU_GOOD_ITEMID].str;
     PrevItemId = jsonItem[JSONConsts.VGU_PREV_ITEMID].str;
     NextItemId = jsonItem[JSONConsts.VGU_NEXT_ITEMID].str;
 }
Esempio n. 4
0
 void parseData(string data)
 {
     JSONObject json = new JSONObject (data);
     string action = json.GetField ("action").str;
     print(action + "parse data" + data);
     JSONObject pos = json.GetField("position");
     Single pX = Convert.ToSingle (pos.GetField ("X").str);
     Single pY = Convert.ToSingle (pos.GetField ("Y").str);
     Single pZ = Convert.ToSingle (pos.GetField ("Z").str);
     Vector3 position = new Vector3 (pX, pY, pZ);
     print ("new vector = x-" + pos.GetField ("X").str + " y-" + pos.GetField ("Y").str);
     JSONObject rot = json.GetField("rotation");
     Single rX = Convert.ToSingle (rot.GetField ("X").str);
     Single rY = Convert.ToSingle (rot.GetField ("Y").str);
     Single rZ = Convert.ToSingle (rot.GetField ("Z").str);
     Single rW = Convert.ToSingle (rot.GetField ("W").str);
     Quaternion rotation = new Quaternion (rX, rY, rZ, rW);
     switch (action) {
         case "start":
             this.id = json.GetField ("id").str;
             createPlayer ();
             break;
         case "newPlayer":
             createNewClient (json.GetField ("id").str, position, rotation);
             break;
         case "move":
             moveClient (json.GetField ("id").str, position, rotation);
             break;
     }
 }
 /// <summary>
 /// Adds Score to database
 /// </summary>
 /// <param name="name"></param>
 /// <param name="id"></param>
 /// <param name="score"></param>
 /// <returns></returns>
 private IEnumerator AddScore(string name, string id, string score)
 {
     WWWForm f = new WWWForm();
     f.AddField("ScoreID", id);
     f.AddField("Name", name);
     f.AddField("Point", score);
     WWW w = new WWW("demo/theappguruz/score/add", f);
     yield return w;
     if (w.error == null)
     {
         JSONObject jsonObject = new JSONObject(w.text);
         string data = jsonObject.GetField("Status").str;
         if (data != null && data.Equals("Success"))
         {
             Debug.Log("Successfull");
         }
         else
         {
             Debug.Log("Fatel Error");
         }
     }
     else
     {
         Debug.Log("No Internet Or Other Network Issue" + w.error);
     }
 }
 /// <summary>
 /// A wrapper function that calls <c>AppRequest</c> from Facebook's API: "Prompts the user to  
 /// send app requests, short messages between users."
 /// </summary>
 /// <param name="message">Message to send.</param>
 /// <param name="to">Who to send message to (can be 1 or more users).</param>
 /// <param name="extraData">Extra data.</param>
 /// <param name="dialogTitle">Dialog title.</param>
 /// <param name="success">Callback function that is called if App request succeeded.</param>
 /// <param name="fail">Callback function that is called if App request failed.</param>
 public override void AppRequest(string message, string[] to, string extraData, string dialogTitle, AppRequestSuccess success, AppRequestFailed fail)
 {
     FB.AppRequest(message,
                   to,
                   null, null, null,
                   extraData,
                   dialogTitle,
                   (FBResult result) => {
                         if (result.Error != null) {
                             SoomlaUtils.LogError(TAG, "AppRequest[result.Error]: "+result.Error);
                             fail(result.Error);
                         }
                         else {
                             SoomlaUtils.LogDebug(TAG, "AppRequest[result.Text]: "+result.Text);
                             SoomlaUtils.LogDebug(TAG, "AppRequest[result.Texture]: "+result.Texture);
                             JSONObject jsonResponse = new JSONObject(result.Text);
                             List<JSONObject> jsonRecipinets = jsonResponse["to"].list;
                             List<string> recipients = new List<string>();
                             foreach (JSONObject o in jsonRecipinets) {
                                 recipients.Add(o.str);
                             }
                             success(jsonResponse["request"].str, recipients);
                         }
                     });
 }
Esempio n. 7
0
	// Update is called once per frame
	void Update () {

		lastQ = Input.gyro.attitude;
		lastAcc = Input.acceleration;

		if (Transfering) {

			counter += Time.deltaTime;

						if (counter > updateRate) {
								counter = 0;

								JSONObject json = new JSONObject ();
								json.AddField ("command", "gyro");
								json.AddField ("x", lastQ.x);
								json.AddField ("y", lastQ.y);
								json.AddField ("z", lastQ.z);
								json.AddField ("w", lastQ.w);
								json.AddField ("accX", lastAcc.x);
								json.AddField ("accY", lastAcc.y);
								json.AddField ("accZ", lastAcc.z);
								communicationManager.SendJson (json);


						}

				}

	}
Esempio n. 8
0
 void ITmdbObject.ProcessJson(JSONObject jsonObject)
 {
     Adult = jsonObject.GetSafeBoolean("adult");
     Id = (int)jsonObject.GetSafeNumber("id");
     Name = jsonObject.GetSafeString("name");
     ProfilePath = jsonObject.GetSafeString("profile_path");
 }
Esempio n. 9
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;
        }
Esempio n. 10
0
	/*
	 * 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;
	}
Esempio n. 11
0
	public static Vector4 ToVector4(JSONObject obj) {
		float x = obj["x"] ? obj["x"].f : 0;
		float y = obj["y"] ? obj["y"].f : 0;
		float z = obj["z"] ? obj["z"].f : 0;
		float w = obj["w"] ? obj["w"].f : 0;
		return new Vector4(x, y, z, w);
	}
Esempio n. 12
0
 void ITmdbObject.ProcessJson(JSONObject jsonObject)
 {
     Id = (int)jsonObject.GetSafeNumber("id");
     BackdropPath = jsonObject.GetSafeString("backdrop_path");
     Name = jsonObject.GetSafeString("name");
     PosterPath = jsonObject.GetSafeString("poster_path");
 }
Esempio n. 13
0
    void accessData(JSONObject obj)
    {
        switch(obj.type){
            case JSONObject.Type.OBJECT:
                for(int i = 0; i < obj.list.Count; i++){
                    string key = (string)obj.keys[i];
                    JSONObject j = (JSONObject)obj.list[i];
                    Debug.Log(key);
                    accessData(j);
                }
                break;
            case JSONObject.Type.ARRAY:
                foreach(JSONObject j in obj.list){
                    accessData(j);
                }
                break;
            case JSONObject.Type.STRING:
                Debug.Log(obj.str);
                break;
            case JSONObject.Type.NUMBER:
                Debug.Log(obj.n);
                break;
            case JSONObject.Type.BOOL:
                Debug.Log(obj.b);
                break;
            case JSONObject.Type.NULL:
                Debug.Log("NULL");
                break;

        }
    }
Esempio n. 14
0
		/// <summary>
		/// see parent
		/// </summary>
		public VirtualCurrencyPack(JSONObject jsonItem)
			: base(jsonItem)
		{
			this.CurrencyAmount = System.Convert.ToInt32(((JSONObject)jsonItem[JSONConsts.CURRENCYPACK_CURRENCYAMOUNT]).n);
			
			CurrencyItemId = jsonItem[JSONConsts.CURRENCYPACK_CURRENCYITEMID].str;
		}
        private static void ProcessMyGameStateResponse(JSONObject jsonData)
        {
            if (jsonData.GetField ("gameStates")) {
                JSONObject gameStateData = jsonData.GetField ("gameStates");

                for (int i = 0; i < gameStateData.list.Count; i++) {
                    JSONObject gameState = gameStateData.list [i];

                    string access = null;
                    if (gameState.HasField ("access")) {
                        access = gameState.GetField ("access").str;
                    }

                    string data = null;
                    if (gameState.HasField ("data")) {
                        data = gameState.GetField ("data").str;
                    }

                    if (access != null && data != null) {
                        if (access.Equals ("private")) {
                            PrivateGameStateData = data;
                            SpilUnityImplementationBase.fireGameStateUpdated ("private");
                        } else if (access.Equals ("public")) {
                            PublicGameStateData = data;
                            SpilUnityImplementationBase.fireGameStateUpdated ("public");
                        }
                    }
                }
            }
        }
    public void setData(JSONObject dataObject)
    {
        leaderboardUI.SetActive(true);
        scaleTween.enabled = true;

        //set data
        for(int i = 0;i <leaderLabelArray.Count;i++){

            UILabel label = leaderLabelArray[i].GetComponent<UILabel>();

            if(i>=dataObject.list.Count)
            {
                Debug.Log("1");
                label.text = " ";
            }
            else
            {
                Debug.Log("2");
                JSONObject itemData = dataObject[i];

                string name1 = itemData["username1"].str;
                string name2 = itemData["username2"].str;
                float time =  (float)itemData["exeTime"].n;

                TimeSpan timeSpan = TimeSpan.FromSeconds(time);

                string timeStr = string.Format("{0:00}:{1:00}:{2:00}s",timeSpan.Hours,timeSpan.Minutes, timeSpan.Seconds);

                label.text = " "+(i+1)+"."+name1 +" and "+name2+"\n                               "+timeStr;
            }

        }
    }
Esempio n. 17
0
  public void SetResults(JSONObject jsonData) {
		spinDataResult = jsonData;
    resultsData = jsonData.GetArray("items");
    winningGold = jsonData.GetArray("wGold");
		// Calculate extra data (winning type, winning count from list result items)
		JSONObject extraData = SlotCombination.CalculateCombination(resultsData, GetNumLine());
    winningCount = extraData.GetArray("wCount");
    winningType = extraData.GetArray("wType");
		//
    isJackpot = jsonData.GetBoolean("isJP");
		freeSpinLeft = jsonData.GetInt("frLeft");
		isBigWin = jsonData.GetBoolean("bWin");
		gotFreeSpin = jsonData.GetInt("frCount") > 0;
		// bool[] winingItems = new bool[15];
		// for (int i = 0; i < winningGold.Length; i++) {
		// 	if (winningGold[i].Number > 0) {
		// 		for (int j = 0; j < SlotCombination.NUM_REELS; j++) {
		// 			winingItems[SlotCombination.COMBINATION[i, j]] = true;
		// 		}
		// 	}
		// }
    for (int i = 0; i < slotReels.Length; i++) {
      slotReels[i].SetResults(new int[3] { (int)resultsData[i * 3].Number, (int)resultsData[i * 3 + 1].Number, (int)resultsData[i * 3 + 2].Number });
    }
  }
Esempio n. 18
0
        void CreateLobbyPlayerObject(JSONObject playerInfo, int position)
        {
            string playerId = playerInfo["id"].str;
              bool   isOwner  = playerInfo["owner"].b;
              bool   isReady  = playerInfo["ready"].b;

              float x = 0;
              float y = -(position * (LobbyPlayer.HEIGHT + LOBBY_PLAYER_VERTICAL_MARGIN));
              Vector2 positionVector = new Vector2(x, y);

              GameObject go_lobbyPlayer =
            Instantiate(
              Resources.Load("Prefabs/Lobby/LobbyPlayer")
            ) as GameObject;

              go_lobbyPlayer.name = playerId;
              go_lobbyPlayer.transform.SetParent(transform);
              go_lobbyPlayer.transform.Find("PlayerName").GetComponent<Text>().text = playerId;
              go_lobbyPlayer.GetComponent<RectTransform>().anchoredPosition = positionVector;
              go_lobbyPlayer.transform.Find("Ready").gameObject.active = isReady;

              if (isOwner){
            go_lobbyPlayer.GetComponent<Image>().color = new Color32(252, 254, 159, 255);
              }

              lobbyPlayers.Add(go_lobbyPlayer);
        }
Esempio n. 19
0
 public static string SerializeObject(JSONObject jsonObject)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("{");
     foreach (KeyValuePair<string, object> pair in jsonObject)
     {
         if (pair.Value is JSONObject)
         {
             builder.Append(string.Format("{0}:{1},", pair.Key, SerializeObject((JSONObject) pair.Value)));
         }
         else if (pair.Value is JSONArray)
         {
             builder.Append(string.Format("{0}:{1},", pair.Key, SerializeArray((JSONArray) pair.Value)));
         }
         else if (pair.Value is string)
         {
             builder.Append(string.Format("{0}:{1},", pair.Key, pair.Value));
         }
         else
         {
             builder.Append(string.Format("{0}:{1},", pair.Key, pair.Value));
         }
     }
     if (builder.Length > 1)
     {
         builder.Remove(builder.Length - 1, 1);
     }
     builder.Append("}");
     return builder.ToString();
 }
  public void UpdateRowData(JSONObject data, LeaderboardScreen.Tab selectedTab) {
    rowData = data;
    
    if (AccountManager.Instance.IsYou(rowData.GetString("username"))) {
      background.spriteName = "PopupBackground";
    } else {
      background.spriteName = "Global_Window_Paper";
    }
    
    playerNameLabel.text = rowData.GetString("displayName");
    if (selectedTab == LeaderboardScreen.Tab.TOP_RICHER) {
      cashLabel.text = rowData.GetLong("cash").ToString("N0") + "$";
    } else {
      // cashLabel.text = Utils.Localize("Top_Winner_Match_Text", new string[1] {rowData.GetInt("winMatchNumb").ToString("N0")});
      cashLabel.text = Localization.Format("Top_Winner_Match_Text", rowData.GetInt("bossKill").ToString("N0"));
    }
    rank = rowData.GetInt("rank");
    if (rank <= 3) {
			Utils.SetActive(rankBackground, false);
			Utils.SetActive(rankIcon.gameObject, true);
      rankIcon.spriteName = "Chat_RankIcon0" + rank;
    } else {
			Utils.SetActive(rankBackground, true);
			Utils.SetActive(rankIcon.gameObject, false);
      rankLabel.text = rank.ToString();
    }
    eventTrigger.inputParams = new object[] {rowData.GetString("username")};
    EventDelegate.Set(eventTrigger.onClick, delegate() { EventShowUserInfo((string)eventTrigger.inputParams[0]); });
  }
Esempio n. 21
0
	public void Create() {
		TLMBGameConfig gameConfig = TLMBGameConfig.CreateCountGame(10);
		JSONObject jsonData = new JSONObject();
		jsonData.Add("gameConfig", gameConfig.ToJsonObject());
		jsonData.Add("seatIndex", 0);
		SmartfoxClient.Instance.HandleServerRequest(CreateExtensionRequest(Command.TLMB.CREATE, jsonData));
	}
        public static JSONObject GetValues(string referenceId, string itemId)
        {
            var data = GetAccordionData(referenceId);
            var item = data.GetItem(itemId);

            JSONObject result = new JSONObject();
            result.AddValue("headline", item.Headline);
            result.AddValue("content", item.Content);

            result.AddValue("isRoot", item.Id == data.Id);

            if (item.Id == data.Id)
            {
                result.AddValue("canMoveUp", false);
                result.AddValue("canMoveDown", false);
            }
            else
            {
                var parent = item.Parent;
                var index = item.Parent.Items.IndexOf(item);
                result.AddValue("canMoveUp", index > 0);
                result.AddValue("canMoveDown", index < parent.Items.Count-1);
            }

            if (!string.IsNullOrEmpty(item.ModuleId))
            {
                var module = CmsService.Instance.GetItem<Entity>(new Id(item.ModuleId));
                if (module != null)
                {
                    result.AddValue("moduleId", item.ModuleId);
                    result.AddValue("moduleName", module.EntityName);
                }
            }
            return result;
        }
Esempio n. 23
0
 public static Vector3 ToVector3(JSONObject obj)
 {
     float x = obj["x"] ? obj["x"].f : 0;
     float y = obj["y"] ? obj["y"].f : 0;
     float z = obj["z"] ? obj["z"].f : 0;
     return new Vector3(x, y, z);
 }
Esempio n. 24
0
    private void OnPlayAvariable(SocketIOEvent evt )
    {
        UserData player1 = CheckPlayer(evt.data.GetField("player1"));
        UserData player2 = CheckPlayer(evt.data.GetField("player2"));

        if( GameManager.Instance.userData.ID == player1.ID ){
            Debug.Log("Player1 Ready!!");
            GameManager.Instance.player = GameManager.Player.player1;

            JSONObject ready = new JSONObject();
            ready.AddField("id", player1.ID );
            NetworkManager.Instance.Socket.Emit("READY", ready);
        }else{
            if( GameManager.Instance.userData.ID == player2.ID ){
                Debug.Log("Player2 Ready!!");
                GameManager.Instance.player = GameManager.Player.player2;
                JSONObject ready = new JSONObject();
                ready.AddField("id", player1.ID );
                NetworkManager.Instance.Socket.Emit("READY", ready);
            }else{
                Debug.Log("JUST WATCH!!");
                GameManager.Instance.player = GameManager.Player.guest;
            }
        }

        oldText.text 		= player1.UserName;
        friendText.text 	= player2.UserName;
    }
	public void fromJSONObject(JSONObject json)
	{
		JSONObject marketItem = json.GetField("marketItem");

		JSONObject jsonProductId = marketItem.GetField("productId");
		if (jsonProductId != null) {
			this.productId = marketItem.GetField("productId").str;
		} else {
			this.productId = "";
		}
        
		JSONObject jsonIosId = marketItem.GetField ("iosId");

		this.useIos = (jsonIosId != null);
		if (this.useIos)
		{
			this.iosId = jsonIosId.str;
		}
		
		JSONObject jsonAndroidId = marketItem.GetField ("androidId");
		this.useAndroid = (jsonAndroidId != null);
		if (this.useAndroid)
		{
			this.androidId = jsonAndroidId.str;
		}
		
		this.price = marketItem.GetField ("price").f;
		this.consumable = (Consumable)int.Parse(marketItem.GetField("consumable").ToString());
	}
Esempio n. 26
0
        /// <summary>
        /// Buys the purchasable virtual item.
        /// Implementation in subclasses will be according to specific type of purchase.
        /// </summary>
        /// <param name="payload">a string you want to be assigned to the purchase. This string
        /// is saved in a static variable and will be given bacl to you when the
        ///  purchase is completed.</param>
        /// <exception cref="Soomla.Store.InsufficientFundsException">throws InsufficientFundsException</exception>
        public override void Buy(string payload)
        {
            SoomlaUtils.LogDebug("SOOMLA PurchaseWithVirtualItem", "Trying to buy a " + AssociatedItem.Name + " with "
                                 + Amount + " pieces of " + TargetItemId);

            VirtualItem item = getTargetVirtualItem ();
            if (item == null) {
                return;
            }

            JSONObject eventJSON = new JSONObject();
            eventJSON.AddField("itemId", AssociatedItem.ItemId);
            StoreEvents.Instance.onItemPurchaseStarted(eventJSON.print(), true);

            if (!checkTargetBalance (item)) {
                StoreEvents.OnNotEnoughTargetItem(StoreInfo.VirtualItems["seed"]);
                return;
            //				throw new InsufficientFundsException (TargetItemId);
            }

            item.Take(Amount);

            AssociatedItem.Give(1);

            // We have to make sure the ItemPurchased event will be fired AFTER the balance/currency-changed events.
            StoreEvents.Instance.RunLater(() => {
                eventJSON = new JSONObject();
                eventJSON.AddField("itemId", AssociatedItem.ItemId);
                eventJSON.AddField("payload", payload);
                StoreEvents.Instance.onItemPurchased(eventJSON.print(), true);
            });
        }
Esempio n. 27
0
    public Dictionary<string, string> ParseFrom(string rawdata)
    {
        JSONObject jsonObj = new JSONObject(rawdata);
        Dictionary<string, string> data = jsonObj.ToDictionary();

        return data;
    }
    public void Update()
    {
        if (dataLoaded || currencyWWW == null || !currencyWWW.isDone) return;

        // let's look at the results
        JSONObject j = new JSONObject(currencyWWW.text);

        j.GetField("list", delegate (JSONObject list) {

            list.GetField("resources", delegate (JSONObject resources) {
                foreach (JSONObject entry in resources.list)
                {
                    entry.GetField("resource", delegate (JSONObject resource) {
                        resource.GetField("fields", delegate (JSONObject fields) {
                            string name;
                            string price;
                            string volume;

                            fields.GetField(out price, "price", "-1");
                            fields.GetField(out name, "name", "NONAME");
                            fields.GetField(out volume, "volume", "NOVOLUME");

                            CurrencyData data = new CurrencyData(name, price, volume);
                            CreateDataObject(data);

                            //Debug.Log("Found : " + name + " = " + float.Parse(price) + " at " + float.Parse(volume) + " sold");
                        });
                    });
                }
                dataLoaded = true;
            });
        }, delegate (string list) { //"name" will be equal to the name of the missing field.  In this case, "hits"
            Debug.LogWarning("no data found");
        });
    }
Esempio n. 29
0
    public OSRICAttributeModel(RPGCharacterModel _cm, JSONObject _jo)
    {
        cm = _cm;
        CharacterModifiers = new OSRICModifierCollection();
        characterName = _jo["characterName"].str;
        Str = (int)_jo["Str"].n;
        Dex = (int)_jo["Dex"].n;
        Con = (int)_jo["Con"].n;
        Int = (int)_jo["Int"].n;
        Wis = (int)_jo["Wis"].n;
        Cha = (int)_jo["Cha"].n;
        hitPoints = (int)_jo["hitPoints"].n;

        string[] levelStr = _jo["level"].str.Split('/');
        level = new int[levelStr.Length];

        for(int i=0; i<levelStr.Length; i++)
            level[i] = Int32.Parse(levelStr[i]);

        experiencePoints = (int)_jo["experiencePoints"].n;
        vision = (int)_jo["vision"].n;
        move = (int)_jo["move"].n;
        characterGender = OSRICConstants.GetEnum<OSRIC_GENDER>(_jo["characterGender"].str);
        characterRace = OSRICConstants.GetEnum<OSRIC_RACE>(_jo["characterRace"].str);
        characterClass = OSRICConstants.GetEnum<OSRIC_CLASS>(_jo["characterClass"].str);
        characterAlignment = OSRICConstants.GetEnum<OSRIC_ALIGNMENT>(_jo["characterAlignment"].str);
        characterState = OSRICConstants.GetEnum<OSRIC_CHARACTER_STATE>(_jo["characterState"].str);
        foreach(JSONObject obj in _jo["CharacterModifiers"].list)
            CharacterModifiers.Add(new OSRICCharacterModifier(obj));
    }
Esempio n. 30
0
 public Node(JSONObject json)
 {
     id = TrackGenerator.getByKey (json, "@id").i;
     lat = TrackGenerator.getByKey (json, "lat").n;
     lon = TrackGenerator.getByKey (json, "lon").n;
     ele = TrackGenerator.getByKey (json, "ele").n;
 }
Esempio n. 31
0
 /*
  * The Merge function is experimental. Use at your own risk.
  */
 public void Merge(JSONObject obj)
 {
     MergeRecur(this, obj);
 }
 public TradeTransactionCommand(JSONObject arguments, bool prettyPrint)
     : base(arguments, prettyPrint)
 {
 }
Esempio n. 33
0
 public MatchResponse(JSONObject response) : base(response)
 {
 }
Esempio n. 34
0
        private void HandleMessage(JSONObject message)
        {
            if (!message.HasField(Field.MSG))
            {
                // Silently ignore those messages.
                return;
            }

            switch (message[Field.MSG].str)
            {
            case MessageType.CONNECTED: {
                sessionId          = message[Field.SESSION].str;
                ddpConnectionState = ConnectionState.CONNECTED;

                if (OnConnected != null)
                {
                    OnConnected(this);
                }
                break;
            }

            case MessageType.FAILED: {
                if (OnError != null)
                {
                    OnError(new DdpError()
                        {
                            errorCode = "Connection refused",
                            reason    = "The server is using an unsupported DDP protocol version: " +
                                        message[Field.VERSION]
                        });
                }
                Close();
                break;
            }

            case MessageType.PING: {
                if (message.HasField(Field.ID))
                {
                    Send(GetPongMessage(message[Field.ID].str));
                }
                else
                {
                    Send(GetPongMessage());
                }
                break;
            }

            case MessageType.NOSUB: {
                string subscriptionId = message[Field.ID].str;
                subscriptions.Remove(subscriptionId);

                if (message.HasField(Field.ERROR))
                {
                    if (OnError != null)
                    {
                        OnError(GetError(message[Field.ERROR]));
                    }
                }
                break;
            }

            case MessageType.ADDED: {
                if (OnAdded != null)
                {
                    OnAdded(
                        message[Field.COLLECTION].str,
                        message[Field.ID].str,
                        message[Field.FIELDS]);
                }
                break;
            }

            case MessageType.CHANGED: {
                if (OnChanged != null)
                {
                    OnChanged(
                        message[Field.COLLECTION].str,
                        message[Field.ID].str,
                        message[Field.FIELDS],
                        message[Field.CLEARED]);
                }
                break;
            }

            case MessageType.REMOVED: {
                if (OnRemoved != null)
                {
                    OnRemoved(
                        message[Field.COLLECTION].str,
                        message[Field.ID].str);
                }
                break;
            }

            case MessageType.READY: {
                string[] subscriptionIds = ToStringArray(message[Field.SUBS]);

                foreach (string subscriptionId in subscriptionIds)
                {
                    Subscription subscription = subscriptions[subscriptionId];
                    if (subscription != null)
                    {
                        subscription.isReady = true;
                        if (subscription.OnReady != null)
                        {
                            subscription.OnReady(subscription);
                        }
                    }
                }
                break;
            }

            case MessageType.ADDED_BEFORE: {
                if (OnAddedBefore != null)
                {
                    OnAddedBefore(
                        message[Field.COLLECTION].str,
                        message[Field.ID].str,
                        message[Field.FIELDS],
                        message[Field.BEFORE].str);
                }
                break;
            }

            case MessageType.MOVED_BEFORE: {
                if (OnMovedBefore != null)
                {
                    OnMovedBefore(
                        message[Field.COLLECTION].str,
                        message[Field.ID].str,
                        message[Field.BEFORE].str);
                }
                break;
            }

            case MessageType.RESULT: {
                string     methodCallId = message[Field.ID].str;
                MethodCall methodCall   = methodCalls[methodCallId];
                if (methodCall != null)
                {
                    if (message.HasField(Field.ERROR))
                    {
                        methodCall.error = GetError(message[Field.ERROR]);
                    }
                    methodCall.result = message[Field.RESULT];
                    if (methodCall.hasUpdated)
                    {
                        methodCalls.Remove(methodCallId);
                    }
                    methodCall.hasResult = true;
                    if (methodCall.OnResult != null)
                    {
                        methodCall.OnResult(methodCall);
                    }
                }
                break;
            }

            case MessageType.UPDATED: {
                string[] methodCallIds = ToStringArray(message[Field.METHODS]);
                foreach (string methodCallId in methodCallIds)
                {
                    MethodCall methodCall = methodCalls[methodCallId];
                    if (methodCall != null)
                    {
                        if (methodCall.hasResult)
                        {
                            methodCalls.Remove(methodCallId);
                        }
                        methodCall.hasUpdated = true;
                        if (methodCall.OnUpdated != null)
                        {
                            methodCall.OnUpdated(methodCall);
                        }
                    }
                }
                break;
            }

            case MessageType.ERROR: {
                if (OnError != null)
                {
                    OnError(GetError(message));
                }
                break;
            }
            }
        }
Esempio n. 35
0
        private static bool GetAnimationsFromJSON(ImportedAnimationSheet animationSheet, JSONObject meta)
        {
            if (!meta.ContainsKey("frameTags"))
            {
                Debug.LogWarning("No 'frameTags' found in JSON created by Aseprite.");
                IssueVersionWarning();
                return(false);
            }

            var frameTags = meta["frameTags"].Array;

            foreach (var item in frameTags)
            {
                JSONObject        frameTag = item.Obj;
                ImportedAnimation anim     = new ImportedAnimation();
                anim.name             = frameTag["name"].Str;
                anim.firstSpriteIndex = (int)(frameTag["from"].Number);
                anim.lastSpriteIndex  = (int)(frameTag["to"].Number);

                animationSheet.animations.Add(anim);
            }

            return(true);
        }
Esempio n. 36
0
        private static void GetMetaInfosFromJSON(ImportedAnimationSheet animationSheet, JSONObject meta)
        {
            var size = meta["size"].Obj;

            animationSheet.width  = (int)size["w"].Number;
            animationSheet.height = (int)size["h"].Number;
        }
Esempio n. 37
0
    public string print(int depth, bool pretty = false)         //Convert the JSONObject into a string
    {
        if (depth++ > MAX_DEPTH)
        {
            Debug.Log("reached max depth!");
            return("");
        }
        string str = "";

        switch (type)
        {
        case Type.STRING:
            str = "\"" + this.str + "\"";
            break;

        case Type.NUMBER:
#if USEFLOAT
            if (float.IsInfinity(n))
            {
                str = INFINITY;
            }
            else if (float.IsNegativeInfinity(n))
            {
                str = NEGINFINITY;
            }
            else if (float.IsNaN(n))
            {
                str = NaN;
            }
#else
            if (double.IsInfinity(n))
            {
                str = INFINITY;
            }
            else if (double.IsNegativeInfinity(n))
            {
                str = NEGINFINITY;
            }
            else if (double.IsNaN(n))
            {
                str = NaN;
            }
#endif
            else
            {
                str += n;
            }
            break;

        case JSONObject.Type.OBJECT:
            str = "{";
            if (list.Count > 0)
            {
#if (PRETTY)     //for a bit more readability, comment the define above to disable system-wide
                if (pretty)
                {
                    str += "\n";
                }
#endif
                for (int i = 0; i < list.Count; i++)
                {
                    string     key = (string)keys[i];
                    JSONObject obj = (JSONObject)list[i];
                    if (obj)
                    {
#if (PRETTY)
                        if (pretty)
                        {
                            for (int j = 0; j < depth; j++)
                            {
                                str += "\t";                                         //for a bit more readability
                            }
                        }
#endif
                        str += "\"" + key + "\":";
                        str += obj.print(depth, pretty) + ",";
#if (PRETTY)
                        if (pretty)
                        {
                            str += "\n";
                        }
#endif
                    }
                }
#if (PRETTY)
                if (pretty)
                {
                    str = str.Substring(0, str.Length - 1);                                     //BOP: This line shows up twice on purpose: once to remove the \n if readable is true and once to remove the comma
                }
#endif
                str = str.Substring(0, str.Length - 1);
            }
#if (PRETTY)
            if (pretty && list.Count > 0)
            {
                str += "\n";
                for (int j = 0; j < depth - 1; j++)
                {
                    str += "\t";                             //for a bit more readability
                }
            }
#endif
            str += "}";
            break;

        case JSONObject.Type.ARRAY:
            str = "[";
            if (list.Count > 0)
            {
#if (PRETTY)
                if (pretty)
                {
                    str += "\n";                             //for a bit more readability
                }
#endif
                foreach (JSONObject obj in list)
                {
                    if (obj)
                    {
#if (PRETTY)
                        if (pretty)
                        {
                            for (int j = 0; j < depth; j++)
                            {
                                str += "\t";                                         //for a bit more readability
                            }
                        }
#endif
                        str += obj.print(depth, pretty) + ",";
#if (PRETTY)
                        if (pretty)
                        {
                            str += "\n";                                     //for a bit more readability
                        }
#endif
                    }
                }
#if (PRETTY)
                if (pretty)
                {
                    str = str.Substring(0, str.Length - 1);                             //BOP: This line shows up twice on purpose: once to remove the \n if readable is true and once to remove the comma
                }
#endif
                str = str.Substring(0, str.Length - 1);
            }
#if (PRETTY)
            if (pretty && list.Count > 0)
            {
                str += "\n";
                for (int j = 0; j < depth - 1; j++)
                {
                    str += "\t";                             //for a bit more readability
                }
            }
#endif
            str += "]";
            break;

        case Type.BOOL:
            if (b)
            {
                str = "true";
            }
            else
            {
                str = "false";
            }
            break;

        case Type.NULL:
            str = "null";
            break;
        }
        return(str);
    }
Esempio n. 38
0
 public void Emit(string ev, JSONObject data, Action <JSONObject> action)
 {
     EmitMessage(++packetId, string.Format("[\"{0}\",{1}]", ev, data));
     ackList.Add(new Ack(packetId, action));
 }
Esempio n. 39
0
 public PlayerData(JSONObject json) : base(json)
 {
 }
Esempio n. 40
0
    //Parse Settings from json tree
    public void ParseJSON(ref Settings settings, JSONObject input)
    {
        json = input;
        int screenint = 0;

        json.GetField(ref screenint, "display");
        settings.displayType = screenint;


        try
        {
            JSONObject room = DeepAdd(json, "geometry/realroom/walls");

            List <Vector2> WallWarnerPoints = new List <Vector2>();

            for (int pts = 0; pts < room.list.Count; pts++)
            {
                float x = room.list[pts].list[0].f;

                float y = room.list[pts].list[1].f;

                //Debug.Log("" + x + ", " + y);
                WallWarnerPoints.Add(new Vector2(x, y));
            }

            settings.SetWallWarnerPoints(WallWarnerPoints.ToArray());
        }
        catch
        {
            Debug.Log("geometry/realroom/walls not found, using rect");
            JSONObject rect     = DeepAdd(json, "geometry/realroom/axalignedrect");
            float      roomXmin = 0.0f;
            float      roomXmax = 0.0f;
            float      roomZmin = 0.0f;
            float      roomZmax = 0.0f;
            rect.GetField(ref roomXmin, "xmin");
            rect.GetField(ref roomXmax, "xmax");
            rect.GetField(ref roomZmin, "ymin");
            rect.GetField(ref roomZmax, "ymax");

            List <Vector2> WallWarnerPoints = new List <Vector2>();

            WallWarnerPoints.Add(new Vector2(roomXmin, roomZmin));
            WallWarnerPoints.Add(new Vector2(roomXmin, roomZmax));
            WallWarnerPoints.Add(new Vector2(roomXmax, roomZmax));
            WallWarnerPoints.Add(new Vector2(roomXmax, roomZmin));

            settings.SetWallWarnerPoints(WallWarnerPoints.ToArray());
        }


        int resx = 0, resy = 0;

        json.GetField("screen").GetField(ref resx, "width");
        json.GetField("screen").GetField(ref resy, "height");
        settings.SetResolution(resx, resy);

        float IPD = 0.64f;

        json.GetField("oculus").GetField(ref IPD, "ipd");
        settings.ipd = IPD;

        float vrRenderScale = 1.0f;

        json.GetField("oculus").GetField(ref vrRenderScale, "virtualTextureScale");
        settings.VrRenderScale = vrRenderScale;
    }
Esempio n. 41
0
    IEnumerable StringifyAsync(int depth, StringBuilder builder, bool pretty = false)           //Convert the JSONObject into a string
    //Profiler.BeginSample("JSONprint");
    {
        if (depth++ > MAX_DEPTH)
        {
            Debug.Log("reached max depth!");
            yield break;
        }
        if (printWatch.Elapsed.TotalSeconds > maxFrameTime)
        {
            printWatch.Reset();
            yield return(null);

            printWatch.Start();
        }
        switch (type)
        {
        case Type.BAKED:
            builder.Append(str);
            break;

        case Type.STRING:
            builder.AppendFormat("\"{0}\"", str);
            break;

        case Type.NUMBER:
#if USEFLOAT
            if (float.IsInfinity(n))
            {
                builder.Append(INFINITY);
            }
            else if (float.IsNegativeInfinity(n))
            {
                builder.Append(NEGINFINITY);
            }
            else if (float.IsNaN(n))
            {
                builder.Append(NaN);
            }
#else
            if (double.IsInfinity(n))
            {
                builder.Append(INFINITY);
            }
            else if (double.IsNegativeInfinity(n))
            {
                builder.Append(NEGINFINITY);
            }
            else if (double.IsNaN(n))
            {
                builder.Append(NaN);
            }
#endif
            else
            {
                builder.Append(n.ToString());
            }
            break;

        case Type.OBJECT:
            builder.Append("{");
            if (list.Count > 0)
            {
#if (PRETTY)     //for a bit more readability, comment the define above to disable system-wide
                if (pretty)
                {
                    builder.Append("\n");
                }
#endif
                for (int i = 0; i < list.Count; i++)
                {
                    string     key = keys[i];
                    JSONObject obj = list[i];
                    if (obj)
                    {
#if (PRETTY)
                        if (pretty)
                        {
                            for (int j = 0; j < depth; j++)
                            {
                                builder.Append("\t");                                         //for a bit more readability
                            }
                        }
#endif
                        builder.AppendFormat("\"{0}\":", key);
                        foreach (IEnumerable e in obj.StringifyAsync(depth, builder, pretty))
                        {
                            yield return(e);
                        }
                        builder.Append(",");
#if (PRETTY)
                        if (pretty)
                        {
                            builder.Append("\n");
                        }
#endif
                    }
                }
#if (PRETTY)
                if (pretty)
                {
                    builder.Length -= 2;
                }
                else
#endif
                builder.Length--;
            }
#if (PRETTY)
            if (pretty && list.Count > 0)
            {
                builder.Append("\n");
                for (int j = 0; j < depth - 1; j++)
                {
                    builder.Append("\t");                             //for a bit more readability
                }
            }
#endif
            builder.Append("}");
            break;

        case Type.ARRAY:
            builder.Append("[");
            if (list.Count > 0)
            {
#if (PRETTY)
                if (pretty)
                {
                    builder.Append("\n");                             //for a bit more readability
                }
#endif
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i])
                    {
#if (PRETTY)
                        if (pretty)
                        {
                            for (int j = 0; j < depth; j++)
                            {
                                builder.Append("\t");                                         //for a bit more readability
                            }
                        }
#endif
                        foreach (IEnumerable e in list[i].StringifyAsync(depth, builder, pretty))
                        {
                            yield return(e);
                        }
                        builder.Append(",");
#if (PRETTY)
                        if (pretty)
                        {
                            builder.Append("\n");                                     //for a bit more readability
                        }
#endif
                    }
                }
#if (PRETTY)
                if (pretty)
                {
                    builder.Length -= 2;
                }
                else
#endif
                builder.Length--;
            }
#if (PRETTY)
            if (pretty && list.Count > 0)
            {
                builder.Append("\n");
                for (int j = 0; j < depth - 1; j++)
                {
                    builder.Append("\t");                             //for a bit more readability
                }
            }
#endif
            builder.Append("]");
            break;

        case Type.BOOL:
            if (b)
            {
                builder.Append("true");
            }
            else
            {
                builder.Append("false");
            }
            break;

        case Type.NULL:
            builder.Append("null");
            break;
        }
        //Profiler.EndSample();
    }
Esempio n. 42
0
 public void Emit(string ev, JSONObject data)
 {
     EmitMessage(-1, string.Format("[\"{0}\",{1}]", ev, data));
 }
Esempio n. 43
0
        protected override void InitEquipmentModel(ref JSONObject source)
        {
            mEquipmentConfig = ScriptableObject.CreateInstance <HiddenWeaponConfig>() as IEquipmentConfig;

            mEquipmentConfig.InitEquipmentConfig(ref source);
        }
Esempio n. 44
0
        IEnumerator FetchVersionFile(Action cb)
        {
            _step = 1;
            WWW lrequest = new WWW(GetWWWPersistentDataPath() + "/version.mf");

            _request = lrequest;
            yield return(lrequest);

            if (lrequest.text == null || lrequest.text.Length == 0)
            {
                // copy
                TextAsset tasset = Resources.Load <TextAsset>("version");
                _lversion = tasset.text;
                CreateDirOrFile(UnityEngine.Application.persistentDataPath, new string[] { "version.mf" }, 0, tasset.text);

                // init path
                JSONObject o   = new JSONObject(tasset.text);
                JSONObject abs = o.GetField("abs");
                for (int i = 0; i < abs.keys.Count; i++)
                {
                    _path[abs.keys[i]] = PathType.RES;
                }

                // write path
                JSONObject path = new JSONObject(JSONObject.Type.OBJECT);
                for (int i = 0; i < abs.keys.Count; i++)
                {
                    path.AddField(abs.keys[i], (int)PathType.RES);
                }
                CreateDirOrFile(UnityEngine.Application.persistentDataPath, new string[] { "path.mf" }, 0, path.ToString());
            }

            // double check
            if (lrequest.text == null || lrequest.text.Length == 0)
            {
                _step    = 2;
                lrequest = new WWW(GetWWWPersistentDataPath() + "/version.mf");
                _request = lrequest;
                yield return(lrequest);

                if (lrequest.text == null || lrequest.text.Length == 0)
                {
                    // no
                    cb();
                    yield break;
                }
                _lversion = lrequest.text;
            }
            else
            {
                _lversion = lrequest.text;
            }

            // check path
            _step = 3;
            WWW lpathrequest = new WWW(GetWWWPersistentDataPath() + "/path.mf");

            _request = lpathrequest;
            yield return(lpathrequest);

            if (lpathrequest.text == null || lpathrequest.text.Length == 0)
            {
                // create
                UnityEngine.Debug.Assert(_lversion != null);
                JSONObject json = new JSONObject(_lversion);
                JSONObject abs  = json.GetField("abs");
                JSONObject path = new JSONObject(JSONObject.Type.OBJECT);
                for (int i = 0; i < abs.keys.Count; i++)
                {
                    _path.Add(abs.keys[i], PathType.RES);
                    path.AddField(abs.keys[i], (int)PathType.RES);
                }
                CreateDirOrFile(UnityEngine.Application.persistentDataPath, new string[] { "path.mf" }, 0, path.ToString());
            }
            else
            {
                JSONObject path = new JSONObject(lpathrequest.text);
                for (int i = 0; i < path.keys.Count; i++)
                {
                    _path.Add(path.keys[i], (PathType)path.GetField(path.keys[i]).i);
                }
            }

            _step = 4;
            string url = SayDataSet.Instance.GetDataItem(1).value;

            url = GetHttpUrl();
            WWW srequest = new WWW(url + "/version.json");

            _request = srequest;
            yield return(srequest);

            if (srequest.text != null && srequest.text.Length > 0)
            {
                _sversion = srequest.text;
            }
            else
            {
                cb();
                yield break;
            }

            JSONObject ljson = new JSONObject(_lversion);
            JSONObject sjson = new JSONObject(_sversion);
            // 比较服务器与当地,不同就下载更新
            long lversion = ljson.GetField("version").i;
            long sversion = sjson.GetField("version").i;

            if (sversion > lversion)
            {
                // 比较资源
                JSONObject sabs = sjson.GetField("abs");
                JSONObject labs = ljson.GetField("abs");
                int        step = _step;
                for (int i = 0; i < sabs.keys.Count; i++)
                {
                    JSONObject shash = sabs.GetField(sabs.keys[i]);
                    JSONObject lhash = labs.GetField(labs.keys[i]);
                    if (lhash == null || (shash.i != lhash.i))
                    {
                        // 下载并存储
                        _step = step + i;
                        WWW frequest = new WWW(url + "/" + sabs.keys[i]);
                        _request = frequest;
                        yield return(frequest);

                        string[] sp = sabs.keys[i].Split(new char[] { '/' });
                        if (sp.Length > 1)
                        {
                            CreateDirOrFile(UnityEngine.Application.persistentDataPath, sp, 0, Encoding.ASCII.GetString(frequest.bytes));
                        }
                        else
                        {
                            CreateDirOrFile(UnityEngine.Application.persistentDataPath, sp, 0, Encoding.ASCII.GetString(frequest.bytes));
                        }

                        _path[sabs.keys[i]] = PathType.PER;

                        // manifest
                        WWW mrequest = new WWW(url + "/" + sabs.keys[i] + ".manifest");
                        _request = mrequest;
                        yield return(mrequest);

                        string[] msp = sabs.keys[i].Split(new char[] { '/' });
                        if (msp.Length > 1)
                        {
                            CreateDirOrFile(UnityEngine.Application.persistentDataPath, msp, 0, Encoding.ASCII.GetString(mrequest.bytes));
                        }
                        else
                        {
                            CreateDirOrFile(UnityEngine.Application.persistentDataPath, msp, 0, Encoding.ASCII.GetString(mrequest.bytes));
                        }
                        _path[sabs.keys[i] + ".manifest"] = PathType.PER;
                    }
                    else
                    {
                    }
                }
                // 写入版本文件
                CreateDirOrFile(UnityEngine.Application.persistentDataPath, new string[] { "version.mf" }, 0, sjson.ToString());
                // 写入路径文件
                JSONObject path = new JSONObject(JSONObject.Type.OBJECT);
                foreach (var item in _path)
                {
                    path.AddField(item.Key, (int)item.Value);
                }
                CreateDirOrFile(UnityEngine.Application.persistentDataPath, new string[] { "path.mf" }, 0, path.ToString());
                cb();
            }
            else
            {
                cb();
            }
        }
Esempio n. 45
0
	/** {@inheritDoc} */
    public override void onHttpStatusOK(QQHttpResponse response)
    {
		JSONObject json = new JSONObject(response.getResponseString());
		int retcode = json.getInt("retcode");
		QQStore store = getContext().getStore();
		if (retcode == 0) {
			// 处理好友列表
			JSONObject results = json.getJSONObject("result");
			// 获取JSON列表信息
			JSONArray jsonCategories = results.getJSONArray("categories");
			// 获取JSON好友基本信息列表 flag/uin/categories
			JSONArray jsonFriends = results.getJSONArray("friends");
			// face/flag/nick/uin
			JSONArray jsonInfo = results.getJSONArray("info");
			// uin/markname/
			JSONArray jsonMarknames = results.getJSONArray("marknames");
			// vip_level/u/is_vip
			JSONArray jsonVipinfo = results.getJSONArray("vipinfo");

			// 默认好友列表
			QQCategory c = new QQCategory();
			c.setIndex(0);
			c.setName("我的好友");
			c.setSort(0);
			store.addCategory(c);
			// 初始化好友列表
			for (int i = 0; i < jsonCategories.length(); i++) {
				JSONObject jsonCategory = jsonCategories.getJSONObject(i);
				QQCategory qqc = new QQCategory();
				qqc.setIndex(jsonCategory.getInt("index"));
				qqc.setName(jsonCategory.getString("name"));
				qqc.setSort(jsonCategory.getInt("sort"));
				store.addCategory(qqc);
			}
			// 处理好友基本信息列表 flag/uin/categories
			for (int i = 0; i < jsonFriends.length(); i++) {
				QQBuddy buddy = new QQBuddy();
				JSONObject jsonFriend = jsonFriends.getJSONObject(i);
				long uin = jsonFriend.getLong("uin");
				buddy.setUin(uin);
				buddy.setStatus(QQStatus.OFFLINE);
				// 添加到列表中
				int category = jsonFriend.getInt("categories");
				QQCategory qqCategory = store.getCategoryByIndex(category);
				buddy.setCategory(qqCategory);
				qqCategory.getBuddyList().Add(buddy);

				// 记录引用
				store.addBuddy(buddy);
			}
			// face/flag/nick/uin
			for (int i = 0; i < jsonInfo.length(); i++) {
				JSONObject info = jsonInfo.getJSONObject(i);
				long uin = info.getLong("uin");
				QQBuddy buddy = store.getBuddyByUin(uin);
				buddy.setNickname(info.getString("nick"));
			}
			// uin/markname
			for (int i = 0; i < jsonMarknames.length(); i++) {
				JSONObject jsonMarkname = jsonMarknames.getJSONObject(i);
				long uin = jsonMarkname.getLong("uin");
				QQBuddy buddy = store.getBuddyByUin(uin);
				if(buddy != null){
					buddy.setMarkname(jsonMarkname.getString("markname"));
				}
			}
			// vip_level/u/is_vip
			for (int i = 0; i < jsonVipinfo.length(); i++) {
				JSONObject vipInfo = jsonVipinfo.getJSONObject(i);
				long uin = vipInfo.getLong("u");
				QQBuddy buddy = store.getBuddyByUin(uin);
				buddy.setVipLevel(vipInfo.getInt("vip_level"));
				int isVip = vipInfo.getInt("is_vip");
				if(isVip != 0) {
					buddy.setVip(true);
				} else {
					buddy.setVip(false);
				}
			}

			notifyActionEvent(QQActionEvent.Type.EVT_OK, store.getCategoryList());

		} else {
			notifyActionEvent(QQActionEvent.Type.EVT_ERROR, null);
		}

	}
Esempio n. 46
0
 void Init()
 {
     jsonStr  = ReadJsonFile(jsonPath);
     jsonRoot = new JSONObject(jsonStr);
 }
Esempio n. 47
0
 internal void Update(JSONObject thumbnail)
 {
     url    = thumbnail["url"].Value;
     width  = thumbnail["width"].AsInt;
     height = thumbnail["height"].AsInt;
 }
Esempio n. 48
0
            private async void _btnNext_Click(object sender, EventArgs e)
            {
                switch (Arguments.GetInt(ArgSectionNumber))
                {
                case 1:
                    if (_imageValidator)
                    {
                        FragmentContext._viewPager.CurrentItem =
                            Arguments.GetInt(ArgSectionNumber);
                    }
                    else
                    {
                        Toast.MakeText(FragmentContext, "Alegeti o imagine!", ToastLength.Short)
                        .Show();
                    }
                    break;

                case 2:
                    if (!string.IsNullOrEmpty(FragmentContext._firstSetupModel.Gender) && !string.IsNullOrEmpty(FragmentContext._firstSetupModel.DateOfBirth))
                    {
                        FragmentContext._viewPager.CurrentItem = Arguments.GetInt(ArgSectionNumber);
                    }
                    else
                    {
                        Toast.MakeText(FragmentContext, "Va rugam sa completati formularul", ToastLength.Short)
                        .Show();
                    }
                    break;

                case 3:
                    FragmentContext._progressBarDialog.Show();
                    FragmentContext._firstSetupModel.ImageName =
                        Utils.GetDefaults("Email");


                    foreach (SearchListModel el in _selectedDiseases)
                    {
                        if (!el.IsSelected)
                        {
                            continue;
                        }
                        FragmentContext._firstSetupModel.Disease.Add(el.Id);
                        listOfPersonalDiseases.Add(new PersonalDisease(el.Id, el.Title));
                    }
                    await Task.Run(async() =>
                    {
                        string jsonData =
                            JsonConvert.SerializeObject(FragmentContext._firstSetupModel);

                        Log.Error("data to send", jsonData);

                        string response = await WebServices.WebServices.Post(
                            Constants.PublicServerAddress + "/api/firstSetup",
                            new JSONObject(jsonData), Utils.GetDefaults("Token"));
                        if (response != null)
                        {
                            Snackbar snack;
                            var responseJson = new JSONObject(response);
                            switch (responseJson.GetInt("status"))
                            {
                            case 0:
                                snack = Snackbar.Make(FragmentContext._mainContent,
                                                      "Wrong Data", Snackbar.LengthLong);
                                snack.Show();
                                break;

                            case 1:
                                snack = Snackbar.Make(FragmentContext._mainContent,
                                                      "Internal Server Error", Snackbar.LengthLong);
                                snack.Show();
                                break;

                            case 2:



                                Utils.SetDefaults("Logins", true.ToString());
                                Utils.SetDefaults("Avatar",
                                                  $"{Constants.PublicServerAddress}/{Utils.GetDefaults("Email")}.{FragmentContext._firstSetupModel.ImageExtension}");


                                await SaveProfileData();


                                createSimpleChannelForServices();
                                createNonstopChannelForServices();

                                if (int.Parse(Utils.GetDefaults("UserType")) == 3)
                                {
                                    var _medicationServerServiceIntent = new Intent(Application.Context, typeof(MedicationServerService));
                                    Activity.StartService(_medicationServerServiceIntent);
                                }

                                FragmentContext.StartActivity(typeof(MainActivity));
                                FragmentContext.Finish();
                                break;
                            }
                        }
                        else
                        {
                            var snack = Snackbar.Make(FragmentContext._mainContent,
                                                      "Unable to reach the server!", Snackbar.LengthLong);
                            snack.Show();
                        }
                    });

                    FragmentContext._progressBarDialog.Dismiss();

                    break;
                }
            }
Esempio n. 49
0
    /// <summary>
    ///     Merge object right into left recursively
    /// </summary>
    /// <param name="left">The left (base) object</param>
    /// <param name="right">The right (new) object</param>
    private 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 (var i = 0; i < right.list.Count; i++)
            {
                var 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 (var 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];
                    }
                }
            }
        }
    }
Esempio n. 50
0
 internal void Update(JSONObject thumbnails)
 {
     @default.Update(thumbnails["default"].AsObject);
     medium.Update(thumbnails["medium"].AsObject);
     high.Update(thumbnails["high"].AsObject);
 }
Esempio n. 51
0
 public void Invoke(JSONObject ev)
 {
     action.Invoke(ev);
 }
Esempio n. 52
0
 public JSONObjectEnumer(JSONObject jsonObject)
 {
     Debug.Assert(jsonObject.isContainer); //must be an array or object to itterate
     _jobj = jsonObject;
 }
Esempio n. 53
0
        public override IEnumerable <MonoBehaviour> Create(Vector2d tileMercPos, JSONObject geo)
        {
            var kind = geo["properties"]["kind"].str.ConvertToEnum <RoadType>();

            if (_settings.AllSettings.Any(x => x.Type == kind))
            {
                var typeSettings = _settings.GetSettingsFor(kind);

                if (geo["geometry"]["type"].str == "LineString")
                {
                    var road     = new GameObject("road").AddComponent <Road>();
                    var mesh     = road.GetComponent <MeshFilter>().mesh;
                    var roadEnds = new List <Vector3>();
                    var verts    = new List <Vector3>();
                    var indices  = new List <int>();

                    for (var i = 0; i < geo["geometry"]["coordinates"].list.Count; i++)
                    {
                        var c            = geo["geometry"]["coordinates"][i];
                        var dotMerc      = GM.LatLonToMeters(c[1].f, c[0].f);
                        var localMercPos = dotMerc - tileMercPos;
                        roadEnds.Add(localMercPos.ToVector3());
                    }
                    CreateMesh(roadEnds, typeSettings, ref verts, ref indices);
                    mesh.vertices  = verts.ToArray();
                    mesh.triangles = indices.ToArray();
                    mesh.RecalculateNormals();
                    mesh.RecalculateBounds();
                    road.GetComponent <MeshRenderer>().material = typeSettings.Material;
                    road.Initialize(geo, roadEnds, _settings);
                    road.transform.position += Vector3.up * road.SortKey / 100;
                    yield return(road);
                }
                else if (geo["geometry"]["type"].str == "MultiLineString")
                {
                    for (var i = 0; i < geo["geometry"]["coordinates"].list.Count; i++)
                    {
                        var road     = new GameObject("Roads").AddComponent <Road>();
                        var mesh     = road.GetComponent <MeshFilter>().mesh;
                        var roadEnds = new List <Vector3>();
                        var verts    = new List <Vector3>();
                        var indices  = new List <int>();

                        roadEnds.Clear();
                        var c = geo["geometry"]["coordinates"][i];
                        for (var j = 0; j < c.list.Count; j++)
                        {
                            var seg          = c[j];
                            var dotMerc      = GM.LatLonToMeters(seg[1].f, seg[0].f);
                            var localMercPos = dotMerc - tileMercPos;
                            roadEnds.Add(localMercPos.ToVector3());
                        }
                        CreateMesh(roadEnds, typeSettings, ref verts, ref indices);
                        mesh.vertices  = verts.ToArray();
                        mesh.triangles = indices.ToArray();
                        mesh.RecalculateNormals();
                        mesh.RecalculateBounds();
                        road.GetComponent <MeshRenderer>().material = typeSettings.Material;
                        road.Initialize(geo, roadEnds, _settings);
                        road.transform.position += Vector3.up * road.SortKey / 100;
                        yield return(road);
                    }
                }
            }
        }
Esempio n. 54
0
    IEnumerator <object> PostToFaceAPI(byte[] imageData, Matrix4x4 cameraToWorldMatrix, Matrix4x4 pixelToCameraMatrix)
    {
        WWW www = new WWW(faceApiUrl, imageData);

        yield return(www);

        string responseString = www.text;

        Debug.Log(responseString);
        JSONObject j        = new JSONObject(responseString);
        var        existing = GameObject.FindGameObjectsWithTag("faceText");

        foreach (var go in existing)
        {
            Destroy(go);
        }

        existing = GameObject.FindGameObjectsWithTag("faceBounds");

        foreach (var go in existing)
        {
            Destroy(go);
        }

        if (j.list.Count == 0)
        {
            status.GetComponent <TextMesh>().text = "no faces found";
            yield break;
        }
        else
        {
            status.SetActive(false);
        }

        foreach (var result in j.list)
        {
            GameObject txtObject = (GameObject)Instantiate(textPrefab);
            TextMesh   txtMesh   = txtObject.GetComponent <TextMesh>();
            var        r         = result["kairos"];
            float      top       = -(r["topLeftY"].f / cameraResolution.height - .5f);
            float      left      = r["topLeftX"].f / cameraResolution.width - .5f;
            float      width     = r["width"].f / cameraResolution.width;
            float      height    = r["height"].f / cameraResolution.height;

            GameObject faceBounds = (GameObject)Instantiate(framePrefab);
            faceBounds.transform.position = cameraToWorldMatrix.MultiplyPoint3x4(pixelToCameraMatrix.MultiplyPoint3x4(new Vector3(left + width / 2, top, 0)));
            faceBounds.transform.rotation = cameraRotation;
            Vector3 scale = pixelToCameraMatrix.MultiplyPoint3x4(new Vector3(width, height, 0));
            scale.z = .1f;
            faceBounds.transform.localScale = scale;
            faceBounds.tag = "faceBounds";
            Debug.Log(string.Format("{0},{1} translates to {2},{3}", left, top, faceBounds.transform.position.x, faceBounds.transform.position.y));

            Vector3 origin = cameraToWorldMatrix.MultiplyPoint3x4(pixelToCameraMatrix.MultiplyPoint3x4(new Vector3(left + width + .1f, top, 0)));
            txtObject.transform.position = origin;
            txtObject.transform.rotation = cameraRotation;
            txtObject.tag = "faceText";
            if (j.list.Count > 1)
            {
                txtObject.transform.localScale /= 2;
            }

            txtMesh.text = result["text"].str.Replace("\\n", "\n");
        }
    }
Esempio n. 55
0
    JSONObject ParseToJSON(string txt)
    {
        JSONObject newJSONObject = JSONObject.Create(txt);

        return(newJSONObject);
    }
Esempio n. 56
0
    IEnumerator ICallAPINoForm(string getForm)
    {
        //create postform
        baseURL = UserCommonData.GetURL();
        WWW api;

        api = new WWW(baseURL + page + getForm);
        Debug.Log("Call API NO Form : " + api.url);
        while (!api.isDone)
        {
            //waiting
            yield return(null);
        }
        IsDone = true;
        if (api.error != null)
        {
            IsError = true;
            Debug.Log("Error : " + api.error);
            //			PopupObject.ShowAlertPopup("Error",api.error,"ปิด",errorMethod);
            PopupObject.ShowAlertPopup("พบปัญหาในการเชื่อมต่อ", "กรุณาเชื่อมต่อ  อินเทอเน็ตเพื่อเข้าใช้งาน  Oryor  Smart  Application", "เชื่อมต่อ", errorMethod);
            yield break;
        }
        //decrypt msg
        Debug.Log(api.text);
        JSONObject json = new JSONObject(api.text);

        if (json["msg"] != null)
        {
            msg.msg = json["msg"].str;
            if (msg.msg == "OK")
            {
                JSONObject userArr = json["user"];
                if (userArr != null)
                {
                    List <UserData> userList = new List <UserData>();
                    foreach (JSONObject user in userArr.list)
                    {
                        UserData dat = new UserData();
                        dat.user_id        = user["user_id"].str;
                        dat.user_address   = user["user_address"].str;
                        dat.user_picture   = user["user_picture"].str;
                        dat.user_email     = user["user_email"].str;
                        dat.user_firstname = user["user_firstname"].str;
                        dat.user_surname   = user["user_surname"].str;
                        dat.user_location  = user["user_location"].str;
                        dat.user_tel       = user["user_tel"].str;

                        dat.user_money = user["user_money"].str;

                        dat.user_level = user["user_level"].str;
                        //naming notice
                        //coin means item plus score
                        //score means item plus exp
                        //F**K THE NAMING SERVER!!!
                        dat.user_item1 = user["user_item_heart_no"].str;
                        dat.user_item2 = user["user_item_coin_no"].str;
                        dat.user_item3 = user["user_item_score_no"].str;

                        dat.user_int_exp  = user["user_int_exp"].str;
                        dat.user_exp      = user["user_exp"].str;
                        dat.user_next_exp = user["user_next_exp"].str;

                        dat.user_exp_plus     = user["user_exp_plus"].str;
                        dat.user_coin_plus    = user["user_coin_plus"].str;
                        dat.user_score_plus   = user["user_score_plus"].str;
                        dat.user_hardmode     = user["user_hardmode"].str;
                        dat.user_unlock_item1 = user["user_unlock_item1"].str;
                        dat.user_unlock_item2 = user["user_unlock_item2"].str;
                        dat.user_unlock_item3 = user["user_unlock_item3"].str;

                        dat.user_date_regis  = user["user_date_regis"].str;
                        dat.user_date_update = user["user_date_update"].str;

                        userList.Add(dat);
                    }
                    msg.user = userList.ToArray();
                }
            }
        }
        if (apiCB != null)
        {
            apiCB(msg);
        }
    }
Esempio n. 57
0
            public SongMap(JSONObject song, string LevelId = "", string path = "")
            {
                if (!song["version"].IsString)
                {
                    //RequestBot.Instance.QueueChatMessage($"{song["key"].Value}: {song["metadata"]}");
                    if (!song["key"].IsString)
                    {
                        song.Add("id", song["id"]);
                        song.Add("version", song["id"]);
                        song.Add("hash", song["versions"][0]["hash"]);
                        song.Add("downloadURL", song["versions"][0]["downloadURL"]);
                        song.Add("coverURL", song["versions"][0]["coverURL"]);
                        song.Add("previewURL", song["versions"][0]["previewURL"]);
                    }
                    else
                    {
                        song.Add("id", song["key"]);
                        song.Add("version", song["key"]);
                    }
                    var metadata        = song["metadata"];
                    var songName        = metadata["songName"].Value;
                    var songSubName     = metadata["songSubName"].Value;
                    var authorName      = metadata["songAuthorName"].Value;
                    var levelAuthorName = metadata["levelAuthorName"].Value;
                    song.Add("songName", songName);
                    song.Add("songSubName", songSubName);
                    song.Add("authorName", authorName);
                    song.Add("levelAuthor", levelAuthorName);
                    song.Add("rating", song["stats"]["rating"].AsFloat * 100);
                    bool authorIsMapper = authorName.Replace(" ", "").ToLower().Equals(levelAuthorName.Replace(" ", "").ToLower()) ||
                                          authorName.ToLower().Contains(levelAuthorName.ToLower());
                    if (authorIsMapper)
                    {
                        levelAuthorName = authorName;
                        authorName      = songSubName;
                        songSubName     = "";
                    }
                    if (songSubName.Length > 0)
                    {
                        songName = $"{songName} ({Regex.Replace(songSubName, @"\((.*)\)", @"$1")})";
                    }
                    song.Add("trueSongName", songName);
                    song.Add("trueSongAuthor", authorName);
                    song.Add("trueLevelAuthor", levelAuthorName);

                    bool degrees90  = false;
                    bool degrees360 = false;

                    try
                    {
                        var characteristics = metadata["characteristics"][0]["difficulties"];
                        var lenghtlabel     = "length";
                        if (!song["key"].IsString)
                        {
                            characteristics = song["versions"][0]["diffs"];
                            lenghtlabel     = "seconds";
                        }

                        //Instance.QueueChatMessage($"{characteristics}");

                        foreach (var entry in metadata["characteristics"])
                        {
                            if (entry.Value["name"] == "360Degree")
                            {
                                degrees360 = true;
                            }
                            if (entry.Value["name"] == "90Degree")
                            {
                                degrees90 = true;
                            }
                        }

                        int maxnjs = 0;
                        foreach (var entry in characteristics)
                        {
                            if (entry.Value.IsNull)
                            {
                                continue;
                            }

                            if (entry.Value["characteristic"] == "360Degree")
                            {
                                degrees360 = true;
                            }
                            if (entry.Value["characteristic"] == "90Degree")
                            {
                                degrees90 = true;
                            }
                            var diff = entry.Value[lenghtlabel].AsInt;
                            var njs  = entry.Value["njs"].AsInt;
                            if (njs > maxnjs)
                            {
                                maxnjs = njs;
                            }



                            if (diff > 0)
                            {
                                song.Add("songlength", $"{diff / 60}:{diff % 60:00}");
                                song.Add("songduration", diff);
                                //Instance.QueueChatMessage($"{diff / 60}:{diff % 60}");
                            }
                        }

                        if (maxnjs > 0)
                        {
                            song.Add("njs", maxnjs);
                        }
                        if (degrees360 || degrees90)
                        {
                            song.Add("maptype", "360");
                        }
                    }
                    catch
                    {
                    }
                }


                float songpp = 0;

                if (ppmap.TryGetValue(song["id"].Value, out songpp))
                {
                    song.Add("pp", songpp);
                }

                //SongMap oldmap;
                //if (MapDatabase.MapLibrary.TryGetValue(song["id"].Value,out oldmap))
                //{

                //    if (LevelId == oldmap.LevelId && song["version"].Value == oldmap.song["version"].Value)
                //    {
                //        oldmap.song = song;
                //        return;
                //    }

                //    int id = int.Parse(song["id"].Value.ToUpper(), System.Globalization.NumberStyles.HexNumber);

                //    oldmap.UnIndexSong(id);
                //}

                this.path = path;
                //this.LevelId = LevelId;
                IndexSong(song);
            }
Esempio n. 58
0
 public void sendPost(string apiKey, JSONObject jsonDict)
 {
     StartCoroutine(postJSONRequest(apiKey, jsonDict));
 }
Esempio n. 59
0
            // Update Database from Directory
            public static async Task LoadCustomSongs(string folder = "", string songid = "")
            {
                if (MapDatabase.DatabaseLoading)
                {
                    return;
                }

                DatabaseLoading = true;

                await Task.Run(() =>
                {
                    if (songid == "")
                    {
                        Instance.QueueChatMessage($"Starting song indexing {folder}");
                    }

                    var StarTime = DateTime.UtcNow;

                    if (folder == "")
                    {
                        folder = Path.Combine(Environment.CurrentDirectory, "Beat Saber_data\\customlevels");
                    }

                    List <FileInfo> files        = new List <FileInfo>();      // List that will hold the files and subfiles in path
                    List <DirectoryInfo> folders = new List <DirectoryInfo>(); // List that hold direcotries that cannot be accessed

                    DirectoryInfo di = new DirectoryInfo(folder);
                    FullDirList(di, "*");

                    if (RequestBotConfig.Instance.additionalsongpath != "")
                    {
                        di = new DirectoryInfo(RequestBotConfig.Instance.additionalsongpath);
                        FullDirList(di, "*");
                    }

                    void FullDirList(DirectoryInfo dir, string searchPattern)
                    {
                        try
                        {
                            foreach (FileInfo f in dir.GetFiles(searchPattern))
                            {
                                if (f.FullName.EndsWith("info.dat"))
                                {
                                    files.Add(f);
                                }
                            }
                        }
                        catch
                        {
                            Console.WriteLine("Directory {0}  \n could not be accessed!!!!", dir.FullName);
                            return;
                        }

                        foreach (DirectoryInfo d in dir.GetDirectories())
                        {
                            folders.Add(d);
                            FullDirList(d, searchPattern);
                        }
                    }

                    // This might need some optimization


                    Instance.QueueChatMessage($"Processing {files.Count} maps. ");
                    foreach (var item in files)
                    {
                        //msg.Add(item.FullName,", ");

                        string id = "", version = "0";

                        GetIdFromPath(item.DirectoryName, ref id, ref version);

                        try
                        {
                            if (MapDatabase.MapLibrary.ContainsKey(id))
                            {
                                continue;
                            }

                            JSONObject song = JSONObject.Parse(File.ReadAllText(item.FullName)).AsObject;

                            string hash;

                            JSONNode difficultylevels = song["difficultyLevels"].AsArray;
                            var FileAccumulator       = new StringBuilder();
                            foreach (var level in difficultylevels)
                            {
                                //Instance.QueueChatMessage($"key={level.Key} value={level.Value}");
                                try
                                {
                                    FileAccumulator.Append(File.ReadAllText($"{item.DirectoryName}\\{level.Value["jsonPath"].Value}"));
                                }
                                catch
                                {
                                    //Instance.QueueChatMessage($"key={level.Key} value={level.Value}");
                                    //throw;
                                }
                            }

                            hash = CreateMD5FromString(FileAccumulator.ToString());

                            string levelId = string.Join("∎", hash, song["songName"].Value, song["songSubName"].Value, song["authorName"], song["beatsPerMinute"].AsFloat.ToString()) + "∎";

                            if (LevelId.ContainsKey(levelId))
                            {
                                LevelId[levelId].path = item.DirectoryName;
                                continue;
                            }

                            song.Add("id", id);
                            song.Add("version", version);
                            song.Add("hashMd5", hash);

                            new SongMap(song, levelId, item.DirectoryName);
                        }
                        catch (Exception)
                        {
                            Instance.QueueChatMessage($"Failed to process {item}.");
                        }
                    }
                    var duration = DateTime.UtcNow - StarTime;
                    if (songid == "")
                    {
                        Instance.QueueChatMessage($"Song indexing done. ({duration.TotalSeconds} secs.");
                    }

                    DatabaseImported = true;
                    DatabaseLoading  = false;
                });
            }
Esempio n. 60
0
    IEnumerator DownloadListOfURLs()
    {
        WWW www = new WWW(serverURL + "/pullData?username="******"&password="******"/"), "*.data");
        foreach (string file in filesToDelete)
        {
            File.Delete(file);
        }
        string directoryPath = Application.persistentDataPath + "/images/";

        if (!Directory.Exists(directoryPath))
        {
            Directory.CreateDirectory(directoryPath);
        }
        imagesLoaded   = 0;
        imagesRequired = 0;
        for (int i = 0; i < totalAssigns; i++)
        {
            //getting string values from  JSON obj
            string thisAssign      = (string)(allAssignments [i].GetField("assignmentName").ToString());
            int    thisAssignOrder = -1;
            if (allAssignments[i].GetField("order") != null)
            {
                thisAssignOrder = int.Parse(allAssignments[i].GetField("order").ToString().Replace("\"", ""));
            }
            string thisAssignSurvey = "NA";
            if (allAssignments[i].GetField("survey") != null)
            {
                thisAssignSurvey = allAssignments[i].GetField("survey").ToString().Replace("\"", "");
            }
            string thisAssignName = "NA";
            if (allAssignments[i].GetField("dispName") != null)
            {
                thisAssignName = allAssignments[i].GetField("dispName").ToString().Replace("\"", "");
            }
            //			string hasImages = (string)(allAssignments [i].GetField ("hasImages").ToString ());
            string imgDirPath = directoryPath + thisAssign.Replace("\"", "") + "-images";
            if (imgDirPath.Contains("cards") || imgDirPath.Contains("multiples"))
            {
                if (!Directory.Exists(imgDirPath))
                {
                    Directory.CreateDirectory(imgDirPath);
                    imagesRequired++;
                    StartCoroutine(pullImgs(thisAssign));

                    //checksum for if there was a corrupted zip which would result in only one file existing
                }
                else if (Directory.GetFiles(imgDirPath).Length < 1)
                {
                    Directory.Delete(imgDirPath, true);
                    Directory.CreateDirectory(imgDirPath);
                    imagesRequired++;
                    StartCoroutine(pullImgs(thisAssign));
                }
            }
            //currently filePath is not used
            //			string filePath = (Application.persistentDataPath + "/" + thisAssign).Replace ("\"", "");
            StartCoroutine(saveAssignment(thisAssign, thisAssignOrder, thisAssignSurvey, thisAssignName));
        }
        urlsDownloaded = true;
    }