コード例 #1
0
ファイル: Builder.cs プロジェクト: gordon-david/2DGame
        /*
         *  Only Builds Equipment,
         *  This may introduce duplicates, it doesn't route through the EquipmentQueue
         */
        private static Equipment BuildEquipment(string equipmentName)
        {
            Database database = new Database();
            Dictionary <string, object> itemData = database.GetItemData(equipmentName);

            Items.Equipment item = new Items.Equipment((string)itemData["display_name"], (string)itemData["name"], StringToEquipSlot((string)itemData["slot"]));
            foreach (KeyValuePair <string, long> row in (Dictionary <string, long>)itemData["modifiers"])
            {
                item.AddStatMod(new Modifier((int)row.Value, ModifierType.Flat, item, StringToAbilityType(row.Key)));
            }

            Debug.Log("Building: " + item.ToString());

            return(item);
        }
コード例 #2
0
ファイル: Builder.cs プロジェクト: gordon-david/2DGame
        // builds all equipment in data.xml, for testing
        private static List <Equipment> BuildAllEquipment()
        {
            Database         database = new Database();
            List <Equipment> result   = new List <Equipment>();
            List <Dictionary <string, object> > itemDataList = database.GetAllEquipmentData();

            Debug.Log(itemDataList.Count);
            foreach (Dictionary <string, object> itemData in itemDataList)
            {
                Items.Equipment temp = new Items.Equipment((string)itemData["display_name"], (string)itemData["name"], StringToEquipSlot((string)itemData["slot"]));
                foreach (KeyValuePair <string, long> row in (Dictionary <string, long>)itemData["modifiers"])
                {
                    temp.AddStatMod(new Modifier((int)row.Value, ModifierType.Flat, temp, StringToAbilityType(row.Key)));
                }
                result.Add(temp);
            }
            return(result);
        }