SSTUTools.TankSet.getSetNames C# (CSharp) Method

getSetNames() public static method

public static getSetNames ( TankSet sets, bool includeEmpty = false ) : string[]
sets TankSet
includeEmpty bool
return string[]
        public static string[] getSetNames(TankSet[] sets, bool includeEmpty = false)
        {
            List<string> names = new List<string>();
            int len = sets.Length;
            for (int i = 0; i < len; i++)
            {
                if (sets[i].Length > 0 || includeEmpty) { names.Add(sets[i].name); }
            }
            return names.ToArray();
        }

Usage Example

Example #1
0
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            initialize();

            string[] groupNames = TankSet.getSetNames(tankSets);
            this.updateUIChooseOptionControl("currentTankSet", groupNames, groupNames, true, currentTankSet);

            string[] names = currentTankSetModule.getModelNames();
            string[] descs = currentTankSetModule.getTankDescriptions();
            this.updateUIChooseOptionControl("currentTankType", names, descs, true, currentTankType);

            if (maxTankDiameter == minTankDiameter)
            {
                Fields["currentTankDiameter"].guiActiveEditor = false;
            }
            else
            {
                this.updateUIFloatEditControl("currentTankDiameter", minTankDiameter, maxTankDiameter, tankDiameterIncrement * 2, tankDiameterIncrement, tankDiameterIncrement * 0.05f, true, currentTankDiameter);
            }
            updateAvailableVariants();
            updateUIScaleControls();

            currentNoseModule.updateTextureUIControl(this, "currentNoseTexture", currentNoseTexture);
            currentMainTankModule.updateTextureUIControl(this, "currentTankTexture", currentTankTexture);
            currentMountModule.updateTextureUIControl(this, "currentMountTexture", currentMountTexture);

            bool useModelSelectionGUI = HighLogic.CurrentGame.Parameters.CustomParams <SSTUGameSettings>().useModelSelectGui;

            Events["selectNoseEvent"].guiActiveEditor  = useModelSelectionGUI;
            Events["selectMountEvent"].guiActiveEditor = useModelSelectionGUI;

            Fields["currentTankDiameter"].uiControlEditor.onFieldChanged      = tankDiameterUpdated;
            Fields["currentTankVerticalScale"].uiControlEditor.onFieldChanged = tankHeightScaleUpdated;
            Fields["currentTankSet"].uiControlEditor.onFieldChanged           = tankSetUpdated;
            Fields["currentTankType"].uiControlEditor.onFieldChanged          = tankTypeUpdated;
            Fields["currentNoseType"].uiControlEditor.onFieldChanged          = noseTypeUpdated;
            Fields["currentMountType"].uiControlEditor.onFieldChanged         = mountTypeUpdated;

            Fields["currentNoseTexture"].uiControlEditor.onFieldChanged  = onNoseTextureUpdated;
            Fields["currentTankTexture"].uiControlEditor.onFieldChanged  = onTankTextureUpdated;
            Fields["currentMountTexture"].uiControlEditor.onFieldChanged = onMountTextureUpdated;

            Fields["currentTankSet"].guiActiveEditor   = tankSets.Length > 1;
            Fields["currentTankType"].guiActiveEditor  = currentTankSetModule.Length > 1;
            Fields["currentNoseType"].guiActiveEditor  = !useModelSelectionGUI && noseModules.Length > 1;
            Fields["currentMountType"].guiActiveEditor = !useModelSelectionGUI && mountModules.Length > 1;

            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onPartGeometryUpdate(part, true);
            if (HighLogic.LoadedSceneIsEditor)
            {
                GameEvents.onEditorShipModified.Add(new EventData <ShipConstruct> .OnEvent(onEditorVesselModified));
            }
        }
All Usage Examples Of SSTUTools.TankSet::getSetNames