// Decrease count of material
    public void DecreaseCount(materialEnum mat)
    {
        for (int i = 0; i < mr.Length; i++)
        {
            if (mr[i].materials.materialName == mat)
            {
                mr[i].materials.count--;
            }
        }

        UpdateUI();
    }
示例#2
0
    public void RemoveMaterial(materialEnum mat, int count)
    {
        for (int i = 0; i < materialInventory.Length; i++)
        {
            if (materialInventory[i].materialName == mat)
            {
                materialInventory[i].count -= count;
            }
        }

        UpdateUI();
        crafting.UpdateUIElements();
    }
示例#3
0
    public int GetMaterialCount(materialEnum mat)
    {
        for (int i = 0; i < materialInventory.Length; i++)
        {
            if (materialInventory[i].materialName == mat)
            {
                return(materialInventory[i].count);
            }
        }

        // Should never get here
        Debug.LogError("Could not find: " + mat.ToString() + " in Machine.cs");
        return(0);
    }
    // Increase count of material
    public void IncreaseCount(materialEnum mat)
    {
        for (int i = 0; i < mr.Length; i++)
        {
            if (mr[i].materials.materialName == mat)
            {
                if (mr[i].GetCount() > mr[i].materials.count)
                {
                    mr[i].materials.count++;
                }
            }
        }

        UpdateUI();
    }
示例#5
0
        private void woodEssence_Click(object sender, RoutedEventArgs e)
        {
            if (mapleEssenceRadioButton.IsChecked.HasValue && mapleEssenceRadioButton.IsChecked.Value)
            {
                currentFrameMaterial = materialEnum.Maple;
            }
            else if (cherryEssenceRadioButton.IsChecked.HasValue && cherryEssenceRadioButton.IsChecked.Value)
            {
                currentFrameMaterial = materialEnum.Cherry;
            }

            RebuildChair();

            model1.Invalidate();
        }
示例#6
0
        protected override void OnContentRendered(EventArgs e)
        {
            model1.GetGrid().Visible = false;
            model1.Backface.ColorMethod = backfaceColorMethodType.Cull;

            currentFrameMaterial = materialEnum.Maple;

            Material mapleMat = new Material(mapleMatName, System.Drawing.Color.FromArgb(100, 100, 100), System.Drawing.Color.White, 1, new Bitmap(Textures + "Maple.jpg"));

            mapleMat.Density = 0.7 * 1e-3; // set maple density

            model1.Materials.Add(mapleMat);

            Material cherryMat = new Material(cherryMatName, System.Drawing.Color.FromArgb(100, 100, 100), System.Drawing.Color.White, 1, new Bitmap(Textures + "Maple.jpg"));

            cherryMat.Density = 0.8 * 1e-3; // set cherry density

            model1.Materials.Add(cherryMat);

            model1.Layers.Add(plasticMatName, System.Drawing.Color.GreenYellow);

            Material plasticLayerMat = new Material(plasticMatName, System.Drawing.Color.GreenYellow);

            model1.Layers[plasticMatName].MaterialName = plasticMatName;

            plasticLayerMat.Density = 1.4 * 1e-3; // set plastic density

            model1.Materials.Add(plasticLayerMat);

            RebuildChair();

            // sets trimetric view
            model1.SetView(viewType.Trimetric);

            // fits the model in the viewport
            model1.ZoomFit();

            // refresh the viewport
            model1.Invalidate();

            base.OnContentRendered(e);
        }