Unity 3 dリュックサックシステム(三)——設計品類のJSONファイル


この節では、物品のjsonファイルについて説明します.jsonファイルには主に2つの構造が含まれています.
  • は「名前/値」ペアの集合であり、異なる言語では、オブジェクト(object)、レコード(record)、構造(struct)、辞書(dictionary)、ハッシュテーブル(hash table)、キーリスト(keyed list)、関連配列(associative array)など、解析されない.
  • は値のあるシーケンステーブルであり、多くの言語では「array」とも呼ばれる.

  • このセクションのjsonは、前節で説明したアイテムのいくつかのプロパティを含む順序付きリストを使用します.次に、アイテムのjsonファイルを直接リストします.
    [
      {
        "id": 1,
        "name": "  ",
        "type": "Consumable",
        "quality": "Common",
        "description": "        ",
        "capacity": 10,
        "buyPrice": 10,
        "sellPrice": 5,
        "hp": 10,
        "mp": 0,
        "sprite": "Sprites/Items/hp"
      },
      {
        "id": 2,
        "name": "  ",
        "type": "Consumable",
        "quality": "Common",
        "description": "        ",
        "capacity": 10,
        "buyPrice": 10,
        "sellPrice": 5,
        "hp": 0,
        "mp": 10,
        "sprite": "Sprites/Items/mp"
      },
      {
        "id": 3,
        "name": "    ",
        "type": "Equipment",
        "quality": "Rare",
        "description": "      B",
        "capacity": 1,
        "buyPrice": 20,
        "sellPrice": 10,
        "sprite": "Sprites/Items/armor",
        "level": 10, 
        "strength":10,
        "intellect":4,
        "agility":9,
        "stamina":1,
        "equipType":"Chest"
      },
      {
        "id": 4,
        "name": "    ",
        "type": "Equipment",
        "quality": "Epic",
        "description": "        ",
        "capacity": 1,
        "buyPrice": 20,
        "sellPrice": 10,
        "sprite": "Sprites/Items/belts",
        "level": 10, 
        "strength":1,
        "intellect":6,
        "agility":10,
        "stamina":10,
        "equipType":"Belt"
      },
      {
        "id": 5,
        "name": "    ",
        "type": "Equipment",
        "quality": "Legendary",
        "description": "        ",
        "capacity": 1,
        "buyPrice": 20,
        "sellPrice": 10,
        "sprite": "Sprites/Items/boots",
        "level": 10, 
        "strength":10,
        "intellect":5,
        "agility":0,
        "stamina":10,
        "equipType":"Boots"
      },
      {
        "id": 6,
        "name": "    ",
        "type": "Equipment",
        "quality": "Rare",
        "description": "          ",
        "capacity": 1,
        "buyPrice": 20,
        "sellPrice": 10,
        "sprite": "Sprites/Items/bracers",
        "level": 10, 
        "strength":1,
        "intellect":2,
        "agility":3,
        "stamina":4,
        "equipType":"Bracelet"
      },
      {
        "id": 7,
        "name": "    ",
        "type": "Weapon",
        "quality": "Common",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 10,
        "sellPrice": 5,
        "sprite": "Sprites/Items/gloves",
        "level": 10, 
        "damage":54,
        "weaponType":"MainWeapon"
      },
      {
        "id": 8,
        "name": "    ",
        "type": "Equipment",
        "quality": "Artifact",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 10,
        "sellPrice": 5,
        "sprite": "Sprites/Items/helmets",
        "level": 10, 
        "strength":2,
        "intellect":3,
        "agility":4,
        "stamina":4,
        "equipType":"Head"
      },
      {
        "id": 9,
        "name": "    ",
        "type": "Equipment",
        "quality": "Rare",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 10,
        "sellPrice": 5,
        "sprite": "Sprites/Items/necklace",
        "level": 10, 
        "strength":2,
        "intellect":3,
        "agility":4,
        "stamina":4,
        "equipType":"Neck"
      },
      {
        "id": 10,
        "name": "    ",
        "type": "Equipment",
        "quality": "Common",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 20,
        "sellPrice": 20,
        "sprite": "Sprites/Items/rings",
        "level": 10, 
        "strength":20,
        "intellect":3,
        "agility":4,
        "stamina":4,
        "equipType":"Ring"
      },
      {
        "id": 11,
        "name": "    ",
        "type": "Equipment",
        "quality": "Common",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 40,
        "sellPrice": 20,
        "sprite": "Sprites/Items/pants",
        "level": 10, 
        "strength":20,
        "intellect":30,
        "agility":40,
        "stamina":40,
        "equipType":"Leg"
      },
      {
        "id": 12,
        "name": "    ",
        "type": "Equipment",
        "quality": "Legendary",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 100,
        "sellPrice": 20,
        "sprite": "Sprites/Items/shoulders",
        "level": 10, 
        "strength":2,
        "intellect":3,
        "agility":4,
        "stamina":4,
        "equipType":"Shoulder"
      },
      {
        "id": 13,
        "name": "   ",
        "type": "Weapon",
        "quality": "Artifact",
        "description": "         ",
        "capacity": 1,
        "buyPrice": 50,
        "sellPrice": 20,
        "sprite": "Sprites/Items/axe",
        "level": 10, 
        "damage":100,
        "weaponType":"MainWeapon"
      },
      {
        "id": 14,
        "name": "   ",
        "type": "Weapon",
        "quality": "Rare",
        "description": "      ",
        "capacity": 1,
        "buyPrice": 15,
        "sellPrice": 5,
        "sprite": "Sprites/Items/sword",
        "level": 10, 
        "damage":20,
        "weaponType":"OffWeapon"
      },
      {
        "id": 15,
        "name": "        ",
        "type": "Material",
        "quality": "Artifact",
        "description": "          ",
        "capacity": 2,
        "buyPrice": 100,
        "sellPrice": 99,
        "sprite": "Sprites/Items/book"
      },
      {
        "id": 16,
        "name": "       ",
        "type": "Material",
        "quality": "Common",
        "description": "         ",
        "capacity": 2,
        "buyPrice": 50,
        "sellPrice": 10,
        "sprite": "Sprites/Items/scroll"
      },
      {
        "id": 17,
        "name": "  ",
        "type": "Material",
        "quality": "Common",
        "description": "             ",
        "capacity": 20,
        "buyPrice": 5,
        "sellPrice": 4,
        "sprite": "Sprites/Items/ingots"
      }
    ]

    jsonデータフォーマットの詳細については、ネット上の他の記事を参照してください.ここでは詳しく説明しません.この記事を参照してください.http://www.cnblogs.com/SkySoot/archive/2012/04/17/2453010.html
    この節はこれで終わり、次の節は続きます....