示例#1
0
    public void ToggleAvailable(bool?showAvailable = null, ThreeDPrinter printer = null)
    {
        if (!showAvailable.HasValue)
        {
            showAvailable = showingAll;
        }

        if (printer)
        {
            currentPrinter = printer;
        }

        AvailablePanel.gameObject.SetActive(showAvailable.Value);
        AllPanel.gameObject.SetActive(!showAvailable.Value);

        showingAll = !showAvailable.Value;

        if (showingAll)
        {
            FillAllList();
        }
        else if (currentPrinter != null)
        {
            FillFirstScreen(currentPrinter);
        }
    }
示例#2
0
    internal void TogglePrinter(bool show, ThreeDPrinter printer = null)
    {
        Printer.SetShowing(show, printer);

        Cursor.visible   = show;
        Cursor.lockState = show ? CursorLockMode.None : CursorLockMode.Confined;
    }
示例#3
0
    public void SetShowing(bool showing, ThreeDPrinter printer = null)
    {
        Showing = showing;
        Panel.gameObject.SetActive(showing);

        if (showing && printer)
        {
            ToggleAvailable(true, printer);
        }
    }
示例#4
0
    public void FillAvailableList(ThreeDPrinter printer)
    {
        List <KeyValuePair <Matter, PrinterData> > available = new List <KeyValuePair <Matter, PrinterData> >();

        foreach (var kvp in Crafting.PrinterData)
        {
            bool canPrint = true;
            foreach (var req in kvp.Value.Requirements)
            {
                bool has = printer.Has(req);
                if (!has)
                {
                    canPrint = false;
                    break;
                }
                else
                {
                    canPrint = canPrint && true;
                }
            }

            if (canPrint)
            {
                available.Add(kvp);
            }
        }
        int i = 0;

        foreach (Transform child in AvailableList.transform)
        {
            if (child == NoneAvailableFlag)
            {
                continue;
            }

            bool show = i < available.Count;
            child.gameObject.SetActive(show);

            if (show)
            {
                KeyValuePair <Matter, PrinterData> kvp = available[i];
                child.name = Convert.ToInt32(kvp.Key).ToString();
                child.GetChild(0).GetComponent <Text>().text    = kvp.Key.ToString();
                child.GetChild(1).GetComponent <Image>().sprite = kvp.Key.Sprite();
            }
            i++;
        }
        AvailableDetailPanel.gameObject.SetActive(available.Count > 0);
        NoneAvailableFlag.gameObject.SetActive(available.Count == 0);
    }
示例#5
0
    public void FillFirstScreen(ThreeDPrinter printer)
    {
        TabSwitchText.text = "All Prints";
        CurrentPrintButtonHintsPanel.gameObject.SetActive(IsCurrentlyPrinting);
        AvailableList.gameObject.SetActive(!IsCurrentlyPrinting);

        if (!IsCurrentlyPrinting)
        {
            FillAvailableList(printer);
        }

        //this is...complicated
        //technically you should never be able to detail CO
        //so this is to allow Detail to populate when we change to Unspecified
        //blow out the cache on the last effective detail
        lastEffectiveDetail = Matter.CarbonMonoxide;
        RefreshDetail();
    }
示例#6
0
        public void Create(
            string make,
            string model,
            decimal price,
            string buildVolume,
            string description,
            string imageUrl,
            string userId)
        {
            var threeDPrinter = new ThreeDPrinter
            {
                Make        = make,
                Model       = model,
                Price       = price,
                BuildVolume = buildVolume,
                Description = description,
                ImageUrl    = imageUrl,
                UserId      = userId
            };

            this.db.Add(threeDPrinter);
            this.db.SaveChanges();
        }