コード例 #1
0
        /// <Summary>
        /// Returns the item name that is specified by item ID.
        /// </Summary>
        /// <param name="itemId">Specify item ID.</param>
        public static string GetItemNameById(int itemId)
        {
            string         itemName = ITEM_NAME_NONE;
            ItemMasterData item     = (ItemMasterData)Resources.Load("ItemData/item_" + itemId.ToString("D5"));

            if (item != null)
            {
                itemName = item.itemName;
            }
            return(itemName);
        }
コード例 #2
0
ファイル: EventEditor.cs プロジェクト: lavumi/DungeonRPG
        /// <Summary>
        /// Get an item list from item data.
        /// </Summary>
        void GetTreasureItemList()
        {
            List <int>    itemIdList   = new List <int>();
            List <string> itemNameList = new List <string>();

            string dataType = "ItemMasterData";

            string[] guidArray = MapEditorUtil.GetGuidArray(dataType);

            foreach (string guid in guidArray)
            {
                string         path     = AssetDatabase.GUIDToAssetPath(guid);
                ItemMasterData itemData = AssetDatabase.LoadAssetAtPath <ItemMasterData>(path);
                if (itemData == null)
                {
                    continue;
                }
                itemIdList.Add(itemData.itemId);
                itemNameList.Add(itemData.itemName);
            }
            itemIds   = itemIdList.ToArray();
            itemNames = itemNameList.ToArray();
        }
コード例 #3
0
        /// <Summary>
        /// Returns the checking result of key type.
        /// </Summary>
        /// <param name="keyType">Key type of the key.</param>
        public static bool CheckCorrespondingKey(DoorKeyType keyType)
        {
            bool hasDoorKey = false;

            foreach (KeyValuePair <int, int> pair in holdItemDict)
            {
                if (pair.Value <= 0)
                {
                    continue;
                }

                ItemMasterData item = (ItemMasterData)Resources.Load("ItemData/item_" + pair.Key.ToString("D5"));
                if (item == null)
                {
                    continue;
                }

                if (item.itemType == AriadneItemType.Key && item.doorKeyType == keyType)
                {
                    hasDoorKey = true;
                }
            }
            return(hasDoorKey);
        }