示例#1
0
 public Item(string name, string description, float price, ItemCategory category)
 {
     Name = name;
     Description = description;
     Price = price;
     Category = category;
 }
示例#2
0
 public Item(string name, int buyPrize, int sellPrize, ItemCategory itemCategory)
 {
     mName = name;
     mBuyPrize = buyPrize;
     mSellPrize = sellPrize;
     mCategory = itemCategory;
 }
示例#3
0
 // All Items in one Category
 public List<InventoryItem> Items(ItemCategory filter)
 {
     IEnumerable<InventoryItem> filteredList = from query
                                               in _items
                                               where query.ItemCategoryId == filter
                                               select query;
     return filteredList.ToList();
 }
示例#4
0
 // All Items in many Categories
 /* UNTESTED */
 public List<InventoryItem> Items(ItemCategory[] filter)
 {
     IEnumerable<InventoryItem> filteredList = from query
                                               in _items
                                               where filter.Any(c => c == query.ItemCategoryId)
                                               select query;
     return filteredList.ToList();
 }
示例#5
0
 public Item(ItemCategory category, string type, string version, int gridWidth, int gridHeight)
 {
     Category = category;
     Type = type;
     Version = version;
     GridWidth = gridWidth;
     GridHeight = gridHeight;
 }
示例#6
0
        public IEnumerable<ItemObject> GetItemsByDistance(IntPoint3 location, ItemCategory category, Func<ItemObject, bool> filter)
        {
            var items = m_items
                .Where(i => i.ItemCategory == category)
                .Where(filter)
                .OrderBy(i => (i.Location - location).ManhattanLength);

            return items;
        }
示例#7
0
    public GameObject CreateItem( ItemCategory category, string itemName )
    {
        Item item = m_Categories.GetItem( category, itemName );
        if( null == item )
            return null;

        if( null == item.m_Prefab )
            return null;

        return (GameObject)Instantiate( item.m_Prefab );
    }
 // Use this for initialization
 void Start()
 {
     rend = this.GetComponent<MeshRenderer>();
     normalMats = rend.materials;
     selectedMatList = new Material[normalMats.Length];
     for (int i = 0; i < normalMats.Length; i++)
     {
         selectedMatList[i] = selectedMat;
     }
     myType = ItemCategory.resource;
 }
示例#9
0
        public SpaceShipItem(string description, ItemCategory category, params object[] args)
        {
            Contract.Requires(args.Length % 2 == 0,
                "args must be even, containing pairs of property names and values.");

            Id = Guid.NewGuid();
            Description = description;
            Category = category;

            for (int i = 0; i < args.Length; i += 2)
                _properties[args[i].ToString()] = args[i + 1];
        }
        public async Task<ActionResult> SearchItems(int id, ItemCategory category, string keywords) {
            var existingItemIds = await (
                from wi in _db.WishlistItems
                where wi.WishlistId == id
                select wi.ItemId).ToListAsync();
            var items = await _retailer.FindItemsAsync(category, keywords);
            var viewModel = new FindGiftsResultsViewModel {
                WishlistId = id,
                Results = items.ToList(),
                ExistingItemIds = existingItemIds
            };

            return PartialView("_SearchResults", viewModel);
        }
        public async Task<Item[]> FindItemsAsync(ItemCategory category, string keywords) {
            var itemSearch = new ItemSearch {
                AssociateTag = _associateTag,
                AWSAccessKeyId = _accessKey,
                Request = new ItemSearchRequest[] { 
                    new ItemSearchRequest {
                        SearchIndex = Enum.GetName(typeof(ItemCategory), category),
                        Keywords = keywords,
                        ItemPage = "1",
                        ResponseGroup = new string[] { "Images", "ItemAttributes" }
                    }
                }
            };
            var searchResult = await _amazonClient.ItemSearchAsync(new ItemSearchRequest1 { ItemSearch = itemSearch });

            var items = searchResult.ItemSearchResponse.Items[0].Item;

            if (items == null) {
                return new Item[0];
            }

            return items.Select(item => ToRetailerItem(item)).ToArray();
        }
示例#12
0
    public void ChangeStoreCategory(ItemCategory category)
    {
        ClearCurrentItems();

        _selectedCategory = category;
        var categoryItems = _storeItems.Where(catItem => catItem.Category == _selectedCategory).ToList();

        var itemWidth = 100;
        var itemOffset = 5;
        var itemHeight = 40;

        int columns = 3;
        int startX = (columns / 2)*(itemWidth + itemOffset) * -1;
        int startY = (((categoryItems.Count + columns - 1) / columns) * (itemHeight + itemOffset)) * -1;

        int x = 0, y = 0;

        for(int i = 0; i < categoryItems.Count(); i++)
        {
            var item = categoryItems[i];
            var child = NGUITools.AddChild(UIParent, ButtonPrefab);
            child.transform.localPosition = new Vector3(
                startX + x * (itemWidth + itemOffset),
                (startY + y * (itemHeight + itemOffset)) * -1,
                0);

            var s = child.GetComponent<StoreItem>();
            s.Item = item;

            x++;
            if (x == columns)
            {
                x = 0;
                y++;
            }
        }
    }
示例#13
0
 public void Clear()
 {
     _id = -1;
     _name = "";
     _itemCategoryId = ItemCategory.Null;
     _ownerId = -1;
     _worldGridSize = -1;
     _inventoryGridSize = -1;
     _quantity = -1;
     //private Byte[] _worldModel;
     //private Byte[] _inventoryImage;
     _statsList.Clear();
 }
示例#14
0
    void OnGUI()
    {
        if (_serializedObject != null)
        {
            if (_database.ItemList == null)
            {
                _database.ItemList = new List<Item>();
            }

            GUILayout.Space(15);
            GUILayout.BeginHorizontal();
            toolbarIndex = GUILayout.Toolbar(toolbarIndex, toolbarStrings);
            GUILayout.EndHorizontal();

            //Items
            EditorUtility.SetDirty(_database);
            if (toolbarIndex == 0)
            {
                ReinitializeDatabase();
                ReinitializeProperties();
                GUILayout.Space(20);
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical("Box", GUILayout.Width(350));
                if (GUILayout.Button("Create New Item"))
                {
                    Item newItem = new Item("New Item " + _database.ItemList.Count.ToString(), "Sample Description");
                    EditedItem = newItem;
                    _database.ItemList.Add(newItem);
                    ReinitializeDatabase();
                }
                GUILayout.BeginVertical("Box", GUILayout.Height(650));

                itemListVector = GUILayout.BeginScrollView(itemListVector, GUILayout.Height(650));
                foreach (Item item in _database.ItemList)
                {
                    GUILayout.Space(5);
                    if (GUILayout.Button(item.Name))
                    {
                        EditedItem = item;
                        EditorGUI.FocusTextInControl(null);

                    }
                }
                GUILayout.EndScrollView();

                GUILayout.EndVertical();
                GUILayout.EndVertical();
                if (EditedItem != null)
                {
                        if (ItemPropertyList == null || !ItemPropertyList.list.Equals(EditedItem.ItemProperties))
                        {
                            if (_database.ItemList.Count > 0)
                            {
                                if (EditedItem.ItemProperties != null)
                                {
                                    ItemPropertyList = new ReorderableList(EditedItem.ItemProperties,
                                        typeof (ItemProperty));

                                    ItemPropertyList.drawElementCallback =
                                        (Rect rect, int index, bool active, bool focused) =>
                                        {
                                            ItemProperty property = EditedItem.ItemProperties[index];
                                            rect.y += 2;

                                                EditorGUI.LabelField(
                                                    new Rect(rect.x + 25, rect.y, 150, EditorGUIUtility.singleLineHeight),property.PropertyName);
                                            property.PropertyValue = EditorGUI.TextField(new Rect(rect.x + 250, rect.y, 150, EditorGUIUtility.singleLineHeight), property.PropertyValue);
                                        };

                                    ItemPropertyList.drawHeaderCallback = (Rect rect) =>
                                    {
                                        EditorGUI.LabelField(new Rect(rect.x + 25, rect.y, rect.width, rect.height),
                                            "Name");
                                        EditorGUI.LabelField(new Rect(rect.x + 250, rect.y, rect.width, rect.height),
                                            "Value");
                                    };

                                    //ItemPropertyList.onAddCallback = (ReorderableList l) =>
                                    //{
                                    //    var index = EditedItem.ItemProperties.Count;
                                    //    ItemProperty property = new ItemProperty();
                                    //    EditedItem.ItemProperties.Add(property);

                                    //    property = EditedItem.ItemProperties[index];

                                    //    property.PropertyName = property.GetExisting(PropertyStrings);
                                    //    property.PropertyValue =
                                    //        _database.GetByNameProperty(property.PropertyName).PropertyValue;

                                    //};

                                    ItemPropertyList.onAddDropdownCallback = (Rect rect, ReorderableList list) =>
                                    {
                                        var menu = new GenericMenu();

                                        for (int i = 0; i < _database.ItemProperties.Count; i++)
                                        {
                                            if (!EditedItem.ItemProperties.Contains(_database.ItemProperties[i]))
                                            {
                                                menu.AddItem(new GUIContent(_database.ItemProperties[i].PropertyName), false, AddProperty, _database.GetByNameProperty(_database.ItemProperties[i].PropertyName));
                                            }
                                        }

                                        menu.ShowAsContext();
                                    };
                                }
                            }
                        }
                    GUILayout.BeginVertical("Box", GUILayout.Height(650));
                    if (GUILayout.Button("Delete this Item"))
                    {
                        ItemToDelete = EditedItem;
                    }

                    itemDataVector = GUILayout.BeginScrollView(itemDataVector, GUILayout.Height(650));

                    GUILayout.BeginVertical("Box");

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("ID: ");
                    GUILayout.Label(EditedItem.ID.ToString());
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Name");
                    EditedItem.Name = GUILayout.TextField(EditedItem.Name, GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Description");
                    EditedItem.Description = GUILayout.TextArea(EditedItem.Description, GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Max Stack's length");
                    int.TryParse(GUILayout.TextField(EditedItem.MaxStackCount.ToString(), GUILayout.Width(460)), out EditedItem.MaxStackCount);
                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();

                    GUILayout.BeginVertical("Box");

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Icon");
                    EditedItem.Icon = (Sprite)EditorGUILayout.ObjectField(EditedItem.Icon, typeof(Sprite), GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Prefab");
                    EditedItem.ItemPrefab =
                        (GameObject)
                            EditorGUILayout.ObjectField(EditedItem.ItemPrefab, typeof(GameObject), GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("On Use AudioClip");
                    EditedItem.OnUseAudioClip =
                        (AudioClip)
                            EditorGUILayout.ObjectField(EditedItem.OnUseAudioClip, typeof(AudioClip),
                                GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label("On Gear AudioClip");
                    EditedItem.OnGearAudioClip =
                        (AudioClip)
                            EditorGUILayout.ObjectField(EditedItem.OnGearAudioClip, typeof(AudioClip),
                                GUILayout.Width(460));
                    GUILayout.EndHorizontal();

                    GUILayout.Space(10);

                    GUILayout.BeginVertical("Box");
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Item Category");
                    EditedItem.categoryChoiceID = EditorGUILayout.Popup(EditedItem.categoryChoiceID, CategoryStrings);
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();

                    GUILayout.EndVertical();

                    GUILayout.Space(10);

                    GUILayout.BeginVertical("Box");
                    //ReorderableListHere
                    GUILayout.Label("Item Properties");
                    EditorUtility.SetDirty(_database);
                    ItemPropertyList.DoLayoutList();
                    EditorUtility.SetDirty(_database);

                    GUILayout.EndVertical();

                    GUILayout.EndScrollView();

                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();
            }
            else if (toolbarIndex == 1) //ItemCategories & Properties
            {
                ReinitializeDatabase();
                ReinitializeProperties();
                GUILayout.Space(20);
                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical("Box", GUILayout.Width(250));
                newItemCategory = GUILayout.TextField(newItemCategory, GUILayout.Width(250));
                if (GUILayout.Button("Create Item Category"))
                {
                    if (!_database.CategoryExist(newItemCategory))
                    {
                        _database.ItemCategories.Add(new ItemCategory(newItemCategory));
                    }
                }
                if (_database.ItemCategories.Count != 0)
                {
                    categoryListVector = GUILayout.BeginScrollView(categoryListVector, GUILayout.Width(250));

                    GUILayout.BeginVertical("Box");
                    foreach (ItemCategory category in _database.ItemCategories)
                    {
                        GUILayout.Space(10);
                        if (GUILayout.Button(category.Category))
                        {
                            selectedCategory = category;
                        }
                    }
                    GUILayout.EndVertical();
                    GUILayout.EndScrollView();
                }
                GUILayout.Space(20);
                GUILayout.BeginVertical("Box");
                if (GUILayout.Button("Remove"))
                {
                    _database.ItemCategories.Remove(selectedCategory);
                    selectedCategory = null;
                }
                GUILayout.EndVertical();
                GUILayout.EndVertical();

                GUILayout.BeginVertical("Box");
                GUILayout.BeginHorizontal();
                newItemProperty = GUILayout.TextField(newItemProperty, GUILayout.Width(250));
                if (GUILayout.Button("Create Item Property"))
                {
                    if (!_database.PropertyExist(newItemProperty))
                    {
                        _database.ItemProperties.Add(new ItemProperty(newItemProperty, string.Empty));
                    }
                }
                GUILayout.EndHorizontal();
                if (_database.ItemProperties.Count != 0)
                {
                    propertyListVector2 = GUILayout.BeginScrollView(propertyListVector2, GUILayout.Height(650));
                    GUILayout.BeginVertical("Box");
                    foreach (ItemProperty property in _database.ItemProperties)
                    {
                        GUILayout.Space(10);
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Name:");
                        property.PropertyName = GUILayout.TextField(property.PropertyName, GUILayout.Width(450));
                        GUILayout.EndHorizontal();
                        GUILayout.BeginHorizontal();
                        GUILayout.Label("Default Value:");
                        property.PropertyValue = GUILayout.TextField(property.PropertyValue.ToString(), GUILayout.Width(450));
                        GUILayout.EndHorizontal();
                        if (GUILayout.Button("Remove"))
                        {
                            foreach (Item i in _database.ItemList)
                            {
                                if (i.ItemProperties.Contains(property))
                                {
                                    i.ItemProperties.Remove(property);
                                }
                            }
                            propertyToDelete = property;
                        }
                    }
                    GUILayout.EndVertical();
                    GUILayout.EndScrollView();
                }

                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            else if (toolbarIndex == 2)
            {
                GUILayout.BeginHorizontal();
                //EditorUtility.SetDirty(_database);
                //GUILayout.BeginVertical("box");

                //if(GUILayout.Button("New Recipe"))
                //{
                //    _database.Recipes.Add(new Recipe());
                //}
                //foreach (Recipe rec in _database.Recipes)
                //{
                //    GUILayout.Space(15);
                //  int.TryParse(GUILayout.TextField(rec.OutputID.ToString()), out rec.OutputID);
                //  if (GUILayout.Button("Remove Recipe"))
                //  {
                //      if (RecipeToRemove == null)
                //      {
                //          RecipeToRemove = rec;
                //      }
                //  }
                //}

                //GUILayout.EndVertical();
                //GUILayout.BeginVertical("box");

                //GUILayout.EndVertical();
                //EditorUtility.SetDirty(_database);
                craftToolbarIndex = GUILayout.Toolbar(craftToolbarIndex, craftToolbarStrings);
                GUILayout.EndHorizontal();

                if (craftToolbarIndex == 0) //Recipes
                {

                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical("box",GUILayout.Width(250)); //list
                    GUILayout.BeginHorizontal();
                    newRecipe = GUILayout.TextField(newRecipe.ToString(), GUILayout.Width(150));
                    if (GUILayout.Button("Create Recipe"))
                    {
                        if(int.Parse(newRecipe) <= _database.ItemList.Count-1)
                        {
                            bool foundDuplicate = false;
                            for (int i = 0; i < _database.Recipes.Count; i++)
                            {
                                if (_database.Recipes[i].OutputID == int.Parse(newRecipe))
                                {
                                    foundDuplicate = true;
                                }
                            }
                            if (!foundDuplicate)
                            {
                                _database.Recipes.Add(new Recipe(int.Parse(newRecipe)));
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                    try
                    {
                    foreach (Recipe rec in _database.Recipes)
                        {
                            if (GUILayout.Button(_database.ItemByID(rec.OutputID).Name.ToString()))
                            {
                                EditedRecipe = rec;
                            }
                        }
                    }
                    catch(Exception ex) {

                    }

                    GUILayout.EndVertical();
                    if (EditedRecipe != null)
                    {
                        try
                        {
                            GUILayout.BeginVertical("box");
                            GUILayout.BeginHorizontal();
                            GUILayout.Label("Result Item");
                            GUILayout.Label(_database.ItemByID(EditedRecipe.OutputID).Name.ToString());
                            GUILayout.EndHorizontal();

                            GUILayout.Label("Ingredients");

                            if (GUILayout.Button("New Ingredient"))
                            {
                                EditedRecipe.RequiredData.Add(_database.ItemByID(0));
                            }
                            if (EditedRecipe.RequiredData != null)
                            {
                                foreach (Item i in EditedRecipe.RequiredData)
                                {
                                    GUILayout.Space(10);
                                    GUILayout.BeginHorizontal();
                                    if (GUILayout.Button("Remove"))
                                    {
                                        CraftDataToRemove = i;
                                    }
                                    GUILayout.Label("Ingredient ID");
                                    int.TryParse(GUILayout.TextField(i.ID.ToString()), out i.ID);

                                    GUILayout.EndHorizontal();
                                }
                            }
                        }
                        catch(Exception ex) {

                        }

                        GUILayout.EndVertical();
                    }
                    GUILayout.EndHorizontal();

                }
                else if (craftToolbarIndex == 1) //BluePrints
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical("box", GUILayout.Width(250)); //list
                    GUILayout.BeginHorizontal();
                    newBluePrint = GUILayout.TextField(newBluePrint.ToString(), GUILayout.Width(150));
                    EditorUtility.SetDirty(_database);
                    if (GUILayout.Button("Create BluePrint"))
                    {
                        if (int.Parse(newBluePrint) <= _database.ItemList.Count - 1)
                        {
                            bool foundDuplicate = false;
                            for (int i = 0; i < _database.BluePrints.Count; i++)
                            {
                                if (_database.BluePrints[i].OutputID == int.Parse(newBluePrint))
                                {
                                    foundDuplicate = true;
                                }
                            }
                            if (!foundDuplicate)
                            {
                                _database.BluePrints.Add(new BluePrint(int.Parse(newBluePrint)));
                            }
                        }
                    }
                    GUILayout.EndHorizontal();
                    foreach (BluePrint bp in _database.BluePrints)
                    {
                        if (GUILayout.Button(_database.ItemByID(bp.OutputID).Name.ToString()))
                        {
                            EditedBluePrint = bp;
                        }
                    }

                    GUILayout.EndVertical();
                    if (EditedBluePrint!= null)
                    {
                        GUILayout.BeginVertical("box", GUILayout.Width(200));
                        GUILayout.BeginHorizontal();
                        GUILayout.EndHorizontal();

                            GUILayout.BeginVertical();

                            GUILayout.BeginHorizontal();
                            EditedBluePrint.x1y1 = GUILayout.TextField(EditedBluePrint.x1y1.ToString(),GUILayout.Width(40));
                            EditedBluePrint.x1y2 = GUILayout.TextField(EditedBluePrint.x1y2.ToString(), GUILayout.Width(40));
                            EditedBluePrint.x1y3 = GUILayout.TextField(EditedBluePrint.x1y3.ToString(), GUILayout.Width(40));
                            GUILayout.EndHorizontal();

                            GUILayout.BeginHorizontal();
                            EditedBluePrint.x2y1 = GUILayout.TextField(EditedBluePrint.x2y1.ToString(), GUILayout.Width(40));
                            EditedBluePrint.x2y2 = GUILayout.TextField(EditedBluePrint.x2y2.ToString(), GUILayout.Width(40));
                            EditedBluePrint.x2y3 = GUILayout.TextField(EditedBluePrint.x2y3.ToString(), GUILayout.Width(40));
                            GUILayout.EndHorizontal();

                            GUILayout.BeginHorizontal();
                            EditedBluePrint.x3y1 = GUILayout.TextField(EditedBluePrint.x3y1.ToString(), GUILayout.Width(40));
                            EditedBluePrint.x3y2 = GUILayout.TextField(EditedBluePrint.x3y2.ToString(), GUILayout.Width(40));
                            EditedBluePrint.x3y3 = GUILayout.TextField(EditedBluePrint.x3y3.ToString(), GUILayout.Width(40));
                            GUILayout.EndHorizontal();

                            GUILayout.EndVertical();

                        GUILayout.EndVertical();

                    }
                    GUILayout.EndHorizontal();
                }
            }
            else if (toolbarIndex == 3) //Currencies
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical("box", GUILayout.Width(this.position.width / 2));

                GUILayout.BeginHorizontal();
                newCurrency = GUILayout.TextField(newCurrency, GUILayout.Width(125));
                GUILayout.Space(20);
                if (GUILayout.Button("Create new currency", GUILayout.Width(200)))
                {
                    if(!string.IsNullOrEmpty(newCurrency))
                    {
                        if (!_database.CurrencyExist(newCurrency))
                        {
                            Currency currency = new Currency();
                            currency.Name = newCurrency;

                            _database.Currencies.Add(currency);
                        }
                    }
                }
                GUILayout.EndHorizontal();

                foreach (var c in _database.Currencies)
                {
                    GUILayout.Space(10);

                    if (GUILayout.Button(c.Name))
                    {
                        EditedCurrency = _database.CurrencyByName(c.Name);
                        CurrencyDependencyList = new ReorderableList(EditedCurrency.Dependencies, typeof(CurrencyDependency));
                        EditorGUI.FocusTextInControl(null);
                    }
                }

                GUILayout.EndVertical();

                GUILayout.BeginVertical("box");

                        if (EditedCurrency != null)
                        {

                        if (CurrencyDependencyList == null)
                        {
                            CurrencyDependencyList = new ReorderableList(EditedCurrency.Dependencies, typeof(CurrencyDependency));
                        }

                        if (CurrencyDependencyList != null || !CurrencyDependencyList.list.Equals(EditedCurrency.Dependencies))
                        {
                            if (EditedCurrency.Dependencies != null)
                            {
                                CurrencyDependencyList.elementHeight = EditorGUIUtility.singleLineHeight * 5f;

                                CurrencyDependencyList.drawHeaderCallback = (Rect rect) =>
                                   {
                                       EditorGUI.LabelField(rect, "Currency Names and Currency Values");
                                   };

                                CurrencyDependencyList.onAddCallback = (ReorderableList l) =>
                                    {
                                        var index = EditedCurrency.Dependencies.Count;
                                        CurrencyDependency dependency = new CurrencyDependency();
                                        EditedCurrency.Dependencies.Add(dependency);

                                        dependency = EditedCurrency.Dependencies[index];

                                        dependency.FirstCurrency = EditedCurrency.Name;
                                        dependency.SecondCurrency = EditedCurrency.Name;

                                        dependency.FirstCurrencyCount = 1;
                                        dependency.SecondCurrencyCount = 1;
                                    };

                                CurrencyDependencyList.drawElementCallback = (Rect rect, int index, bool active, bool focused) =>
                                    {
                                        try
                                        {
                                            CurrencyDependency dependency = EditedCurrency.Dependencies[index];
                                            rect.y += 2;

                                            dependency.FirstCurrency = EditorGUI.TextField(new Rect(rect.x, rect.y, 90, EditorGUIUtility.singleLineHeight), dependency.FirstCurrency);
                                            dependency.SecondCurrency = EditorGUI.TextField(new Rect(rect.x, rect.y + 50, 90, EditorGUIUtility.singleLineHeight), dependency.SecondCurrency);

                                            int.TryParse(EditorGUI.TextField(new Rect(rect.x + 100, rect.y, 90, EditorGUIUtility.singleLineHeight), dependency.FirstCurrencyCount.ToString()), out dependency.FirstCurrencyCount);
                                            int.TryParse(EditorGUI.TextField(new Rect(rect.x + 100, rect.y + 50, 90, EditorGUIUtility.singleLineHeight), dependency.SecondCurrencyCount.ToString()), out dependency.SecondCurrencyCount);
                                        }
                                        catch (Exception ex)
                                        {

                                        }

                                    };
                            }
                        }
                        GUILayout.BeginHorizontal();
                        if (GUILayout.Button("Remove"))
                        {
                            CurrencyToRemove = EditedCurrency;
                        }
                        GUILayout.Label("Currency Name:");
                        EditedCurrency.Name = GUILayout.TextField(EditedCurrency.Name, GUILayout.Width(125));
                        GUILayout.EndHorizontal();

                        EditorUtility.SetDirty(_database);
                        CurrencyDependencyList.DoLayoutList();
                        EditorUtility.SetDirty(_database);
                }

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }

            _serializedObject.Update();
            _serializedObject.ApplyModifiedProperties();
        }
        if (BluePrintToRemove != null)
        {
            _database.BluePrints.Remove(BluePrintToRemove);
            BluePrintToRemove = null;
        }
        if (CurrencyToRemove != null)
        {
            _database.Currencies.Remove(CurrencyToRemove);
            CurrencyToRemove = null;
            EditedCurrency = null;
        }
        if (CraftDataToRemove != null)
        {
            EditedRecipe.RequiredData.Remove(CraftDataToRemove);
            CraftDataToRemove = null;
        }
        if (RecipeToRemove != null)
        {
            _database.Recipes.Remove(RecipeToRemove);
            RecipeToRemove = null;
        }
        if (ItemToDelete != null)
        {
            if (ItemToDelete.ID != 0)
            {
                EditedItem = _database.ItemList[ItemToDelete.ID - 1];
            }
            else if (_database.ItemList.Count == 1)
            {
                EditedItem = null;
            }
            else
            {
                EditedItem = _database.ItemList[ItemToDelete.ID + 1];
            }

            _database.ItemList.Remove(ItemToDelete);

            ItemToDelete = null;
            ReinitializeDatabase();
        }
        if (propertyToDelete != null)
        {
            _database.ItemProperties.Remove(propertyToDelete);
            propertyToDelete = null;
        }
        EditorUtility.SetDirty(_database);
    }
    // Use this for initialization
    void Start()
    {
        Console.Instance.CommandSent += OnCommand;
        GameObject sceneMaster = GameObject.Find( "SceneMaster" );

        if( null == sceneMaster )
        {
            Debug.LogError( "Failed to find SceneMaster object" );
            return;
        }

        m_ItemMap = (ItemMap) sceneMaster.GetComponent<ItemMap>();

        if( null == m_ItemMap )
        {
            Debug.LogError( "Failed to find 'ItemMap' component on SceneMaster object" );
            return;
        }

        m_ToolsCategory = m_ItemMap.m_Categories.FindCategory( "Tools" );

        if( null == m_ToolsCategory )
        {
            Debug.LogError( "Failed to find 'Tools' category in ItemMap" );
            return;
        }

        ChangeTool( m_ItemMap.CreateItem( m_ToolsCategory, "Hand" ) );

        m_InternalIZ = this.gameObject.AddComponent<CapsuleCollider>();
        UpdateInternalIZ();
    }
示例#16
0
        private void UpdateCategories()
        {
            var oldSelectedCategory = _selectedCategory;

            using (var context = new ERPContext())
            {
                Categories.Clear();
                var allCategory = new ItemCategory { ID = -1, Name = "All" };
                Categories.Add(new ItemCategoryVM { Model = allCategory });
                var categoriesFromDatabase = context.Categories.OrderBy(category => category.Name);
                foreach (var category in categoriesFromDatabase)
                    Categories.Add(new ItemCategoryVM { Model = category });
            }

            UpdateSelectedCategory(oldSelectedCategory);
        }
示例#17
0
 public IComponent(int _item, ItemCategory _Category)
 {
     amount   = 1;
     ID       = _item;
     Category = _Category;
 }
示例#18
0
 public bool Match(ItemID itemID, ItemCategory itemCategory, MaterialID materialID, MaterialCategory materialCategory)
 {
     return m_itemIDMask.Get(itemID) &&
         m_itemCategoryMask.Get(itemCategory) &&
         m_materialIDMask.Get(materialID) &&
         m_materialCategoryMask.Get(materialCategory);
 }
 public ItemTableViewData(int id, string name, Sprite icon, List <ItemEffect> effects, string description, ItemCategory category, ItemRarity rarity, bool active, string folderPath)
 {
     this.Id          = id;
     this.Name        = name;
     this.oldName     = Name;
     this.Icon        = icon;
     this.Effects     = effects;
     this.Description = description;
     this.Category    = category;
     this.Rarity      = rarity;
     this.Active      = active;
     this.folderPath  = folderPath;
 }
 public Item GetItem( ItemCategory category, string itemName )
 {
     return category.SearchCatItemRecurse( itemName );
 }
示例#21
0
文件: Item.cs 项目: sinhpham/tanka
 // Private methods.
 static void GetInfoPositions(ItemCategory cat, ref Vector2 iconPosition, ref Vector2 stringPosition)
 {
     iconPosition.X = 800;
     stringPosition.X = 850;
     switch (cat)
     {
         case ItemCategory.TankSpeed:
             iconPosition.Y = 20;
             stringPosition.Y = 30;
             break;
         case ItemCategory.AmmoSpeed:
             iconPosition.Y = 70;
             stringPosition.Y = 80;
             break;
         case ItemCategory.Armor:
             iconPosition.Y = 120;
             stringPosition.Y = 130;
             break;
         case ItemCategory.TBF:
             iconPosition.Y = 170;
             stringPosition.Y = 180;
             break;
         case ItemCategory.Other:
             iconPosition.Y = 220;
             stringPosition.Y = 230;
             break;
     }
 }
示例#22
0
 public bool Match(ItemID itemID, ItemCategory itemCategory, MaterialID materialID, MaterialCategory materialCategory)
 {
     return (m_itemIDMask == null || m_itemIDMask.Get(itemID)) &&
         (m_itemCategoryMask == null || m_itemCategoryMask.Get(itemCategory)) &&
         (m_materialIDMask == null || m_materialIDMask.Get(materialID)) &&
         (m_materialCategoryMask == null || m_materialCategoryMask.Get(materialCategory));
 }
示例#23
0
 /*
 public static IGui.EditorType getEditorType(ItemCategory itemCategory)
 {
     switch (itemCategory)
     {
     }
 }
 */
 public static string CategoryLookup(ItemCategory itemCategory)
 {
     return itemCategory.ToString().Replace('_', ' ');
 }
 public async Task<ActionResult> Search(ItemCategory category, string keywords) {
     var items = await _retailer.FindItemsAsync(category, keywords);
     return PartialView("_SearchResults", items);
 }
示例#25
0
 private static void AddItemInfo(string itemID, ItemCategory category, string defaultSerialized, bool hide = false, bool preventDelete = false)
 {
     itemInfo.Add(itemID, new ItemInfo {
         category = category, defaultSerialized = defaultSerialized, hide = hide, preventDelete = preventDelete
     });
 }
示例#26
0
 public void Load(ItemCategory itemCategory)
 {
     itemCategory.CodexTab_Object = uow.GetRepo <CodexTabRepository>().GetByID(itemCategory.CodexTabID);
 }
示例#27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            db = new MooglenomicsDatabaseDataContext();
            //itemsList = db.Items.Where(p => p.isUntradeable == false).OrderBy(p => p.ItemSubCategory.ItemCategory.ItemCategoryID).ThenBy(p => p.ItemSubCategory.ItemSubCat_ID).ToList();
            HttpCookie hc = MoogleCookieHelper.GetCookie(Request);
            if (hc != null)
            {
                currentUser = db.Users.SingleOrDefault(i => i.UserID.ToString().Equals(hc["userID"]));
            }
            if (currentUser == null)
            {
                Response.Redirect("Login.aspx");
            }

            if (!IsPostBack)
            {
                string catID = Request.QueryString["cat"];
            string subcatID = Request.QueryString["subcat"];
            string itemID = Request.QueryString["item"];
                if (itemID != null)
            {
                Load_Item(itemID);
            }
                Subcategory_DropDownList.Items.Clear();
                Category_DropDownList.Items.Clear();
                Subcategory_DropDownList.Items.Add("All");
                Category_DropDownList.Items.Add("All");
                int iCat = 0;
                List<ItemCategory> icList = db.ItemCategories.ToList();
                foreach (ItemCategory ic in icList)
                {
                    iCat++;
                    Category_DropDownList.Items.Add(ic.CategoryName);

                    if (catID != null && ic.ItemCategoryID.ToString().Equals(catID))
                    {
                        Category_DropDownList.SelectedIndex = iCat;
                        itemCategory = ic;
                        List<ItemSubCategory> iscList = ic.ItemSubCategories.ToList();
                        foreach (ItemSubCategory isc in iscList)
                        {
                            Subcategory_DropDownList.Items.Add(isc.Name);
                            if (subcatID != null && isc.ItemSubCat_ID.ToString().Equals(subcatID))
                            {
                                itemSubcategory = isc;
                            }
                        }
                    }
                }
                ItemList_Filter();
            }
        }
示例#28
0
 public ItemType GetEquipment(ItemCategory category, int tier)
 {
     return (from i in ItemBase.Types
             where i.Category == category
                 && i.Tier <= tier
             orderby i.Tier descending,
                 i.Rarity descending
             select i).FirstOrDefault();
 }
示例#29
0
 public static bool HasItem(this List <Item> list, ItemCategory cat)
 {
     return(list.Any(i => i.Category == cat));
 }
示例#30
0
        public static IEnumerable<ItemInfo> GetItemInfos(ItemCategory category)
        {
            Debug.Assert(category != ItemCategory.Undefined);

            return s_items.Where(ii => ii != null && ii.Category == category);
        }
示例#31
0
        // Methods
        public ItemAction(byte[] data)
            : base(data)
        {
            this.superiorType = SuperiorItemType.NotApplicable;
            this.charClass = CharacterClass.NotApplicable;
            this.level = -1;
            this.usedSockets = -1;
            this.use = -1;
            this.graphic = -1;
            this.color = -1;
            this.stats = new List<StatBase>();
            this.unknown1 = -1;
            this.runewordID = -1;
            this.runewordParam = -1;
            BitReader br = new BitReader(data, 1);
            this.action = (ItemActionType) br.ReadByte();
            br.SkipBytes(1);
            this.category = (ItemCategory) br.ReadByte();
            this.uid = br.ReadUInt32();
            if (data[0] == 0x9d)
            {
                br.SkipBytes(5);
            }
            this.flags = (ItemFlags) br.ReadUInt32();
            this.version = (ItemVersion) br.ReadByte();
            this.unknown1 = br.ReadByte(2);
            this.destination = (ItemDestination) br.ReadByte(3);
            if (this.destination == ItemDestination.Ground)
            {
                this.x = br.ReadUInt16();
                this.y = br.ReadUInt16();
            }
            else
            {
                this.location = (EquipmentLocation) br.ReadByte(4);
                this.x = br.ReadByte(4);
                this.y = br.ReadByte(3);
                this.container = (ItemContainer) br.ReadByte(4);
            }
            if ((this.action == ItemActionType.AddToShop) || (this.action == ItemActionType.RemoveFromShop))
            {
                int num = ((int) this.container) | 0x80;
                if ((num & 1) == 1)
                {
                    num--;
                    this.y += 8;
                }
                this.container = (ItemContainer) num;
            }
            else if (this.container == ItemContainer.Unspecified)
            {
                if (this.location == EquipmentLocation.NotApplicable)
                {
                    if ((this.Flags & ItemFlags.InSocket) == ItemFlags.InSocket)
                    {
                        this.container = ItemContainer.Item;
                        this.y = -1;
                    }
                    else if ((this.action == ItemActionType.PutInBelt) || (this.action == ItemActionType.RemoveFromBelt))
                    {
                        this.container = ItemContainer.Belt;
                        this.y = this.x / 4;
                        this.x = this.x % 4;
                    }
                }
                else
                {
                    this.x = -1;
                    this.y = -1;
                }
            }
            if ((this.flags & ItemFlags.Ear) == ItemFlags.Ear)
            {
                this.charClass = (CharacterClass) br.ReadByte(3);
                this.level = br.ReadByte(7);
                this.name = br.ReadString(7, '\0', 0x10);
                this.baseItem = BaseItem.Get(ItemType.Ear);
            }
            else
            {
                this.baseItem = BaseItem.GetByID(this.category, br.ReadUInt32());
                if (this.baseItem.Type == ItemType.Gold)
                {
                    this.stats.Add(new SignedStat(BaseStat.Get(StatType.Quantity), br.ReadInt32(br.ReadBoolean(1) ? 0x20 : 12)));
                }
                else
                {
                    this.usedSockets = br.ReadByte(3);
                    if ((this.flags & (ItemFlags.Compact | ItemFlags.Gamble)) == ItemFlags.None)
                    {
                        BaseStat stat;
                        int num2;
                        this.level = br.ReadByte(7);
                        this.quality = (ItemQuality) br.ReadByte(4);
                        if (br.ReadBoolean(1))
                        {
                            this.graphic = br.ReadByte(3);
                        }
                        if (br.ReadBoolean(1))
                        {
                            this.color = br.ReadInt32(11);
                        }
                        if ((this.flags & ItemFlags.Identified) == ItemFlags.Identified)
                        {
                            switch (this.quality)
                            {
                                case ItemQuality.Inferior:
                                    this.prefix = new ItemAffix(ItemAffixType.InferiorPrefix, br.ReadByte(3));
                                    break;

                                case ItemQuality.Superior:
                                    this.prefix = new ItemAffix(ItemAffixType.SuperiorPrefix, 0);
                                    this.superiorType = (SuperiorItemType) br.ReadByte(3);
                                    break;

                                case ItemQuality.Magic:
                                    this.prefix = new ItemAffix(ItemAffixType.MagicPrefix, br.ReadUInt16(11));
                                    this.suffix = new ItemAffix(ItemAffixType.MagicSuffix, br.ReadUInt16(11));
                                    break;

                                case ItemQuality.Set:
                                    this.setItem = BaseSetItem.Get(br.ReadUInt16(12));
                                    break;

                                case ItemQuality.Rare:
                                case ItemQuality.Crafted:
                                    this.prefix = new ItemAffix(ItemAffixType.RarePrefix, br.ReadByte(8));
                                    this.suffix = new ItemAffix(ItemAffixType.RareSuffix, br.ReadByte(8));
                                    break;

                                case ItemQuality.Unique:
                                    if (this.baseItem.Code != "std")
                                    {
                                        try
                                        {
                                            this.uniqueItem = BaseUniqueItem.Get(br.ReadUInt16(12));
                                        }
                                        catch{}
                                    }
                                    break;
                            }
                        }
                        if ((this.quality == ItemQuality.Rare) || (this.quality == ItemQuality.Crafted))
                        {
                            this.magicPrefixes = new List<MagicPrefixType>();
                            this.magicSuffixes = new List<MagicSuffixType>();
                            for (int i = 0; i < 3; i++)
                            {
                                if (br.ReadBoolean(1))
                                {
                                    this.magicPrefixes.Add((MagicPrefixType) br.ReadUInt16(11));
                                }
                                if (br.ReadBoolean(1))
                                {
                                    this.magicSuffixes.Add((MagicSuffixType) br.ReadUInt16(11));
                                }
                            }
                        }
                        if ((this.Flags & ItemFlags.Runeword) == ItemFlags.Runeword)
                        {
                            this.runewordID = br.ReadUInt16(12);
                            this.runewordParam = br.ReadUInt16(4);
                            num2 = -1;
                            if (this.runewordParam == 5)
                            {
                                num2 = this.runewordID - (this.runewordParam * 5);
                                if (num2 < 100)
                                {
                                    num2--;
                                }
                            }
                            else if (this.runewordParam == 2)
                            {
                                num2 = ((this.runewordID & 0x3ff) >> 5) + 2;
                            }
                            br.ByteOffset -= 2;
                            this.runewordParam = br.ReadUInt16();
                            this.runewordID = num2;
                            if (num2 == -1)
                            {
                                throw new Exception("Unknown Runeword: " + this.runewordParam);
                            }
                            this.runeword = BaseRuneword.Get(num2);
                        }
                        if ((this.Flags & ItemFlags.Personalized) == ItemFlags.Personalized)
                        {
                            this.name = br.ReadString(7, '\0', 0x10);
                        }
                        if (this.baseItem is BaseArmor)
                        {
                            stat = BaseStat.Get(StatType.ArmorClass);
                            this.stats.Add(new SignedStat(stat, br.ReadInt32(stat.SaveBits) - stat.SaveAdd));
                        }
                        if ((this.baseItem is BaseArmor) || (this.baseItem is BaseWeapon))
                        {
                            stat = BaseStat.Get(StatType.MaxDurability);
                            num2 = br.ReadInt32(stat.SaveBits);
                            this.stats.Add(new SignedStat(stat, num2));
                            if (num2 > 0)
                            {
                                stat = BaseStat.Get(StatType.Durability);
                                this.stats.Add(new SignedStat(stat, br.ReadInt32(stat.SaveBits)));
                            }
                        }
                        if ((this.Flags & (ItemFlags.None | ItemFlags.Socketed)) == (ItemFlags.None | ItemFlags.Socketed))
                        {
                            stat = BaseStat.Get(StatType.Sockets);
                            this.stats.Add(new SignedStat(stat, br.ReadInt32(stat.SaveBits)));
                        }
                        if (this.baseItem.Stackable)
                        {
                            if (this.baseItem.Useable)
                            {
                                this.use = br.ReadByte(5);
                            }
                            this.stats.Add(new SignedStat(BaseStat.Get(StatType.Quantity), br.ReadInt32(9)));
                        }
                        if ((this.Flags & ItemFlags.Identified) == ItemFlags.Identified)
                        {
                            StatBase base2;
                            int num4 = (this.Quality == ItemQuality.Set) ? br.ReadByte(5) : -1;
                            this.mods = new List<StatBase>();
                            while ((base2 = ReadStat(br)) != null)
                            {
                                this.mods.Add(base2);
                            }
                            if ((this.flags & ItemFlags.Runeword) == ItemFlags.Runeword)
                            {
                                while ((base2 = ReadStat(br)) != null)
                                {
                                    this.mods.Add(base2);
                                }
                            }
                            if (num4 > 0)
                            {
                                this.setBonuses = new List<StatBase>[5];
                                for (int j = 0; j < 5; j++)
                                {
                                    if ((num4 & (((int) 1) << j)) != 0)
                                    {
                                        this.setBonuses[j] = new List<StatBase>();
                                        while ((base2 = ReadStat(br)) != null)
                                        {
                                            this.setBonuses[j].Add(base2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#32
0
 public static Boolean isComponent(ItemCategory itemCategory)
 {
     return itemCategory.Equals(Items.ItemCategory.Ammo_Component)
         || itemCategory.Equals(Items.ItemCategory.Consumable)
         || itemCategory.Equals(Items.ItemCategory.Electronic_Item)
         || itemCategory.Equals(Items.ItemCategory.Fabricated_Item)
         || itemCategory.Equals(Items.ItemCategory.Invalid)
         || itemCategory.Equals(Items.ItemCategory.Looted_Item)
         || itemCategory.Equals(Items.ItemCategory.Raw_Resource)
         || itemCategory.Equals(Items.ItemCategory.Reactor_Component)
         || itemCategory.Equals(Items.ItemCategory.Refined_Resource)
         || itemCategory.Equals(Items.ItemCategory.Trade_Good)
         || itemCategory.Equals(Items.ItemCategory.Weapon_Component);
 }
示例#33
0
        /// <summary>
        /// Return a random item of a certain category. 
        /// If the item is a shop, then only return good items
        /// </summary>
        /// <param name="itemCategory"></param>
        /// <param name="shop"></param>
        /// <returns></returns>
        public static Item getRandomItem(ItemCategory itemCategory, bool shop)
        {
            List<ItemClass> ics = new List<ItemClass>();
            switch (itemCategory)
            {
                case ItemCategory.FOOD:
                    ics.Add(ItemClass.APPLE);
                    ics.Add(ItemClass.FLAPJACKS);
                    ics.Add(ItemClass.BACON);
                    ics.Add(ItemClass.PUFFBALL);
                    ics.Add(ItemClass.MOREL);
                    ics.Add(ItemClass.BUTTON_MUSHROOM);
                    ics.Add(ItemClass.CORN);
                    ics.Add(ItemClass.PUMPKIN);
                    if (!shop)
                    {
                        ics.Add(ItemClass.DEATH_CAP);
                        ics.Add(ItemClass.FLY_AGARIC);
                        ics.Add(ItemClass.GHOST_FUNGUS);
                    }
                    break;

                case ItemCategory.WEAPON:
                    return null;

                case ItemCategory.TOOL:
                    ics.Add(ItemClass.AXE);
                    ics.Add(ItemClass.BUCKET);
                    ics.Add(ItemClass.KEY);
                    ics.Add(ItemClass.PICKAXE);
                    ics.Add(ItemClass.SHOVEL);
                    ics.Add(ItemClass.WATER_BUCKET);
                    ics.Add(ItemClass.TENT);
                    ics.Add(ItemClass.CORN_SEED);
                    ics.Add(ItemClass.PUMPKIN_SEED);
                    ics.Add(ItemClass.MOP);
                    break;

                case ItemCategory.HELMET:
                    ics.Add(ItemClass.HAT);
                    break;

                case ItemCategory.ARMOR:
                    ics.Add(ItemClass.JACKET);
                    break;

                case ItemCategory.BOOTS:
                    ics.Add(ItemClass.BOOTS);
                    break;

                case ItemCategory.MONEY:
                    ics.Add(ItemClass.COINS);
                    break;

                case ItemCategory.LIGHT:
                    ics.Add(ItemClass.LANTERN);
                    ics.Add(ItemClass.TORCH);
                    break;

                case ItemCategory.MATERIAL:
                    ics.Add(ItemClass.ASH);
                    ics.Add(ItemClass.FLOODGATE);
                    ics.Add(ItemClass.MOSS);
                    if (!shop)
                    {
                        ics.Add(ItemClass.DIAMOND);
                        ics.Add(ItemClass.EMERALD);
                        ics.Add(ItemClass.LOG);
                        ics.Add(ItemClass.RUBY);
                        ics.Add(ItemClass.SAPPHIRE);
                    }
                    break;
            }

            //Make and return the item
            Item newItem = new Item();
            newItem.itemClass = ics[RandomNumber.RandomInteger(ics.Count)];
            ItemManager.initialize(newItem);
            return newItem;
        }
 public MyGameplayProperties(float PricePerUnit, float WeightPerUnit, int MaxAmount, int UsedSlots, float MaxHealth, bool IsDestructible = true, ItemCategory itemCategory = ItemCategory.DEFAULT)
 {
     this.PricePerUnit = PricePerUnit;
     this.WeightPerUnit = WeightPerUnit;
     this.MaxAmount = MaxAmount;
     this.UsedSlots = UsedSlots;
     this.MaxHealth = MaxHealth;
     this.ItemCategory = itemCategory;
     this.IsDestructible = IsDestructible;
 }
 public async Task<Item[]> FindItemsAsync(ItemCategory category, string keywords) {
     using (var reader = new StreamReader(_itemFileName)) {
         string serializedItems = reader.ReadToEnd();
         return JsonConvert.DeserializeObject<Item[]>(serializedItems);
     }
 }
示例#36
0
        public static bool EconomyTweak_h_GetDailyDemandForCategory(Town town, ItemCategory category, int extraProsperity, ref float __result)
        {
            float num = 0f;

            for (int i = 0; i < town.Workshops.Length; i++)
            {
                for (int j = 0; j < town.Workshops[i].WorkshopType.Productions.Count; j++)
                {
                    IEnumerable <ValueTuple <ItemCategory, int> > inputs = town.Workshops[i].WorkshopType.Productions[j].Inputs;
                    foreach (ValueTuple <ItemCategory, int> valueTuple in inputs)
                    {
                        bool flag = category == valueTuple.Item1;
                        if (flag)
                        {
                            float averageValue = category.AverageValue;
                            num += town.Workshops[i].WorkshopType.Productions[j].ConversionSpeed / averageValue;
                        }
                    }
                }
            }
            float num2  = Math.Max(1f, town.Prosperity);
            float num3  = Math.Max(1f, num2 - 3000f);
            float num4  = category.BaseDemand * EconomyTweak_h_globalConstants.EconomyTweak_h_DemandMultiplier * num2;
            float num5  = category.LuxuryDemand * EconomyTweak_h_globalConstants.EconomyTweak_h_DemandMultiplier * num3;
            float num6  = num4 + num5;
            bool  flag2 = category.BaseDemand < 1E-08f;

            if (flag2)
            {
                num6 = num2 * 0.01f;
            }
            EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryWorkshopPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)] = MathF.Clamp(1f + num / (category.BaseDemand / 2f + category.LuxuryDemand / 2f + num), 0.5f, 1.5f);
            num6 *= EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryWorkshopPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)];
            EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryProsperityPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)] = MathF.Clamp(MathF.Pow(3000f / (town.Prosperity + 1f), EconomyTweak_h_globalConstants.EconomyTweak_h_ProsperityPriceFactorExpValue), 0.5f, 1.5f);
            num6 *= EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryProsperityPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)];
            float num7  = 0f;
            float num8  = town.FoodStocks + town.FoodChange * (float)EconomyTweak_h_globalConstants.EconomyTweak_h_OptimalStockPeriodFood - town.Prosperity / 50f;
            bool  flag3 = num8 < 0f;

            if (flag3)
            {
                bool flag4 = category.Properties == ItemCategory.Property.BonusToFoodStores;
                if (flag4)
                {
                    num7  = Math.Min(-num8, num6 * 0.1f);
                    num6 += num7;
                }
            }
            bool flag5 = !category.IsTradeGood;

            if (flag5)
            {
                num6 *= EconomyTweak_h_globalConstants.EconomyTweak_h_EquipmentDemandMultiplier;
            }
            __result = num6;
            bool flag6 = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugLevel > 0;

            if (flag6)
            {
                using (StreamWriter streamWriter = File.AppendText(EconomyTweak_h_globalConstants.EconomyTweak_h_path + "EconomyTweak_h_log.txt"))
                {
                    streamWriter.WriteLine("EconomyTweak_h_GetDailyDemandForCategory");
                }
                bool economyTweak_h_DebugDisplay = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugDisplay;
                if (economyTweak_h_DebugDisplay)
                {
                    InformationManager.DisplayMessage(new InformationMessage("EconomyTweak_h_GetDailyDemandForCategory"));
                }
                bool flag7 = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugLevel > 1;
                if (flag7)
                {
                    using (StreamWriter streamWriter2 = File.AppendText(EconomyTweak_h_globalConstants.EconomyTweak_h_path + "EconomyTweak_h_log.txt"))
                    {
                        streamWriter2.WriteLine(string.Concat(new string[]
                        {
                            "town = ",
                            town.ToString(),
                            ", category = ",
                            category.ToString(),
                            ", EconomyTweak_h_workShopProduction = ",
                            num.ToString(),
                            ", BaseDemand(num3) = ",
                            num4.ToString(),
                            ", LuxuryDemand(num4) = ",
                            num5.ToString(),
                            ", EconomyTweak_h_TownCategoryWorkshopPriceFactorDictionary = ",
                            EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryWorkshopPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)].ToString(),
                            ", EconomyTweak_h_TownCategoryProsperityPriceFactorDictionary = ",
                            EconomyTweak_h_Dictionaries.EconomyTweak_h_TownCategoryProsperityPriceFactorDictionary[new ValueTuple <Town, ItemCategory>(town, category)].ToString(),
                            ", EconomyTweak_h_foodShortageDemand = ",
                            num7.ToString(),
                            ", category.IsTradeGood = ",
                            category.IsTradeGood.ToString(),
                            ", EconomyTweak_h_GetDailyDemandForCategory(result) = ",
                            __result.ToString()
                        }));
                    }
                }
            }
            return(false);
        }