internal static void Register() { if (EmptyData != null) { return; } CraftingData recipe = new CraftingData("Flower Bomb", "330 4 574 1", delivery: "none"); // 4 Clay, 1 Mudstone string displayName = Helper.Translation.Get("FlowerBomb.name"); string description = Helper.Translation.Get("FlowerBomb.description"); Texture2D emptyTexture = Helper.Content.Load <Texture2D> ( Path.Combine("assets", "FlowerBomb-empty.png")); EmptyData = new CustomObjectData("kdau.FlowerBombs.FlowerBomb", $"Flower Bomb/50/-300/Crafting -8/{displayName}/{description}", emptyTexture, Color.White, type: typeof(FlowerBomb), craftingData: recipe); Texture2D fullTexture = Helper.Content.Load <Texture2D> ( Path.Combine("assets", "FlowerBomb-full.png")); FullData = new CustomObjectData("kdau.FlowerBombs.FlowerBombFull", $"Flower Bomb (full)/50/-300/Crafting -8/{displayName}/{description}", fullTexture, Color.White, type: typeof(FlowerBomb)); }
//////////////// private void UpdateCurrentRecipe(CraftingData data) { if (data == null) { return; } m_CurrentRecipe = data; IItem craftItem = null; // определяем тип предмета if (m_CurrentRecipe.CraftItemType == ItemType.equipment) { craftItem = GameDataStorage.Instance.GetEquipmentByName(m_CurrentRecipe.CraftItemName); } else { MaterialData matData = GameDataStorage.Instance.GetMaterialByName(m_CurrentRecipe.CraftItemName); craftItem = new MaterialInfo(matData, 0); } // Отображаем иконку создаваевомого предмета m_ItemResultIcon.overrideSprite = craftItem.GetIcon(); // отображаем ингредиенты для крафта UpdateIngredientsView(); // показываем информацию о предмете крафта m_ItemInfoText.text = UIHelper.GetItemInformationText(craftItem); }
public void LoadCraftingState(CraftingData craftingData) { if (craftingData == null) { return; } craftingLevel = craftingData.level; materials = craftingData.materials; craftingExperience = craftingData.experience; }
public CraftingData SaveCraftingState() { CraftingData craftingData = new CraftingData(); craftingData.level = craftingLevel; craftingData.materials = materials; craftingData.experience = craftingExperience; return(craftingData); }
public void CreateUI(CraftingData craftingData, Inventory craftingInventory, Inventory resultInventory, PageUI page) { this.craftingData = craftingData; this.craftingInventory = craftingInventory; this.resultInventory = resultInventory; if (craftingPrefab == null) { craftingPrefab = Resources.Load("Prefabs/Crafting") as GameObject; } SceneManager.sceneManager.StartCoroutine(CreateCrafting(page)); }
public CraftingData GetPlayerCraftingData(NWPlayer player) { // Need to store the data outside of the conversation because of the constant // context switching between conversation and accessing placeable containers. // Conversation data is wiped when it closes. if (player.Data.ContainsKey("CRAFTING_MODEL")) { return(player.Data["CRAFTING_MODEL"]); } var model = new CraftingData(); player.Data["CRAFTING_MODEL"] = model; return(model); }
/////////////// public void Init(CraftingData data) { m_Recipe = data; if (m_Recipe.CraftItemType == ItemType.equipment) { EquipmentItem item = GameDataStorage.Instance.GetEquipmentByName(m_Recipe.CraftItemName); m_Icon.overrideSprite = item.GetIcon(); } else { MaterialData item = GameDataStorage.Instance.GetMaterialByName(m_Recipe.CraftItemName); m_Icon.overrideSprite = item.GetIcon(); } }
public void Setting() { m_Item = GameObject.Find("Inven").GetComponent <ItemSetting>(); m_Item.Setting(); for (int i = 0; i < m_CraftingMap.Length; i++) { m_CraftingMap[i].m_Data = new Dictionary <string, CraftingData>(); } List <Dictionary <string, object> > data = CSVReader.Read(path); string name; for (var i = 0; i < data.Count; i++) { var item = new CraftingData(); item.m_Array = new Item[9]; int index = -1; for (int j = 0; j < item.m_Array.Length; j++) { name = (string)data[i][j.ToString()]; if (m_Item.m_ItemMap.ContainsKey(name)) { item.m_Array[j] = m_Item.m_ItemMap[name]; item.code += m_Item.m_ItemMap[name].m_Code.ToString(); ++index; } else { item.m_Array[j] = null; } } item.name = (string)data[i]["이름"]; item.count = (int)data[i]["개수"]; m_CraftingMap[index].m_Data.Add(item.code.ToString(), item); } }
public override void Entry(IModHelper helper) { _monitor = Monitor; _helper = helper; SaveEvents.AfterLoad += SaveEvents_AfterLoad; //InputEvents.ButtonPressed += InputEvents_ButtonPressed; _containerTexture = Helper.Content.Load <Texture2D>("Assets/Container.png", ContentSource.ModFolder); _toolRackCraftingData = new CraftingData("Tool-Rack", "388 20", "Tool-Rack", -1, true, false, "Farming 1"); _toolRackObjectData = new CustomObjectData("Tool-Rack", "Tool-Rack/0/-300/Crafting -9/A nice way to store your tools./true/true/0/0/Tool-Rack", _containerTexture, Color.White, 0, true, typeof(ToolRack), _toolRackCraftingData); _freezerCraftingData = new CraftingData("Freezer", "335 2 84 5", "Freezer", -1, true, false, "Farming 1"); _freezerObjectData = new CustomObjectData("Freezer", "Freezer/0/-300/Crafting -9/Store your foods in here to acces them via the fridge./false/true/0/0/Freezer", _containerTexture, Color.White, 3, true, typeof(Freezer), _freezerCraftingData); MenuEvents.MenuChanged += FreezerToFridgeHandler.OnMenuChanged; MenuEvents.MenuClosed += FreezerToFridgeHandler.OnMenuClosed; }
public BasicItemInformation(string name, string description, string categoryName, Color categoryColor, int edibility, int fragility, bool isLamp, int price, Vector2 TileLocation, bool canBeSetOutdoors, bool canBeSetIndoors, string id, string data, Texture2D texture, Color color, int tileIndex, bool bigCraftable, Type type, CraftingData craftingData, AnimationManager animationManager, Color drawColor, bool ignoreBoundingBox, InventoryManager Inventory, LightManager Lights) : base(id, data, texture, color, tileIndex, bigCraftable, type, craftingData) { this.name = name; this.description = description; this.categoryName = categoryName; this.categoryColor = categoryColor; this.price = price; this.TileLocation = TileLocation; this.edibility = edibility; this.canBeSetOutdoors = canBeSetOutdoors; this.canBeSetIndoors = canBeSetIndoors; this.fragility = fragility; this.isLamp = isLamp; this.animationManager = animationManager; if (this.animationManager.IsNull) { this.animationManager = new AnimationManager(new Graphics.Texture2DExtended(), new Animation(new Rectangle(0, 0, 16, 16)), false); this.animationManager.getExtendedTexture().texture = this.texture; } else { this.texture = this.animationManager.getTexture(); } this.drawPosition = Vector2.Zero; this.drawColor = drawColor; this.ignoreBoundingBox = ignoreBoundingBox; this.recreateDataString(); this.inventory = Inventory ?? new InventoryManager(); this.lightManager = Lights ?? new LightManager(); this.facingDirection = Enums.Direction.Down; }
public Resource(int id, string name, RarityTier rarity, string description, ResourceType type, string spritePath, CraftingData craftingMaterials) { if (!IsRecipeType(type)) { Debug.LogError("Only Recipe type can contain CraftingMaterials. Otherwise may caused errors."); } this.id = id; this.name = name; this.rarity = rarity; this.description = description; this.type = type; this.spritePath = spritePath; this.craftingData = craftingMaterials; }