Example #1
0
    public static bool GetItemTypeNeedsRefining(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item.need_refining);
    }
Example #2
0
    public static Recipe GetItemTypeItem(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item);
    }
Example #3
0
    public static string GetItemTypeResorceLocation(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item.prefab_path);
    }
Example #4
0
 public void remove_material(Enums.enum_item material)
 {
     if (Inventory_Item_Count(material) >= 1)
     {
         var r = (from InventoryManager.Item n in inventory where n.item_type == material select n).Take(1).ToList();
         foreach (InventoryManager.Item i in r)
         {
             inventory.Remove(i);
         }
         r = null;
     }
 }
Example #5
0
 public static string GetItemTypeDescription(Enums.enum_item Item_type)
 {
     UnityFunctions.PopulateItemResorces();
     if (UnityFunctions.resource_data.Contains(Item_type.ToString()))
     {
         Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];
         return(item.description);
     }
     else
     {
         return("");
     }
 }
 public bool IsAvalible(Enums.enum_item item)
 {
     //***************************************
     //Check to see if can be used on a module
     //***************************************
     foreach (Enums.enum_item e in avalible_for)
     {
         if (e == item)
         {
             return(true);
         }
     }
     return(false);
 }
Example #7
0
    public static bool ModuleInstalled(Enums.enum_item item)
    {
        ItemResorce[] items = UnityFunctions.modules.GetComponentsInChildren <ItemResorce>();
        var           r     = (from ItemResorce n in items where n.Item_type == item select n).Count();

        if (r > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #8
0
    private IEnumerator ProcessBin()
    {
        processing = true;
        do
        {
            if (this.is_online && this.active)
            {
                Recipe item      = processing_bin[0];
                bool   validated = true;
                foreach (Recipe.Ingreadient i in item.ingredients)
                {
                    int in_stock = storage.Inventory_Item_Count(i.item_type);
                    if (in_stock < i.qty)
                    {
                        validated = false; break;
                    }
                }
                if (validated == true)
                {
                    process_time    = item.make_time;
                    current_item    = item.item_type;
                    est_finish_time = new DateTimeOffset(DateTime.Now.AddSeconds(process_time));
                    yield return(new WaitForSeconds(process_time));

                    Recipe id = UnityFunctions.GetItemTypeItem(item.item_type);
                    if (storage != null)
                    {
                        if (id.resorce_type == Enums.enum_resorce_type.material)
                        {
                            //First check we have all the  items

                            //************************************
                            //We need to remove x items from stock
                            //************************************
                            foreach (Recipe.Ingreadient i in item.ingredients)
                            {
                                storage.remove_x_material(i.item_type, i.qty);
                            }
                            storage.Store_Material(item.item_type);
                        }
                    }
                }
                processing_bin.RemoveAt(0);
            }
        } while (processing_bin.Count > 0);
        processing = false;
        StopUsage();
    }
Example #9
0
    private IEnumerator ProcessBin()
    {
        processing = true;
        do
        {
            yield return(new WaitForSeconds(processing_time));

            if (this.is_online && this.active)
            {
                Enums.enum_item item = processing_bin[0];
                UnityFunctions.ship_manager.Store_Material(item);
                processing_bin.RemoveAt(0);
            }
        } while (processing_bin.Count > 0);
        processing = false;
        StopUsage();
    }
Example #10
0
    public void ReadData(GameObject module)
    {
        ModuleSystemInfo sys = module.GetComponent <ModuleSystemInfo>();
        ItemResorce      ir  = module.GetComponent <ItemResorce>();

        //Save the upgrades
        foreach (Upgrade_Settings u in sys.upgrades)
        {
            upgrades.Add(u.Full_name);
        }
        module_name = ir.Item_Data.recipe_name;
        //id = module.name;
        item_type          = ir.Item_Data.item_type;
        mount_point        = sys.mount_point;
        health             = sys.current_health;
        order_layer        = sys.order_layer;
        is_in_storage      = sys.is_in_storage;
        enabled            = sys.active;
        is_internal_module = sys.is_internal_module;
    }
Example #11
0
 private void OnValidate()
 {
     //***********************************
     //this deals with just setting values
     //Annd configuring the control
     //***********************************
     if (recipe != null)
     {
         Setup();
         item_type   = recipe.item_type;
         img.sprite  = recipe.sprite;
         txt.enabled = true;
         if (recipe != null && read_type == Enums.enum_read_type.replicator_make)
         {
             is_Blueprint = recipe.blueprint;
             txt.enabled  = !is_Blueprint;
         }
         if (but != null)
         {
             but.targetGraphic = img;
         }
     }
 }
Example #12
0
    public int processbin_Item_Count(Enums.enum_item material)
    {
        var res = (from n in processing_bin where n.item_type == material select n).Count();

        return(res);
    }
Example #13
0
    public void SetItem(GameObject item)
    {
        Debug.Log("Adding item");
        //WriteLine(item);
        ItemResorce ir = item.GetComponent <ItemResorce>();

        sr             = GetComponent <Image>();
        this.item_type = ir.Item_type;

        ModuleSystemInfo module_sys = item.GetComponent <ModuleSystemInfo>();

        this.mount_type_util_side = module_sys.mount_type_util_side;
        this.mount_type_util_top  = module_sys.mount_type_util_top;
        this.mount_type_internal  = module_sys.is_internal_module;
        this.mount_type_thruster  = module_sys.mount_type_thruster;
        this.mount_type_engine    = module_sys.mount_type_engine;
        this.is_command_module    = module_sys.is_command_module;
        this.item = item;

        //SpriteRenderer isr = item.GetComponent<SpriteRenderer>();
        sr.sprite = module_sys.settings.Sprite;
        //module_sys.settings.ico
        //*************
        //Set the image
        //*************

        /* switch (this.item_type) {
         *   case Enums.enum_item.module_command_module_type1:
         *       sr.sprite = single_blaster;
         *       break;
         *
         *   case Enums.enum_item.module_single_blaster:
         *       sr.sprite = single_blaster;
         *       break;
         *
         *   case Enums.enum_item.module_double_blaster:
         *       sr.sprite = double_blaster;
         *       break;
         *
         *   case Enums.enum_item.module_mining_laser:
         *       sr.sprite = mining_laser;
         *       break;
         *
         *   case Enums.enum_item.module_main_engine:
         *       sr.sprite = main_engine;
         *       break;
         *
         *   case Enums.enum_item.module_thruster:
         *       sr.sprite = thruster;
         *       break;
         *
         *   case Enums.enum_item.module_refiner:
         *       sr.sprite = refiner;
         *       break;
         *
         *   case Enums.enum_item.module_tracktor_beam:
         *       sr.sprite = tracktor_beam;
         *       break;
         *
         *   case Enums.enum_item.module_power_reactor:
         *       sr.sprite = power;
         *       break;
         *
         *   default:
         *       sr.sprite = unknown;
         *       break;
         * }*/
    }
Example #14
0
 public Ingreadient(Enums.enum_item item_type, int qty)
 {
     this.item_type = item_type;
     this.qty       = qty;
 }
Example #15
0
 public Item(Enums.enum_item item_type, GameObject item)
 {
     this.item_type = item_type;
     this.item      = item;
 }
Example #16
0
        //Enum of the item type

        //Ref to the item

        #region Public Constructors

        public Item(Enums.enum_item item_type)
        {
            this.item_type = item_type;
            this.item      = null;
        }
Example #17
0
 public void Store_Blueprint(Enums.enum_item blue_print)
 {
     blueprints.Add(new InventoryManager.Item(blue_print));
 }
Example #18
0
 public void Store_Material(Enums.enum_item material)
 {
     inventory.Add(new InventoryManager.Item(material));
 }
Example #19
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();
            }
        }
    }
Example #20
0
    public int Inventory_Item_Count(Enums.enum_item material)
    {
        var res = (from n in inventory where n.item_type == material select n).Count();

        return(res);
    }
Example #21
0
    /* public ModuleSystemInfo[] GetStoredItems() {
     *   Stored_Modules_game_object = GameObject.Find("Stored_Modules");
     *   return Stored_Modules_game_object.GetComponentsInChildren<ModuleSystemInfo>();
     * }*/

    /*public Upgrade_Settings[] GetStoredUpgrades() {
     *  Stored_Upgrades_game_object = GameObject.Find("Stored_Upgrades");
     *  return Stored_Upgrades_game_object.GetComponentsInChildren<Upgrade_Settings>();
     * }*/

    public int Blueprint_Item_Count(Enums.enum_item material)
    {
        var res = (from n in blueprints where n.item_type == material select n).Count();

        return(res);
    }
Example #22
0
    public static Enums.enum_item GetItemType(Enums.enum_item Item_type)
    {
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item.item_type);
    }