internal void DrawCraftingRecipes(Game game) { currentRecipes = new int[1024]; currentRecipesCount = 0; for (int i = 0; i < craftingrecipes2Count; i++) { Packet_CraftingRecipe r = craftingrecipes2[i]; if (r == null) { continue; } bool next = false; //can apply recipe? for (int k = 0; k < r.IngredientsCount; k++) { Packet_Ingredient ingredient = r.Ingredients[k]; if (ingredient == null) { continue; } if (craftingblocksFindAllCount(craftingblocks, craftingblocksCount, ingredient.Type) < ingredient.Amount) { next = true; break; } } if (!next) { currentRecipes[currentRecipesCount++] = i; } } int menustartx = game.xcenter(600); int menustarty = game.ycenter(currentRecipesCount * 80); if (currentRecipesCount == 0) { game.Draw2dText1(game.language.NoMaterialsForCrafting(), game.xcenter(200), game.ycenter(20), 12, null, false); return; } for (int i = 0; i < currentRecipesCount; i++) { Packet_CraftingRecipe r = craftingrecipes2[currentRecipes[i]]; for (int ii = 0; ii < r.IngredientsCount; ii++) { int xx = menustartx + 20 + ii * 130; int yy = menustarty + i * 80; game.Draw2dTexture(game.d_TerrainTextures.terrainTexture(), xx, yy, 32, 32, IntRef.Create(game.TextureIdForInventory[r.Ingredients[ii].Type]), game.texturesPacked(), Game.ColorFromArgb(255, 255, 255, 255), false); game.Draw2dText1(game.platform.StringFormat2("{0} {1}", game.platform.IntToString(r.Ingredients[ii].Amount), game.blocktypes[r.Ingredients[ii].Type].Name), xx + 50, yy, 12, IntRef.Create(i == craftingselectedrecipe ? Game.ColorFromArgb(255, 255, 0, 0) : Game.ColorFromArgb(255, 255, 255, 255)), false); } { int xx = menustartx + 20 + 400; int yy = menustarty + i * 80; game.Draw2dTexture(game.d_TerrainTextures.terrainTexture(), xx, yy, 32, 32, IntRef.Create(game.TextureIdForInventory[r.Output.Type]), game.texturesPacked(), Game.ColorFromArgb(255, 255, 255, 255), false); game.Draw2dText1(game.platform.StringFormat2("{0} {1}", game.platform.IntToString(r.Output.Amount), game.blocktypes[r.Output.Type].Name), xx + 50, yy, 12, IntRef.Create(i == craftingselectedrecipe ? Game.ColorFromArgb(255, 255, 0, 0) : Game.ColorFromArgb(255, 255, 255, 255)), false); } } }
internal void CraftingRecipesStart(Game game, Packet_CraftingRecipe[] recipes, int recipesCount, int[] blocks, int blocksCount, int posx, int posy, int posz) { craftingrecipes2 = recipes; craftingrecipes2Count = recipesCount; craftingblocks = blocks; craftingblocksCount = blocksCount; craftingTableposx = posx; craftingTableposy = posy; craftingTableposz = posz; game.guistate = GuiState.CraftingRecipes; game.menustate = new MenuState(); game.SetFreeMouse(true); }