Esempio n. 1
0
 public OseModuleWorkshop()
 {
     _queue        = new WorkshopQueue();
     _pauseTexture = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_pause");
     _playTexture  = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_play");
     _binTexture   = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_bin");
 }
Esempio n. 2
0
        private void LoadFilters()
        {
            var filters = new List <FilterBase>();

            filters.Add(new FilterModule("ModuleKISItem"));
            filters.Add(new FilterCategory(PartCategories.none));

            var filterTextures = new List <Texture>();

            filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_evatech"));
            filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_robotics"));

            var categoryFilterAddOns = vessel.FindPartModulesImplementing <OseModuleCategoryAddon>();

            if (categoryFilterAddOns != null)
            {
                foreach (var addon in categoryFilterAddOns.Distinct(new OseModuleCategoryAddonEqualityComparer()).ToArray())
                {
                    Debug.Log("[OSE] - Found addon for category: " + addon.Category);
                    filters.Add(new FilterCategory(addon.Category));
                    filterTextures.Add(WorkshopUtils.LoadTexture(addon.IconPath));
                }
            }

            _filters        = filters.ToArray();
            _filterTextures = filterTextures.ToArray();
        }
Esempio n. 3
0
 public OseModuleRecycler()
 {
     _queue = new WorkshopQueue();
     //_broker = new ResourceBroker();
     _pauseTexture = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_pause");
     _playTexture  = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_play");
     _binTexture   = WorkshopUtils.LoadTexture("Workshop/Assets/Icons/icon_bin");
 }
Esempio n. 4
0
        private void LoadFilters()
        {
            var filters        = new List <FilterBase>();
            var filterTextures = new List <Texture>();

            var categoryFilterAddOns = vessel.FindPartModulesImplementing <OseModuleCategoryAddon>();

            if (categoryFilterAddOns != null)
            {
                foreach (var addon in categoryFilterAddOns.Distinct(new OseModuleCategoryAddonEqualityComparer()).ToArray())
                {
                    Debug.Log("[OSE] - Found addon for category: " + addon.Category);
                    filters.Add(new FilterCategory(addon.Category));
                    filterTextures.Add(WorkshopUtils.LoadTexture(addon.IconPath));
                }
            }

            _filters        = filters.ToArray();
            _filterTextures = filterTextures.ToArray();
        }
Esempio n. 5
0
        private void LoadFilters()
        {
            var filters        = new List <FilterBase>();
            var filterTextures = new List <Texture>();

            if (this.part.partInfo.partConfig == null)
            {
                return;
            }
            ConfigNode[]   nodes        = this.part.partInfo.partConfig.GetNodes("MODULE");
            ConfigNode     node         = null;
            ConfigNode     workshopNode = null;
            PartCategories category;

            //Get the nodes we're interested in
            for (int index = 0; index < nodes.Length; index++)
            {
                node = nodes[index];
                if (node.HasValue("name"))
                {
                    moduleName = node.GetValue("name");
                    if (moduleName == this.ClassName)
                    {
                        workshopNode = node;
                        break;
                    }
                }
            }
            if (workshopNode == null)
            {
                return;
            }

            //Each category represets one of the tab buttons from the KSP editor.
            //Mods have the ability to specify which categories that the workshop can produce.
            //If there are no CATEGORY nodes specified then the defaults are used instead.
            nodes = workshopNode.GetNodes("CATEGORY");

            //If we have no category nodes then just load the defaults.
            if (nodes.Length == 0)
            {
                //Pods
                filters.Add(new FilterCategory(PartCategories.Pods));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/RDicon_commandmodules"));

                //FuelTank
                filters.Add(new FilterCategory(PartCategories.FuelTank));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/RDicon_fuelSystems-advanced"));

                //Engine
                filters.Add(new FilterCategory(PartCategories.Engine));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/RDicon_propulsionSystems"));

                //Control
                filters.Add(new FilterCategory(PartCategories.Control));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_largecontrol"));

                //Structural
                filters.Add(new FilterCategory(PartCategories.Structural));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_generalconstruction"));

                //Aero
                filters.Add(new FilterCategory(PartCategories.Aero));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advaerodynamics"));

                //Utility
                filters.Add(new FilterCategory(PartCategories.Utility));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_generic"));

                //Electrical
                filters.Add(new FilterCategory(PartCategories.Electrical));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_electrics"));

                //Ground
                filters.Add(new FilterCategory(PartCategories.Ground));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advancedmotors"));

                //Payload
                filters.Add(new FilterCategory(PartCategories.Payload));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_composites"));

                //Communications
                filters.Add(new FilterCategory(PartCategories.Communication));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advunmanned"));

                //Coupling
                filters.Add(new FilterCategory(PartCategories.Coupling));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/cs_size3"));

                //Thermal
                filters.Add(new FilterCategory(PartCategories.Thermal));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/fuels_monopropellant"));

                //Science
                filters.Add(new FilterCategory(PartCategories.Science));
                filterTextures.Add(WorkshopUtils.LoadTexture("Squad/PartList/SimpleIcons/R&D_node_icon_advsciencetech"));

                if (HighLogic.CurrentGame.Parameters.CustomParams <Workshop_MiscSettings>().showMiscCategory)
                {
                    //Misc (catchall for parts not in other categories)
                    filters.Add(new FilterCategory(PartCategories.none));
                    filterTextures.Add(WorkshopUtils.LoadTexture("Workshop/Assets/Icons/Misc"));
                }
            }

            else //Load all the specified CATEGORY nodes.
            {
                //Load the categories
                for (int index = 0; index < nodes.Length; index++)
                {
                    node = nodes[index];
                    if (!node.HasValue("name") && !node.HasValue("iconPath"))
                    {
                        continue;
                    }

                    try
                    {
                        category = (PartCategories)Enum.Parse(typeof(PartCategories), node.GetValue("name"));
                        filters.Add(new FilterCategory(category));
                        filterTextures.Add(WorkshopUtils.LoadTexture(node.GetValue("iconPath")));
                    }
                    catch (Exception ex)
                    {
                        WorkshopUtils.LogError("Error during LoadFilters: " + ex.ToString());
                        continue;
                    }
                }
            }

            _filters        = filters.ToArray();
            _filterTextures = filterTextures.ToArray();
            _searchFilter   = new FilterSearch();
        }