SSTUTools.SolarData.getNames C# (CSharp) Method

getNames() public static method

public static getNames ( SolarData data, Part part, PartModule module ) : string[]
data SolarData
part Part
module PartModule
return string[]
        public static string[] getNames(SolarData[] data, Part part, PartModule module)
        {
            List<string> names = new List<string>();
            int len = data.Length;
            for (int i = 0; i < len; i++)
            {
                names.Add(data[i].name);
                //if (string.IsNullOrEmpty(data[i].upgradeName) || module.upgradesApplied.Contains(data[i].upgradeName))
                //{
                //    names.Add(data[i].name);
                //}
            }
            return names.ToArray();
        }

Usage Example

Ejemplo n.º 1
0
        private void initializeGUI()
        {
            bool useModelSelectionGUI = HighLogic.CurrentGame.Parameters.CustomParams <SSTUGameSettings>().useModelSelectGui;

            string[] names = SingleModelData.getAvailableModelNames(topDockModules, this);
            this.updateUIChooseOptionControl("currentTopDock", names, names, true, currentTopDock);
            Fields["currentTopDock"].uiControlEditor.onFieldChanged = onTopDockChanged;
            Fields["currentTopDock"].guiActiveEditor = names.Length > 1;

            names = SingleModelData.getValidSelectionNames(part, topModules, topNodeNames);
            this.updateUIChooseOptionControl("currentTop", names, names, true, currentTop);
            Fields["currentTop"].uiControlEditor.onFieldChanged = onTopChanged;
            Fields["currentTop"].guiActiveEditor     = !useModelSelectionGUI && names.Length > 1;
            Events["selectTopEvent"].guiActiveEditor = useModelSelectionGUI && names.Length > 1;

            names = SingleModelData.getModelNames(coreModules);
            this.updateUIChooseOptionControl("currentCore", names, names, true, currentCore);
            Fields["currentCore"].uiControlEditor.onFieldChanged = onCoreChanged;
            Fields["currentCore"].guiActiveEditor = coreModules.Length > 1;

            names = SingleModelData.getValidSelectionNames(part, bottomModules, bottomNodeNames);
            this.updateUIChooseOptionControl("currentBottom", names, names, true, currentBottom);
            Fields["currentBottom"].uiControlEditor.onFieldChanged = onBottomChanged;
            Fields["currentBottom"].guiActiveEditor     = !useModelSelectionGUI && names.Length > 1;
            Events["selectBottomEvent"].guiActiveEditor = useModelSelectionGUI && names.Length > 1;

            names = SingleModelData.getAvailableModelNames(bottomDockModules, this);
            this.updateUIChooseOptionControl("currentBottomDock", names, names, true, currentBottomDock);
            Fields["currentBottomDock"].uiControlEditor.onFieldChanged = onBottomDockChanged;
            Fields["currentBottomDock"].guiActiveEditor = names.Length > 1;

            names = SolarData.getNames(solarModules, part, this);
            this.updateUIChooseOptionControl("currentSolar", names, names, true, currentSolar);
            Fields["currentSolar"].uiControlEditor.onFieldChanged = onSolarChanged;
            Fields["currentSolar"].guiActiveEditor = names.Length > 1;

            names = topModule.modelDefinition.getTextureSetNames();
            this.updateUIChooseOptionControl("currentTopTexture", names, names, true, currentTopTexture);
            Fields["currentTopTexture"].uiControlEditor.onFieldChanged = onTopTextureChanged;
            Fields["currentTopTexture"].guiActiveEditor = names.Length > 1;

            names = coreModule.modelDefinition.getTextureSetNames();
            this.updateUIChooseOptionControl("currentCoreTexture", names, names, true, currentCoreTexture);
            Fields["currentCoreTexture"].uiControlEditor.onFieldChanged = onCoreTextureChanged;
            Fields["currentCoreTexture"].guiActiveEditor = names.Length > 1;

            names = bottomModule.modelDefinition.getTextureSetNames();
            this.updateUIChooseOptionControl("currentBottomTexture", names, names, true, currentBottomTexture);
            Fields["currentBottomTexture"].uiControlEditor.onFieldChanged = onBottomTextureChanged;
            Fields["currentBottomTexture"].guiActiveEditor = names.Length > 1;
        }