Пример #1
0
        private void CraftButtonOnPressed(object sender, EventArgs eventArgs)
        {
            if (CraftingWindow.CanCraft)
            {
                var recipe      = (Recipe)CraftingWindow.RecipesList.SelectedItem;
                var recipeIndex = CraftingWindow.Player.EntityFactory.Config.Recipes.IndexOf(recipe);

                CraftingWindow.Player.CraftUse(recipeIndex);
                CraftingWindow.Update();
            }
        }
Пример #2
0
        public void ShowCrafting()
        {
            var desktop = GuiManager.Screen.Desktop;

            if (CraftingWindow.RecipesList.Items.Count > 0 && CraftingWindow.RecipesList.SelectedItems.Count == 0)
            {
                CraftingWindow.RecipesList.SelectItem(0);
            }

            CraftingWindow.LayoutFlags = ControlLayoutFlags.Center;
            desktop.Children.Add(CraftingWindow);
            CraftingWindow.Update();

            desktop.UpdateLayout();
        }