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


C# JSONObject.GetArray方法代码示例

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


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

示例1: SetResults

  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 });
    }
  }
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:25,代码来源:SlotMachine.cs

示例2: LoadLeaderboardDataSuccess

 void LoadLeaderboardDataSuccess(JSONObject data) {
   LeaderboardScreen.Tab selectedTab = (LeaderboardScreen.Tab)data.GetInt("type");
   LeaderboardScreen.SetData( data.GetArray("users"), selectedTab);
   Debug.Log("LoadLeaderboardDataSuccess " + data.ToString());
   if (ScreenManager.Instance.LeaderboardScreen != null) {
     ScreenManager.Instance.LeaderboardScreen.ShowTopPlayer(selectedTab);
   }
   PopupManager.Instance.CloseLoadingPopup();
 }
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:9,代码来源:UserExtensionRequest.cs

示例3: LoadInboxDataSuccess

  void LoadInboxDataSuccess(JSONObject data) {
    PopupManager.Instance.CloseLoadingPopup();
    ErrorCode.USER errorCode = (ErrorCode.USER)data.GetInt("errorCode");
    if (errorCode == ErrorCode.USER.NULL) {
			if (PopupManager.Instance != null && PopupManager.Instance.PopupInbox != null) {
				PopupManager.Instance.PopupInbox.LoadInboxCallback(data.GetArray("inbox"));
			}
		}
  }
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:9,代码来源:UserExtensionRequest.cs

示例4: FromJSON

		public void FromJSON(JSONObject data)
		{
			// clear old values
			Reset();

			JSONArray wasUsedArray = data.GetArray("wasUsed");
			for (int i = 0; i < wasUsedArray.Length; i++)
			{
				wasUsed.Add((int)wasUsedArray[i].Number);
			}
		}
开发者ID:paveltimofeev,项目名称:GameJamFramework,代码行数:11,代码来源:GameStateData.cs

示例5: update

	public void update(JSONObject json, bool all = false)
    {
        is_connected = true;
        id = (int)json.GetNumber("id");
        username = json.GetString("username");
        email = json.GetString("email");
        score = (int)json.GetNumber("score");
        room = json.GetString("room");

        if (!json.ContainsKey("friends"))
        {
            this.friends = new Friends();
            return;
        } // Info private
        phi = (int)json.GetNumber("phi");
		if (all)
			ProcessSwungMens(json.GetArray("swungmens"));


        // -- Friends
        JSONArray friends = json.GetArray("friends");
        this.friends = new Friends(friends);
	}
开发者ID:CanPayU,项目名称:SuperSwungBall,代码行数:23,代码来源:User.cs

示例6: Init

	public void Init(JSONObject jsonData) {
		roomId = jsonData.GetString("roomId");
		userGames.Clear();
		JSONArray userGameArray = jsonData.GetArray("userGames");

		for (int i = 0; i < userGameArray.Length; i++) {
			userGames.Add(new TLMBGame(userGameArray[i].Obj));
		}

		droppedCards = new TLMBCombination(jsonData.GetString("droppedCards"));
		roundDroppedCards = new TLMBCombination(jsonData.GetString("roundDroppedCards"));
		activeUserSeatIndex = jsonData.GetInt("activeUserSeatIndex");
		state = (State)jsonData.GetInt("state");
		gameConfig = new TLMBGameConfig(jsonData.GetObject("gameConfig"));
		remainingSeconds = jsonData.GetInt("remainingSeconds");
	}
开发者ID:markofevil3,项目名称:SlotMachine,代码行数:16,代码来源:TLMBRoom.cs

示例7: from_json

    public static SPClientMessage from_json(JSONObject jso)
    {
        SPClientMessage rtv = new SPClientMessage();

        JSONArray bullets = jso.GetArray(SN.BULLETS);
        foreach(JSONValue v in bullets) {
            rtv._bullets.Add(SPBulletObject.from_json(v.Obj));
        }

        rtv._player = SPPlayerObject.from_json(jso.GetObject(SN.PLAYER));

        return rtv;
    }
开发者ID:spotco,项目名称:Shoot3Kill,代码行数:13,代码来源:SPDefs.cs

示例8: getPlayer

 private static Player getPlayer(JSONObject obj)
 {
     JSONArray array = obj.GetArray ("levels");
     Dictionary<string,LevelData> levels = new Dictionary<string, LevelData> ();
     for (int i =0; i < array.Length; i++) {
         JSONObject lvl = array [i].Obj;
         LevelData lData = getLevelData (lvl);
         levels.Add (lData.Id, lData);
     }
     return new Player ((int)obj.GetNumber("id"), obj.GetString("name"), levels);
 }
开发者ID:rodrigod89,项目名称:project-decubed-online,代码行数:11,代码来源:UserSettings.cs

示例9: Deserialize

		public override void Deserialize(JSONObject obj)
		{
			Name = obj.GetString(NAME);
			AlternativeNames = new List<string>();
			JSONArray tempArray = obj.GetArray(cAltNames);
			foreach (var val in tempArray)
			{
				AlternativeNames.Add(val.Str);
			}
			Alignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
			WorshippingRaces = new List<DnDRace>();
			tempArray = obj.GetArray(cRaces);
			foreach (var val in tempArray)
			{
				WorshippingRaces.Add((DnDRace)(int)val.Number);
			}
			WorshippingClasses = new List<DnDCharClass>();
			tempArray = obj.GetArray(cClasses);
			foreach (var val in tempArray)
			{
				WorshippingClasses.Add((DnDCharClass)(int)val.Number);
			}
			Domains = new List<DnDClericDomain>();
			tempArray = obj.GetArray(cDomains);
			foreach (var val in tempArray)
			{
				Domains.Add((DnDClericDomain)(int)val.Number);
			}
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:29,代码来源:DnDDeity.cs

示例10: Deserialize

		public override void Deserialize(JSONObject obj)
		{
			mClassLevel = (int)obj.GetNumber(LEVEL);
			DeserializeKnownSpells(obj);
			DeserializeMainSpells(obj);
			DeserializeExtraSpells(obj);
			mSkills = new DnDSkillModel();
			mSkills.Deserialize(obj.GetObject(SKILLS));
			// spec:
			JSONArray tempArray = obj.GetArray(SPECIALIZATION);
			for (int i = 0; i < tempArray.Length; ++i)
			{
				if (i == 0) // first item is the specialization
				{
					mSpecialization = (DnDMagicSchool)((int)tempArray[i].Number);
				}
				else // the other items are the forbidden schools
				{
					mForbiddenSchools.Add((DnDMagicSchool)((int)tempArray[i].Number));
				}
			}
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:22,代码来源:DnDWizard.cs

示例11: Deserialize

		public override void Deserialize(JSONObject obj)
		{
			mName = obj.GetString(NAME);
			mGender = (CharacterGender)(int)obj.GetNumber(GENDER);
			mExperience = (int)obj.GetNumber(EXPERIENCE);
			mAvatar = obj.GetString(AVATAR);
			mAlignment = (DnDAlignment)(int)obj.GetNumber(ALIGNMENT);
			mRace = (DnDRace)(int)obj.GetNumber(RACE);
			mAge = (int)obj.GetNumber(AGE);
			if (obj.ContainsKey(DEITY))
			{
				mDeity = new DnDDeity();
				mDeity.Deserialize(obj.GetObject(DEITY));
			}
			mSize = (DnDCharacterSize)(int)obj.GetNumber(SIZE);
			// souls:
			JSONObject jSouls = obj.GetObject(CLASS_SOULS);
			var classes = Enum.GetValues(typeof(DnDCharClass)).Cast<DnDCharClass>();
			foreach (DnDCharClass charClass in classes)
			{
				if (jSouls.ContainsKey(charClass.ToString()))
				{
					if (!string.IsNullOrEmpty(jSouls.GetObject(charClass.ToString()).ToString()))
					{
						DnDClassSoul newSoul = null;
						switch (charClass)
						{
							case DnDCharClass.Wizard:
								newSoul = new DnDWizard(this);
								break;
							default:
								break;
						}
						if (newSoul != null)
						{
							newSoul.Deserialize(jSouls.GetObject(charClass.ToString()));
							mClasses.Add(newSoul);
						}
					}
				}
			}
			// abilities:
			JSONArray tempArray = obj.GetArray(ABILITIES);
			foreach (var val in tempArray)
			{
				mAbilities[(DnDAbilities)((int)val.Array[0].Number)] = (int)val.Array[1].Number;
			}
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:48,代码来源:DnDCharacter.cs

示例12: RetrieveAsset

        //retrive all assets in a container
        private IEnumerator RetrieveAsset(string containerID, string assetID)
        {
            string url = this.endpoint + containerID + "/all";

            isResetting = true;

            JSONObject containerJSON = new JSONObject();

            //add container
            if (!this.containers.ContainsKey(containerID)){
                Container container = new Container();
                this.containers.Add(containerID, container);
            }

            //validate credentials
            if (this.accessKey == null || this.secretKey == null) {
                throw new System.MemberAccessException("missing credentials");
            }
            //#if UNITY_IPHONE
            //
            //			float timeOut = Time.time + requestTimeout;
            //			var request = new HTTP.Request("GET", url);
            //			request.SetHeader("Authorization", "Basic " + System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(this.accessKey + ":" + this.secretKey)));
            //			request.Send();
            //			while(!request.isDone && Time.time <= timeOut)
            //			{
            //				yield return new WaitForEndOfFrame();
            //			}
            //			if (!request.isDone){ //if request is not done before timeout
            //				yield break;
            //			}
            //			if (request.exception!=null){ // check internet connection
            //				Debug.Log(request.exception);
            //				yield break;
            //			} else {
            //				var response = request.response;
            //				//inspect response code
            //				Debug.Log(response.status);
            //				//inspect headers
            //				Debug.Log(response.GetHeader("Content-Type"));
            //				//Get the body as a byte array
            //				//Debug.Log(response.bytes);
            //				//Or as a string
            //				Debug.Log(response.Text);
            //
            //				containerJSON = JSONObject.Parse(response.Text);
            //			}
            //
            //
            //
            //#else

            Hashtable headers = new Hashtable();
            headers["Authorization"] = "Basic " +
                System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(
                    this.accessKey + ":" + this.secretKey));
            WWW www = new WWW(url, null, headers);
            yield return www;
            if (!String.IsNullOrEmpty(www.error)) { //check internet connection
                yield break;
            }
            containerJSON = JSONObject.Parse(www.text);

            //#endif

            //adding assets
            for (int i = 0; i < containerJSON.GetArray("Assets").Length; i++){

                JSONObject assetJSON = JSONObject.Parse(containerJSON.GetArray("Assets")[i].ToString());

                Asset asset = new Asset();
                string currentAssetID = assetJSON.GetString("AssetID");
                if (!this.containers[containerID].assets.ContainsKey(currentAssetID)){
                    this.containers[containerID].assets.Add(currentAssetID, asset);
                }
                Debug.Log ("--- New asset: " + currentAssetID + " ---");

                //adding attributes
                foreach (var keyValuePair in assetJSON.values) {
                    if (keyValuePair.Value.Type == JSONValueType.Object){ //this is how we know if the pair is an attribute pair and not meta data
                        string attributeName = keyValuePair.Key;

                        if (!this.containers[containerID].assets[currentAssetID]
                            .attributes.ContainsKey(attributeName)){

                            JSONObject attributeJSON = JSONObject.Parse(keyValuePair.Value.ToString());
                            //process attributes based on Type
                            string type = attributeJSON.GetString("Type");
                            switch (type)
                            {
                            case "URL":
                            case "FILE":
                            case "STRING":
                                string value = attributeJSON.GetString ("Value");
                                this.containers[containerID].assets[currentAssetID]
                                .attributes.Add(attributeName, value);
                                Debug.Log (attributeName + " : "
                                           + this.containers[containerID]
                                           .assets[currentAssetID]
//.........这里部分代码省略.........
开发者ID:CraftedInc,项目名称:Appcrafted_Unity_Plugin,代码行数:101,代码来源:AppcraftedManager.cs

示例13: DeserializeExtraSpells

		protected void DeserializeExtraSpells(JSONObject obj)
		{
			JSONArray array = obj.GetArray(SerializableObject.EXTRA_SPELLS);
			mExtraSpells = DeserializeListWithPair(array);
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:5,代码来源:DnDClassSoul.cs

示例14: DeserializeMainSpells

		protected void DeserializeMainSpells(JSONObject obj)
		{
			mMainSpells.Clear();
			JSONArray array = obj.GetArray(SerializableObject.MAIN_SPELLS);
			foreach (var list in array)
			{
				mMainSpells.Add(DeserializeListWithPair(list.Array));
			}
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:9,代码来源:DnDClassSoul.cs

示例15: DeserializeKnownSpells

		protected void DeserializeKnownSpells(JSONObject obj)
		{
			mKnownSpells.Clear();
			JSONArray array = obj.GetArray(SerializableObject.KNOWN_SPELLS);
			foreach (var list in array)
			{
				List<Spell> rankList = new List<Spell>();
				foreach(var listObj in list.Array)
				{
					Spell spell = new Spell();
					spell.Deserialize(listObj.Obj);
					rankList.Add(spell);
				}
				mKnownSpells.Add(rankList);
			}
		}
开发者ID:impjmichel,项目名称:SpellMastery2.0,代码行数:16,代码来源:DnDClassSoul.cs


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