コード例 #1
0
        public CustomObjectData(string id, string data, Texture2D texture, Color color, int tileIndex = 0, bool bigCraftable = false, Type type = null, CraftingData craftingData = null)
        {
            this.id           = id;
            this.data         = data;
            this.texture      = texture;
            this.tileIndex    = tileIndex;
            this.bigCraftable = bigCraftable;
            this.color        = color;
            type = type != null ? type : typeof(PySObject);
            string[] typeData = type.AssemblyQualifiedName.Split(',');
            this.type         = typeData[0] + ", " + typeData[1];
            this.craftingData = craftingData;

            if (craftingData != null)
            {
                craftingData.bigCraftable = bigCraftable;
            }

            sdvId = getNewSDVId();

            collection.AddOrReplace(id, this);

            if (OvSpritebatch.recCache.ContainsKey(sdvSourceRectangle))
            {
                OvSpritebatch.recCache.Remove(sdvSourceRectangle);
            }

            if (inventoryCheck == null)
            {
                inventoryCheck = new ItemSelector <Item>(i => collection.Exists(c => c.Value.sdvId == i.ParentSheetIndex && (!(i is SObject sobj) || sobj.bigCraftable.Value == c.Value.bigCraftable))).whenAddedToInventory(l => l.useAll(x => Game1.player.Items[new List <Item>(Game1.player.Items).FindIndex(o => o == x)] = collection.Find(c => c.Value.sdvId == x.ParentSheetIndex && (!(x is SObject sobj) || sobj.bigCraftable.Value == c.Value.bigCraftable)).Value.getObject(x)));
            }
        }
コード例 #2
0
        public static CustomObjectData newBigObject(string uniqueId, Texture2D texture, Color color, string name, string description, int tileIndex = 0, string displayName = "", bool lamp = false, int fragility = 0, bool indoors = true, bool outdoors = true, string type = "Crafting -9", int price = 100, int edibility = -300, CraftingData craftingData = null, Type customType = null)
        {
            if (displayName == "")
            {
                displayName = name;
            }

            List <string> data = new List <string> {
                name, price.ToString(), edibility.ToString(), type, description, indoors.ToString().ToLower(), outdoors.ToString().ToLower(), fragility.ToString()
            };

            if (lamp)
            {
                data.Add("true");
            }

            data.Add(displayName);

            return(new CustomObjectData(uniqueId, String.Join("/", data), texture, color, tileIndex, true, customType, craftingData));
        }
コード例 #3
0
        public static CustomObjectData newObject(string uniqueId, Texture2D texture, Color color, string name, string description, int tileIndex = 0, string displayName = "", string type = "Basic", int price = 100, int edibility = -300, string typeInfo = "", CraftingData craftingData = null, Type customType = null)
        {
            if (displayName == "")
            {
                displayName = name;
            }

            List <string> data = new List <string> {
                name, price.ToString(), edibility.ToString(), type, displayName, description
            };

            if (typeInfo != null && typeInfo != "")
            {
                data.Add(typeInfo);
            }

            return(new CustomObjectData(uniqueId, String.Join("/", data), texture, color, tileIndex, false, customType, craftingData));
        }