Пример #1
0
        protected virtual void setMainTankModuleFromEditor(String newMainTank, bool updateSymmetry)
        {
            TankModelData newModule = Array.Find(mainTankModules, m => m.name == newMainTank);

            currentMainTankModule.destroyCurrentModel();
            currentMainTankModule = newModule;
            currentMainTankModule.setupModel(getTankRootTransform(false), ModelOrientation.CENTRAL);
            currentTankType = newModule.name;
            if (!currentMainTankModule.isValidTextureSet(currentTankTexture))
            {
                currentTankTexture = currentMainTankModule.getDefaultTextureSet();
            }
            currentMainTankModule.enableTextureSet(currentTankTexture);
            currentMainTankModule.updateTextureUIControl(this, "currentTankTexture", currentTankTexture);
            updateUIScaleControls();
            updateEditorStats(true);
            lastSelectedVariant = currentMainTankModule.variantName;
            if (updateSymmetry)
            {
                foreach (Part p in part.symmetryCounterparts)
                {
                    p.GetComponent <SSTUModularFuelTank>().setMainTankModuleFromEditor(newMainTank, false);
                }
            }
            SSTUStockInterop.fireEditorUpdate();
            SSTUModInterop.onPartGeometryUpdate(part, true);
        }
Пример #2
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));
            }
        }
Пример #3
0
 protected virtual void setMainTankModuleFromEditor(String newMainTank, bool updateSymmetry)
 {
     TankModelData newModule = Array.Find(mainTankModules, m => m.name == newMainTank);
     currentMainTankModule.destroyCurrentModel();
     currentMainTankModule = newModule;
     currentMainTankModule.setupModel(getTankRootTransform(false), ModelOrientation.CENTRAL);
     currentTankType = newModule.name;
     if (!currentMainTankModule.isValidTextureSet(currentTankTexture)) { currentTankTexture = currentMainTankModule.getDefaultTextureSet(); }
     currentMainTankModule.enableTextureSet(currentTankTexture);
     currentMainTankModule.updateTextureUIControl(this, "currentTankTexture", currentTankTexture);
     updateUIScaleControls();
     updateEditorStats(true);
     lastSelectedVariant = currentMainTankModule.variantName;
     if (updateSymmetry)
     {
         foreach (Part p in part.symmetryCounterparts)
         {
             p.GetComponent<SSTUModularFuelTank>().setMainTankModuleFromEditor(newMainTank, false);
         }
     }
     SSTUStockInterop.fireEditorUpdate();
     SSTUModInterop.onPartGeometryUpdate(part, true);
 }