Example #1
0
    void Reader.UpdateDisplayData()
    {
        if (storage != null && txt != null)
        {
            //**************
            //Set the colour
            //**************
            if (is_Blueprint && read_type == Enums.enum_read_type.replicator_make)
            {
                ColorBlock cb = but.colors;
                if (storage.Blueprint_Item_Count(recipe.required_blueprint) > 0)
                {
                    cb.disabledColor = Color.blue;
                    but.interactable = HasIngredients();
                }
                else
                {
                    but.interactable = false;
                    cb.disabledColor = Color.red;
                }
                but.colors = cb;
            }

            if (read_type == Enums.enum_read_type.replicator_que)
            {
                //**********************************
                //Counts items in the replicator que
                //**********************************
                if (replicator != null)
                {
                    txt.text = replicator.processbin_Item_Count(item_type).ToString();
                }
            }
            else if (read_type == Enums.enum_read_type.replicator_time)
            {
                //************************
                //Show the replicator time
                //************************
                if (replicator != null)
                {
                    if (replicator_time <= 0)
                    {
                        if (replicator.processing)
                        {
                            replicator_current_item = replicator.current_item;
                            replicator_time         = replicator.est_finish_time.Subtract(new DateTimeOffset(DateTime.Now)).Seconds;
                            txt.text = "Making " + replicator_current_item.ToString() + " Completion time " + replicator_time;
                        }
                        else
                        {
                            txt.text = "";
                        }
                    }
                    else
                    {
                        if (replicator.processing)
                        {
                            replicator_time = replicator.est_finish_time.Subtract(new DateTimeOffset(DateTime.Now)).Seconds;
                        }
                        else
                        {
                            replicator_time = 0;
                            txt.text        = "";
                        }
                        if (replicator_time < 0)
                        {
                            replicator_time = 0;
                            txt.text        = "";
                        }
                        else
                        {
                            txt.text = "Making " + replicator_current_item.ToString() + " Completion time " + replicator_time;
                        }
                    }
                }
            }
            else
            {
                //*************
                //Show the time
                //*************
                txt.text = storage.Inventory_Item_Count(item_type).ToString();
            }
        }
    }